Skip to content

Instantly share code, notes, and snippets.

View konstantin24121's full-sized avatar
🖖
кто к нам с чем зачем, тот от того и того

Konstantin konstantin24121

🖖
кто к нам с чем зачем, тот от того и того
View GitHub Profile
@konstantin24121
konstantin24121 / cloudSettings
Created February 25, 2019 16:00
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-02-25T16:00:03.584Z","extensionVersion":"v3.2.5"}
@konstantin24121
konstantin24121 / UserActions.ts
Created July 6, 2019 07:10
Пример с react-stores
export class UserActionsClass {
public async requestProfile(): void {
const result = await api.send('profile', 'user', {});
this.updateProfile();
}
private updateProfile(data) {
// convert data to userStore acceptable view
newProfile = ...
//
@konstantin24121
konstantin24121 / verifyTelegramWebAppData.tsx
Last active June 5, 2025 07:55
Telegram Bot 6.0 Validating data received via the Web App node implementation
const TELEGRAM_BOT_TOKEN = '110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw'; // https://core.telegram.org/bots#creating-a-new-bot
export const verifyTelegramWebAppData = async (telegramInitData: string): boolean => {
// The data is a query string, which is composed of a series of field-value pairs.
const encoded = decodeURIComponent(telegramInitData);
// HMAC-SHA-256 signature of the bot's token with the constant string WebAppData used as a key.
const secret = crypto