tokens

package
v0.0.0-...-dfd90ba Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadTokenData = errors.New("bad token data")
	ErrBadTokenTime = errors.New("bad token time")
	ErrTokenExpired = errors.New("token expired")
	ErrTokenDecode  = errors.New("can't hex decode token")
)

Functions

This section is empty.

Types

type HashToken

type HashToken struct {
	Secret []byte
}

func NewHMACHashToken

func NewHMACHashToken(secret string) *HashToken

func (*HashToken) Check

func (tk *HashToken) Check(s *SessionParams, inputToken string) (bool, error)

func (*HashToken) Create

func (tk *HashToken) Create(s *SessionParams, tokenExpTime int64) (string, error)

type SessionParams

type SessionParams struct {
	Token      string
	LivingTime time.Duration
}

Jump to

Keyboard shortcuts

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