Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTokenNotAuthenticated = errors.New("token: value could not be authenticated")
ErrTokenNotAuthenticated is raised when you try to validate a non compliant value.
Functions ¶
Types ¶
type GenerateOption ¶
type GenerateOption func(*generateOption)
GenerateOption is used to set up the token generation process.
func WithTokenPrefix ¶
func WithTokenPrefix(value string) GenerateOption
WithTokenPrefix prepends the given prefix to the token generation so that it will be covered by the checksum.
Prefix must match [a-z0-9-]+ regular expression (lowercase kebab case).
type Generator ¶
type Generator interface {
Generate(...GenerateOption) (string, error)
}
Generator describes token generator contract.
func UUIDGenerator ¶
func UUIDGenerator(source UUIDGeneratorFunc, secretKey []byte) Generator
UUIDGenerator wraps the returned UUID byte array from the given source to provide additional integrity protection to the content.
The secret key is used to derive a unique secret used to seal the UUID value.
type UUIDGeneratorFunc ¶
UUIDGeneratorFunc represents the contract used to feed the wrapper with a pre-generated UUID. This is used to pass the UUID byte array coming from your favorite generator.
func StaticUUIDSource ¶
func StaticUUIDSource(in [16]byte) UUIDGeneratorFunc
StaticUUIDSource is used to set a static UUID byte array content.
func UUIDv4Source ¶
func UUIDv4Source() UUIDGeneratorFunc
UUIDv4Source generates an UUIDv4 based byte array.
func UUIDv7Source ¶
func UUIDv7Source() UUIDGeneratorFunc
UUIDv7Source generates an UUIDv7 based byte array.
type VerifiableGenerator ¶
type VerifiableUUIDExtractor ¶
VerifiableUUIDExtractor extends the Verifier to add content extraction helper.
func UUIDVerifier ¶
func UUIDVerifier(secretKey []byte) VerifiableUUIDExtractor
UUIDVerifier verifies a wrapped UUID signature.