secret

package
v0.0.0-...-31b4c3b Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package secret - service for secrets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encrypter

type Encrypter interface {
	Decrypt(src entity.EncryptionData) (dst []byte, err error)
	Encrypt(src []byte) (result entity.EncryptionData, err error)
}

Encrypter interface for encryption functions used in service.

type Service

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

Service struct of service.

func New

func New(store Store, encr Encrypter) *Service

New creates new service.

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, userID entity.UserID, secretID entity.SecretID) (*entity.Data, error)

GetByID - get secret of user by id.

func (*Service) List

func (s *Service) List(ctx context.Context, userID entity.UserID) ([]entity.Secret, error)

List - get list of secrets by user.

func (*Service) Set

func (s *Service) Set(ctx context.Context, userID entity.UserID, data entity.Data) (entity.SecretID, error)

Set saves secret data.

type Store

type Store interface {
	WithTx(ctx context.Context, fn func(context.Context) error) error
	SecretList(ctx context.Context, userID entity.UserID) ([]entity.Secret, error)
	SecretGet(ctx context.Context, secretID entity.SecretID) (*entity.SecretDetail, error)
	SecretSet(ctx context.Context, scrt entity.SecretDetail) (entity.SecretID, error)
	SecretAttrSet(ctx context.Context, secretID entity.SecretID, attr entity.SecretAttr) error
}

Store interface for storage used for service.

Jump to

Keyboard shortcuts

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