Documentation
¶
Index ¶
Constants ¶
View Source
const ( MinWordsInDictionary = 256 NumWordsMin = 2 NumWordsMax = 32 )
Variables ¶
View Source
var ( ErrDictionaryTooSmall = errors.New(fmt.Sprintf("dictionary cannot have less than %d words after word-length restrictions are applied", MinWordsInDictionary)) ErrNumWordsTooSmall = errors.New(fmt.Sprintf("number of words cannot be less than %d", NumWordsMin)) ErrNumWordsTooLarge = errors.New(fmt.Sprintf("number of words cannot be more than %d", NumWordsMax)) ErrWordLengthInvalid = errors.New("word-length rule invalid") )
Functions ¶
func Generate ¶ added in v0.0.7
func Generate() string
Generate generates and returns a passphrase that follows the following rules: * uses an English Dictionary * uses capitalized words * uses a total of 3 words * injects a random number behind one of the words * uses "-" as the separator * ensures words used are between 4 and 7 characters long
Types ¶
type Generator ¶
type Generator interface { // Generate returns a randomly generated password. Generate() string // SetSeed overrides the seed value for the RNG. SetSeed(seed uint64) }
func NewGenerator ¶
NewGenerator returns a password generator that implements the Generator interface.
type Rule ¶
type Rule func(g *generator)
Rule controls how the Generator/Sequencer generates passwords.
func WithCapitalizedWords ¶
WithCapitalizedWords ensures the words are Capitalized.
func WithDictionary ¶
func WithNumWords ¶
WithNumWords sets the number of words in the passphrase.
func WithNumber ¶
WithNumber injects a random number after one of the words in the passphrase.
func WithSeparator ¶
WithSeparator sets up the delimiter to separate words.
func WithWordLength ¶
Click to show internal directories.
Click to hide internal directories.