jwt

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGeneratingToken = errors.New("error generating token")
	ErrValidatingToken = errors.New("error validation token")
)

Functions

func GenerateToken

func GenerateToken(
	id string,
	email string,
	duration time.Duration,
	secret string,
) (string, error)

Types

type Claims

type Claims struct {
	Email string `json:"email"`
	jwt.RegisteredClaims
}

func ValidateToken

func ValidateToken(tokenString string, secret string) (*Claims, error)

type Config

type Config struct {
	AccessTTL  time.Duration `yaml:"access_ttl" env-default:"15m"`
	RefreshTTL time.Duration `yaml:"refresh_ttl" env-default:"168h"`
	Secret     string        `yaml:"secret" env-required:"true"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