xjwt

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultExpireDuration = time.Hour * 24 * 30

Variables

View Source
var (
	ErrTokenInvalid = errors.New("couldn't handle this token")
)

Functions

func CreateToken

func CreateToken(bus string, expires time.Duration) (string, error)

CreateToken 创建Token

func Init

func Init(key string)

func ParseToken

func ParseToken(tokenString string, bus interface{}) error

ParseToken 解析Token

Types

type Business

type Business struct {
	UUID   string `json:"uuid"`
	Role   uint64 `json:"role"`
	Extend string `json:"extend"`
}

type CustomClaims

type CustomClaims struct {
	Business string
	jwt.StandardClaims
}

type TokenResp

type TokenResp struct {
	Token     string `json:"token"`
	ExpiredAt uint64 `json:"expired_at"`
}

Jump to

Keyboard shortcuts

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