bst

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StandardFields

type StandardFields struct {
	IssuedAt   time.Time `json:"iat"`
	Expiration time.Time `json:"exp"`
	Audience   string    `json:"aud"`
	Issuer     string    `json:"is"`
}

type Token

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

func New

func New(encyptionKey []byte, signingKey []byte) *Token

either takes in a 16, 24 or 32 byte key, will panic if fails

func (*Token) GenerateCustomToken

func (t *Token) GenerateCustomToken(fields any) (token string, err error)

func (*Token) GenerateTTLToken

func (t *Token) GenerateTTLToken(ttl time.Time) (token string, err error)

<type>.<ttl>.<hash> no encryption this function will generate a token which only conatains a ttl, best used for simple and lightweight tokens

func (*Token) ParseToken

func (t *Token) ParseToken(token string, dst any) error

this function is used to validate tokens with cutom fields. it takes in the token and the destination struct, it will decode the token fields into the token

func (*Token) ValidateTTLToken

func (t *Token) ValidateTTLToken(token string) error

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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