secret

package
v0.0.0-...-e78ca02 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller for secrets

func NewController

func NewController(cfg config.SecretsConfig, storage Storage, logger logging.Logger) (*Controller, error)

func (*Controller) GetAllSecrets

func (c *Controller) GetAllSecrets(ctx context.Context, claims *models.UserClaims) (*servicepb.GetAllSecretsResponse, error)

GetAllSecrets returns all secrets of user

func (*Controller) GetSecret

func (c *Controller) GetSecret(ctx context.Context, claims *models.UserClaims, name string) (*servicepb.GetSecretResponse, error)

GetSecret gets secret from storage or returns error NotFound

func (*Controller) RemoveSecret

func (c *Controller) RemoveSecret(ctx context.Context, claims *models.UserClaims, name string) (*servicepb.RemoveSecretResponse, error)

RemoveSecret removes secret by name

func (*Controller) SetSecret

func (c *Controller) SetSecret(ctx context.Context, claims *models.UserClaims, secret *datapb.Secret) (*servicepb.SetSecretResponse, error)

SetSecret creates secret or updates curretnly existing

type Storage

type Storage interface {
	SetSecret(ctx context.Context, secret *models.Secret) error
	GetSecret(ctx context.Context, userID, name string) (*models.Secret, error)
	GetAllSecrets(ctx context.Context, userID string) ([]models.Secret, error)
	UpdateSecret(ctx context.Context, secret *models.Secret) error
	RemoveSecret(ctx context.Context, userID, name string) (bool, error)
}

Storage interface for managins secrets in storage

Jump to

Keyboard shortcuts

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