tokens

package
v0.1.0-beta-007 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateFunc

type GenerateFunc = func(tokenKind int, tokenData []byte, ttl time.Duration) (token string, err error)

GenerateFunc generates a new token containing encrypted and signed data.

func CreateGenerateFunc

func CreateGenerateFunc(now func() time.Time, encrypt aes.EncryptFunc, sign hmacsha256.SignFunc) GenerateFunc

CreateGenerateFunc creates a new `tokens.GenerateFunc` function.

type ValidateFunc

type ValidateFunc = func(tokenKind int, token string) (verifiedData []byte, fault check.Fault)

ValidateFunc checks a token's validity and extracts the encrypted data if successful.

func CreateValidateFunc

func CreateValidateFunc(
	now func() time.Time,
	decrypt aes.DecryptFunc,
	isValidSignature hmacsha256.ValidateFunc) ValidateFunc

CreateValidateFunc creates a new `tokens.ValidateFunc` function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL