keymanager

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key interface {
	crypto.Signer

	// ID returns the ID of the key in the KeyManager.
	ID() string
}

Key is a KeyManager-backed key

type KeyManager

type KeyManager interface {
	catalog.PluginInfo

	// GenerateKey generates a key with the given ID and key type. If a key
	// with that ID already exists, it is overwritten.
	GenerateKey(ctx context.Context, id string, keyType KeyType) (Key, error)

	// GetKey returns the key with the given ID. If a key with that ID does
	// not exist, a status of codes.NotFound is returned.
	GetKey(ctx context.Context, id string) (Key, error)

	// GetKeys returns all keys managed by the KeyManager.
	GetKeys(ctx context.Context) ([]Key, error)
}

KeyManager is the client interface for the service type KeyManager interface.

type KeyType

type KeyType int

KeyType represents the types of keys that are supported by the KeyManager.

const (
	KeyTypeUnset KeyType = iota
	ECP256
	ECP384
	RSA2048
	RSA4096
)

func (KeyType) GenerateSigner

func (keyType KeyType) GenerateSigner() (crypto.Signer, error)

GenerateSigner generates a new key for the given key type

func (KeyType) String

func (keyType KeyType) String() string

type Repository

type Repository struct {
	KeyManager KeyManager
}

func (*Repository) Clear

func (repo *Repository) Clear()

func (*Repository) GetKeyManager

func (repo *Repository) GetKeyManager() KeyManager

func (*Repository) SetKeyManager

func (repo *Repository) SetKeyManager(keyManager KeyManager)

type V1

func (V1) GenerateKey

func (v1 V1) GenerateKey(ctx context.Context, id string, keyType KeyType) (Key, error)

func (V1) GetKey

func (v1 V1) GetKey(ctx context.Context, id string) (Key, error)

func (V1) GetKeys

func (v1 V1) GetKeys(ctx context.Context) ([]Key, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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