Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidLength = errors.New("length must be greater than 0") ErrEmptyAlphabet = errors.New("alphabet must not be empty") )
View Source
var DefaultPasswordPolicy = PasswordPolicy{
MinLowercase: 2,
MinUppercase: 2,
MinNumeric: 2,
MinSpecial: 2,
MinLength: 12,
}
Functions ¶
func NewWithAlphabet ¶
NewWithAlphabet returns a securely generated random string using the provided alphabet.
func NewWithPolicy ¶
func NewWithPolicy(p PasswordPolicy) ([]byte, error)
NewWithPolicy generates a random password that satisfies the given PasswordPolicy.
Types ¶
type PasswordPolicy ¶
type PasswordPolicy struct {
MinLowercase int // MinLowercase is the minimum number of lowercase letters required.
MinUppercase int // MinUppercase is the minimum number of uppercase letters required.
MinNumeric int // MinDigits is the minimum number of numeric digits required.
MinSpecial int // MinSymbols is the minimum number of special symbols required.
MinLength int // MinLength is the minimum total length of the password.
}
Click to show internal directories.
Click to hide internal directories.