@wireapp/core 43.2.0 → 43.3.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.
Files changed (22) hide show
  1. package/lib/conversation/ConversationService/ConversationService.d.ts +0 -7
  2. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  3. package/lib/conversation/ConversationService/ConversationService.js +0 -24
  4. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  5. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +4 -1
  6. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +4 -0
  7. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -0
  8. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +72 -0
  9. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +2 -0
  10. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts.map +1 -0
  11. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.js +35 -0
  12. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +1 -0
  13. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
  14. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +1 -0
  15. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +2 -4
  16. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  17. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +1 -8
  18. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +3 -11
  19. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +1 -2
  20. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  21. package/lib/messagingProtocols/mls/MLSService/MLSService.js +47 -39
  22. package/package.json +7 -7
@@ -98,13 +98,6 @@ export declare class ConversationService extends TypedEventEmitter<Events> {
98
98
  addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSCreateConversationResponse>;
99
99
  removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSCreateConversationResponse>;
100
100
  joinByExternalCommit(conversationId: QualifiedId): Promise<PostMlsMessageResponse>;
101
- /**
102
- * Will send an external proposal for the current device to join a specific conversation.
103
- * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
104
- * @param groupId The conversation to join
105
- * @param epoch The current epoch of the local conversation
106
- */
107
- sendExternalJoinProposal(groupId: string, epoch: number): Promise<void>;
108
101
  /**
109
102
  * Will check if mls group exists locally.
110
103
  * @param groupId groupId of the conversation
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,EAEL,cAAc,EAEd,6BAA6B,EAC7B,oBAAoB,EACpB,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AAO,EACP,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,WAAW,CAAC;QACxB,cAAc,EAAE,WAAW,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BH,wBAAwB;YAoBxB,uCAAuC;YAYvC,4BAA4B;YAI5B,wBAAwB;YAIxB,yBAAyB;IAKvC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoB3E"}
1
+ {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EACnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAEL,cAAc,EAEd,6BAA6B,EAC7B,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAkC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjG,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sEAAsE,C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AG,OAAO,CAAC,kBAAkB,CAAC;CAoB3E"}
@@ -29,12 +29,10 @@ const http_1 = require("@wireapp/api-client/lib/http");
29
29
  const bazinga64_1 = require("bazinga64");
30
30
  const logdown_1 = __importDefault(require("logdown"));
31
31
  const commons_1 = require("@wireapp/commons");
32
- const core_crypto_1 = require("@wireapp/core-crypto");
33
32
  const protocol_messaging_1 = require("@wireapp/protocol-messaging");
34
33
  const ConversationService_types_1 = require("./ConversationService.types");
35
34
  const conversation_2 = require("../../conversation/");
36
35
  const AssetCryptography_1 = require("../../cryptography/AssetCryptography");
37
- const mls_1 = require("../../messagingProtocols/mls");
38
36
  const CoreCryptoMLSError_1 = require("../../messagingProtocols/mls/MLSService/CoreCryptoMLSError");
39
37
  const proteus_1 = require("../../messagingProtocols/proteus");
40
38
  const util_1 = require("../../util");
@@ -335,28 +333,6 @@ class ConversationService extends commons_1.TypedEventEmitter {
335
333
  async joinByExternalCommit(conversationId) {
336
334
  return this.mlsService.joinByExternalCommit(() => this.apiClient.api.conversation.getGroupInfo(conversationId));
337
335
  }
338
- /**
339
- * Will send an external proposal for the current device to join a specific conversation.
340
- * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
341
- * @param groupId The conversation to join
342
- * @param epoch The current epoch of the local conversation
343
- */
344
- async sendExternalJoinProposal(groupId, epoch) {
345
- return (0, messageSender_1.sendMessage)(async () => {
346
- const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
347
- const externalProposal = await this.mlsService.newExternalProposal(core_crypto_1.ExternalProposalType.Add, {
348
- epoch,
349
- conversationId: groupIdBytes,
350
- ciphersuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
351
- credentialType: core_crypto_1.CredentialType.Basic,
352
- });
353
- await this.apiClient.api.conversation.postMlsMessage(
354
- //@todo: it's temporary - we wait for core-crypto fix to return the actual Uint8Array instead of regular array
355
- (0, mls_1.optionalToUint8Array)(externalProposal));
356
- //We store the info when user was added (and key material was created), so we will know when to renew it
357
- await this.mlsService.resetKeyMaterialRenewal(groupId);
358
- });
359
- }
360
336
  /**
361
337
  * Will check if mls group exists locally.
362
338
  * @param groupId groupId of the conversation
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAKhH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAG/G,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAJhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;gBAG3D,gBAAgB,EAAE,UAAU,EAC5B,aAAa,EAAE,aAAa;IAIxC,oBAAoB,IAAI,OAAO;IAK/B,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAUxC,sBAAsB,IAAI,OAAO;IAIjC,gBAAgB,IAAI,IAAI;IAIxB,oBAAoB,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhF,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IA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AM,EAAE,cAAc,EAAE,CAAC,CAAC;IA6CnG,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAef,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;CAOtD"}
@@ -91,7 +91,10 @@ class E2EIServiceExternal {
91
91
  }
92
92
  async isFreshMLSSelfClient() {
93
93
  const client = await this.clientService.loadClient();
94
- return !!client && typeof client.mls_public_keys.ed25519 === 'string' && client.mls_public_keys.ed25519.length > 0;
94
+ if (!client) {
95
+ return true;
96
+ }
97
+ return typeof client.mls_public_keys.ed25519 !== 'string' || client.mls_public_keys.ed25519.length === 0;
95
98
  }
96
99
  }
97
100
  exports.E2EIServiceExternal = E2EIServiceExternal;
@@ -0,0 +1,4 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IncomingMesssagesQueue.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.ts"],"names":[],"mappings":"AA2CA,eAAO,MAAM,uBAAuB,kCAAyC,GAAG,EAAE,KAAK,GAAG,WAC/E,MAAM,6DAKhB,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,SAErD,CAAC;AAcF,eAAO,MAAM,0BAA0B,eAAsB,MAAM,qCAUlE,CAAC"}
@@ -0,0 +1,72 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.withLockedMLSMessagesQueue = exports.deleteMLSMessagesQueue = exports.queueIncomingMLSMessage = void 0;
25
+ const logdown_1 = __importDefault(require("logdown"));
26
+ const promise_queue_1 = require("@wireapp/promise-queue");
27
+ const logger = (0, logdown_1.default)('@wireapp/core/MLSService/IncomingMessagesQueue');
28
+ // (groupId string -> queue) map
29
+ const queues = new Map();
30
+ const getQueue = (groupId) => {
31
+ const queue = queues.get(groupId);
32
+ if (queue) {
33
+ return queue;
34
+ }
35
+ const newConversationQueue = new promise_queue_1.PromiseQueue({
36
+ name: `mls-messages-queue-${groupId}`,
37
+ });
38
+ queues.set(groupId, newConversationQueue);
39
+ return newConversationQueue;
40
+ };
41
+ const queueIncomingMLSMessage = async (groupId, handler) => {
42
+ const conversationQueue = getQueue(groupId);
43
+ return conversationQueue.push(handler);
44
+ };
45
+ exports.queueIncomingMLSMessage = queueIncomingMLSMessage;
46
+ const deleteMLSMessagesQueue = (groupId) => {
47
+ queues.delete(groupId);
48
+ };
49
+ exports.deleteMLSMessagesQueue = deleteMLSMessagesQueue;
50
+ const lockMLSMessagesQueue = (groupId) => {
51
+ logger.info(`Locking incoming MLS messages queue for group ${groupId}`);
52
+ const conversationQueue = getQueue(groupId);
53
+ conversationQueue.pause(true);
54
+ };
55
+ const unlockMLSMessagesQueue = (groupId) => {
56
+ logger.info(`Unlocking incoming MLS messages queue for group ${groupId}`);
57
+ const conversationQueue = getQueue(groupId);
58
+ conversationQueue.pause(false);
59
+ };
60
+ const withLockedMLSMessagesQueue = async (groupId, fn) => {
61
+ lockMLSMessagesQueue(groupId);
62
+ try {
63
+ const result = await fn();
64
+ unlockMLSMessagesQueue(groupId);
65
+ return result;
66
+ }
67
+ catch (error) {
68
+ unlockMLSMessagesQueue(groupId);
69
+ throw error;
70
+ }
71
+ };
72
+ exports.withLockedMLSMessagesQueue = withLockedMLSMessagesQueue;
@@ -0,0 +1,2 @@
1
+ export * from './IncomingMesssagesQueue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.ts"],"names":[],"mappings":"AAmBA,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,35 @@
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);
@@ -1,2 +1,3 @@
1
1
  export * from './messageAdd';
2
+ export * from './IncomingMessagesQueue';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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;AAC7B,cAAc,yBAAyB,CAAC"}
@@ -33,3 +33,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  __exportStar(require("./messageAdd"), exports);
36
+ __exportStar(require("./IncomingMessagesQueue"), exports);
@@ -1,13 +1,11 @@
1
- import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
2
1
  import { ConversationMLSMessageAddEvent } from '@wireapp/api-client/lib/event';
3
- import { QualifiedId } from '@wireapp/api-client/lib/user';
4
2
  import { HandledEventPayload } from '../../../../../notification';
5
3
  import { MLSService } from '../../../MLSService/MLSService';
6
4
  interface HandleMLSMessageAddParams {
7
5
  event: ConversationMLSMessageAddEvent;
6
+ groupId: string;
8
7
  mlsService: MLSService;
9
- groupIdFromConversationId: (conversationId: QualifiedId, subconversationId?: SUBCONVERSATION_ID) => Promise<string | undefined>;
10
8
  }
11
- export declare const handleMLSMessageAdd: ({ event, mlsService, groupIdFromConversationId, }: HandleMLSMessageAddParams) => Promise<HandledEventPayload | null>;
9
+ export declare const handleMLSMessageAdd: ({ event, groupId, mlsService, }: HandleMLSMessageAddParams) => Promise<HandledEventPayload | null>;
12
10
  export {};
13
11
  //# sourceMappingURL=messageAdd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAKzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAEhF,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,UAAU,EAAE,UAAU,CAAC;IACvB,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,mBAAmB,sDAI7B,yBAAyB,KAAG,QAAQ,mBAAmB,GAAG,IAAI,CA+ChE,CAAC"}
1
+ {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAEhF,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,oCAI7B,yBAAyB,KAAG,QAAQ,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
@@ -22,15 +22,8 @@ exports.handleMLSMessageAdd = void 0;
22
22
  const bazinga64_1 = require("bazinga64");
23
23
  const protocol_messaging_1 = require("@wireapp/protocol-messaging");
24
24
  const MLSService_1 = require("../../../MLSService/MLSService");
25
- const handleMLSMessageAdd = async ({ event, mlsService, groupIdFromConversationId, }) => {
26
- var _a;
25
+ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
27
26
  const encryptedData = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
28
- const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
29
- const groupId = await groupIdFromConversationId(qualifiedConversationId, event.subconv);
30
- // We should not receive a message for a group the client is not aware of
31
- if (!groupId) {
32
- throw new Error(`Could not find a group_id for conversation ${qualifiedConversationId.id}@${qualifiedConversationId.domain}`);
33
- }
34
27
  const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
35
28
  const { proposals, commitDelay, message, senderClientId: encodedSenderClientId, hasEpochChanged, } = await mlsService.decryptMessage(groupIdBytes, encryptedData);
36
29
  if (encodedSenderClientId) {
@@ -44,15 +44,9 @@ const createMockedMessage = () => {
44
44
  })).finish();
45
45
  };
46
46
  describe('handleMLSMessageAdd', () => {
47
- it('throws when received a message for a group that is not known by a client', async () => {
48
- const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
49
- const groupIdFromConversationId = () => Promise.resolve(undefined);
50
- await expect((0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupIdFromConversationId })).rejects.toThrow();
51
- });
52
47
  it('does not handle pending proposals if message does not contain proposals', async () => {
53
48
  const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
54
49
  const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
55
- const groupIdFromConversationId = () => Promise.resolve(mockGroupId);
56
50
  const message = createMockedMessage();
57
51
  jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
58
52
  proposals: [],
@@ -61,13 +55,12 @@ describe('handleMLSMessageAdd', () => {
61
55
  hasEpochChanged: false,
62
56
  isActive: true,
63
57
  });
64
- await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupIdFromConversationId });
58
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
65
59
  expect(mockedMLSService.handlePendingProposals).not.toHaveBeenCalled();
66
60
  });
67
61
  it('handles pending proposals if message includes proposals', async () => {
68
62
  const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
69
63
  const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
70
- const groupIdFromConversationId = () => Promise.resolve(mockGroupId);
71
64
  const message = createMockedMessage();
72
65
  jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
73
66
  proposals: [{ proposal: new Uint8Array(), proposalRef: new Uint8Array() }],
@@ -76,7 +69,7 @@ describe('handleMLSMessageAdd', () => {
76
69
  hasEpochChanged: false,
77
70
  isActive: true,
78
71
  });
79
- await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupIdFromConversationId });
72
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
80
73
  expect(mockedMLSService.handlePendingProposals).toHaveBeenCalledWith({
81
74
  groupId: mockGroupId,
82
75
  delayInMs: 2000,
@@ -86,7 +79,6 @@ describe('handleMLSMessageAdd', () => {
86
79
  it('emits "newEpoch" event if incoming message has advanced epoch number', async () => {
87
80
  const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
88
81
  const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
89
- const groupIdFromConversationId = () => Promise.resolve(mockGroupId);
90
82
  const message = createMockedMessage();
91
83
  jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
92
84
  proposals: [],
@@ -96,7 +88,7 @@ describe('handleMLSMessageAdd', () => {
96
88
  });
97
89
  const mockedNewEpoch = 5;
98
90
  jest.spyOn(mockedMLSService, 'getEpoch').mockResolvedValueOnce(mockedNewEpoch);
99
- await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupIdFromConversationId });
91
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
100
92
  expect(mockedMLSService.emit).toHaveBeenCalledWith('newEpoch', {
101
93
  groupId: mockGroupId,
102
94
  epoch: mockedNewEpoch,
@@ -5,7 +5,7 @@ import { QualifiedId } from '@wireapp/api-client/lib/user';
5
5
  import logdown from 'logdown';
6
6
  import { APIClient } from '@wireapp/api-client';
7
7
  import { TypedEventEmitter } from '@wireapp/commons';
8
- import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ExternalAddProposalArgs, ExternalProposalType, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
8
+ import { AddProposalArgs, ConversationId, CoreCrypto, DecryptedMessage, ProposalArgs, ProposalType, RemoveProposalArgs } from '@wireapp/core-crypto';
9
9
  import { MLSServiceConfig } from './MLSService.types';
10
10
  import { KeyPackageClaimUser } from '../../../conversation';
11
11
  import { CoreDatabase } from '../../../storage/CoreDB';
@@ -55,7 +55,6 @@ export declare class MLSService extends TypedEventEmitter<Events> {
55
55
  newProposal(proposalType: ProposalType, args: ProposalArgs | AddProposalArgs | RemoveProposalArgs): Promise<import("@wireapp/core-crypto").ProposalBundle>;
56
56
  joinByExternalCommit(getGroupInfo: () => Promise<Uint8Array>): Promise<PostMlsMessageResponse>;
57
57
  exportSecretKey(groupId: string, keyLength: number): Promise<string>;
58
- newExternalProposal(externalProposalType: ExternalProposalType, args: ExternalAddProposalArgs): Promise<Uint8Array>;
59
58
  processWelcomeMessage(welcomeMessage: Uint8Array): Promise<ConversationId>;
60
59
  decryptMessage(conversationId: ConversationId, payload: Uint8Array): Promise<DecryptedMessage>;
61
60
  encryptMessage(conversationId: ConversationId, message: Uint8Array): Promise<Uint8Array>;
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAE1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAW,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,eAAe,EAIf,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAsB,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAC,aAAa,EAAE,mB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Y/F;;;;OAIG;IACU,+BAA+B;IAiB5C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAcjF,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE;IASjF;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;CA4DpC"}
@@ -45,6 +45,7 @@ const numberToHex_1 = require("../../../util/numberToHex");
45
45
  const TaskScheduler_1 = require("../../../util/TaskScheduler");
46
46
  const E2EIServiceInternal_1 = require("../E2EIdentityService/E2EIServiceInternal");
47
47
  const events_1 = require("../EventHandler/events");
48
+ const messageAdd_1 = require("../EventHandler/events/messageAdd");
48
49
  const MLSId_1 = require("../utils/MLSId");
49
50
  //@todo: this function is temporary, we wait for the update from core-crypto side
50
51
  //they are returning regular array instead of Uint8Array for commit and welcome messages
@@ -68,43 +69,45 @@ class MLSService extends commons_1.TypedEventEmitter {
68
69
  this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
69
70
  this.textEncoder = new TextEncoder();
70
71
  this.textDecoder = new TextDecoder();
71
- // We need to lock the websocket while commit bundle is being processed by backend,
72
- // it's possible that we will be sent some mls messages before we receive the response from backend and accept a commit locally.
73
- this.uploadCommitBundle = this.apiClient.withLockedWebSocket(async (groupId, commitBundle, { regenerateCommitBundle, isExternalCommit } = {}) => {
74
- const { commit, groupInfo, welcome } = commitBundle;
75
- const bundlePayload = new Uint8Array([...commit, ...groupInfo.payload, ...(welcome || [])]);
76
- try {
77
- const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
78
- if (isExternalCommit) {
79
- await this.coreCryptoClient.mergePendingGroupFromExternalCommit(groupId);
80
- }
81
- else {
82
- await this.coreCryptoClient.commitAccepted(groupId);
83
- }
84
- const newEpoch = await this.getEpoch(groupId);
85
- const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
86
- this.emit('newEpoch', { epoch: newEpoch, groupId: groupIdStr });
87
- return response;
88
- }
89
- catch (error) {
90
- if (isExternalCommit) {
91
- await this.coreCryptoClient.clearPendingGroupFromExternalCommit(groupId);
92
- }
93
- else {
94
- await this.coreCryptoClient.clearPendingCommit(groupId);
72
+ this.uploadCommitBundle = async (groupId, commitBundle, { regenerateCommitBundle, isExternalCommit } = {}) => {
73
+ const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
74
+ // We need to lock the incoming mls messages queue while we are uploading the commit bundle
75
+ // it's possible that we will be sent some mls messages before we receive the response from backend and accept a commit locally.
76
+ return (0, messageAdd_1.withLockedMLSMessagesQueue)(groupIdStr, async () => {
77
+ const { commit, groupInfo, welcome } = commitBundle;
78
+ const bundlePayload = new Uint8Array([...commit, ...groupInfo.payload, ...(welcome || [])]);
79
+ try {
80
+ const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
81
+ if (isExternalCommit) {
82
+ await this.coreCryptoClient.mergePendingGroupFromExternalCommit(groupId);
83
+ }
84
+ else {
85
+ await this.coreCryptoClient.commitAccepted(groupId);
86
+ }
87
+ const newEpoch = await this.getEpoch(groupId);
88
+ this.emit('newEpoch', { epoch: newEpoch, groupId: groupIdStr });
89
+ return response;
95
90
  }
96
- const shouldRetry = error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT;
97
- if (shouldRetry && regenerateCommitBundle) {
98
- // in case of a 409, we want to retry to generate the commit and resend it
99
- // could be that we are trying to upload a commit to a conversation that has a different epoch on backend
100
- // in this case we will most likely receive a commit from backend that will increase our local epoch
101
- this.logger.warn(`Uploading commitBundle failed. Will retry generating a new bundle`);
102
- const updatedCommitBundle = await regenerateCommitBundle();
103
- return this.uploadCommitBundle(groupId, updatedCommitBundle, { isExternalCommit });
91
+ catch (error) {
92
+ if (isExternalCommit) {
93
+ await this.coreCryptoClient.clearPendingGroupFromExternalCommit(groupId);
94
+ }
95
+ else {
96
+ await this.coreCryptoClient.clearPendingCommit(groupId);
97
+ }
98
+ const shouldRetry = error instanceof http_1.BackendError && error.code === http_1.StatusCode.CONFLICT;
99
+ if (shouldRetry && regenerateCommitBundle) {
100
+ // in case of a 409, we want to retry to generate the commit and resend it
101
+ // could be that we are trying to upload a commit to a conversation that has a different epoch on backend
102
+ // in this case we will most likely receive a commit from backend that will increase our local epoch
103
+ this.logger.warn(`Uploading commitBundle failed. Will retry generating a new bundle`);
104
+ const updatedCommitBundle = await regenerateCommitBundle();
105
+ return this.uploadCommitBundle(groupId, updatedCommitBundle, { isExternalCommit });
106
+ }
107
+ throw error;
104
108
  }
105
- throw error;
106
- }
107
- });
109
+ });
110
+ };
108
111
  /**
109
112
  * Will try to register mls group and send an empty commit to establish it.
110
113
  *
@@ -246,9 +249,6 @@ class MLSService extends commons_1.TypedEventEmitter {
246
249
  const key = await this.coreCryptoClient.exportSecretKey(groupIdBytes, keyLength);
247
250
  return bazinga64_1.Encoder.toBase64(key).asString;
248
251
  }
249
- async newExternalProposal(externalProposalType, args) {
250
- return this.coreCryptoClient.newExternalProposal(externalProposalType, args);
251
- }
252
252
  async processWelcomeMessage(welcomeMessage) {
253
253
  return this.coreCryptoClient.processWelcomeMessage(welcomeMessage);
254
254
  }
@@ -491,6 +491,7 @@ class MLSService extends commons_1.TypedEventEmitter {
491
491
  return this.apiClient.api.client.uploadMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))));
492
492
  }
493
493
  async wipeConversation(groupId) {
494
+ (0, messageAdd_1.deleteMLSMessagesQueue)(groupId);
494
495
  await this.cancelKeyMaterialRenewal(groupId);
495
496
  await this.cancelPendingProposalsTask(groupId);
496
497
  const doesConversationExist = await this.conversationExists(groupId);
@@ -586,7 +587,14 @@ class MLSService extends commons_1.TypedEventEmitter {
586
587
  return clientIds;
587
588
  }
588
589
  async handleMLSMessageAddEvent(event, groupIdFromConversationId) {
589
- return (0, events_1.handleMLSMessageAdd)({ event, mlsService: this, groupIdFromConversationId });
590
+ var _a;
591
+ const qualifiedConversationId = (_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' };
592
+ const groupId = await groupIdFromConversationId(qualifiedConversationId, event.subconv);
593
+ // We should not receive a message for a group the client is not aware of
594
+ if (!groupId) {
595
+ throw new Error(`Could not find a group_id for conversation ${qualifiedConversationId.id}@${qualifiedConversationId.domain}`);
596
+ }
597
+ return (0, messageAdd_1.queueIncomingMLSMessage)(groupId, () => (0, events_1.handleMLSMessageAdd)({ event, mlsService: this, groupId }));
590
598
  }
591
599
  async handleMLSWelcomeMessageEvent(event, clientId) {
592
600
  // Every time we've received a welcome message, it means that our key package was consumed,
package/package.json CHANGED
@@ -11,20 +11,20 @@
11
11
  "./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
12
12
  },
13
13
  "dependencies": {
14
- "@wireapp/api-client": "^26.7.2",
15
- "@wireapp/commons": "^5.2.3",
14
+ "@wireapp/api-client": "^26.8.1",
15
+ "@wireapp/commons": "^5.2.4",
16
16
  "@wireapp/core-crypto": "1.0.0-rc.21",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
- "@wireapp/promise-queue": "^2.2.8",
18
+ "@wireapp/promise-queue": "^2.2.9",
19
19
  "@wireapp/protocol-messaging": "1.44.0",
20
20
  "@wireapp/store-engine": "5.1.5",
21
21
  "@wireapp/store-engine-dexie": "^2.1.7",
22
- "axios": "1.6.2",
22
+ "axios": "1.6.3",
23
23
  "bazinga64": "^6.3.4",
24
24
  "deepmerge-ts": "5.1.0",
25
25
  "hash.js": "1.1.7",
26
26
  "http-status-codes": "2.3.0",
27
- "idb": "7.1.1",
27
+ "idb": "8.0.0",
28
28
  "logdown": "3.3.1",
29
29
  "long": "^5.2.0",
30
30
  "uuidjs": "4.2.13",
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "43.2.0",
65
- "gitHead": "f0bbee291bcfee2d3a4ea43759a08f15cf5535b8"
64
+ "version": "43.3.1",
65
+ "gitHead": "443f593f67da2b1f45e62a7ff6e1db13f4b50b6d"
66
66
  }