masterkey

package
v0.0.0-...-059fb3b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists        = errors.New("a master key already exists")
	ErrKeyAlreadyDeciphered = errors.New("the key have been already deciphered")
	ErrCredsDirNotSet       = errors.New("CREDENTIALS_DIRECTORY not set")
	ErrMasterKeyNotFound    = errors.New("master key not found")
)

Functions

This section is empty.

Types

type HTTPMiddleware

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

func NewHTTPMiddleware

func NewHTTPMiddleware(masterkey Service, html html.Writer) *HTTPMiddleware

func (*HTTPMiddleware) Handle

func (m *HTTPMiddleware) Handle(next http.Handler) http.Handler

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockService) GenerateMasterKey

func (_m *MockService) GenerateMasterKey(ctx context.Context, password *secret.Text) error

GenerateMasterKey provides a mock function with given fields: ctx, password

func (*MockService) IsMasterKeyLoaded

func (_m *MockService) IsMasterKeyLoaded() bool

IsMasterKeyLoaded provides a mock function with given fields:

func (*MockService) IsMasterKeyRegistered

func (_m *MockService) IsMasterKeyRegistered(ctx context.Context) (bool, error)

IsMasterKeyRegistered provides a mock function with given fields: ctx

func (*MockService) LoadMasterKeyFromPassword

func (_m *MockService) LoadMasterKeyFromPassword(ctx context.Context, password *secret.Text) error

LoadMasterKeyFromPassword provides a mock function with given fields: ctx, password

func (*MockService) Open

func (_m *MockService) Open(key *secret.SealedKey) (*secret.Key, error)

Open provides a mock function with given fields: key

func (*MockService) SealKey

func (_m *MockService) SealKey(key *secret.Key) (*secret.SealedKey, error)

SealKey provides a mock function with given fields: key

type PasswordSource

type PasswordSource string

type Service

type Service interface {
	GenerateMasterKey(ctx context.Context, password *secret.Text) error
	LoadMasterKeyFromPassword(ctx context.Context, password *secret.Text) error
	IsMasterKeyLoaded() bool
	IsMasterKeyRegistered(ctx context.Context) (bool, error)

	SealKey(key *secret.Key) (*secret.SealedKey, error)
	Open(key *secret.SealedKey) (*secret.Key, error)
}

func Init

func Init(ctx context.Context, config config.Service, fs afero.Fs, tools tools.Tools) (Service, error)

Jump to

Keyboard shortcuts

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