Skip to content

Instantly share code, notes, and snippets.

View sht0rmx's full-sized avatar
🎁
gift me a present, be lucky

Mihail Konstantinov sht0rmx

🎁
gift me a present, be lucky
View GitHub Profile
@Malith-Rukshan
Malith-Rukshan / validateInitData.py
Last active April 27, 2026 22:05
Validate Init data of Telegram Mini-App | TypeScript & Python
import hmac
def checkValidateInitData(hash_str, init_data, token, c_str="WebAppData"):
"""
Validates the data received from the Telegram web app, using the
method documented here:
https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
hash_str - the has string passed by the webapp
init_data - the query string passed by the webapp