auth

package
v0.0.0-...-c387957 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SecretKey = utils.GetJwtKey()
)

secret key being used to sign tokens

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

CheckPassword hash compares raw password with it's hashed values

func GenerateRandHexString

func GenerateRandHexString() (string, error)

Generate random 32-byte hex string

func GenerateToken

func GenerateToken(email string, nowFunc func() time.Time) (string, error)

GenerateToken generates a jwt token and assign a email to it's claims and return it

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes given password

func ParseToken

func ParseToken(tokenStr string) (string, error)

ParseToken parses a jwt token and returns the email in it's claims

Types

This section is empty.

Jump to

Keyboard shortcuts

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