jwt

package
v0.40.9 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

type JWT interface {
	// Token 生成 token
	Token(data ...map[string]interface{}) (string, error)

	// TokenWithKey 生成 token
	TokenWithKey(key []byte, data ...map[string]interface{}) (string, error)

	// Verify 验证 token,并获取自定义内容
	Verify(s string) (map[string]interface{}, error)

	// VerifyWithKey 验证 token,并获取自定义内容
	VerifyWithKey(key []byte, s string) (map[string]interface{}, error)
}

JWT ..

func NewJWT

func NewJWT(opts ...Option) JWT

NewJWT 创建一个 jwt

type Option

type Option struct {
	// Secret 签名密钥
	Secret []byte

	// Exp 过期时间
	Exp time.Duration

	// ISS 签发者
	ISS string
}

Option ..

Jump to

Keyboard shortcuts

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