jwtg

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JwtGenerator

type JwtGenerator[T any] struct {
	ExpMinute int
	// contains filtered or unexported fields
}

func NewJwtGenrator

func NewJwtGenrator[T any](key []byte, container T) (jg *JwtGenerator[T], err error)

生成Jwt生成器

func (*JwtGenerator[T]) Refresh added in v0.2.10

func (g *JwtGenerator[T]) Refresh(token []byte, opt SignOption) (newToken []byte, err error)

func (*JwtGenerator[T]) Sign added in v0.0.12

func (g *JwtGenerator[T]) Sign(u T, opt SignOption) (token []byte, err error)

func (*JwtGenerator[T]) Verify added in v0.0.12

func (g *JwtGenerator[T]) Verify(b []byte) (token JwtToken[T], err error)

type JwtToken

type JwtToken[T any] struct {
	jwt.Payload
	Tag T `json:"t,omitempty"`
}

type SignOption added in v0.2.4

type SignOption struct {
	ExpMinute int // 如果不设置,将使用JwtGenerator的ExpMinute
}

Jump to

Keyboard shortcuts

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