mk-pass¶
mk_pass.PasswordRequirements ¶
Bases: NamedTuple
A structure to describe password requirements.
validate ¶
validate() -> PasswordRequirements
Validates the instance's values.
This returns a mutated clone of the instance where the values satisfy "sane minimum requirements" suitable for any password.
The phrase "sane minimum requirements" implies
lengthis not less than 10- To avoid repetitions,
lengthis not more than- 52 if only letters (no decimal integers or special characters) are used
- 62 if only letters and decimal integers are used
- 68 if only letters and special characters are used
- 78 if letters, decimal integers, and special characters are used
- 65535 if repeated characters are allowed
specialscharacter count does not overrule the required number of- letters (2; 1 uppercase and 1 lowercase)
- decimal integers (if
decimalis specified as non-zero value)
decimalcharacter count does not overrule the required number of- letters (2; 1 uppercase and 1 lowercase)
- special characters (if
specialsis specified as non-zero value)
Note
If this function finds a conflict between the specified number of
specials characters and decimal, then decimal integers takes precedence.
For example:
>>> from comp_gen_pass import PasswordRequirements
>>> req = PasswordRequirements(length=16, specials=16, decimal=16)
>>> req
PasswordRequirements { length: 16, decimal: 16, specials: 16, first_is_letter: true }
>>> req.validate()
PasswordRequirements { length: 16, decimal: 13, specials: 1, first_is_letter: true }
mk_pass.generate_password ¶
generate_password(config: PasswordRequirements) -> str
Generate a password given the constraints specified by config.
This function will invoke
PasswordRequirements.validate()
to ensure basic password requirements are met.
mk_pass.main ¶
main() -> None
The function used as an entrypoint for the executable script.
This function takes no parameters because
they are parsed directly from sys.argv.