xjwt

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenExpired     = errors.New("token is expired")
	TokenNotValidYet = errors.New("token not active yet")
	TokenMalformed   = errors.New("that's not even a token")
	TokenInvalid     = errors.New("couldn't handle this token")
)

Functions

This section is empty.

Types

type CustomClaims

type CustomClaims struct {
	ValueClaims interface{}
	jwt.RegisteredClaims
}

type JWT

type JWT struct {
	SigningKey []byte
}

func New

func New(signingKey []byte) *JWT

func (*JWT) CreateClaims

func (j *JWT) CreateClaims(value interface{}, registeredClaims jwt.RegisteredClaims) CustomClaims

func (*JWT) CreateToken

func (j *JWT) CreateToken(claims CustomClaims) (string, error)

CreateToken 创建一个token

func (*JWT) ParseToken

func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error)

ParseToken 解析token

Jump to

Keyboard shortcuts

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