Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound is returned by a Storage implementation when a key is not found.
Functions ¶
This section is empty.
Types ¶
type KeyType ¶
type KeyType string
KeyType is a set of "JSON Web Key Types" from https://www.iana.org/assignments/jose/jose.xhtml as mentioned in https://www.rfc-editor.org/rfc/rfc7517#section-4.1
const ( // KeyTypeEC is the key type for ECDSA. KeyTypeEC KeyType = "EC" // KeyTypeOKP is the key type for EdDSA. KeyTypeOKP KeyType = "OKP" // KeyTypeRSA is the key type for RSA. KeyTypeRSA KeyType = "RSA" // KeyTypeOct is the key type for octet sequences, such as HMAC. KeyTypeOct KeyType = "oct" )
type KeyWithMeta ¶
type KeyWithMeta struct { Key interface{} KeyID string }
KeyWithMeta is holds a Key and its metadata.
func NewKey ¶ added in v0.0.3
func NewKey(key interface{}, keyID string) KeyWithMeta
NewKey creates a new KeyWithMeta.
type Storage ¶
type Storage interface { // DeleteKey deletes a key from the storage. It will return ok as true if the key was present for deletion. DeleteKey(ctx context.Context, keyID string) (ok bool, err error) // ReadKey reads a key from the storage. If the key is not present, it returns ErrKeyNotFound. Any pointers returned // should be considered read-only. ReadKey(ctx context.Context, keyID string) (KeyWithMeta, error) // SnapshotKeys reads a snapshot of all keys from storage. As with ReadKey, any pointers returned should be // considered read-only. SnapshotKeys(ctx context.Context) ([]KeyWithMeta, error) // WriteKey writes a key to the storage. If the key already exists, it will be overwritten. After writing a key, // any pointers written should be considered owned by the underlying storage. WriteKey(ctx context.Context, meta KeyWithMeta) error }
Storage handles storage operations for a JWKSet.
func NewMemoryStorage ¶
func NewMemoryStorage() Storage
NewMemoryStorage creates a new in-memory Storage implementation.
Click to show internal directories.
Click to hide internal directories.