A keyring can be used to store a collection of keys for use in the building and parsing of tokens.
Just like a Pasexto.Key, a keyring is also scoped to a protocol's
version and purpose. Keys added to the keyring must have an identifier
assigned to them, it is recommended to use Pasexto.Paserk to achieve
this.
A key can be added to the keyring like so:
iex> key = Key.new(:v4, :local)
iex> keyring = Keyring.new(:v4, :local) |> Keyring.put("key1", key)
Summary
Functions
Get the key for a given key identifier.
Creates an empty keyring for use with the given protocol version and purpose.
Put a key in the keyring for the given key identifier.
Types
@type t() :: %Pasexto.Keyring{ keys: term(), purpose: Pasexto.Key.purpose(), version: Pasexto.Key.version() }
Functions
@spec get(t(), binary()) :: Pasexto.Key.t() | nil
Get the key for a given key identifier.
@spec new(Pasexto.Key.version(), Pasexto.Key.purpose()) :: t()
Creates an empty keyring for use with the given protocol version and purpose.
@spec put(t(), binary(), Pasexto.Key.t()) :: t()
Put a key in the keyring for the given key identifier.
If the key does not have the protocol version and purpose then the key is not added.