@wireapp/core 46.46.6-beta.10.d7a6c4c53 → 46.46.6-beta.14.f6fd03fe6

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 (195) hide show
  1. package/lib/Account.d.ts +51 -168
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +127 -517
  4. package/lib/Account.test.js +147 -158
  5. package/lib/broadcast/AvailabilityType.d.ts +1 -1
  6. package/lib/broadcast/AvailabilityType.d.ts.map +1 -1
  7. package/lib/broadcast/BroadcastService.d.ts +1 -1
  8. package/lib/broadcast/BroadcastService.d.ts.map +1 -1
  9. package/lib/broadcast/BroadcastService.js +1 -1
  10. package/lib/client/ClientService.d.ts +3 -4
  11. package/lib/client/ClientService.d.ts.map +1 -1
  12. package/lib/client/ClientService.js +5 -19
  13. package/lib/conversation/AbortReason.d.ts +1 -1
  14. package/lib/conversation/AbortReason.d.ts.map +1 -1
  15. package/lib/conversation/AssetService/AssetService.d.ts +30 -12
  16. package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
  17. package/lib/conversation/AssetService/AssetService.js +10 -1
  18. package/lib/conversation/AssetService/AssetService.test.js +3 -8
  19. package/lib/conversation/ClientActionType.d.ts +1 -1
  20. package/lib/conversation/ClientActionType.d.ts.map +1 -1
  21. package/lib/conversation/ClientActionType.js +1 -1
  22. package/lib/conversation/ConversationService/ConversationService.d.ts +14 -98
  23. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  24. package/lib/conversation/ConversationService/ConversationService.js +101 -314
  25. package/lib/conversation/ConversationService/ConversationService.test.js +47 -441
  26. package/lib/conversation/ConversationService/ConversationService.types.d.ts +4 -5
  27. package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
  28. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
  29. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +3 -6
  30. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  31. package/lib/conversation/SubconversationService/SubconversationService.js +11 -158
  32. package/lib/conversation/SubconversationService/SubconversationService.test.js +2 -8
  33. package/lib/conversation/content/AssetContent.d.ts +1 -1
  34. package/lib/conversation/content/AssetContent.d.ts.map +1 -1
  35. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +1 -1
  36. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +1 -1
  37. package/lib/conversation/content/ButtonActionContent.d.ts +1 -1
  38. package/lib/conversation/content/ButtonActionContent.d.ts.map +1 -1
  39. package/lib/conversation/content/ClearedContent.d.ts +1 -1
  40. package/lib/conversation/content/ClearedContent.d.ts.map +1 -1
  41. package/lib/conversation/content/ClientActionContent.d.ts +1 -1
  42. package/lib/conversation/content/ClientActionContent.d.ts.map +1 -1
  43. package/lib/conversation/content/CompositeContent.d.ts +1 -1
  44. package/lib/conversation/content/CompositeContent.d.ts.map +1 -1
  45. package/lib/conversation/content/ConfirmationContent.d.ts +1 -1
  46. package/lib/conversation/content/ConfirmationContent.d.ts.map +1 -1
  47. package/lib/conversation/content/DeletedContent.d.ts +1 -1
  48. package/lib/conversation/content/DeletedContent.d.ts.map +1 -1
  49. package/lib/conversation/content/HiddenContent.d.ts +1 -1
  50. package/lib/conversation/content/HiddenContent.d.ts.map +1 -1
  51. package/lib/conversation/content/KnockContent.d.ts +1 -1
  52. package/lib/conversation/content/KnockContent.d.ts.map +1 -1
  53. package/lib/conversation/content/LinkPreviewContent.d.ts +1 -1
  54. package/lib/conversation/content/LinkPreviewContent.d.ts.map +1 -1
  55. package/lib/conversation/content/MentionContent.d.ts +1 -1
  56. package/lib/conversation/content/MentionContent.d.ts.map +1 -1
  57. package/lib/conversation/content/MultipartContent.d.ts +1 -1
  58. package/lib/conversation/content/MultipartContent.d.ts.map +1 -1
  59. package/lib/conversation/content/QuoteContent.d.ts +1 -1
  60. package/lib/conversation/content/QuoteContent.d.ts.map +1 -1
  61. package/lib/conversation/content/TweetContent.d.ts +1 -1
  62. package/lib/conversation/content/TweetContent.d.ts.map +1 -1
  63. package/lib/conversation/content/index.d.ts +1 -1
  64. package/lib/conversation/content/index.d.ts.map +1 -1
  65. package/lib/conversation/content/index.js +1 -1
  66. package/lib/conversation/message/MessageBuilder.d.ts +1 -1
  67. package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
  68. package/lib/conversation/message/MessageBuilder.js +1 -1
  69. package/lib/conversation/message/MessageService.d.ts.map +1 -1
  70. package/lib/conversation/message/MessageService.js +1 -1
  71. package/lib/conversation/message/MessageService.test.js +1 -7
  72. package/lib/conversation/message/MessageToProtoMapper.d.ts +1 -1
  73. package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
  74. package/lib/conversation/message/MessageToProtoMapper.js +1 -1
  75. package/lib/conversation/message/messageSender.js +2 -2
  76. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +2 -2
  77. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +1 -1
  78. package/lib/messagingProtocols/common.types.d.ts +0 -9
  79. package/lib/messagingProtocols/common.types.d.ts.map +1 -1
  80. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
  81. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
  82. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +1 -2
  83. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +1 -1
  84. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  85. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +11 -13
  86. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +16 -21
  87. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -9
  88. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
  89. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +12 -31
  90. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +0 -6
  91. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
  92. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +1 -19
  93. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +4 -0
  94. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -0
  95. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +69 -0
  96. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +2 -0
  97. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.d.ts.map +1 -1
  98. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.js +1 -1
  99. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +1 -0
  100. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
  101. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +1 -0
  102. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  103. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +14 -23
  104. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +2 -0
  105. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +1 -0
  106. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +98 -0
  107. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  108. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -5
  109. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -13
  110. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +2 -38
  111. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
  112. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.js +6 -41
  113. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +34 -38
  114. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  115. package/lib/messagingProtocols/mls/MLSService/MLSService.js +208 -267
  116. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +160 -157
  117. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +3 -3
  118. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +5 -5
  119. package/lib/messagingProtocols/mls/conversationRejoinQueue.js +2 -2
  120. package/lib/messagingProtocols/mls/types.d.ts +8 -0
  121. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  122. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
  123. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.js +1 -7
  124. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +15 -8
  125. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  126. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +62 -97
  127. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +6 -0
  128. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  129. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts +6 -1
  130. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts.map +1 -1
  131. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +22 -19
  132. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +3 -5
  133. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  134. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +24 -11
  135. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +0 -1
  136. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  137. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -11
  138. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +9 -13
  139. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +2 -3
  140. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  141. package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +4 -11
  142. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +4 -0
  143. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
  144. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +5 -0
  145. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +1 -2
  146. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
  147. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +2 -8
  148. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +0 -4
  149. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +1 -1
  150. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  151. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +1 -1
  152. package/lib/notification/NotificationService.d.ts +6 -20
  153. package/lib/notification/NotificationService.d.ts.map +1 -1
  154. package/lib/notification/NotificationService.js +14 -23
  155. package/lib/notification/NotificationService.test.js +0 -8
  156. package/lib/secretStore/secretKeyGenerator.d.ts +0 -1
  157. package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
  158. package/lib/secretStore/secretKeyGenerator.js +1 -3
  159. package/lib/self/SelfService.d.ts +2 -2
  160. package/lib/self/SelfService.d.ts.map +1 -1
  161. package/lib/self/SelfService.test.js +2 -5
  162. package/lib/team/TeamService.d.ts +2 -5
  163. package/lib/team/TeamService.d.ts.map +1 -1
  164. package/lib/team/TeamService.js +2 -12
  165. package/lib/user/UserService.d.ts +2 -2
  166. package/lib/user/UserService.d.ts.map +1 -1
  167. package/lib/user/UserService.js +3 -3
  168. package/lib/util/TypePredicateUtil.d.ts.map +1 -1
  169. package/lib/util/TypePredicateUtil.js +2 -2
  170. package/package.json +3 -3
  171. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts +0 -7
  172. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts.map +0 -1
  173. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.js +0 -48
  174. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.d.ts +0 -2
  175. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts +0 -2
  176. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts.map +0 -1
  177. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.js +0 -124
  178. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +0 -78
  179. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +0 -1
  180. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +0 -173
  181. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +0 -2
  182. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +0 -1
  183. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +0 -117
  184. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +0 -167
  185. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +0 -1
  186. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +0 -317
  187. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +0 -2
  188. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +0 -1
  189. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +0 -248
  190. package/lib/messagingProtocols/mls/recovery/index.d.ts +0 -5
  191. package/lib/messagingProtocols/mls/recovery/index.d.ts.map +0 -1
  192. package/lib/messagingProtocols/mls/recovery/index.js +0 -28
  193. package/lib/test/StoreHelper.d.ts +0 -2
  194. package/lib/test/StoreHelper.d.ts.map +0 -1
  195. package/lib/test/StoreHelper.js +0 -27
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.isResponseStatusValid = exports.getMLSDeviceStatus = exports.MLSDeviceStatus = exports.isMLSDevice = exports.getSignatureAlgorithmForCiphersuite = exports.getE2EIClientId = exports.jsonToByteArray = void 0;
21
+ exports.isResponseStatusValid = exports.isMLSDevice = exports.getSignatureAlgorithmForCiphersuite = exports.getE2EIClientId = exports.jsonToByteArray = void 0;
22
22
  const client_1 = require("@wireapp/api-client/lib/client");
