@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
@@ -51,18 +51,8 @@ class TeamService {
51
51
  updateTeam(teamId, teamData) {
52
52
  return this.apiClient.api.teams.team.putTeam(teamId, teamData);
53
53
  }
54
- commonConfig = null;
55
- commonConfigFetchedAt = null;
56
- CACHE_DURATION_MS = 24 * 60 * 60 * 1000; // 24 hours
57
- async getCommonFeatureConfig() {
58
- const now = Date.now();
59
- if (this.commonConfig == null ||
60
- this.commonConfigFetchedAt == null ||
61
- now - this.commonConfigFetchedAt > this.CACHE_DURATION_MS) {
62
- this.commonConfig = await this.apiClient.api.teams.feature.getAllFeatures();
63
- this.commonConfigFetchedAt = now;
64
- }
65
- return this.commonConfig;
54
+ getCommonFeatureConfig() {
55
+ return this.apiClient.api.teams.feature.getAllFeatures();
66
56
  }
67
57
  }
68
58
  exports.TeamService = TeamService;
@@ -1,4 +1,4 @@
1
- import { CONVERSATION_PROTOCOL } from '@wireapp/api-client/lib/team';
1
+ import { ConversationProtocol } from '@wireapp/api-client/lib/conversation';
2
2
  import { QualifiedId, User } from '@wireapp/api-client/lib/user/';
3
3
  import { APIClient } from '@wireapp/api-client';
4
4
  export declare class UserService {
@@ -13,6 +13,6 @@ export declare class UserService {
13
13
  /**
14
14
  * Get the list of other user's supported protocols.
15
15
  */
16
- getUserSupportedProtocols(userId: QualifiedId): Promise<CONVERSATION_PROTOCOL[]>;
16
+ getUserSupportedProtocols(userId: QualifiedId): Promise<ConversationProtocol[]>;
17
17
  }
18
18
  //# sourceMappingURL=UserService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;;;;;IAO5C;;OAEG;IACU,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAS9F"}
1
+ {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;;;;;IAO5C;;OAEG;IACU,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAS7F"}
@@ -19,7 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.UserService = void 0;
22
- const team_1 = require("@wireapp/api-client/lib/team");
22
+ const conversation_1 = require("@wireapp/api-client/lib/conversation");
23
23
  class UserService {
24
24
  apiClient;
25
25
  constructor(apiClient) {
@@ -40,10 +40,10 @@ class UserService {
40
40
  async getUserSupportedProtocols(userId) {
41
41
  // Clients that uses version below the one supporting MLS, are not aware of user's supported protocols, we default to Proteus in this case.
42
42
  if (!this.apiClient.backendFeatures.supportsMLS) {
43
- return [team_1.CONVERSATION_PROTOCOL.PROTEUS];
43
+ return [conversation_1.ConversationProtocol.PROTEUS];
44
44
  }
45
45
  const supportedProtocols = await this.apiClient.api.user.getUserSupportedProtocols(userId);
46
- return supportedProtocols.length > 0 ? supportedProtocols : [team_1.CONVERSATION_PROTOCOL.PROTEUS];
46
+ return supportedProtocols.length > 0 ? supportedProtocols : [conversation_1.ConversationProtocol.PROTEUS];
47
47
  }
48
48
  }
49
49
  exports.UserService = UserService;
@@ -1 +1 @@
1
- {"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,WAAW,EAAC,MAAM,uCAAuC,CAAC;AAEvH,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,oBAAoB,CAS5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAM1D;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,IAAI,eAAe,CAG7F"}
1
+ {"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAEZ,eAAe,EACf,oBAAoB,EACpB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,oBAAoB,CAS5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAM1D;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,IAAI,eAAe,CAG7F"}
@@ -23,7 +23,7 @@ exports.isQualifiedIdArray = isQualifiedIdArray;
23
23
  exports.isQualifiedUserClients = isQualifiedUserClients;
24
24
  exports.isUserClients = isUserClients;
25
25
  exports.isMLSConversation = isMLSConversation;
26
- const team_1 = require("@wireapp/api-client/lib/team");
26
+ const conversation_1 = require("@wireapp/api-client/lib/conversation/");
27
27
  function isStringArray(obj) {
28
28
  return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
29
29
  }
@@ -52,5 +52,5 @@ function isUserClients(obj) {
52
52
  }
53
53
  function isMLSConversation(conversation) {
54
54
  const { protocol, epoch, group_id } = conversation;
55
- return protocol === team_1.CONVERSATION_PROTOCOL.MLS && epoch !== undefined && group_id !== undefined;
55
+ return protocol === conversation_1.ConversationProtocol.MLS && epoch !== undefined && group_id !== undefined;
56
56
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
12
12
  },
13
13
  "dependencies": {
14
- "@wireapp/api-client": "^27.90.1-beta.18.d7a6c4c53",
14
+ "@wireapp/api-client": "^27.90.1-beta.22.f6fd03fe6",
15
15
  "@wireapp/commons": "^5.4.9",
16
16
  "@wireapp/core-crypto": "9.1.2",
17
17
  "@wireapp/cryptobox": "12.8.0",
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "46.46.6-beta.10.d7a6c4c53",
65
- "gitHead": "d7a6c4c5342038b51cb09a95e8781aad094a42b6"
64
+ "version": "46.46.6-beta.14.f6fd03fe6",
65
+ "gitHead": "f6fd03fe61d83ba1f03786f6d202e1e19478c743"
66
66
  }
@@ -1,7 +0,0 @@
1
- import { Task } from '@wireapp/promise-queue';
2
- export declare function queueProposal<T>(cb: Task<T>): Promise<T>;
3
- export declare function resumeProposalProcessing(): void;
4
- export declare function pauseProposalProcessing(): void;
5
- export declare function getProposalQueueLength(): number;
6
- export declare function flushProposalsQueue(): void;
7
- //# sourceMappingURL=IncomingProposalsQueue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IncomingProposalsQueue.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,IAAI,EAAe,MAAM,wBAAwB,CAAC;AAM1D,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAGxD;AAED,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAED,wBAAgB,sBAAsB,WAErC;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2025 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.queueProposal = queueProposal;
22
- exports.resumeProposalProcessing = resumeProposalProcessing;
23
- exports.pauseProposalProcessing = pauseProposalProcessing;
24
- exports.getProposalQueueLength = getProposalQueueLength;
25
- exports.flushProposalsQueue = flushProposalsQueue;
26
- const commons_1 = require("@wireapp/commons");
27
- const promise_queue_1 = require("@wireapp/promise-queue");
28
- const logger = commons_1.LogFactory.getLogger('@wireapp/core/mls/IncomingProposalsQueue');
29
- const proposalsQueue = new promise_queue_1.PromiseQueue({ name: 'incoming-proposals-queue', paused: true });
30
- function queueProposal(cb) {
31
- logger.info('Queueing proposal for processing');
32
- return proposalsQueue.push(cb);
33
- }
34
- function resumeProposalProcessing() {
35
- logger.info('Resuming proposal processing');
36
- proposalsQueue.resume();
37
- }
38
- function pauseProposalProcessing() {
39
- logger.info('Pausing proposal processing');
40
- proposalsQueue.pause();
41
- }
42
- function getProposalQueueLength() {
43
- return proposalsQueue.getLength();
44
- }
45
- function flushProposalsQueue() {
46
- logger.info('Flushing proposals queue');
47
- proposalsQueue.flush();
48
- }
@@ -1,2 +0,0 @@
1
- export * from './IncomingProposalsQueue';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=CoreCryptoMLSError.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CoreCryptoMLSError.test.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.ts"],"names":[],"mappings":""}
@@ -1,124 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2025 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 core_crypto_1 = require("@wireapp/core-crypto");
22
- const CoreCryptoMLSError_1 = require("./CoreCryptoMLSError");
23
- describe('CoreCryptoMLSError helpers', () => {
24
- describe('epoch and conversation existence guards', () => {
25
- it('detects MlsErrorWrongEpoch by name', () => {
26
- const err = new Error('wrong epoch');
27
- err.name = CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorWrongEpoch;
28
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSWrongEpochError)(err)).toBe(true);
29
- const other = new Error('nope');
30
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSWrongEpochError)(other)).toBe(false);
31
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSWrongEpochError)('not-an-error')).toBe(false);
32
- });
33
- it('detects MlsErrorConversationAlreadyExists by name', () => {
34
- const err = new Error('already exists');
35
- err.name = CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorConversationAlreadyExists;
36
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSConversationAlreadyExistsError)(err)).toBe(true);
37
- const other = new Error('nope');
38
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSConversationAlreadyExistsError)(other)).toBe(false);
39
- expect((0, CoreCryptoMLSError_1.isCoreCryptoMLSConversationAlreadyExistsError)(42)).toBe(false);
40
- });
41
- });
42
- describe('shouldMLSDecryptionErrorBeIgnored', () => {
43
- const namesToIgnore = [
44
- CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorStaleCommit,
45
- CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorStaleProposal,
46
- CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorDuplicateMessage,
47
- CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorBufferedFutureMessage,
48
- CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorUnmergedPendingGroup,
49
- ];
50
- it('returns true for known ignorable error names', () => {
51
- for (const name of namesToIgnore) {
52
- const err = new Error('ignore me');
53
- err.name = name;
54
- expect((0, CoreCryptoMLSError_1.shouldMLSDecryptionErrorBeIgnored)(err)).toBe(true);
55
- }
56
- });
57
- it('returns true for generic MlsErrorOther with expected commit/proposals message', () => {
58
- const err = new Error('Incoming message is a commit for which we have not yet received all the proposals: details...');
59
- err.name = CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorOther;
60
- expect((0, CoreCryptoMLSError_1.shouldMLSDecryptionErrorBeIgnored)(err)).toBe(true);
61
- });
62
- it('returns false for other errors or non-Error values', () => {
63
- const err = new Error('some real failure');
64
- err.name = 'RandomErrorName';
65
- expect((0, CoreCryptoMLSError_1.shouldMLSDecryptionErrorBeIgnored)(err)).toBe(false);
66
- expect((0, CoreCryptoMLSError_1.shouldMLSDecryptionErrorBeIgnored)('not-an-error')).toBe(false);
67
- });
68
- });
69
- describe('abort reason based guards', () => {
70
- function makeRejectedError(reason) {
71
- return {
72
- type: core_crypto_1.ErrorType.Mls,
73
- context: {
74
- type: core_crypto_1.MlsErrorType.MessageRejected,
75
- context: {
76
- reason,
77
- },
78
- },
79
- };
80
- }
81
- it('detects broken MLS conversation errors', () => {
82
- const err = makeRejectedError((0, CoreCryptoMLSError_1.serializeAbortReason)({ message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.BROKEN_MLS_CONVERSATION }));
83
- expect((0, CoreCryptoMLSError_1.isBrokenMLSConversationError)(err)).toBe(true);
84
- expect((0, CoreCryptoMLSError_1.isMLSStaleMessageError)(err)).toBe(false);
85
- expect((0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)(err)).toBe(false);
86
- });
87
- it('detects MLS stale message errors', () => {
88
- const err = makeRejectedError((0, CoreCryptoMLSError_1.serializeAbortReason)({ message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_STALE_MESSAGE }));
89
- expect((0, CoreCryptoMLSError_1.isMLSStaleMessageError)(err)).toBe(true);
90
- expect((0, CoreCryptoMLSError_1.isBrokenMLSConversationError)(err)).toBe(false);
91
- expect((0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)(err)).toBe(false);
92
- });
93
- it('detects MLS group out-of-sync errors and exposes missing users', () => {
94
- const missing = [
95
- { id: 'u1', domain: 'example.com' },
96
- { id: 'u2', domain: 'example.com' },
97
- ];
98
- const err = makeRejectedError((0, CoreCryptoMLSError_1.serializeAbortReason)({
99
- message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_GROUP_OUT_OF_SYNC,
100
- missing_users: missing,
101
- }));
102
- expect((0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)(err)).toBe(true);
103
- expect((0, CoreCryptoMLSError_1.getMLSGroupOutOfSyncErrorMissingUsers)(err)).toEqual(missing);
104
- });
105
- it('throws when getting missing users from non-MLSGroupOutOfSync error', () => {
106
- const err = makeRejectedError((0, CoreCryptoMLSError_1.serializeAbortReason)({ message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_STALE_MESSAGE }));
107
- expect(() => (0, CoreCryptoMLSError_1.getMLSGroupOutOfSyncErrorMissingUsers)(err)).toThrow('Error is not MLSGroupOutOfSyncError');
108
- });
109
- it('returns false for non-mls message rejected errors', () => {
110
- const err = {
111
- type: core_crypto_1.ErrorType.Mls,
112
- context: {
113
- type: core_crypto_1.MlsErrorType.Other,
114
- context: {
115
- reason: (0, CoreCryptoMLSError_1.serializeAbortReason)({ message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_STALE_MESSAGE }),
116
- },
117
- },
118
- };
119
- expect((0, CoreCryptoMLSError_1.isBrokenMLSConversationError)(err)).toBe(false);
120
- expect((0, CoreCryptoMLSError_1.isMLSStaleMessageError)(err)).toBe(false);
121
- expect((0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)(err)).toBe(false);
122
- });
123
- });
124
- });
@@ -1,78 +0,0 @@
1
- /**
2
- * A small, library-free Chain of Responsibility to normalize diverse MLS/core-crypto/backend
3
- * errors into a closed {@link DomainMlsError} union. This module is side-effect free and only
4
- * classifies errors; recovery actions are implemented by a separate orchestrator.
5
- */
6
- import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
7
- import { QualifiedId } from '@wireapp/api-client/lib/user';
8
- import { MlsErrorType } from '@wireapp/core-crypto';
9
- /**
10
- * Domain error taxonomy used by policies and orchestrator.
11
- *
12
- * These are intentionally decoupled from concrete error classes to keep the orchestrator stable.
13
- */
14
- export type DomainMlsErrorType = MlsErrorType | 'KeyMaterialUpdateFailure' | 'GroupOutOfSync' | 'GroupNotEstablished';
15
- /**
16
- * Normalized error shape produced by the mapper.
17
- */
18
- export type DomainMlsError = {
19
- /** The domain classification. */
20
- type: DomainMlsErrorType;
21
- /** Optional human-friendly message for logging only. */
22
- message?: string;
23
- /** The original error value, preserved for debugging. */
24
- cause?: unknown;
25
- /** Lightweight, structured context to inform recovery. */
26
- context?: {
27
- /** Conversation qualified id if known. */
28
- qualifiedConversationId?: QualifiedId;
29
- /** MLS group id (base64) if available. */
30
- groupId?: string;
31
- /** Expected/observed epoch number if relevant. */
32
- epoch?: number | bigint;
33
- /** Users reported as missing by the backend or MLS layer. */
34
- missingUsers?: QualifiedId[];
35
- /** Subconversation context (e.g. conference). */
36
- subconvId?: SUBCONVERSATION_ID;
37
- /** HTTP status when the source error came from the backend. */
38
- httpStatus?: number;
39
- };
40
- };
41
- /**
42
- * Optional context supplied by the caller to improve mapping precision.
43
- */
44
- export type ErrorContextInput = {
45
- qualifiedConversationId?: QualifiedId;
46
- groupId?: string;
47
- subconvId?: SUBCONVERSATION_ID;
48
- };
49
- /** One handler in the chain. Must be side-effect free. */
50
- export interface ErrorHandler {
51
- /** True if this handler can map the provided error given optional context. */
52
- canHandle(error: unknown, context?: ErrorContextInput): boolean;
53
- /** Return a mapped error or undefined to defer to later handlers. */
54
- map(error: unknown, context?: ErrorContextInput): DomainMlsError;
55
- }
56
- /** Public mapper interface returning a normalized {@link DomainMlsError}. */
57
- export interface MlsErrorMapper {
58
- map(error: unknown, context?: ErrorContextInput): DomainMlsError;
59
- }
60
- /**
61
- * Deterministic chain execution
62
- *
63
- * The first handler that both
64
- * canHandle and returns a non-undefined mapping wins. If none map, an Unknown error is returned.
65
- */
66
- export declare class ChainedMlsErrorMapper implements MlsErrorMapper {
67
- private readonly handlers;
68
- constructor(handlers: ErrorHandler[]);
69
- map(error: unknown, context?: ErrorContextInput): DomainMlsError;
70
- }
71
- /**
72
- * Factory for the default mapper chain used by the orchestrator.
73
- *
74
- * Order matters: earlier handlers have higher precedence. The selection reflects
75
- * the most common recovery decisions needed by the orchestrator.
76
- */
77
- export declare function createDefaultMlsErrorMapper(): MlsErrorMapper;
78
- //# sourceMappingURL=MlsErrorMapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MlsErrorMapper.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/recovery/MlsErrorMapper.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AAEH,OAAO,EAAC,kBAAkB,EAA+C,MAAM,sCAAsC,CAAC;AACtH,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAA+D,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAYhH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,0BAA0B,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AAEtH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iCAAiC;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE;QACR,0CAA0C;QAC1C,uBAAuB,CAAC,EAAE,WAAW,CAAC;QACtC,0CAA0C;QAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,kDAAkD;QAClD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,6DAA6D;QAC7D,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;QAC7B,iDAAiD;QACjD,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,uBAAuB,CAAC,EAAE,WAAW,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAChE,qEAAqE;IACrE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAC;CAClE;AAED,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAC;CAClE;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;gBAE9B,QAAQ,EAAE,YAAY,EAAE;IAIpC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,cAAc;CAYjE;AA4FD;;;;;GAKG;AACH,wBAAgB,2BAA2B,IAAI,cAAc,CAS5D"}
@@ -1,173 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2025 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.ChainedMlsErrorMapper = void 0;
22
- exports.createDefaultMlsErrorMapper = createDefaultMlsErrorMapper;
23
- /**
24
- * A small, library-free Chain of Responsibility to normalize diverse MLS/core-crypto/backend
25
- * errors into a closed {@link DomainMlsError} union. This module is side-effect free and only
26
- * classifies errors; recovery actions are implemented by a separate orchestrator.
27
- */
28
- const conversation_1 = require("@wireapp/api-client/lib/conversation");
29
- const bazinga64_1 = require("bazinga64");
30
- const core_crypto_1 = require("@wireapp/core-crypto");
31
- // Reuse existing type-guards from the MLS layer
32
- const CoreCryptoMLSError_1 = require("../MLSService/CoreCryptoMLSError");
33
- /**
34
- * Deterministic chain execution
35
- *
36
- * The first handler that both
37
- * canHandle and returns a non-undefined mapping wins. If none map, an Unknown error is returned.
38
- */
39
- class ChainedMlsErrorMapper {
40
- handlers;
41
- constructor(handlers) {
42
- this.handlers = handlers.slice();
43
- }
44
- map(error, context) {
45
- for (const handler of this.handlers) {
46
- if (handler.canHandle(error, context)) {
47
- const mapped = handler.map(error, context);
48
- if (mapped) {
49
- return mapped;
50
- }
51
- }
52
- }
53
- return FallbackHandler.map(error, context);
54
- }
55
- }
56
- exports.ChainedMlsErrorMapper = ChainedMlsErrorMapper;
57
- /** ---------------------- Concrete handlers ---------------------- */
58
- /** Wrong epoch or stale message from MLS/core-crypto/backend. */
59
- const WrongEpochHandler = {
60
- canHandle: err => (0, CoreCryptoMLSError_1.isCoreCryptoMLSWrongEpochError)?.(err) || (0, CoreCryptoMLSError_1.isMLSStaleMessageError)?.(err) || err instanceof conversation_1.MLSStaleMessageError,
61
- map: (err, context) => ({
62
- type: core_crypto_1.MlsErrorType.WrongEpoch,
63
- message: 'Epoch mismatch or stale message',
64
- cause: err,
65
- context: {
66
- qualifiedConversationId: context?.qualifiedConversationId,
67
- groupId: context?.groupId,
68
- subconvId: context?.subconvId,
69
- },
70
- }),
71
- };
72
- /** Local MLS state indicates the conversation is broken/not established. */
73
- const BrokenConversationHandler = {
74
- canHandle: err => (0, CoreCryptoMLSError_1.isBrokenMLSConversationError)?.(err) === true,
75
- map: (err, context) => ({
76
- type: 'GroupNotEstablished',
77
- message: 'Broken MLS conversation',
78
- cause: err,
79
- context: { qualifiedConversationId: context?.qualifiedConversationId, groupId: context?.groupId },
80
- }),
81
- };
82
- /** Backend/MLS reports missing users; group is out-of-sync. */
83
- const GroupOutOfSyncHandler = {
84
- canHandle: err => (0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)?.(err) === true || err instanceof conversation_1.MLSGroupOutOfSyncError,
85
- map: (err, context) => {
86
- let missingUsers = [];
87
- if ((0, CoreCryptoMLSError_1.isMLSGroupOutOfSyncError)?.(err)) {
88
- missingUsers = (0, CoreCryptoMLSError_1.getMLSGroupOutOfSyncErrorMissingUsers)(err);
89
- }
90
- else if (err instanceof conversation_1.MLSGroupOutOfSyncError) {
91
- missingUsers = err.missing_users;
92
- }
93
- if (missingUsers.length === 0) {
94
- throw new Error('Error is not a GroupOutOfSync error with missing users');
95
- }
96
- return {
97
- type: 'GroupOutOfSync',
98
- message: 'Group out of sync; missing users detected',
99
- cause: err,
100
- context: { qualifiedConversationId: context?.qualifiedConversationId, groupId: context?.groupId, missingUsers },
101
- };
102
- },
103
- };
104
- /** core-crypto indicates a local group already exists for the welcome's group id. */
105
- const ConversationAlreadyExistsHandler = {
106
- canHandle: error => (0, core_crypto_1.isMlsConversationAlreadyExistsError)?.(error) === true,
107
- map: (error, context) => {
108
- if (!(0, core_crypto_1.isMlsConversationAlreadyExistsError)(error)) {
109
- throw new Error('Error is not a ConversationAlreadyExists error');
110
- }
111
- const groupId = tryExtractGroupIdFromCoreCryptoError(error);
112
- return {
113
- type: core_crypto_1.MlsErrorType.ConversationAlreadyExists,
114
- message: 'Conversation already exists',
115
- cause: error,
116
- context: { groupId, qualifiedConversationId: context?.qualifiedConversationId },
117
- };
118
- },
119
- };
120
- /** Orphan welcome (no matching state); caller should try to join. */
121
- const OrphanWelcomeHandler = {
122
- canHandle: err => (0, core_crypto_1.isMlsOrphanWelcomeError)?.(err) === true,
123
- map: (err, context) => ({
124
- type: core_crypto_1.MlsErrorType.OrphanWelcome,
125
- message: 'Orphan welcome message',
126
- cause: err,
127
- context: { qualifiedConversationId: context?.qualifiedConversationId },
128
- }),
129
- };
130
- /** Fallback classification when no handler matches. */
131
- const FallbackHandler = {
132
- canHandle: () => true,
133
- map: (err, context) => err instanceof Error
134
- ? { type: core_crypto_1.MlsErrorType.Other, message: err.message, cause: err, context }
135
- : { type: core_crypto_1.MlsErrorType.Other, message: String(err), cause: err, context },
136
- };
137
- /**
138
- * Factory for the default mapper chain used by the orchestrator.
139
- *
140
- * Order matters: earlier handlers have higher precedence. The selection reflects
141
- * the most common recovery decisions needed by the orchestrator.
142
- */
143
- function createDefaultMlsErrorMapper() {
144
- return new ChainedMlsErrorMapper([
145
- WrongEpochHandler,
146
- BrokenConversationHandler,
147
- GroupOutOfSyncHandler,
148
- ConversationAlreadyExistsHandler,
149
- OrphanWelcomeHandler,
150
- FallbackHandler,
151
- ]);
152
- }
153
- /** ---------------------- helpers ---------------------- */
154
- /**
155
- * Extract the base64 group id from a core-crypto error if present.
156
- *
157
- * core-crypto encodes the conversation id bytes under `error.context.context.conversationId`.
158
- * We convert the byte array to base64 for uniform handling in higher layers.
159
- */
160
- function tryExtractGroupIdFromCoreCryptoError(err) {
161
- try {
162
- // core-crypto error.context?.context?.conversationId is a byte array (number[])
163
- const conversationIdArray = err?.context?.context?.conversationId;
164
- if (!conversationIdArray) {
165
- return undefined;
166
- }
167
- return bazinga64_1.Encoder.toBase64(new Uint8Array(conversationIdArray)).asString;
168
- }
169
- catch {
170
- return undefined;
171
- }
172
- }
173
- // Intentionally not handling HTTP/network errors here; let them bubble up unmodified.
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MlsErrorMapper.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MlsErrorMapper.test.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/recovery/MlsErrorMapper.test.ts"],"names":[],"mappings":""}