- Improved formatting and readability in config.py and other files by adding line breaks. - Introduced INIT_DATA_MAX_AGE_SECONDS to enforce replay protection for Telegram initData. - Updated validate_init_data function to include max_age_seconds parameter for validation. - Enhanced API to reject old initData based on the new max_age_seconds setting. - Added tests for auth_date expiry and validation of initData in test_telegram_auth.py. - Updated README with details on the new INIT_DATA_MAX_AGE_SECONDS configuration.
8 lines
251 B
Python
8 lines
251 B
Python
"""Pytest configuration. Set BOT_TOKEN so config module can be imported."""
|
|
|
|
import os
|
|
|
|
# Set before any project code imports config (which requires BOT_TOKEN).
|
|
if not os.environ.get("BOT_TOKEN"):
|
|
os.environ["BOT_TOKEN"] = "test-token-for-pytest"
|