23
23
  const core_crypto_1 = require("@wireapp/core-crypto");
24
24
  const fullyQualifiedClientIdUtils_1 = require("../../../../util/fullyQualifiedClientIdUtils");
@@ -58,23 +58,5 @@ const isMLSDevice = ({ mls_public_keys }, ciphersuite) => {
58
58
  return typeof signature === 'string' && signature.length > 0;
59
59
  };
60
60
  exports.isMLSDevice = isMLSDevice;
61
- var MLSDeviceStatus;
62
- (function (MLSDeviceStatus) {
63
- MLSDeviceStatus["REGISTERED"] = "registered";
64
- MLSDeviceStatus["FRESH"] = "fresh";
65
- MLSDeviceStatus["MISMATCH"] = "mismatch";
66
- })(MLSDeviceStatus || (exports.MLSDeviceStatus = MLSDeviceStatus = {}));
67
- const getMLSDeviceStatus = ({ mls_public_keys }, ciphersuite, existingClientSignature) => {
68
- const signatureAlogrithm = (0, exports.getSignatureAlgorithmForCiphersuite)(ciphersuite);
69
- const signature = mls_public_keys[signatureAlogrithm];
70
- if (!signature || !existingClientSignature) {
71
- return MLSDeviceStatus.FRESH;
72
- }
73
- if (signature !== existingClientSignature) {
74
- return MLSDeviceStatus.MISMATCH;
75
- }
76
- return MLSDeviceStatus.REGISTERED;
77
- };
78
- exports.getMLSDeviceStatus = getMLSDeviceStatus;
79
61
  const isResponseStatusValid = (status) => status && status === 'valid';
