Skip to content

Instantly share code, notes, and snippets.

@MarvinMiles
MarvinMiles / check_authorization.js
Created February 10, 2022 13:58
Telegram user authentication in JavaScript via Web Crypto API (dependency-free)
async function validate(data, bot_token) {
const encoder = new TextEncoder()
const checkString = await Object.keys(data)
.filter((key) => key !== "hash")
.map((key) => `${key}=${data[key]}`)
.sort()
.join("\n")
//console.log('computed string:', checkString)