paseto_plug v0.4.0 PasetoPlug

Documentation for PasetoPlug.

Link to this section Summary

Functions

Essentially wherever the verification happens. Should everything go according to plan, you will find a new :claims key in your conn.assigns

Main entrypoint for whenever the plug is loaded. It is expected that you will pass in a function capable of returning a binary key (for local) or keypair.

Link to this section Types

Link to this type

paseto_key()
paseto_key() :: {binary(), binary()} | binary()

Link to this section Functions

Link to this function

call(conn, key)

Essentially wherever the verification happens. Should everything go according to plan, you will find a new :claims key in your conn.assigns

Link to this function

init(list)
init(%{key_provider: (() -> paseto_key())}) :: paseto_key()

Main entrypoint for whenever the plug is loaded. It is expected that you will pass in a function capable of returning a binary key (for local) or keypair.

If using v1 local, you will need to provide a binary key up to 32 bytes long.

If using v1 public, you will need to provide a keypair ({binary(), binary()}) that can typically be generated by doing :crypto.generate_key(:rsa, {2048, 65_537}). NOTE: The modulus and exponent must be exactly as they are declared here.

If using v2 local, you will need to provide a binary key that is exactly 64 bytes long.

If using v2 public, you can generate a keypair doing {:ok, public_key, secret_key} = Salty.Sign.Ed25519.keypair()

Further information can be found here: https://github.com/GrappigPanda/paseto