A multipurpose python flask API server and administration SPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
382 B

  1. """Authentication specific utilities."""
  2. from typing import Tuple
  3. from nacl import pwhash
  4. def get_password_hash(password: str) -> Tuple[str, int]:
  5. """
  6. Retrieve argon2id password hash.
  7. :param password: plaintext password to convert
  8. :return: Tuple[password_hash, password_revision]
  9. """
  10. return pwhash.argon2id.str(password.encode('utf8')).decode('utf8'), 1