diff options
Diffstat (limited to 'mu4web/password.py')
-rwxr-xr-x | mu4web/password.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mu4web/password.py b/mu4web/password.py index 26bc712..1741fd1 100755 --- a/mu4web/password.py +++ b/mu4web/password.py @@ -15,6 +15,7 @@ from typing import ( def gen_salt(length: int = 10) -> str: + """Generate a random salt.""" # urandom is stated to be suitable for cryptographic use. return bytearray(os.urandom(length)).hex() @@ -27,6 +28,8 @@ hash_methods = { class PasswordEntry(TypedDict): + """A single entry in the password store.""" + hash: str salt: str # One of the keys of hash_methods @@ -37,10 +40,11 @@ class Passwords: """ Simple password store. - [Parameters] - fname - Path of json file to load and store from. + :param fname: + Path of json file to load and store from. """ - def __init__(self, fname: os.PathLike): + + def __init__(self, fname: os.PathLike[str]): self.fname = fname self.db: dict[str, PasswordEntry] try: @@ -90,6 +94,7 @@ class Passwords: def main() -> None: + """Entry point for directly interfacing with the password store.""" import argparse parser = argparse.ArgumentParser() |