80
62
  exports.isResponseStatusValid = isResponseStatusValid;
@@ -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":"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"}
@@ -0,0 +1,69 @@
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(true);
51
+ };
52
+ const unlockMLSMessagesQueue = (groupId) => {
53
+ logger.info(`Unlocking incoming MLS messages queue for group ${groupId}`);
54
+ const conversationQueue = getQueue(groupId);
55
+ conversationQueue.pause(false);
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;
@@ -0,0 +1,2 @@
1
+ export * from './IncomingMesssagesQueue';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.ts"],"names":[],"mappings":"AAmBA,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.ts"],"names":[],"mappings":"AAmBA,cAAc,0BAA0B,CAAC"}
@@ -32,4 +32,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
32
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- __exportStar(require("./IncomingProposalsQueue"), exports);
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 +1 @@
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;AAS7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAIhF,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,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
1
+ {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAG7E,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,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
@@ -19,41 +19,32 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.handleMLSMessageAdd = void 0;
22
+ const protocol_messaging_1 = require("@pydio/protocol-messaging");
22
23
  const bazinga64_1 = require("bazinga64");
23
- const commons_1 = require("@wireapp/commons");
24
- const core_crypto_1 = require("@wireapp/core-crypto");
25
- const protocol_messaging_1 = require("@wireapp/protocol-messaging");
26
- const IncomingProposalsQueue_1 = require("./IncomingProposalsQueue");
27
24
  const MLSService_1 = require("../../../MLSService/MLSService");
28
- const logger = commons_1.LogFactory.getLogger('@wireapp/core/mls/messageAdd');
29
25
  const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
30
26
  const encryptedData = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
31
27
  const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
32
- const decryptedMessage = await mlsService.decryptMessage(new core_crypto_1.ConversationId(groupIdBytes), encryptedData);
33
- if (!decryptedMessage) {
34
- // If the message is not decrypted, we return null
35
- return null;
36
- }
37
- const { message, commitDelay, senderClientId: encodedSenderClientId } = decryptedMessage;
28
+ const { proposals, commitDelay, message, senderClientId: encodedSenderClientId, hasEpochChanged, } = await mlsService.decryptMessage(groupIdBytes, encryptedData);
38
29
  if (encodedSenderClientId) {
39
30
  const decoder = new TextDecoder();
40
- const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId.copyBytes()));
31
+ const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId));
41
32
  event.senderClientId = senderClientId;
