Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoAvailableRunes = errors.New("no runes are available for password-generation")
ErrNoAvailableRunes is used if the number of runes that can be randomly selected when generating passwords is zero.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is used to generate passwords, by calling the appropriate method on it. The New function is used to create a pointer to a Data struct.
func New ¶
New returns a pointer to a Data struct that is used only to generate passwords. An options argument determines exactly how the passwords should be generated.
func (*Data) AvailableRunes ¶ added in v1.1.0
AvailableRunes returns a freshly allocated slice containing all of the runes that can be randomly selected when generating passwords. These runes are determined by the options contained in the Data struct.
func (*Data) AvailableRunesCount ¶ added in v1.1.0
AvailableRunesCount returns the number of runes that can be randomly selected when generating passwords. These runes are determined by the options contained in the Data struct. If the number of runes is zero, no passwords can be successfully generated.
func (*Data) Generate ¶
Generate creates a single password made up of random runes. The password will conform to the options contained in the Data struct. An error is also returned from Generate, which will be non-nil if the random-number generator is not working, meaning that a password cannot be succesfully generated, or if the options in the Data struct determine that there are no available runes to be randomly selected when generating passwords.
func (*Data) GenerateMany ¶
GenerateMany creates many passwords made up of random runes. The function's single argument will determine exactly how many passwords are generated. Any passwords will conform to the options contained in the Data struct. An error is also returned from GenerateMany, which will be non-nil if the random-number generator is not working, meaning that one of the passwords cannot be succesfully generated, or if the options in the Data struct determine that there are no available runes to be randomly selected when generating passwords.
type Options ¶
type Options struct { Len int IncludeUpperCaseLetters bool IncludeLowerCaseLetters bool IncludeDigits bool ExcludeAmbiguousRunes bool IncludeRunesList []rune ExcludeRunesList []rune }
Options is passed to the New function to determine exactly how any passwords should be generated by the Data struct. The Len field determines the length of any passwords that are generated, while the other fields determine which runes are available to be chosen at random when generating passwords.