spi

package
v5.4.40 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package spi is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyAlreadyExists = errors.New("key already exists")

ErrKeyAlreadyExists indicates that a private key for this keyID already exists.

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) CheckHealth

func (m *MockStorage) CheckHealth() map[string]core.Health

CheckHealth mocks base method.

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(ctx context.Context, kid string) (crypto.Signer, error)

GetPrivateKey mocks base method.

func (*MockStorage) ListPrivateKeys

func (m *MockStorage) ListPrivateKeys(ctx context.Context) []string

ListPrivateKeys mocks base method.

func (*MockStorage) Name

func (m *MockStorage) Name() string

Name mocks base method.

func (*MockStorage) PrivateKeyExists

func (m *MockStorage) PrivateKeyExists(ctx context.Context, kid string) bool

PrivateKeyExists mocks base method.

func (*MockStorage) SavePrivateKey

func (m *MockStorage) SavePrivateKey(ctx context.Context, 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) CheckHealth

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

CheckHealth indicates an expected call of CheckHealth.

func (*MockStorageMockRecorder) GetPrivateKey

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

GetPrivateKey indicates an expected call of GetPrivateKey.

func (*MockStorageMockRecorder) ListPrivateKeys

func (mr *MockStorageMockRecorder) ListPrivateKeys(ctx interface{}) *gomock.Call

ListPrivateKeys indicates an expected call of ListPrivateKeys.

func (*MockStorageMockRecorder) Name

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

Name indicates an expected call of Name.

func (*MockStorageMockRecorder) PrivateKeyExists

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

PrivateKeyExists indicates an expected call of PrivateKeyExists.

func (*MockStorageMockRecorder) SavePrivateKey

func (mr *MockStorageMockRecorder) SavePrivateKey(ctx, 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 {
	core.HealthCheckable
	// GetPrivateKey from the storage backend and return its handler as an implementation of crypto.Signer.
	GetPrivateKey(ctx context.Context, kid string) (crypto.Signer, error)
	// PrivateKeyExists checks if the private key indicated with the kid is stored in the storage backend.
	PrivateKeyExists(ctx context.Context, kid string) bool
	// SavePrivateKey stores the key under the kid in the storage backend.
	SavePrivateKey(ctx context.Context, kid string, key crypto.PrivateKey) error
	// ListPrivateKeys returns the KIDs of the private keys that are present. Returns a []string(nil) if there was a problem.
	ListPrivateKeys(ctx context.Context) []string
}

Storage interface containing functions for storing and retrieving keys.

func NewValidatedKIDBackendWrapper

func NewValidatedKIDBackendWrapper(backend Storage, kidPattern *regexp.Regexp) Storage

NewValidatedKIDBackendWrapper creates a new wrapper for storage backends. Every call to the backend which takes a kid as param, gets the kid validated against the provided kidPattern.

Jump to

Keyboard shortcuts

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