veritas.auth

this module encrypts and decrypts passwords

This module is used to store passwords in encrypted form in the profile.

Package Contents

Functions

encrypt(→ str)

encrypt password

decrypt(→ str | None)

decrypt token

veritas.auth.encrypt(password: str, encryption_key: str, salt: str, iterations: int = 400000) str

encrypt password

Parameters:
  • password (str) – clear password

  • encryption_key (str) – encryption key

  • salt (str) – salt

  • iterations (int, optional) – iterations, by default 400000

Returns:

encrypted – base64 encoded and encrypted password

Return type:

str

veritas.auth.decrypt(token: str, encryption_key: str, salt: str, iterations: int = 400000) str | None

decrypt token

Parameters:
  • token (str) – token (base64 encrypted password)

  • encryption_key (str) – encryption key

  • salt (str) – salt

  • iterations (int, optional) – iterations, by default 400000

Returns:

password – clear password

Return type:

str