qjwt

package
v0.0.0-...-5591726 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConf  = errors.New("conf is not valid")
	ErrTokenExpired = errors.New("token has expired")
	ErrTokenInvalid = errors.New("token is invalid")
)

Functions

func CreateToken

func CreateToken(ctx context.Context, b []byte, expiresAt int64) (string, error)

CreateToken 生成一个token

func Init

func Init(c *Config) error

func Parse

func Parse(ctx context.Context, tokenString string) ([]byte, error)

func ParseTokenWithoutTime

func ParseTokenWithoutTime(ctx context.Context, tokenString string) ([]byte, error)

Types

type Config

type Config struct {
	// 加密key
	Signkey string `toml:"signkey"`
	AesKey  string `toml:"aeskey"`
	AesIv   string `toml:"aesiv"`
}

func (*Config) Check

func (c *Config) Check() bool

type CustomClaims

type CustomClaims struct {
	jwt.StandardClaims
	Sign string `json:"sign"`
}

payload

type Jwt

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

Jump to

Keyboard shortcuts

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