jwt

package
v0.0.0-...-6d513be Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTokenWithExpiryAndKey

func GenerateTokenWithExpiryAndKey(claims jwt.Claims, expiry time.Duration, key []byte) (string, error)

func ParseTokenWithKey

func ParseTokenWithKey(tokenString string, key []byte) (jwt.Claims, error)

ParseTokenWithKey 解析带有自定义秘钥的 JWT

Types

type JWTConfig

type JWTConfig struct {
	SecretKey      string
	ExpiryDuration time.Duration
}

func (*JWTConfig) GenerateToken

func (c *JWTConfig) GenerateToken(claims jwt.Claims) (string, error)

func (*JWTConfig) ParseTokenWithKey

func (c *JWTConfig) ParseTokenWithKey(tokenString string) (jwt.Claims, error)

ParseTokenWithKey 解析带有自定义秘钥的 JWT

Jump to

Keyboard shortcuts

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