token

package
v0.0.0-...-7372eca Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AccessKeyFunc  = keyAcFunc
	RefreshKeyFunc = keyRfFunc
)

var

Functions

func ExtractToken

func ExtractToken(ctx context.Context) (string, error)

ExtractToken extract token from context

func ExtractTokenMetadata

func ExtractTokenMetadata(ts string, keyFunc jwt.Keyfunc) (id uint64, err error)

ExtractTokenMetadata .

func ValidToken

func ValidToken(ctx context.Context, keyFunc jwt.Keyfunc) error

ValidToken .

func VerifyToken

func VerifyToken(ctx context.Context, keyFunc jwt.Keyfunc) (token *jwt.Token, err error)

VerifyToken .

Types

type Token

type Token struct {
	Access    string // access token
	Refresh   string // refresh token
	AtExpires int64  // access token expire time
	RtExpires int64  // refresh token expire time
}

Token jwt token

func New

func New(userID uint64) (t *Token, err error)

New generate a token

Jump to

Keyboard shortcuts

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