Documentation
¶
Overview ¶
Package validate holds the input checks and password hashing shared by the CSuit apps: email and username format, password strength rules, and a bcrypt wrapper that limits how many hashes run at once.
Index ¶
- Constants
- func BurnPasswordCheck(password string)
- func CheckPasswordHash(password, hash string) bool
- func HashPassword(password string) (string, error)
- func IsSpecialChar(r rune) bool
- func IsValidEmail(email string) bool
- func IsValidUsername(username string) bool
- func PasswordStrengthErrors(password string) []string
- func PasswordsMatch(p1, p2 string) bool
Constants ¶
const BcryptCost = 12
Variables ¶
This section is empty.
Functions ¶
func BurnPasswordCheck ¶ added in v1.2.1
func BurnPasswordCheck(password string)
BurnPasswordCheck spends the same time as a real password check. Call it when the account does not exist so login timing does not reveal which emails are registered.
func CheckPasswordHash ¶
CheckPasswordHash compares a plain password with a bcrypt hash, queued the same way as HashPassword.
func HashPassword ¶
HashPassword returns a bcrypt hash. At most two hashes run at once; further callers queue instead of starving the machine.
func IsSpecialChar ¶
func IsValidEmail ¶
func IsValidUsername ¶
IsValidUsername allows letters, numbers, underscores and hyphens.
func PasswordStrengthErrors ¶
PasswordStrengthErrors returns the i18n keys of the unmet requirements.
func PasswordsMatch ¶
Types ¶
This section is empty.