catto.js 0.8.3 → 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/Server.js CHANGED
@@ -38,7 +38,8 @@ class Server extends EventEmitter {
38
38
  "cjs": !1,
39
39
  "proxies": 0,
40
40
  "bodyCompatible": !1,
41
- "secureCookie": !0
41
+ "secureCookie": !0,
42
+ "cookieAge": 31536e6
42
43
  }, options || {});
43
44
  this.app = express();
44
45
  if (this.options.ssl) {
@@ -70,7 +71,8 @@ class Server extends EventEmitter {
70
71
  "store": new FileStore(this.options.storeOptions),
71
72
  "secret": this.options.secret,
72
73
  "cookie": {
73
- "secure": this.options.secureCookie
74
+ "secure": this.options.secureCookie,
75
+ "maxAge": this.options.cookieAge
74
76
  },
75
77
  "resave": !0,
76
78
  "saveUninitialized": !0
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=")).split("=")[1];
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {