leaguemanager.lib.security

Module Contents

Classes

Crypt

Cryptography utilities for password hashing and verification.

Data

settings

__all__

crypt

API

leaguemanager.lib.security.settings

‘get_settings(…)’

leaguemanager.lib.security.__all__

[‘Crypt’, ‘crypt’]

class leaguemanager.lib.security.Crypt

Cryptography utilities for password hashing and verification.

schemes: list[str]

‘field(…)’

crypt_context: passlib.context.CryptContext

‘field(…)’

__attrs_post_init__()

Post-initialization to set up the password hashing context.

generate_password(length: int = 16) str

Generate a random password.

Args: length (int): Length of the password to generate. Default is 16.

Returns: str: Randomly generated password.

get_encryption_key() bytes

Get encryption key.

Args: secret (str): Secret key used for encryption

Returns: bytes: a URL safe encoded version of secret

async get_password_hash(password: str | bytes) str

Get password hash.

Args: password: Plain password Returns: str: Hashed password

async verify_password(plain_password: str | bytes, hashed_password: str) bool

Verify Password.

Args: plain_password (str | bytes): The string or byte password hashed_password (str): the hash of the password

Returns: bool: True if password matches hash.

leaguemanager.lib.security.crypt

‘Crypt(…)’