@wireapp/core 46.34.4 → 46.34.6
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/lib/Account.js +3 -3
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +0 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +1 -3
- package/package.json +4 -4
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +0 -4
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +0 -69
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +0 -2
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.js +0 -35
package/lib/Account.js
CHANGED
|
@@ -526,7 +526,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
526
526
|
* forwarding the event to the consumer via the `onEvent` callback.
|
|
527
527
|
*/
|
|
528
528
|
createEventHandler = (onEvent) => {
|
|
529
|
-
return
|
|
529
|
+
return (payload, source) => {
|
|
530
530
|
const { event } = payload;
|
|
531
531
|
switch (event?.type) {
|
|
532
532
|
case event_1.CONVERSATION_EVENT.MESSAGE_TIMER_UPDATE: {
|
|
@@ -563,7 +563,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
563
563
|
}
|
|
564
564
|
const messages = this.service.notification.handleNotification(notification, source, dryRun);
|
|
565
565
|
for await (const message of messages) {
|
|
566
|
-
|
|
566
|
+
handleEvent(message, source);
|
|
567
567
|
}
|
|
568
568
|
this.logger.info(`Finished processing legacy notification "${notification.id}" in ${Date.now() - start}ms`);
|
|
569
569
|
}
|
|
@@ -639,7 +639,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
639
639
|
this.apiClient.transport.ws.acknowledgeNotification(notification);
|
|
640
640
|
}
|
|
641
641
|
for await (const payload of payloads ?? []) {
|
|
642
|
-
|
|
642
|
+
handleEvent(payload, source);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAC7G,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAuB,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,WAAW,EAGX,cAAc,EACd,UAAU,EAEV,gBAAgB,EAKjB,MAAM,sBA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iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAc9F;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,gBAAgB,EAC/B,mBAAmB,EAAE,2BAA2B,GAC/C,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
|
@@ -31,7 +31,6 @@ const TaskScheduler_1 = require("../../../util/TaskScheduler");
|
|
|
31
31
|
const E2EIServiceInternal_1 = require("../E2EIdentityService/E2EIServiceInternal");
|
|
32
32
|
const Helper_1 = require("../E2EIdentityService/Helper");
|
|
33
33
|
const events_1 = require("../EventHandler/events");
|
|
34
|
-
const messageAdd_1 = require("../EventHandler/events/messageAdd");
|
|
35
34
|
const MLSId_1 = require("../utils/MLSId");
|
|
36
35
|
//@todo: this function is temporary, we wait for the update from core-crypto side
|
|
37
36
|
//they are returning regular array instead of Uint8Array for commit and welcome messages
|
|
@@ -621,7 +620,6 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
621
620
|
return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
|
|
622
621
|
}
|
|
623
622
|
async wipeConversation(groupId) {
|
|
624
|
-
(0, messageAdd_1.deleteMLSMessagesQueue)(groupId);
|
|
625
623
|
await this.cancelKeyMaterialRenewal(groupId);
|
|
626
624
|
await this.cancelPendingProposalsTask(groupId);
|
|
627
625
|
const doesConversationExist = await this.conversationExists(groupId);
|
|
@@ -725,7 +723,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
725
723
|
if (!groupId) {
|
|
726
724
|
throw new Error(`Could not find a group_id for conversation ${qualifiedConversationId.id}@${qualifiedConversationId.domain}${event.subconv ? `/subconversation:${event.subconv}` : ''}`);
|
|
727
725
|
}
|
|
728
|
-
return (0,
|
|
726
|
+
return (0, events_1.handleMLSMessageAdd)({ event, mlsService: this, groupId });
|
|
729
727
|
}
|
|
730
728
|
async handleMLSWelcomeMessageEvent(event, clientId) {
|
|
731
729
|
// Every time we've received a welcome message, it means that our key package was consumed,
|
package/package.json
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^27.75.
|
|
14
|
+
"@wireapp/api-client": "^27.75.5",
|
|
15
15
|
"@wireapp/commons": "^5.4.4",
|
|
16
16
|
"@wireapp/core-crypto": "7.0.2",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/priority-queue": "^2.1.11",
|
|
19
|
-
"@wireapp/promise-queue": "^2.4.
|
|
19
|
+
"@wireapp/promise-queue": "^2.4.4",
|
|
20
20
|
"@wireapp/protocol-messaging": "1.53.0",
|
|
21
21
|
"@wireapp/store-engine": "^5.1.11",
|
|
22
22
|
"axios": "1.11.0",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "46.34.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "46.34.6",
|
|
65
|
+
"gitHead": "660e56ed4f903fceee5279bd6c525ea286111ce4"
|
|
66
66
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const queueIncomingMLSMessage: <EventHandler extends (...args: any[]) => any>(groupId: string, handler: EventHandler) => Promise<ReturnType<EventHandler>>;
|
|
2
|
-
export declare const deleteMLSMessagesQueue: (groupId: string) => void;
|
|
3
|
-
export declare const withLockedMLSMessagesQueue: <T>(groupId: string, fn: () => Promise<T>) => Promise<T>;
|
|
4
|
-
//# sourceMappingURL=IncomingMesssagesQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IncomingMesssagesQueue.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,uBAAuB,GAAU,YAAY,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,WAC/E,MAAM,WACN,YAAY,KACpB,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAGlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,SAErD,CAAC;AAcF,eAAO,MAAM,0BAA0B,GAAU,CAAC,WAAW,MAAM,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAUpG,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.withLockedMLSMessagesQueue = exports.deleteMLSMessagesQueue = exports.queueIncomingMLSMessage = void 0;
|
|
22
|
-
const commons_1 = require("@wireapp/commons");
|
|
23
|
-
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
24
|
-
const logger = commons_1.LogFactory.getLogger('@wireapp/core/MLSService/IncomingMessagesQueue');
|
|
25
|
-
// (groupId string -> queue) map
|
|
26
|
-
const queues = new Map();
|
|
27
|
-
const getQueue = (groupId) => {
|
|
28
|
-
const queue = queues.get(groupId);
|
|
29
|
-
if (queue) {
|
|
30
|
-
return queue;
|
|
31
|
-
}
|
|
32
|
-
const newConversationQueue = new promise_queue_1.PromiseQueue({
|
|
33
|
-
name: `mls-messages-queue-${groupId}`,
|
|
34
|
-
});
|
|
35
|
-
queues.set(groupId, newConversationQueue);
|
|
36
|
-
return newConversationQueue;
|
|
37
|
-
};
|
|
38
|
-
const queueIncomingMLSMessage = async (groupId, handler) => {
|
|
39
|
-
const conversationQueue = getQueue(groupId);
|
|
40
|
-
return conversationQueue.push(handler);
|
|
41
|
-
};
|
|
42
|
-
exports.queueIncomingMLSMessage = queueIncomingMLSMessage;
|
|
43
|
-
const deleteMLSMessagesQueue = (groupId) => {
|
|
44
|
-
queues.delete(groupId);
|
|
45
|
-
};
|
|
46
|
-
exports.deleteMLSMessagesQueue = deleteMLSMessagesQueue;
|
|
47
|
-
const lockMLSMessagesQueue = (groupId) => {
|
|
48
|
-
logger.info(`Locking incoming MLS messages queue for group ${groupId}`);
|
|
49
|
-
const conversationQueue = getQueue(groupId);
|
|
50
|
-
conversationQueue.pause();
|
|
51
|
-
};
|
|
52
|
-
const unlockMLSMessagesQueue = (groupId) => {
|
|
53
|
-
logger.info(`Unlocking incoming MLS messages queue for group ${groupId}`);
|
|
54
|
-
const conversationQueue = getQueue(groupId);
|
|
55
|
-
conversationQueue.resume();
|
|
56
|
-
};
|
|
57
|
-
const withLockedMLSMessagesQueue = async (groupId, fn) => {
|
|
58
|
-
lockMLSMessagesQueue(groupId);
|
|
59
|
-
try {
|
|
60
|
-
const result = await fn();
|
|
61
|
-
unlockMLSMessagesQueue(groupId);
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
unlockMLSMessagesQueue(groupId);
|
|
66
|
-
throw error;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
exports.withLockedMLSMessagesQueue = withLockedMLSMessagesQueue;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.ts"],"names":[],"mappings":"AAmBA,cAAc,0BAA0B,CAAC"}
|
package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2023 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(o, k2, desc);
|
|
27
|
-
}) : (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
o[k2] = m[k];
|
|
30
|
-
}));
|
|
31
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
__exportStar(require("./IncomingMesssagesQueue"), exports);
|