Documentation ¶
Overview ¶
Package fernet implements the Fernet spec (see https://github.com/fernet/spec).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt is the reverse of encrypt. Given a token returned by Encrypt, the same secret, the current time, and a TTL, returns the original message unless either of the following is true: the token has been tampered with, or the TTL has elapsed since the token was generated.
func Encrypt ¶
Encrypt uses secret to encrypt and sign msg. Use Decrypt to recover the original message from the token. secret must be a base64-encoded slice of 32 bytes, where the first sixteen bytes are used to sign the token and the second sixteen are used to encrypt the message. now should generally be set to the current time except during testing.
func RandomSecret ¶
RandomSecret generates a secret suitable for use with Encrypt.
Types ¶
This section is empty.