v1

package
v0.0.0-...-6aec01b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package v1 implements v1 version of the gRPC API.

Index

Constants

View Source
const (
	DefaultMaxUsernameLength   = 128
	DefaultMaxSecretNameLength = 256

	DefaultMetadataLimit = 2 * 1024 * 1024

	DefaultDataLimit = 4 * 1024 * 1024
)

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.

func RegisterRoutes

func RegisterRoutes(server *grpc.Server, useCases *usecase.UseCases)

RegisterRoutes injects new routes into the provided gRPC server.

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

Create creates new secret for a user.

func (SecretsServer) Delete

Delete removes particular secret stored by a user.

func (SecretsServer) Get

Get returns particular secret with data.

func (SecretsServer) List

List retrieves list of the secrets stored a user.

func (SecretsServer) Update

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

Register creates new user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL