type
PasswordPolicy
Length, byte, bcrypt, and common-password policy for local credentials.
Properties
| Property | Type | Description |
|---|---|---|
MinLength | int | Minimum Unicode code-point length; zero defaults to 8. |
MaxBytes | int | Maximum UTF-8 byte length; zero defaults to bcrypt’s safe 72-byte limit. |
BcryptCost | int | bcrypt work factor; zero uses bcrypt.DefaultCost and values above 16 are rejected. |
Validate | func(password string) error | Adds an application-specific rule and should return a user-safe correction message. |
How it works
Ridu deliberately uses length-based defaults rather than mandatory character classes. The custom validator runs only in trusted Go code and is never serialized.