View Source Pow.Plug.MessageVerifier behaviour (Pow v1.0.27)

This module can sign and verify messages.

Based on Phoenix.Token.

Link to this section Summary

Link to this section Callbacks

Link to this callback

sign(t, binary, binary, keyword)

View Source
@callback sign(Plug.Conn.t(), binary(), binary(), keyword()) :: binary()
Link to this callback

verify(t, binary, binary, keyword)

View Source
@callback verify(Plug.Conn.t(), binary(), binary(), keyword()) :: {:ok, binary()} | :error

Link to this section Functions

Link to this function

sign(conn, salt, message, config)

View Source
@spec sign(Plug.Conn.t(), binary(), binary(), keyword()) :: binary()

Signs a message.

Plug.Crypto.MessageVerifier.sign/2 is used. The secret is derived from the salt and conn.secret_key_base using Plug.Crypto.KeyGenerator.generate/3. If :key_generator_opts is set in the config, this will be passed on to Plug.Crypto.KeyGenerator.

Link to this function

verify(conn, salt, message, config)

View Source
@spec verify(Plug.Conn.t(), binary(), binary(), keyword()) :: {:ok, binary()} | :error

Verifies a message.

Plug.Crypto.MessageVerifier.sign/2 is used. The secret is derived from the salt and conn.secret_key_base using Plug.Crypto.KeyGenerator.generate/3. If :key_generator_opts is set in the config, this will be passed on to Plug.Crypto.KeyGenerator.