wingbot-mongodb 3.2.5-test.1 → 3.2.6-alpha.1
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/.nyc_output/1091dc07-773b-48f1-9817-b8048f05d575.json +1 -0
- package/.nyc_output/processinfo/{fb200475-7184-4caf-a314-c2fe4216d1dc.json → 1091dc07-773b-48f1-9817-b8048f05d575.json} +1 -1
- package/.nyc_output/processinfo/index.json +1 -1
- package/package.json +1 -1
- package/src/BaseStorage.js +12 -5
- package/src/ChatLogStorage.js +0 -1
- package/.nyc_output/fb200475-7184-4caf-a314-c2fe4216d1dc.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"parent":null,"pid":
|
|
1
|
+
{"parent":null,"pid":38479,"argv":["/usr/local/bin/node","/Users/david/Development/wingbot-mongodb/node_modules/.bin/mocha","./test"],"execArgv":[],"cwd":"/Users/david/Development/wingbot-mongodb","time":1692102034748,"ppid":38478,"coverageFilename":"/Users/david/Development/wingbot-mongodb/.nyc_output/1091dc07-773b-48f1-9817-b8048f05d575.json","externalId":"","uuid":"1091dc07-773b-48f1-9817-b8048f05d575","files":["/Users/david/Development/wingbot-mongodb/src/BaseStorage.js","/Users/david/Development/wingbot-mongodb/src/defaultLogger.js","/Users/david/Development/wingbot-mongodb/src/AttachmentCache.js","/Users/david/Development/wingbot-mongodb/src/AuditLogStorage.js","/Users/david/Development/wingbot-mongodb/src/BotConfigStorage.js","/Users/david/Development/wingbot-mongodb/src/BotTokenStorage.js","/Users/david/Development/wingbot-mongodb/src/tokenFactory.js","/Users/david/Development/wingbot-mongodb/src/ChatLogStorage.js","/Users/david/Development/wingbot-mongodb/src/NotificationsStorage.js","/Users/david/Development/wingbot-mongodb/src/StateStorage.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"1091dc07-773b-48f1-9817-b8048f05d575":{"parent":null,"children":[]}},"files":{"/Users/david/Development/wingbot-mongodb/src/BaseStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/defaultLogger.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/AttachmentCache.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/AuditLogStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/BotConfigStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/BotTokenStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/tokenFactory.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/ChatLogStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/NotificationsStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"],"/Users/david/Development/wingbot-mongodb/src/StateStorage.js":["1091dc07-773b-48f1-9817-b8048f05d575"]},"externalIds":{}}
|
package/package.json
CHANGED
package/src/BaseStorage.js
CHANGED
|
@@ -31,6 +31,17 @@ function getNestedObjects (obj, nested, attr = null, ret = {}) {
|
|
|
31
31
|
return ret;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @template T
|
|
37
|
+
* @param {string} k
|
|
38
|
+
* @param {T} v
|
|
39
|
+
* @returns {T|null}
|
|
40
|
+
*/
|
|
41
|
+
function signReplacer (k, v) {
|
|
42
|
+
return v === undefined ? null : v;
|
|
43
|
+
}
|
|
44
|
+
|
|
34
45
|
class BaseStorage {
|
|
35
46
|
|
|
36
47
|
static netFailuresIntervalMs = 600000; // 10 minutes
|
|
@@ -371,10 +382,6 @@ class BaseStorage {
|
|
|
371
382
|
const objToSign = this._objectToSign(object);
|
|
372
383
|
const sign = this._signWithSecret(objToSign, secret);
|
|
373
384
|
|
|
374
|
-
if (this.logSig) {
|
|
375
|
-
this._log.log(`sign ${this._collectionName}`, JSON.stringify(objToSign, null, 2));
|
|
376
|
-
}
|
|
377
|
-
|
|
378
385
|
return Object.assign(objToSign, {
|
|
379
386
|
sign
|
|
380
387
|
});
|
|
@@ -413,7 +420,7 @@ class BaseStorage {
|
|
|
413
420
|
*/
|
|
414
421
|
_signWithSecret (objToSign, secret, previous = null) {
|
|
415
422
|
const h = crypto.createHmac('sha3-224', secret)
|
|
416
|
-
.update(JSON.stringify(objToSign));
|
|
423
|
+
.update(JSON.stringify(objToSign, signReplacer));
|
|
417
424
|
|
|
418
425
|
if (previous) {
|
|
419
426
|
h.update(previous);
|
package/src/ChatLogStorage.js
CHANGED
|
@@ -114,7 +114,6 @@ class ChatLogStorage extends BaseStorage {
|
|
|
114
114
|
const compare = this._signWithSecret(objToSign, secret);
|
|
115
115
|
const ok = compare === sign;
|
|
116
116
|
if (!ok) {
|
|
117
|
-
this._log.log(`compare ${this._collectionName}`, JSON.stringify(objToSign, null, 2));
|
|
118
117
|
this._log.error(`ChatLog: found wrong signature at pageId: "${r.pageId}", senderId: "${r.senderId}", at: ${r.timestamp}`, r);
|
|
119
118
|
}
|
|
120
119
|
|