Documentation
¶
Index ¶
- Variables
- func HashArgon2id(password string) (string, error)
- func IsBcryptHash(hash string) bool
- func Validate(password string) error
- func ValidateHash(hash, algorithm string) error
- func VerifyArgon2id(encoded, password string) (bool, error)
- func VerifyBcrypt(hash, password string) (bool, error)
- type Params
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidHash = errors.New("invalid_password_hash")
ErrInvalidHash means a stored hash is malformed or outside the supported work policy. Callers may require a password reset; verification never runs its KDF.
Functions ¶
func HashArgon2id ¶
HashArgon2id returns a PHC-encoded string.
func IsBcryptHash ¶
IsBcryptHash detects common bcrypt PHC prefixes.
func Validate ¶
Validate applies the current password policy. Minimal policy: length >= 8 characters.
func ValidateHash ¶ added in v0.100.0
ValidateHash checks a supported hash without computing the password KDF. The algorithm must be explicit; imports normalize their source format.
func VerifyArgon2id ¶
VerifyArgon2id checks a password against a PHC-encoded hash.
func VerifyBcrypt ¶
VerifyBcrypt compares a bcrypt hash with a plaintext password.
Types ¶
Click to show internal directories.
Click to hide internal directories.