helper

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpDbError

func HttpDbError(err error, msg string) error

func IssueTokens

func IssueTokens(userID int64, secret string) (access, refresh string, err error)

func RandomToken

func RandomToken(n int) (string, error)

RandomToken generates a random string of a fixed length using crypto/rand

func RequireTokenType

func RequireTokenType(expect string, audience ...string) fiber.Handler

Types

type Claims

type Claims struct {
	UserID    int64  `json:"user_id"`
	TokenType string `json:"typ"` // "access" or "refresh"
	jwt.RegisteredClaims
}

type JWTUser

type JWTUser struct {
	Id int64
}

func GetUser

func GetUser(c *fiber.Ctx) (*JWTUser, error)

func GetUserFromToken

func GetUserFromToken(token *jwt.Token) (*JWTUser, error)

Jump to

Keyboard shortcuts

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