Spaces:
Build error
Build error
| # config.py | |
| import os | |
| from dataclasses import dataclass | |
| from datetime import timedelta | |
| from typing import Optional | |
| from cryptography.fernet import Fernet | |
| from services import EmailService, CryptoService, MonitoringService | |
| CREATOR_INFO = { | |
| "name": "MUHAMMAD SHAHEER", | |
| "version": "1.0.0", | |
| "contact": "shaheerawan001@proton.me" | |
| } | |
| class SecurityConfig: | |
| JWT_SECRET: str = os.getenv("JWT_SECRET", Fernet.generate_key().decode()) | |
| PASSWORD_MIN_LENGTH: int = 12 | |
| MAX_LOGIN_ATTEMPTS: int = 3 | |
| LOCKOUT_DURATION: int = 15 # minutes | |
| SESSION_TIMEOUT: int = 30 # minutes | |
| ENCRYPTION_KEY: str = os.getenv("ENCRYPTION_KEY", Fernet.generate_key().decode()) | |
| MFA_ISSUER: str = "Digital Heir System" | |
| class AppState: | |
| security: SecurityConfig | |
| email_service: EmailService | |
| crypto_service: CryptoService | |
| monitoring: MonitoringService | |
| def init_app() -> AppState: | |
| security_config = SecurityConfig() | |
| email_service = EmailService() | |
| crypto_service = CryptoService(security_config.ENCRYPTION_KEY) | |
| monitoring_service = MonitoringService() | |
| return AppState( | |
| security=security_config, | |
| email_service=email_service, | |
| crypto_service=crypto_service, | |
| monitoring=monitoring_service | |
| ) | |