token

package
v1.213.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module for fx.

Functions

func Generate added in v1.213.0

func Generate() (Key, Hash, error)

Generate key and hash for token.

func IsEnabled added in v1.204.0

func IsEnabled(cfg *Config) bool

IsEnabled the config.

Types

type Config added in v1.117.0

type Config struct {
	Key  Key  `yaml:"key,omitempty" json:"key,omitempty" toml:"key,omitempty"`
	Hash Hash `yaml:"hash,omitempty" json:"hash,omitempty" toml:"hash,omitempty"`
}

Config for token.

type Generator

type Generator interface {
	// Generate a new token or error.
	Generate(ctx context.Context) (context.Context, []byte, error)
}

Generator allows the implementation of different types generators.

type Hash added in v1.213.0

type Hash string

Hash for the token.

type Key added in v1.204.0

type Key string

Key for token.

type Tokenizer added in v1.204.0

type Tokenizer interface {
	Generator
	Verifier
}

Tokenizer will generate and verify.

func NewTokenizer added in v1.204.0

func NewTokenizer(cfg *Config, algo argon2.Algo) Tokenizer

NewTokenizer for token.

type Verifier

type Verifier interface {
	// Verify a token or error.
	Verify(ctx context.Context, token []byte) (context.Context, error)
}

Verifier allows the implementation of different types of verifiers.

Jump to

Keyboard shortcuts

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