type
PasswordPolicy
type PasswordPolicy struct {
// MinLength is the minimum password length in Unicode code points. Zero
// defaults to 8.
MinLength int
// MaxBytes is the maximum UTF-8 encoded password length. Zero defaults to 72,
// bcrypt's safe input limit.
MaxBytes int
// BcryptCost controls bcrypt work. Zero uses bcrypt.DefaultCost. Increasing
// it transparently upgrades older hashes after a successful login. Values
// above 16 are rejected because they can make startup and login impractical.
BcryptCost int
// Validate adds application-specific password rules. Return a user-safe error
// explaining how the candidate must change.
Validate func(password string) error
}Built-in local password validation and hashing policy.
Ridu deliberately uses length-based defaults rather than mandatory character classes. The custom validator runs only in trusted Go code and is never serialized.