View Source fernet (fernet v0.1.0)

Implements fernet token generation and verification.

See https://github.com/fernet/spec

Link to this section Summary

Functions

Decode a base64url encoded key.
Encode a key using base64url encoding format for interoperability
Encode a signing key and an encryption key using base64url encoding format for interoperability
Generate a pseudorandom 32 bytes key, and encode it with the proper base64url format for interoperability.
Generate a pseudorandom 32 bytes key.
Generate a token for the provided Message using the supplied Key.
Verify a token and extract the message

Link to this section Types

Specs

encoded_key() :: binary().

Specs

encoded_token() :: binary().

Specs

encryption_key() :: <<_:128>>.

Specs

key() :: <<_:256>>.

Specs

signing_key() :: <<_:128>>.

Link to this section Functions

Specs

decode_key(encoded_key()) -> key().
Decode a base64url encoded key.

Specs

encode_key(key()) -> encoded_key().
Encode a key using base64url encoding format for interoperability

Specs

encode_key(signing_key(), encryption_key()) -> encoded_key().
Encode a signing key and an encryption key using base64url encoding format for interoperability

Specs

generate_encoded_key() -> encoded_key().
Generate a pseudorandom 32 bytes key, and encode it with the proper base64url format for interoperability.

Specs

generate_key() -> key().
Generate a pseudorandom 32 bytes key.
Link to this function

generate_token(Message, Key)

View Source

Specs

generate_token(iodata(), key()) -> encoded_token().
Generate a token for the provided Message using the supplied Key.
Link to this function

verify_and_decrypt_token(Token, Key, TTL)

View Source

Specs

verify_and_decrypt_token(encoded_token(), key(), TTL :: integer() | infinity) ->
                            {ok, binary()} | {error, atom()}.
Verify a token and extract the message