jwt

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 5 Imported by: 2

README

jwt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(content string) (string, error)

GenerateToken 生成token

func Init

func Init(config *Config)

Init 初始化

func InitClient added in v0.1.20210914101941

func InitClient(name string, config *Config)

InitClient init client

func InitClients added in v0.1.20210914101941

func InitClients(configs map[string]*Config)

InitClients init clients

func VerifyToken

func VerifyToken(tokens string) (string, error)

VerifyToken 格式化token

Types

type Config added in v0.1.20210914101941

type Config struct {
	Key    string `json:"key"`    // 密钥
	Expire string `json:"expire"` // 超时时长,1s,10m
}

Config config struct

type JWT

type JWT struct {
	// contains filtered or unexported fields
}

JWT Struct Info

func GetClient added in v0.1.20210914101941

func GetClient(name string) *JWT

GetClient get client

func New added in v0.1.20210914101941

func New(config *Config) *JWT

New create instance

func (*JWT) GenerateToken

func (receiver *JWT) GenerateToken(content string) (token string, err error)

GenerateToken generate token

func (*JWT) VerifyToken

func (receiver *JWT) VerifyToken(tokenStr string) (string, error)

VerifyToken verify token

Jump to

Keyboard shortcuts

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