42
33
  }
43
34
  // Check if the message includes proposals
44
- if (typeof commitDelay === 'number') {
45
- (0, IncomingProposalsQueue_1.queueProposal)(async () => {
46
- // we are dealing with a proposal, add a task to process this proposal later on
47
- // Those proposals are stored inside of coreCrypto and will be handled after a timeout
48
- await mlsService.handlePendingProposals({
49
- groupId,
50
- delayInMs: commitDelay ?? 0,
51
- eventTime: event.time,
52
- });
53
- }).catch(error => {
54
- logger.error('Failed to process proposal:', error);
35
+ if (typeof commitDelay === 'number' || proposals.length > 0) {
36
+ // we are dealing with a proposal, add a task to process this proposal later on
37
+ // Those proposals are stored inside of coreCrypto and will be handled after a timeout
38
+ await mlsService.handlePendingProposals({
39
+ groupId,
40
+ delayInMs: commitDelay ?? 0,
41
+ eventTime: event.time,
55
42
  });
56
43
  }
44
+ if (hasEpochChanged) {
45
+ const newEpoch = await mlsService.getEpoch(groupId);
46
+ mlsService.emit('newEpoch', { groupId, epoch: newEpoch });
47
+ }
57
48
  return message ? { event, decryptedData: protocol_messaging_1.GenericMessage.decode(message) } : null;
58
49
  };
59
50
  exports.handleMLSMessageAdd = handleMLSMessageAdd;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=messageAdd.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageAdd.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 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
+ const protocol_messaging_1 = require("@pydio/protocol-messaging");
22
+ const event_1 = require("@wireapp/api-client/lib/event");
23
+ const messageAdd_1 = require("./messageAdd");
24
+ const mockedMLSService = {
25
+ getGroupIdFromConversationId: jest.fn(),
26
+ decryptMessage: jest.fn(),
27
+ handlePendingProposals: jest.fn(),
28
+ getEpoch: jest.fn(),
29
+ emit: jest.fn(),
30
+ };
31
+ const createMLSMessageAddEventMock = (conversationId) => ({
32
+ data: '',
33
+ conversation: conversationId.id,
34
+ qualified_conversation: conversationId,
35
+ from: '',
36
+ senderClientId: '',
37
+ type: event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD,
38
+ time: '2023-08-21T06:47:43.387Z',
39
+ });
40
+ const createMockedMessage = () => {
41
+ return protocol_messaging_1.GenericMessage.encode(protocol_messaging_1.GenericMessage.create({
42
+ messageId: '2d7cb6d8-118f-11e8-b642-0ed5f89f718b',
43
+ text: protocol_messaging_1.Text.create({ content: 'Hello, World!' }),
44
+ })).finish();
45
+ };
46
+ describe('handleMLSMessageAdd', () => {
47
+ it('does not handle pending proposals if message does not contain proposals', async () => {
48
+ const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
49
+ const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
50
+ const message = createMockedMessage();
51
+ jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
52
+ proposals: [],
53
+ commitDelay: undefined,
54
+ message,
55
+ hasEpochChanged: false,
56
+ isActive: true,
57
+ });
58
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
59
+ expect(mockedMLSService.handlePendingProposals).not.toHaveBeenCalled();
60
+ });
61
+ it('handles pending proposals if message includes proposals', async () => {
62
+ const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
63
+ const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
64
+ const message = createMockedMessage();
65
+ jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
66
+ proposals: [{ proposal: new Uint8Array(), proposalRef: new Uint8Array(), crlNewDistributionPoints: [] }],
67
+ commitDelay: 2000,
68
+ crlNewDistributionPoints: [],
69
+ message,
70
+ hasEpochChanged: false,
71
+ isActive: true,
72
+ });
73
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
74
+ expect(mockedMLSService.handlePendingProposals).toHaveBeenCalledWith({
75
+ groupId: mockGroupId,
76
+ delayInMs: 2000,
77
+ eventTime: event.time,
78
+ });
79
+ });
80
+ it('emits "newEpoch" event if incoming message has advanced epoch number', async () => {
81
+ const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
82
+ const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
83
+ const message = createMockedMessage();
84
+ jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
85
+ proposals: [],
86
+ message,
87
+ hasEpochChanged: true,
88
+ isActive: true,
89
+ });
90
+ const mockedNewEpoch = 5;
91
+ jest.spyOn(mockedMLSService, 'getEpoch').mockResolvedValueOnce(mockedNewEpoch);
92
+ await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
93
+ expect(mockedMLSService.emit).toHaveBeenCalledWith('newEpoch', {
94
+ groupId: mockGroupId,
95
+ epoch: mockedNewEpoch,
96
+ });
97
+ });
98
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEjE,UAAU,0BAA0B;IAClC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,2BAGjC,0BAA0B,KAAG,OAAO,CAAC,mBAAmB,CAmB1D,CAAC"}
1
+ {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAE/C,UAAU,0BAA0B;IAClC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,2BAGjC,0BAA0B,KAAG,OAAO,CAAC,mBAAmB,CAiB1D,CAAC"}
@@ -20,19 +20,16 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.handleMLSWelcomeMessage = void 0;
22
22
  const bazinga64_1 = require("bazinga64");
23
- const MLSService_1 = require("../../../MLSService");
24
23
  const handleMLSWelcomeMessage = async ({ mlsService, event, }) => {
25
24
  const data = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
26
25
  // We extract the groupId from the welcome message and let coreCrypto store this group
27
26
  const newGroupId = await mlsService.processWelcomeMessage(data);
28
- const groupIdStr = bazinga64_1.Encoder.toBase64(newGroupId.copyBytes()).asString;
27
+ const groupIdStr = bazinga64_1.Encoder.toBase64(newGroupId).asString;
29
28
  // The groupId can then be sent back to the consumer
30
29
  // After we were added to the group we need to schedule a periodic key material renewal
31
30
  await mlsService.scheduleKeyMaterialRenewal(groupIdStr);
32
- // We also need to emit a NEW_EPOCH event to notify the rest of the system that we have joined a new group
33
31
  const newEpoch = await mlsService.getEpoch(groupIdStr);
34
- mlsService.emit(MLSService_1.MLSServiceEvents.NEW_EPOCH, { groupId: groupIdStr, epoch: newEpoch });
35
- mlsService.logger.info(`Joined MLS group with id ${groupIdStr} via welcome message, new epoch: ${newEpoch}`);
32
+ mlsService.emit('newEpoch', { groupId: groupIdStr, epoch: newEpoch });
36
33
  return {
37
34
  event: { ...event, data: groupIdStr },
38
35
  };
@@ -19,9 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const event_1 = require("@wireapp/api-client/lib/event");
22
- const core_crypto_1 = require("@wireapp/core-crypto");
23
22
  const welcomeMessage_1 = require("./welcomeMessage");
24
- const MLSService_1 = require("../../../MLSService");
25
23
  jest.mock('bazinga64', () => ({
26
24
  ...jest.requireActual('bazinga64'),
27
25
  Decoder: {
@@ -41,15 +39,10 @@ const mockParams = {
41
39
  },
42
40
  source: {},
43
41
  mlsService: {
44
- processWelcomeMessage: jest.fn().mockResolvedValue(new core_crypto_1.Welcome(Uint8Array.from([1, 2, 3]))),
42
+ processWelcomeMessage: jest.fn().mockResolvedValue('conversationId'),
45
43
  scheduleKeyMaterialRenewal: jest.fn(),
46
44
  getEpoch: jest.fn(),
47
45
  emit: jest.fn(),
48
- logger: {
49
- info: jest.fn(),
50
- warn: jest.fn(),
51
- error: jest.fn(),
52
- },
53
46
  },
54
47
  dryRun: false,
55
48
  };
@@ -63,15 +56,12 @@ describe('MLS welcomeMessage eventHandler', () => {
63
56
  it('returns a eventHandlerResult', async () => {
64
57
  const eventHandlerResult = await (0, welcomeMessage_1.handleMLSWelcomeMessage)(mockParams);
65
58
  expect(eventHandlerResult).toBeDefined();
66
- expect(eventHandlerResult.event).toEqual({ data: Uint8Array.from([1, 2, 3]), type: 'conversation.mls-welcome' });
59
+ expect(eventHandlerResult.event).toEqual({ data: 'conversationId', type: 'conversation.mls-welcome' });
67
60
  });
68
61
  it('emits new epoch event after processing a welcome message', async () => {
69
62
  jest.spyOn(mockParams.mlsService, 'getEpoch').mockResolvedValue(1);
70
63
  await (0, welcomeMessage_1.handleMLSWelcomeMessage)(mockParams);
71
- expect(mockParams.mlsService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
72
- groupId: Uint8Array.from([1, 2, 3]),
73
- epoch: 1,
74
- });
64
+ expect(mockParams.mlsService.emit).toHaveBeenCalledWith('newEpoch', { groupId: 'conversationId', epoch: 1 });
75
65
  });
76
66
  });
77
67
  });
@@ -1,5 +1,3 @@
1
- import { QualifiedId } from '@wireapp/api-client/lib/user';
2
- import { CoreCryptoError, ErrorContext, ErrorType, MlsErrorType } from '@wireapp/core-crypto';
3
1
  export declare const CORE_CRYPTO_ERROR_NAMES: {
4
2
  MlsErrorConversationAlreadyExists: string;
5
3
  MlsErrorDuplicateMessage: string;
@@ -13,44 +11,10 @@ export declare const CORE_CRYPTO_ERROR_NAMES: {
13
11
  ProteusErrorSessionNotFound: string;
14
12
  ProteusErrorRemoteIdentityChanged: string;
15
13
  MlsErrorWrongEpoch: string;
14
+ MlsErrorOrphanWelcomeMessage: string;
16
15
  };
17
16
  export declare const isCoreCryptoMLSWrongEpochError: (error: unknown) => boolean;
18
17
  export declare const isCoreCryptoMLSConversationAlreadyExistsError: (error: unknown) => boolean;
18
+ export declare const isCoreCryptoMLSOrphanWelcomeMessageError: (error: unknown) => boolean;
19
19
  export declare const shouldMLSDecryptionErrorBeIgnored: (error: unknown) => error is Error;
20
- export declare const UPLOAD_COMMIT_BUNDLE_ABORT_REASONS: {
21
- BROKEN_MLS_CONVERSATION: string;
22
- MLS_STALE_MESSAGE: string;
23
- MLS_GROUP_OUT_OF_SYNC: string;
24
- OTHER: string;
25
- };
26
- export type ConversationAlreadyExistsError = CoreCryptoError<ErrorType.Mls> & {
27
- context: Extract<ErrorContext[ErrorType.Mls], {
28
- type: MlsErrorType.ConversationAlreadyExists;
29
- }>;
30
- };
31
- type MessageRejectedError = CoreCryptoError<ErrorType.Mls> & {
32
- context: Extract<ErrorContext[ErrorType.Mls], {
33
- type: MlsErrorType.MessageRejected;
34
- }>;
35
- };
36
- export declare function isBrokenMLSConversationError(error: unknown): error is MessageRejectedError;
37
- export declare function isMLSStaleMessageError(error: unknown): error is MessageRejectedError;
38
- export declare function isMLSGroupOutOfSyncError(error: unknown): error is MessageRejectedError;
39
- export declare function getMLSGroupOutOfSyncErrorMissingUsers(error: unknown): QualifiedId[];
40
- type AbortReasonBrokenMLSConversation = {
41
- message: typeof UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.BROKEN_MLS_CONVERSATION;
42
- };
43
- type AbortReasonMLSStaleMessage = {
44
- message: typeof UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_STALE_MESSAGE;
45
- };
46
- type AbortReasonMLSGroupOutOfSync = {
47
- message: typeof UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_GROUP_OUT_OF_SYNC;
48
- missing_users: QualifiedId[];
49
- };
50
- type AbortReasonOther = {
51
- message: typeof UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.OTHER;
52
- };
53
- type AbortReasons = AbortReasonBrokenMLSConversation | AbortReasonMLSStaleMessage | AbortReasonMLSGroupOutOfSync | AbortReasonOther;
54
- export declare function serializeAbortReason(reason: AbortReasons): string;
55
- export {};
56
20
  //# sourceMappingURL=CoreCryptoMLSError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoreCryptoMLSError.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/CoreCryptoMLSError.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,eAAe,EAAE,YAAY,EAAE,SAAS,EAA6B,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;CAanC,CAAC;AAEF,eAAO,MAAM,8BAA8B,UAAW,OAAO,KAAG,OAE/D,CAAC;AAEF,eAAO,MAAM,6CAA6C,UAAW,OAAO,KAAG,OAE9E,CAAC;AAoBF,eAAO,MAAM,iCAAiC,UAAW,OAAO,KAAG,KAAK,IAAI,KAI3E,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;CAK9C,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG;IAC5E,OAAO,EAAE,OAAO,CACd,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,EAC3B;QACE,IAAI,EAAE,YAAY,CAAC,yBAAyB,CAAC;KAC9C,CACF,CAAC;CACH,CAAC;AAEF,KAAK,oBAAoB,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG;IAC3D,OAAO,EAAE,OAAO,CACd,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,EAC3B;QACE,IAAI,EAAE,YAAY,CAAC,eAAe,CAAC;KACpC,CACF,CAAC;CACH,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAM1F;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAMpF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAMtF;AAED,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,EAAE,CAOnF;AAED,KAAK,gCAAgC,GAAG;IACtC,OAAO,EAAE,OAAO,kCAAkC,CAAC,uBAAuB,CAAC;CAC5E,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,OAAO,kCAAkC,CAAC,iBAAiB,CAAC;CACtE,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,OAAO,kCAAkC,CAAC,qBAAqB,CAAC;IACzE,aAAa,EAAE,WAAW,EAAE,CAAC;CAC9B,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,OAAO,kCAAkC,CAAC,KAAK,CAAC;CAC1D,CAAC;AAEF,KAAK,YAAY,GACb,gCAAgC,GAChC,0BAA0B,GAC1B,4BAA4B,GAC5B,gBAAgB,CAAC;AAErB,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEjE"}
1
+ {"version":3,"file":"CoreCryptoMLSError.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/CoreCryptoMLSError.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;CAcnC,CAAC;AAEF,eAAO,MAAM,8BAA8B,UAAW,OAAO,KAAG,OAE/D,CAAC;AAEF,eAAO,MAAM,6CAA6C,UAAW,OAAO,KAAG,OAE9E,CAAC;AAEF,eAAO,MAAM,wCAAwC,UAAW,OAAO,KAAG,OAEzE,CAAC;AAoBF,eAAO,MAAM,iCAAiC,UAAW,OAAO,KAAG,KAAK,IAAI,KAI3E,CAAC"}
@@ -18,13 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS = exports.shouldMLSDecryptionErrorBeIgnored = exports.isCoreCryptoMLSConversationAlreadyExistsError = exports.isCoreCryptoMLSWrongEpochError = exports.CORE_CRYPTO_ERROR_NAMES = void 0;
22
- exports.isBrokenMLSConversationError = isBrokenMLSConversationError;
23
- exports.isMLSStaleMessageError = isMLSStaleMessageError;
24
- exports.isMLSGroupOutOfSyncError = isMLSGroupOutOfSyncError;
25
- exports.getMLSGroupOutOfSyncErrorMissingUsers = getMLSGroupOutOfSyncErrorMissingUsers;
26
- exports.serializeAbortReason = serializeAbortReason;
27
- const core_crypto_1 = require("@wireapp/core-crypto");
21
+ exports.shouldMLSDecryptionErrorBeIgnored = exports.isCoreCryptoMLSOrphanWelcomeMessageError = exports.isCoreCryptoMLSConversationAlreadyExistsError = exports.isCoreCryptoMLSWrongEpochError = exports.CORE_CRYPTO_ERROR_NAMES = void 0;
28
22
  exports.CORE_CRYPTO_ERROR_NAMES = {
29
23
  MlsErrorConversationAlreadyExists: 'MlsErrorConversationAlreadyExists',
30
24
  MlsErrorDuplicateMessage: 'MlsErrorDuplicateMessage',
@@ -38,6 +32,7 @@ exports.CORE_CRYPTO_ERROR_NAMES = {
38
32
  ProteusErrorSessionNotFound: 'ProteusErrorSessionNotFound',
39
33
  ProteusErrorRemoteIdentityChanged: 'ProteusErrorRemoteIdentityChanged',
40
34
  MlsErrorWrongEpoch: 'MlsErrorWrongEpoch',
35
+ MlsErrorOrphanWelcomeMessage: 'MlsErrorOrphanWelcomeMessage',
41
36
  };
42
37
  const isCoreCryptoMLSWrongEpochError = (error) => {
43
38
  return error instanceof Error && error.name === exports.CORE_CRYPTO_ERROR_NAMES.MlsErrorWrongEpoch;
@@ -47,6 +42,10 @@ const isCoreCryptoMLSConversationAlreadyExistsError = (error) => {
47
42
  return error instanceof Error && error.name === exports.CORE_CRYPTO_ERROR_NAMES.MlsErrorConversationAlreadyExists;
48
43
  };
49
44
  exports.isCoreCryptoMLSConversationAlreadyExistsError = isCoreCryptoMLSConversationAlreadyExistsError;
45
+ const isCoreCryptoMLSOrphanWelcomeMessageError = (error) => {
46
+ return error instanceof Error && error.name === exports.CORE_CRYPTO_ERROR_NAMES.MlsErrorOrphanWelcomeMessage;
47
+ };
48
+ exports.isCoreCryptoMLSOrphanWelcomeMessageError = isCoreCryptoMLSOrphanWelcomeMessageError;
50
49
  const mlsDecryptionErrorNamesToIgnore = [
51
50
  exports.CORE_CRYPTO_ERROR_NAMES.MlsErrorStaleCommit,
52
51
  exports.CORE_CRYPTO_ERROR_NAMES.MlsErrorStaleProposal,
@@ -65,37 +64,3 @@ const shouldMLSDecryptionErrorBeIgnored = (error) => {
65
64
  return (error instanceof Error && (mlsDecryptionErrorNamesToIgnore.includes(error.name) || isOtherErrorToIgnore(error)));
66
65
  };
67
66
  exports.shouldMLSDecryptionErrorBeIgnored = shouldMLSDecryptionErrorBeIgnored;
68
- exports.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS = {
69
- BROKEN_MLS_CONVERSATION: 'BROKEN_MLS_CONVERSATION',
70
- MLS_STALE_MESSAGE: 'MLS_STALE_MESSAGE',
71
- MLS_GROUP_OUT_OF_SYNC: 'MLS_GROUP_OUT_OF_SYNC',
72
- OTHER: 'OTHER',
73
- };
74
- function isBrokenMLSConversationError(error) {
75
- return ((0, core_crypto_1.isMlsMessageRejectedError)(error) &&
76
- deserializeAbortReason(error.context.context.reason).message ===
77
- exports.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.BROKEN_MLS_CONVERSATION);
78
- }
79
- function isMLSStaleMessageError(error) {
80
- return ((0, core_crypto_1.isMlsMessageRejectedError)(error) &&
81
- deserializeAbortReason(error.context.context.reason).message ===
82
- exports.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_STALE_MESSAGE);
83
- }
84
- function isMLSGroupOutOfSyncError(error) {
85
- return ((0, core_crypto_1.isMlsMessageRejectedError)(error) &&
86
- deserializeAbortReason(error.context.context.reason).message ===
87
- exports.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_GROUP_OUT_OF_SYNC);
88
- }
89
- function getMLSGroupOutOfSyncErrorMissingUsers(error) {
90
- if (isMLSGroupOutOfSyncError(error)) {
91
- const reason = deserializeAbortReason(error.context.context.reason);
92
- return reason.missing_users;
93
- }
94
- throw new Error('Error is not MLSGroupOutOfSyncError');
95
- }
96
- function serializeAbortReason(reason) {
97
- return JSON.stringify(reason);
98
- }
99
- function deserializeAbortReason(reasonString) {
100
- return JSON.parse(reasonString);
101
- }