Coverage for fastid / security / crypto.py: 100%
3 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
1import secrets
3from passlib.context import CryptContext
5from fastid.auth.config import auth_settings
7crypt_ctx = CryptContext(
8 schemes=auth_settings.hash_schemas,
9 default=auth_settings.hash_default,
10 argon2__time_cost=auth_settings.argon2_time_cost,
11 argon2__memory_cost=auth_settings.argon2_memory_cost,
12 argon2__parallelism=auth_settings.argon2_parallelism,
13 argon2__salt_len=auth_settings.argon2_salt_len,
14 argon2__hash_len=auth_settings.argon2_hash_len,
15)
18def generate_otp() -> str:
19 return str(secrets.choice(range(100_000, 1_000_000)))