I've tried to do user verification script for telegram web app for bots. I have no idea how to fix it.
import sha256 from 'js-sha256'
const telegram = window.Telegram.WebApp
const bot_token = '<bot-token>'
const data_check_string = telegram.initData
var secret_key = sha256.hmac.create(bot_token).update("WebAppData")
var hash = sha256.hmac.create(data_check_string).update(secret_key).hex();
if ( hash == telegram.initDataUnsafe.hash) {
// data is from Telegram
}