Documentation ¶
Overview ¶
Package v1 implements v1 version of the gRPC API.
Index ¶
- Constants
- func AuthUnaryInterceptor(secret creds.Password) grpc.UnaryServerInterceptor
- func LoggingUnaryInterceptor(log *logger.Logger) grpc.UnaryServerInterceptor
- func RegisterRoutes(server *grpc.Server, useCases *usecase.UseCases)
- type AuthServer
- type SecretsServer
- func (s SecretsServer) Create(ctx context.Context, req *goph.CreateSecretRequest) (*goph.CreateSecretResponse, error)
- func (s SecretsServer) Delete(ctx context.Context, req *goph.DeleteSecretRequest) (*goph.DeleteSecretResponse, error)
- func (s SecretsServer) Get(ctx context.Context, req *goph.GetSecretRequest) (*goph.GetSecretResponse, error)
- func (s SecretsServer) List(ctx context.Context, _ *goph.ListSecretsRequest) (*goph.ListSecretsResponse, error)
- func (s SecretsServer) Update(ctx context.Context, req *goph.UpdateSecretRequest) (*goph.UpdateSecretResponse, error)
- type UsersServer
Constants ¶
const ( DefaultMaxUsernameLength = 128 DefaultMaxSecretNameLength = 256 DefaultMetadataLimit = 2 * 1024 * 1024 DefaultDataLimit = 4 * 1024 * 1024 )
const DefaultMaxMessageSize = DefaultDataLimit + DefaultMetadataLimit + 2*DefaultMaxSecretNameLength
DefaultMaxMessageSize suggests limit for maximum length of gRPC message.
Variables ¶
This section is empty.
Functions ¶
func AuthUnaryInterceptor ¶
func AuthUnaryInterceptor(secret creds.Password) grpc.UnaryServerInterceptor
AuthUnaryInterceptor is gRPC unary server interceptor extracts access token from metadata and verifies it. If the token is valid, request is passed further. Token's subject ID is injected as user ID into the context to use later.
func LoggingUnaryInterceptor ¶
func LoggingUnaryInterceptor(log *logger.Logger) grpc.UnaryServerInterceptor
LoggingUnaryInterceptor is gRPC unary server interceptor which logs incoming requests and responses.
Types ¶
type AuthServer ¶
type AuthServer struct { goph.UnimplementedAuthServer // contains filtered or unexported fields }
AuthServer provides implementation of the Auth API.
func NewAuthServer ¶
func NewAuthServer(auth usecase.Auth) *AuthServer
NewAuthServer initializes and creates new AuthServer.
func (AuthServer) Login ¶
func (s AuthServer) Login( ctx context.Context, req *goph.LoginRequest, ) (*goph.LoginResponse, error)
Login authenticates a user in the service.
type SecretsServer ¶
type SecretsServer struct { goph.UnimplementedSecretsServer // contains filtered or unexported fields }
SecretsServer provides implementation of the Secrets API.
func NewSecretsServer ¶
func NewSecretsServer(secrets usecase.Secrets) *SecretsServer
NewSecretsServer initializes and creates new SecretsServer.
func (SecretsServer) Create ¶
func (s SecretsServer) Create( ctx context.Context, req *goph.CreateSecretRequest, ) (*goph.CreateSecretResponse, error)
Create creates new secret for a user.
func (SecretsServer) Delete ¶
func (s SecretsServer) Delete( ctx context.Context, req *goph.DeleteSecretRequest, ) (*goph.DeleteSecretResponse, error)
Delete removes particular secret stored by a user.
func (SecretsServer) Get ¶
func (s SecretsServer) Get( ctx context.Context, req *goph.GetSecretRequest, ) (*goph.GetSecretResponse, error)
Get returns particular secret with data.
func (SecretsServer) List ¶
func (s SecretsServer) List( ctx context.Context, _ *goph.ListSecretsRequest, ) (*goph.ListSecretsResponse, error)
List retrieves list of the secrets stored a user.
func (SecretsServer) Update ¶
func (s SecretsServer) Update( ctx context.Context, req *goph.UpdateSecretRequest, ) (*goph.UpdateSecretResponse, error)
Update updates particular secret stored by a user.
type UsersServer ¶
type UsersServer struct { goph.UnimplementedUsersServer // contains filtered or unexported fields }
UsersServer provides implementation of the Users API.
func NewUsersServer ¶
func NewUsersServer(users usecase.Users) *UsersServer
NewUsersServer initializes and creates new UsersServer.
func (UsersServer) Register ¶
func (s UsersServer) Register( ctx context.Context, req *goph.RegisterUserRequest, ) (*goph.RegisterUserResponse, error)
Register creates new user.