token

package
v0.0.0-...-1a4a1ec Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey string
const TokenContextKey ContextKey = "token"

type Token

type Token struct {
	ID         int64
	Token      string
	CreatedAt  time.Time
	ValidUntil time.Time
}

func FromModel

func FromModel(t database.Token) Token

func New

func New(validFor *time.Duration) *Token

Generate a new token. A token is just 256-bit random number encoded as base64 string

func (Token) Expired

func (t Token) Expired() bool

func (Token) ToModel

func (t Token) ToModel() database.Token

Jump to

Keyboard shortcuts

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