qtoken

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckToken added in v0.0.4

func CheckToken(tokenString string) bool

CheckToken

@Description: 验证token是否有效,当token无效或过期时,返回false
@param tokenString
@return bool

func GenerateToken

func GenerateToken(content Content, ttl int64) (string, error)

GenerateToken

@Description: 生成Token
@param content token的内容
@param ttl 生存时间 单位小时
@return string
@return error

Types

type Content added in v0.0.4

type Content struct {
	Id      uint64                 `json:"i"`
	Roles   []int                  `json:"r"`
	Customs map[string]interface{} `json:"c"`
}

func AnalyseToken added in v0.0.4

func AnalyseToken(tokenString string) (*Content, error)

AnalyseToken

@Description: 解析Token
@param tokenString
@return *T
@return error

Jump to

Keyboard shortcuts

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