authex v0.1.1 Authex.Signer View Source

Link to this section Summary

Functions

Creates a new binary compact token from the Authex.Signer struct and binary claims map

Creates a new Authex.Signer struct from the options

Link to this section Types

Link to this type claims() View Source
claims() :: %{optional(binary()) => binary()}
Link to this type t() View Source
t() :: %Authex.Signer{jwk: integer(), jws: integer()}

Link to this section Functions

Link to this function compact(signer, claims) View Source
compact(t(), claims()) :: binary()

Creates a new binary compact token from the Authex.Signer struct and binary claims map.

Parameters

  • signer - An Authex.Signer struct.
  • cliams: A binary claims map.

Examples

iex> token = Authex.Token.new()
iex> claims = Authex.Token.get_claims(token)
iex> signer = Authex.Signer.new()
iex> signer |> Authex.Signer.compact(claims) |> is_binary() 
true
Link to this function new(options \\ []) View Source
new(list()) :: t()

Creates a new Authex.Signer struct from the options.

Parameters

  • options: A keyword list of options.

Options

  • :secret - the secret to sign the token with.
  • :alg - the algorithm to sign the token with.