Fernet

Generate or verify Fernet tokens based on https://github.com/fernet/spec

Summary

generate(options)

Generate a token for the given message using the secret to encrypt it

verify(options)

Verify a token using the given secret and optionally validate TTL

Functions

generate(options)

Generate a token for the given message using the secret to encrypt it.

Options

The accepted options are:

  • :message - message to be tokenized
  • :secret - secret to use for encryptions (256 bits, defaults to env)
verify(options)

Verify a token using the given secret and optionally validate TTL

Options

The accepted options are:

  • :token - token to be decrypted and verified
  • :secret - secret to use for decryption (256 bits, defaults to env)
  • :ttl - If :enforce_ttl then this is the time in seconds
  • :enforce_ttl - Should ttl be enforced (default to true)