auth

package
v0.0.0-...-c798314 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Issuer       = "donezo"
	BearerPrefix = "Bearer "
)

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(secret []byte, expiration time.Duration) (string, error)

GenerateToken creates a signed JWT token with the given secret and expiration duration.

func ValidateToken

func ValidateToken(secret []byte, tokenString string) error

ValidateToken parses and validates the JWT token string using the provided secret. It returns an error if the token is invalid, expired, or has an incorrect issuer.

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
}

Claims defines the structure of JWT claims

Jump to

Keyboard shortcuts

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