jwtmaker

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("token is invalid")
	ErrExpiredToken = errors.New("token has expired")
)

Functions

func NewPayload

func NewPayload(user string, lifetime time.Duration) (*jwt.StandardClaims, error)

Types

type JWTMaker

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

func NewJWTMaker

func NewJWTMaker(secretKey string) *JWTMaker

func (*JWTMaker) Create

func (maker *JWTMaker) Create(username string, duration time.Duration) (string, error)

func (*JWTMaker) Verify

func (maker *JWTMaker) Verify(token string) (*jwt.StandardClaims, error)

type Payload

type Payload struct {
	ID        uuid.UUID
	User      string
	IssuedAt  time.Time
	ExpiredAt time.Time
}

Jump to

Keyboard shortcuts

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