utils

package
v0.0.0-...-99c9ccf Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SECRET_KEY string = os.Getenv("SECRET_KEY")
View Source
var SECRET_REFRESH_KEY string = os.Getenv("SECRET_REFRESH_KEY")

Functions

func GenerateAllTokens

func GenerateAllTokens(email, firstName, lastName, role, userId string) (string, string, error)

func GetAccessToken

func GetAccessToken(c *gin.Context) (string, error)

func GetRoleFromContext

func GetRoleFromContext(c *gin.Context) (string, error)

func GetUserIdFromContext

func GetUserIdFromContext(c *gin.Context) (string, error)

func UpdateAllTokens

func UpdateAllTokens(userId, token, refreshToken string, client *mongo.Client, c *gin.Context) (err error)

Types

type SignedDetails

type SignedDetails struct {
	Email     string
	FirstName string
	LastName  string
	Role      string
	UserId    string
	jwt.RegisteredClaims
}

func ValidateRefreshToken

func ValidateRefreshToken(tokenString string) (*SignedDetails, error)

func ValidateToken

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

Jump to

Keyboard shortcuts

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