utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenSigningMethod = errors.New("ErrTokenSigningMethod")
	ErrTokenExpired       = errors.New("ErrTokenExpired")
	ErrTokenMalformed     = errors.New("ErrTokenMalformed")
	ErrTokenHandle        = errors.New("ErrTokenHandle")
	ErrSignedString       = errors.New("ErrSignedString")
)

Functions

func CreatJwt

func CreatJwt(uid string, tp TokenType, key string, data []byte, duration time.Duration) (string, error)

CreatJwt 生成一个JwtToken,包含uid

func ParseToken

func ParseToken(token string, tokenType TokenType, key string) (string, []byte, error)

ParseToken 从Jwt中解析Token

Types

type TokenType

type TokenType int32
const (
	TokenTypeAccess TokenType = iota
	TokenTypeRefresh
)

Jump to

Keyboard shortcuts

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