Update files
This commit is contained in:
parent
7abadaf126
commit
7c379eb74d
|
|
@ -68,13 +68,12 @@ def validate_telegram_widget(auth_data: Dict[str, Any], bot_token: Optional[str]
|
||||||
print(f"[TelegramWidget] Data check string: {repr(data_check_string)}")
|
print(f"[TelegramWidget] Data check string: {repr(data_check_string)}")
|
||||||
|
|
||||||
# Create secret key
|
# Create secret key
|
||||||
secret_key = hmac.new(
|
# ВАЖНО: Для Login Widget используется SHA256(bot_token), а НЕ HMAC-SHA256('WebAppData', bot_token)
|
||||||
'WebAppData'.encode('utf-8'),
|
# Это отличается от WebApp initData!
|
||||||
token_to_use.encode('utf-8'),
|
secret_key = hashlib.sha256(token_to_use.encode('utf-8')).digest()
|
||||||
hashlib.sha256
|
|
||||||
).digest()
|
|
||||||
|
|
||||||
print(f"[TelegramWidget] Secret key (hex): {secret_key.hex()[:40]}...")
|
print(f"[TelegramWidget] Secret key (hex): {secret_key.hex()[:40]}...")
|
||||||
|
print(f"[TelegramWidget] Bot token для secret key: {token_to_use[:10]}...{token_to_use[-10:]}")
|
||||||
|
|
||||||
# Calculate hash
|
# Calculate hash
|
||||||
calculated_hash = hmac.new(
|
calculated_hash = hmac.new(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue