jwt

package
v0.0.0-...-a3e8f81 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimsParam

type ClaimsParam struct {
	UserID int `json:"user_id"`
}

type Config

type Config struct {
	Secret string `yaml:"Secret"`
	Issuer string `yaml:"Issuer"`
}

type JWT

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

func NewJWT

func NewJWT(conf *Config) (*JWT, error)

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(param ClaimsParam, duration time.Duration) (*Token, error)

func (*JWT) ParseToken

func (j *JWT) ParseToken(input string) (*ClaimsParam, error)

type Token

type Token struct {
	Token    string
	ExpireAt int64
}

Jump to

Keyboard shortcuts

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