utils

package
v0.0.0-...-977c01d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSON = jsoniter.Config{
	EscapeHTML:                    true,
	MarshalFloatWith6Digits:       true,
	TagKey:                        "json",
	CaseSensitive:                 false,
	ObjectFieldMustBeSimpleString: false,
}.Froze()

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func GenerateJWT

func GenerateJWT(userID uuid.UUID, email string) (string, error)

GenerateJWT tạo JWT token

func HashPassword

func HashPassword(password string) (string, error)

Types

type Claims

type Claims struct {
	UserID uuid.UUID `json:"user_id"`
	Email  string    `json:"email"`
	jwt.RegisteredClaims
}

Claims cấu trúc payload của JWT

func ValidateJWT

func ValidateJWT(tokenString string) (*Claims, error)

ValidateJWT xác thực và giải mã JWT token

Jump to

Keyboard shortcuts

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