token

package
v2.167.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Access *access.Config `yaml:"access,omitempty" json:"access,omitempty" toml:"access,omitempty"`
	JWT    *jwt.Config    `yaml:"jwt,omitempty" json:"jwt,omitempty" toml:"jwt,omitempty"`
	Paseto *paseto.Config `yaml:"paseto,omitempty" json:"paseto,omitempty" toml:"paseto,omitempty"`
	SSH    *ssh.Config    `yaml:"ssh,omitempty" json:"ssh,omitempty" toml:"ssh,omitempty"`
	Kind   string         `yaml:"kind,omitempty" json:"kind,omitempty" toml:"kind,omitempty"`
}

Config for token.

func (*Config) IsEnabled added in v2.115.0

func (c *Config) IsEnabled() bool

IsEnabled for configuration.

type Generator

type Generator interface {
	// Generate a new token or error.
	Generate(aud, sub string) ([]byte, error)
}

Generator allows the implementation of different types generators.

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token will generate and verify based on what is defined in the config.

func NewToken

func NewToken(name env.Name, cfg *Config, fs *os.FS, sig *ed25519.Signer, ver *ed25519.Verifier, gen id.Generator) *Token

NewToken based on config.

func (*Token) Generate

func (t *Token) Generate(aud, sub string) ([]byte, error)

Generate a token based on kind.

func (*Token) Verify

func (t *Token) Verify(token []byte, aud string) (string, error)

Verify a token based on kind.

type Verifier

type Verifier interface {
	// Verify a token or error.
	Verify(token []byte, aud string) (string, error)
}

Verifier allows the implementation of different types of verifiers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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