key

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, id string, providerType KeyProviderType) error

Delete goes to the specified key provider and deletes the Key returns a nil error when successful

func RegisterKeyProvider

func RegisterKeyProvider(k KeyProvider, providerType KeyProviderType) error

func Store

func Store(ctx context.Context, id string, pemBytes []byte, providerType KeyProviderType) error

Store goes to the specified key provider and stores the wrapped Key. It takes in a PEM-encoded byte slice and converts it to a wrapped Key type returns a nil error when successful

Types

type Key

type Key struct {
	// Hash sha256 hash of the canonical representation of the key
	Hash string
	// Type represents the type of the key
	Type KeyType
	// Key is the crypto.PublicKey of the public key
	Val crypto.PublicKey
	// Scheme is the supported scheme by the key type.
	Scheme KeyScheme
}

func Find

func Find(ctx context.Context, id string) (*Key, error)

Find goes through each of the registered key providers and retrieves the wrapped Key TODO: Should this handle if multiple keys are returned

func Retrieve

func Retrieve(ctx context.Context, id string, providerType KeyProviderType) (*Key, error)

Retrieve goes to the specified key provider and gets the wrapped Key

type KeyProvider

type KeyProvider interface {
	// RetrieveKey takes in the ID (which is commonly the hash of the key)
	// and it retrieves the wrapped key struct that is associated
	// Returns nil, nil if no keys are found
	// Return nil, error if the request to the provider failed
	RetrieveKey(ctx context.Context, id string) (*Key, error)
	// StoreKey takes in the ID and the crypto.PublicKey and stores them
	// for future retrieval. If key id is already present, it replaces
	// the key with the new one
	StoreKey(ctx context.Context, id string, pk *Key) error
	// DeleteKey takes in the ID and will remove the associated key from the provider
	DeleteKey(ctx context.Context, id string) error
	// Type returns the key provider type
	Type() KeyProviderType
}

type KeyProviderType

type KeyProviderType string

type KeyScheme

type KeyScheme string

type KeyType

type KeyType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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