jwt

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePassword

func ComparePassword(hashedPassword, plainPassword string) bool

ComparePassword compares a hashed password with a plain password

func GenerateRefreshToken

func GenerateRefreshToken(id uuid.UUID) (string, error)

GenerateRefreshToken generates a refresh token with longer expiration

func GenerateToken

func GenerateToken(id uuid.UUID) (string, error)

GenerateToken generates a JWT token for admin

func GenerateTokenWithExpiry

func GenerateTokenWithExpiry(id uuid.UUID, expiry time.Duration) (string, error)

GenerateTokenWithExpiry generates a JWT token with custom expiration time

func GetAccessTokenExpiry

func GetAccessTokenExpiry() time.Duration

GetAccessTokenExpiry returns the access token expiry duration

func GetSecret

func GetSecret() string

GetSecret returns the JWT secret for debugging/verification purposes WARNING: Only use this for debugging. Never expose in production responses.

func Init

func Init()

Init initializes JWT with secret from config

Types

type Claims

type Claims struct {
	UUID string `json:"uuid"`
	jwt.RegisteredClaims
}

Claims represents JWT claims

func ValidateToken

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

ValidateToken validates a JWT token and returns the claims

Jump to

Keyboard shortcuts

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