Documentation
¶
Overview ¶
Package tokens generates typed authenticated tokens that allow untrusted third parties to safely carry state between applictions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Decrypt ¶
func Decrypt(token string, key []byte) (*types.SecureToken, error)
Decrypt returns the decrypted SecureToken. It's only intended to be used from debugging utilities.
func New ¶
New generates a token from the provided protocol message, encrypting and signing it with the provided 32-byte symmetric key.
func VerifyAndUnmarshal ¶
VerifyAndUnmarshal unmarshals a token created by NewToken into the provided protocol message. An error is returned if the token is too new, too old, cryptographically invalid, or if the type of the destination message and contained message do not match.
Types ¶
type GeneratorConfig ¶
type GeneratorConfig struct {
Key []byte // A key with which to sign and encrypt tokens. Must be exactly 32 bytes.
}
func (*GeneratorConfig) SetKey ¶
func (c *GeneratorConfig) SetKey(key []byte) error
Click to show internal directories.
Click to hide internal directories.