Documentation
¶
Overview ¶
Package password provides utilities to validate a password or list of passwords against a set of criteria
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTooShort is the error when a password doesn't meet the minimum password length requirement ErrTooShort = errors.New("Too Short") // ErrTooLong is the error when a password doesn't meet the maxumum password length requirement ErrTooLong = errors.New("Too Long") // ErrInvalidCharacters is the error when the password contains non-ASCII characters ErrInvalidCharacters = errors.New("Invalid Characters") // ErrCommon is the error when the password matches a string in the common password list ErrCommon = errors.New("Common Password") )
Functions ¶
This section is empty.
Types ¶
type CommonList ¶
type CommonList struct {
// contains filtered or unexported fields
}
CommonList holds a list of strings containing common passwords
func NewCommonList ¶
func NewCommonList(r io.Reader) (CommonList, error)
NewCommonList list returns a CommonList with a list of sorted strings from the contents of the supplied filename
func (*CommonList) Matches ¶
func (c *CommonList) Matches(input string) bool
Matches determines if the supplied string it a match to the list of common passwords
type Password ¶
type Password string
Password is a type alias for a string of password that needs to be validated
type Validator ¶
type Validator struct { AcceptASCIIOnly bool MaxCharacters int MinCharacters int // contains filtered or unexported fields }
Validator is a password validator with configurable settings
func NewValidator ¶
NewValidator returns a password validator based on the configuration values supplied
func (*Validator) AddCommonPasswords ¶
AddCommonPasswords constructs a CommonList from the supplied reader
func (*Validator) ValidatePassword ¶
ValidatePassword checks the Password based on the NIST password criteria