v2

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthAlgo

type AuthAlgo uint8
const (
	AuthAlgoUnknown AuthAlgo = iota
	AuthAlgoHMACSHA256
)

func (AuthAlgo) New

func (a AuthAlgo) New() func() hash.Hash

func (AuthAlgo) Size

func (a AuthAlgo) Size() int

func (AuthAlgo) String

func (a AuthAlgo) String() string

type Generator

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

func NewGenerator

func NewGenerator(algo AuthAlgo, secret []byte, timeToLive time.Duration) (*Generator, error)

func (*Generator) GenerateToken

func (g *Generator) GenerateToken() (*Token, error)

type Token

type Token struct {
	AuthAlgo  AuthAlgo
	Signature []byte
	Payload   []byte
}

func UnmarshalToken

func UnmarshalToken(data []byte) (*Token, error)

func (*Token) Marshal

func (t *Token) Marshal() []byte

type Validator

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

func NewValidator

func NewValidator(secret []byte) *Validator

func (*Validator) Validate

func (v *Validator) Validate(data any) error

Jump to

Keyboard shortcuts

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