jwtutil

package
v0.0.0-...-784c0f6 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedSigningMethod = errors.New("unexpected signing method")
	ErrVerificationError       = errors.New("verification error")
	ErrInvalidToken            = errors.New("the token is invalid")
)

Functions

func LoadKeys

func LoadKeys(pubKeyPath, privKeyPath string) error

LoadKeys is ...

func NewToken

func NewToken(id, expires string, credentials []string) (string, error)

NewToken func for generate a new Access token.

func PrivateKey

func PrivateKey() *rsa.PrivateKey

func PublicKey

func PublicKey() *rsa.PublicKey

Types

type TokenMetadata

type TokenMetadata struct {
	ID        string
	IssuedAt  float64
	ExpiresAt float64
}

TokenMetadata struct to describe metadata in JWT.

func ExtractMetadata

func ExtractMetadata(tokenKey string) (*TokenMetadata, error)

ExtractMetadata func to extract metadata from JWT.

func ExtractMetadataFiber

func ExtractMetadataFiber(c *fiber.Ctx) (*TokenMetadata, error)

ExtractMetadataFiber extracts the metadata from a JWT token within a Fiber context.

Jump to

Keyboard shortcuts

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