utils

package
v0.0.0-...-79faf1b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(user models.User) (string, error)

GenerateToken generates a JWT token for the provided user.

func GetToken

func GetToken(c *gin.Context) (*jwt.Token, error)

func HashPassword

func HashPassword(user *models.User) error

HashPassword hashes the user's password using bcrypt.

func ValidateToken

func ValidateToken(c *gin.Context) (jwt.MapClaims, error)

ValidateToken validates the JWT token provided in the request headers.

func VerifyPassword

func VerifyPassword(password, hashedPassword string) error

VerifyPassword compares a password with a hashed password.

Types

type NoToken

type NoToken struct{}

func (*NoToken) Error

func (m *NoToken) Error() string

Jump to

Keyboard shortcuts

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