lib

package
v0.0.0-...-32fa971 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUsernameExists              bizError = "Username has been used"
	ErrUsernameOrPasswordIncorrect bizError = "Incorrect username or password"
	ErrUserNotFound                bizError = "user not found"
)

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func Decrypt

func Decrypt(encryptedKey []byte) ([]byte, error)

Decrypt will return the original value of the encrypted string

func Encrypt

func Encrypt(key []byte) ([]byte, error)

Encrypt will encrypt a raw string to an encrypted value an encrypted value has an IV (nonce) + actual encrypted value when we decrypt, we only decrypt the latter part

func HashPassword

func HashPassword(password string) (string, error)

func JwtToken

func JwtToken(jwtSecret string, claim jwt.MapClaims) (string, error)

func NewRandomKey

func NewRandomKey() []byte

NewRandomKey will generate a 32 bytes random string

Types

This section is empty.

Jump to

Keyboard shortcuts

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