catto.js 0.8.4 → 0.8.5
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 +8 -1
- package/package.json +1 -1
package/TelegramBot.js
CHANGED
|
@@ -114,8 +114,15 @@ module.exports = class extends EventEmitter {
|
|
|
114
114
|
return this;
|
|
115
115
|
}
|
|
116
116
|
parseInitData(qs) {
|
|
117
|
+
if (typeof qs !== "string") {
|
|
118
|
+
return !1;
|
|
119
|
+
}
|
|
117
120
|
var dcs = decodeURIComponent(qs).split("&").sort();
|
|
118
|
-
var hash = dcs.find(a => a.startsWith("hash="))
|
|
121
|
+
var hash = dcs.find(a => a.startsWith("hash="));
|
|
122
|
+
if (!hash) {
|
|
123
|
+
return !1;
|
|
124
|
+
}
|
|
125
|
+
hash = hash.split("=")[1];
|
|
119
126
|
dcs = dcs.filter(a => !a.startsWith("hash=")).join("\n");
|
|
120
127
|
var secretKey = crypto.createHmac("sha256", "WebAppData").update(this.options.token).digest();
|
|
121
128
|
var checkHash = crypto.createHmac("sha256", secretKey).update(dcs).digest("hex");
|