Phauxth v0.16.0 Phauxth.Token View Source

Create api tokens, based on the Phoenix token implementation.

The data stored in the token is signed to prevent tampering but not encrypted. This means it is safe to store identification information (such as user IDs) but should not be used to store confidential information (such as credit card numbers).

Key generator options

The key generator has three options:

  • key_iterations - the number of iterations the key derivation function uses

    • the default is 1000
  • key_length - the length of the key, in bytes

    • the default is 32
  • key_digest - the hash algorithm that is used

    • the default is :sha256

Note that the same key generator options should be used for signing and verifying tokens.

Link to this section Summary

Link to this section Functions

Link to this function sign(conn, data, opts \\ []) View Source

Sign the token.

opts are the key generator options. See the module documentation for details.

Link to this function verify(conn, token, max_age, opts \\ []) View Source

Verify the token.

opts are the key generator options. See the module documentation for details.