Documentation
¶
Overview ¶
Package memory provides in-memory providers for tests and examples.
They are not for production: key material is held in process memory only, nothing persists, and no root key protects it. Their purpose is to exercise the client and the control plane against both styles of provider keyforge has to support:
- NewKeyring behaves like the local keyring: it holds every version itself and numbers them 1, 2, 3 and so on.
- NewNative behaves like a managed key service: the service assigns version numbers, which only increase and are not consecutive, and a wrapped key records the version that wrapped it.
A caller that assumes the next version is the previous plus one passes against the first and fails against the second.
Index ¶
- type Option
- type Provider
- func (p *Provider) CreateKey(ctx context.Context, spec provider.KeySpec) (provider.KeyRef, error)
- func (p *Provider) Destroy(ctx context.Context, ref provider.KeyRef, ver uint32) error
- func (p *Provider) Health(ctx context.Context) error
- func (p *Provider) Name() string
- func (p *Provider) Rotate(ctx context.Context, ref provider.KeyRef) (uint32, error)
- func (p *Provider) Unwrap(ctx context.Context, ref provider.KeyRef, ver uint32, wrapped, aad []byte) ([]byte, error)
- func (p *Provider) Wrap(ctx context.Context, ref provider.KeyRef, ver uint32, dek, aad []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Provider.
func WithEntropy ¶
WithEntropy sets the source of key material and identifiers. The default is crypto/rand. Tests inject a deterministic reader.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is an in-memory provider.Provider.
func NewKeyring ¶
NewKeyring returns a provider that behaves like the local keyring.
func (*Provider) CreateKey ¶
CreateKey implements provider.Provider.
func (*Provider) Destroy ¶
Destroy implements provider.Provider.
func (*Provider) Health ¶
Health implements provider.Provider.
func (*Provider) Rotate ¶
Rotate implements provider.Provider.