Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
func CreateToken[T any](data *T, sessionToken string, sessionInterval time.Duration) (string, error)
CreateToken creates a new signed jwt token with the user information saved in the claims.
func ValidateToken ¶
ValidateToken validates a given jwt token and returns the user from the claims or an error when the validation fails.
Types ¶
type CustomClaims ¶
type CustomClaims[T any] struct { Data *T `json:"data,omitempty"` goJWT.RegisteredClaims }
CustomClaims is the struct which defines the claims for our jwt tokens.
Click to show internal directories.
Click to hide internal directories.