jwt

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	UuidKey     = "id"
	IssuedAtKey = "iat"
	ExpiryKey   = "exp"
)

mapping key constants

Variables

View Source
var (
	ErrUnexpectedSigningMethod = errors.New("unexpected signing method")
	ErrInvalidToken            = errors.New("invalid token")
	ErrInvalidClaims           = errors.New("invalid claims")
)

error messages

Functions

func Generate

func Generate(c Claims, signingKey []byte) (string, error)

Generate() creates a new JWT token with Claims{} data and signs it with signingKey.

Types

type Claims

type Claims struct {
	Uuid uuid.UUID
	Iat  int64
	Exp  int64
}

Claim data

func Validate

func Validate(tokenStr string, signingKey []byte) (*Claims, error)

Validate() checks if token is signed with signingKey.

Jump to

Keyboard shortcuts

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