Skip to content

Instantly share code, notes, and snippets.

View Antiokh's full-sized avatar
:electron:
You know, I'm something of a scientist

Anton Nazarov Antiokh

:electron:
You know, I'm something of a scientist
View GitHub Profile
@Antiokh
Antiokh / supabase_api_auth.sql
Created April 13, 2025 21:35 — forked from FelixZY/supabase_api_auth.sql
How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
-- Token Based API Access for Supabase
--
-- How to configure Supabase (https://supabase.com/) to generate and accept API tokens.
--
-- (c) 2022 Felix Zedén Yverås
-- Provided under the MIT license (https://spdx.org/licenses/MIT.html)
--
-- Disclaimer: This file is formatted using pg_format. I'm not happy with the result but
-- prefer to follow a tool over going by personal taste.
--
@Antiokh
Antiokh / telegram_web_app_bot_validate_hash.js
Created April 22, 2025 02:36 — forked from MakStashkevich/telegram_web_app_bot_validate_hash.js
Telegram Web App Bot (Validate hash function) on Javascript (JS or NodeJs)
// Bot token
const bot_token = '0123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
// https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app
function isValidHash() {
// Parse query data
const parsedData = Telegram.Utils.urlParseQueryString(Telegram.WebApp.initData)
// Get Telegram hash
const hash = parsedData.hash
@Antiokh
Antiokh / validateInitData.py
Created April 22, 2025 02:36 — forked from Malith-Rukshan/validateInitData.py
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