catto.js 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TelegramBot.js +1 -1
- package/package.json +1 -1
package/TelegramBot.js
CHANGED
|
@@ -117,7 +117,7 @@ module.exports = class extends EventEmitter {
|
|
|
117
117
|
var dcs = decodeURIComponent(qs).split("&").sort();
|
|
118
118
|
var hash = dcs.find(a => a.startsWith("hash=")).split("=")[1];
|
|
119
119
|
dcs = dcs.filter(a => !a.startsWith("hash=")).join("\n");
|
|
120
|
-
var secretKey = crypto.createHmac("sha256", "WebAppData").update(
|
|
120
|
+
var secretKey = crypto.createHmac("sha256", "WebAppData").update(this.options.token).digest();
|
|
121
121
|
var checkHash = crypto.createHmac("sha256", secretKey).update(dcs).digest("hex");
|
|
122
122
|
return (checkHash === hash ? new TelegramUser(JSON.parse(dcs.split("\n").find(a => a.startsWith("user=")).split("=")[1]), this) : null);
|
|
123
123
|
}
|