auth

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(userID uint) (string, error)

GenerateToken creates a signed JWT for the given user ID. Reads JWT_SECRET and JWT_EXPIRY (seconds) from environment.

func GenerateTokenFromString added in v2.6.0

func GenerateTokenFromString(userID string) (string, error)

GenerateTokenFromString creates a signed JWT for the given user ID string. Use this for UUID or other string-based primary keys. Reads JWT_SECRET and JWT_EXPIRY (seconds) from environment.

func ValidateToken

func ValidateToken(tokenStr string) (jwt.MapClaims, error)

ValidateToken parses and validates a JWT string. Returns the claims if the token is valid. Note: user_id claim is float64 (from GenerateToken) or string (from GenerateTokenFromString).

Types

This section is empty.

Jump to

Keyboard shortcuts

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