NoWayJose.KeyStore (NoWayJose v1.0.2)

View Source

ETS-backed storage for cryptographic keys.

Keys are stored by namespace and key ID, allowing multiple key sets to be managed (e.g., one per JWKS endpoint, one for local signing keys).

Usage

# Store keys from a JWKS fetcher
NoWayJose.KeyStore.put("auth0", keys)

# Lookup a specific key
{:ok, key} = NoWayJose.KeyStore.get("auth0", "key-id-1")

# Get all keys for a namespace
keys = NoWayJose.KeyStore.get_all("auth0")

Summary

Functions

Returns the number of keys stored for a namespace.

Deletes all keys for a namespace.

Deletes a specific key.

Retrieves a key by namespace and key ID.

Retrieves all keys for a namespace.

Stores multiple keys for a namespace.

Stores a single key for a namespace.

Functions

count(name)

@spec count(String.t()) :: non_neg_integer()

Returns the number of keys stored for a namespace.

delete(name)

@spec delete(String.t()) :: :ok

Deletes all keys for a namespace.

delete_key(name, kid)

@spec delete_key(String.t(), String.t() | nil) :: :ok

Deletes a specific key.

get(name, kid)

@spec get(String.t(), String.t() | nil) :: {:ok, NoWayJose.Key.t()} | :error

Retrieves a key by namespace and key ID.

get_all(name)

@spec get_all(String.t()) :: [NoWayJose.Key.t()]

Retrieves all keys for a namespace.

put(name, keys)

@spec put(String.t(), [NoWayJose.Key.t()]) :: :ok

Stores multiple keys for a namespace.

Replaces all existing keys for the namespace.

put_key(name, key)

@spec put_key(String.t(), NoWayJose.Key.t()) :: :ok

Stores a single key for a namespace.