# `Pasexto.Keyring`
[🔗](https://github.com/alexkornitzer/pasexto/blob/v0.1.2/lib/pasexto/keyring.ex#L1)

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:

```elixir
iex> key = Key.new(:v4, :local)
iex> keyring = Keyring.new(:v4, :local) |> Keyring.put("key1", key)
```

# `t`

```elixir
@type t() :: %Pasexto.Keyring{
  keys: term(),
  purpose: Pasexto.Key.purpose(),
  version: Pasexto.Key.version()
}
```

# `get`

```elixir
@spec get(t(), binary()) :: Pasexto.Key.t() | nil
```

Get the key for a given key identifier.

# `new`

```elixir
@spec new(Pasexto.Key.version(), Pasexto.Key.purpose()) :: t()
```

Creates an empty keyring for use with the given protocol version and purpose.

# `put`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
