keystore

package
v0.0.0-...-16ef530 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: 12 Imported by: 0

Documentation

Overview

Package keystore implements the auth.KeyLookup interface. This implements an in-memory keystore for JWT support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyStore

type KeyStore struct {
	// contains filtered or unexported fields
}

KeyStore represents an in memory store implementation of the KeyLookup interface for use with the auth package.

func New

func New() *KeyStore

New constructs an empty KeyStore ready for use.

func (*KeyStore) LoadByEnv

func (ks *KeyStore) LoadByEnv(env string) (int, error)

LoadByEnv is given an env variable to read. It assume a JSON document will be provided with two fields, key and pem (private key). If the env var does not exist, the function does not fail and returns the total number of keys in the store.

func (*KeyStore) LoadByFileSystem

func (ks *KeyStore) LoadByFileSystem(fsys fs.FS) (int, error)

LoadByFileSystem loads a set of RSA PEM files rooted inside of a directory. The name of each PEM file will be used as the key id. The function also returns the total number of keys in the store. Example: ks.LoadRSAKeys(os.DirFS("/zarf/keys/")) Example: /zarf/keys/54bb2165-71e1-41a6-af3e-7da4a0e1e2c1.pem

func (*KeyStore) PrivateKey

func (ks *KeyStore) PrivateKey(kid string) (string, error)

PrivateKey searches the key store for a given kid and returns the private key.

func (*KeyStore) PublicKey

func (ks *KeyStore) PublicKey(kid string) (string, error)

PublicKey searches the key store for a given kid and returns the public key.

Jump to

Keyboard shortcuts

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