Personal Assertion Tokens (PASSporT, RFC 8225) with the SHAKEN extension (RFC 8588), signed with ES256.
A PASSporT is a JSON Web Token in compact serialization: the base64url encoded header, claims and signature, separated by dots. The JSON objects have their keys sorted and no whitespace (RFC 8225 §9).
Summary
Types
The claims of a PASSporT (RFC 8225, RFC 8588), by name.
A decoded PASSporT: header, claims, signing input and signature.
Functions
Decodes a PASSporT, without checking its signature.
Encodes and signs a PASSporT. header gets alg (ES256) and typ
(passport).
Checks the ES256 signature of a decoded PASSporT with a public key.
Types
Functions
Decodes a PASSporT, without checking its signature.
iex> token = "eyJhbGciOiJFUzI1NiJ9.eyJpYXQiOjF9.AAAA"
iex> {:ok, %{header: header, claims: claims}} = Caracola.StirShaken.Passport.decode(token)
iex> {header, claims}
{%{"alg" => "ES256"}, %{"iat" => 1}}
iex> Caracola.StirShaken.Passport.decode("nope")
:error
@spec encode(map(), claims(), :public_key.private_key()) :: String.t()
Encodes and signs a PASSporT. header gets alg (ES256) and typ
(passport).
@spec verify(t(), :public_key.public_key()) :: boolean()
Checks the ES256 signature of a decoded PASSporT with a public key.