storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package storage is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("entry not found")

ErrNotFound indicates that the specified crypto storage entry couldn't be found.

Functions

This section is empty.

Types

type MockStorage

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

MockStorage is a mock of Storage interface.

func NewMockStorage

func NewMockStorage(ctrl *gomock.Controller) *MockStorage

NewMockStorage creates a new mock instance.

func (*MockStorage) EXPECT

func (m *MockStorage) EXPECT() *MockStorageMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStorage) GetPrivateKey

func (m *MockStorage) GetPrivateKey(kid string) (crypto.Signer, error)

GetPrivateKey mocks base method.

func (*MockStorage) ListPrivateKeys

func (m *MockStorage) ListPrivateKeys() []string

ListPrivateKeys mocks base method.

func (*MockStorage) PrivateKeyExists

func (m *MockStorage) PrivateKeyExists(kid string) bool

PrivateKeyExists mocks base method.

func (*MockStorage) SavePrivateKey

func (m *MockStorage) SavePrivateKey(kid string, key crypto.PrivateKey) error

SavePrivateKey mocks base method.

type MockStorageMockRecorder

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

MockStorageMockRecorder is the mock recorder for MockStorage.

func (*MockStorageMockRecorder) GetPrivateKey

func (mr *MockStorageMockRecorder) GetPrivateKey(kid interface{}) *gomock.Call

GetPrivateKey indicates an expected call of GetPrivateKey.

func (*MockStorageMockRecorder) ListPrivateKeys

func (mr *MockStorageMockRecorder) ListPrivateKeys() *gomock.Call

ListPrivateKeys indicates an expected call of ListPrivateKeys.

func (*MockStorageMockRecorder) PrivateKeyExists

func (mr *MockStorageMockRecorder) PrivateKeyExists(kid interface{}) *gomock.Call

PrivateKeyExists indicates an expected call of PrivateKeyExists.

func (*MockStorageMockRecorder) SavePrivateKey

func (mr *MockStorageMockRecorder) SavePrivateKey(kid, key interface{}) *gomock.Call

SavePrivateKey indicates an expected call of SavePrivateKey.

type PublicKeyEntry

type PublicKeyEntry struct {
	Period core.Period `json:"period"`

	Key map[string]interface{} `json:"publicKeyJwk,omitempty"`
	// contains filtered or unexported fields
}

PublicKeyEntry is a public key entry also containing the period it's valid for.

func (*PublicKeyEntry) FromJWK

func (pke *PublicKeyEntry) FromJWK(key jwk.Key) error

FromJWK fills the publicKeyEntry with key material from the given key

func (PublicKeyEntry) JWK

func (pke PublicKeyEntry) JWK() jwk.Key

JWK returns the key as JSON Web Key.

func (*PublicKeyEntry) UnmarshalJSON

func (pke *PublicKeyEntry) UnmarshalJSON(bytes []byte) error

UnmarshalJSON parses the json

type Storage

type Storage interface {
	// GetPrivateKey from the storage backend and return its handler as an implementation of crypto.Signer.
	GetPrivateKey(kid string) (crypto.Signer, error)
	// PrivateKeyExists checks if the private key indicated with the kid is stored in the storage backend.
	PrivateKeyExists(kid string) bool
	// SavePrivateKey stores the key under the kid in the storage backend.
	SavePrivateKey(kid string, key crypto.PrivateKey) error
	// ListPrivateKeys returns the KIDs of the private keys that are present.
	ListPrivateKeys() []string
}

Storage interface containing functions for storing and retrieving keys.

func NewFileSystemBackend

func NewFileSystemBackend(fspath string) (Storage, error)

NewFileSystemBackend creates a new filesystem backend, all directories will be created for the given path Using a filesystem backend in production is not recommended!

func NewVaultKVStorage

func NewVaultKVStorage(config VaultConfig) (Storage, error)

NewVaultKVStorage creates a new Vault backend using the kv version 1 secret engine: https://www.vaultproject.io/docs/secrets/kv It currently only supports token authentication which should be provided by the token param. If config.Address is empty, the VAULT_ADDR environment should be set. If config.Token is empty, the VAULT_TOKEN environment should be is set.

type VaultConfig

type VaultConfig struct {
	// Token to authenticate to the Vault cluster.
	Token string `koanf:"token"`
	// Address of the Vault cluster
	Address string `koanf:"address"`
	// PathPrefix can be used to overwrite the default 'kv' path.
	PathPrefix string `koanf:"pathprefix"`
}

VaultConfig contains the config options to configure the vaultKVStorage backend

func DefaultVaultConfig

func DefaultVaultConfig() VaultConfig

DefaultVaultConfig returns a VaultConfig with the PathPrefix containing the default value.

Jump to

Keyboard shortcuts

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