jwt

package
v0.0.0-...-ffb6c4e Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypName

func TypName(typ TokenType) string

Types

type Claims

type Claims struct {
	Typ TokenType `json:"typ"`
	UID int       `json:"id"`
	*jwt.RegisteredClaims
}

type JWT

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

func New

func New(sec []byte, issuer string, expire time.Duration) *JWT

func (*JWT) Generate

func (j *JWT) Generate(id int) (string, error)

func (*JWT) GenerateWithContext

func (j *JWT) GenerateWithContext(ctx context.Context, id int) (string, error)

func (*JWT) Parse

func (j *JWT) Parse(token string) (*Claims, error)

func (*JWT) Typ

func (j *JWT) Typ(typ TokenType) *JWT

type TokenType

type TokenType int
const (
	AccessToken TokenType = iota + 1
	RefreshToken
)

Jump to

Keyboard shortcuts

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