encryption

package
v0.0.0-...-3dea1f4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHash         = errors.New("the encoded hash is not in the correct format")
	ErrIncompatibleVersion = errors.New("incompatible version of argon2")
)

Functions

func Base64Decode

func Base64Decode(encodedData string) (string, error)

func Base64Encode

func Base64Encode(data string) string

func ComparePasswordAndHash

func ComparePasswordAndHash(password, encodedHash string) (match bool, err error)

Check if the password is match the hashed password

func DecryptStructFields

func DecryptStructFields(data interface{}) error

func EncryptStructFields

func EncryptStructFields(data interface{}) error

func GenerateNewJwtToken

func GenerateNewJwtToken(id uint64, credentials []string, expiresAt time.Time) (string, error)

Generate new jwt token with credentials

func GenerateRandomBase64String

func GenerateRandomBase64String() (string, error)

Generate 32 long random base64 string

func HashPassword

func HashPassword(password string) (string, error)

Hash passsword with argon2i

func RandStringRunes

func RandStringRunes(n int) (string, error)

Generate random string this can provide 88^n possible

Types

This section is empty.

Jump to

Keyboard shortcuts

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