Documentation
¶
Index ¶
- func ComparePassword(pass string, salt string, hash string) bool
- func CreateToken() (string, string)
- func GenerateHash(pass string, salt []byte) []byte
- func GenerateSalt(len int) []byte
- func ProcessPassword(pass string) (string, string)
- func TryBind(obj any, c *gin.Context) (error, gin.H)
- func ValidateToken(token string, hash string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePassword ¶
ComparePassword compares pass with salt and hash and returns true if it's valid You must provide the base64 encoded salt and hash to this function.
func CreateToken ¶
CreateToken creates a session-based auth token and sha256 hash of it and returns them The token and token hash are base64 encoded.
func GenerateHash ¶
GenerateHsh takes a password and salt byte array and returns a byte array containing an argon2 key
func GenerateSalt ¶
func ProcessPassword ¶
ProcessPassword returns the base64 encoded salt and base64 encoded argon2 hash or an error
func ValidateToken ¶
ValidateToken takes base64 encoded token and token hash and returns true if they are equal when the token is decoded and sha256'd.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.