@wireapp/core 40.5.3-draft-20-cc.3 → 40.5.3-draft-20-cc-1.3

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 (143) hide show
  1. package/lib/Account.d.ts +9 -7
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +32 -35
  4. package/lib/CoreError.js +1 -1
  5. package/lib/broadcast/BroadcastService.d.ts +2 -11
  6. package/lib/broadcast/BroadcastService.d.ts.map +1 -1
  7. package/lib/broadcast/BroadcastService.js +5 -39
  8. package/lib/client/ClientDatabaseRepository.d.ts +5 -5
  9. package/lib/client/ClientDatabaseRepository.d.ts.map +1 -1
  10. package/lib/client/ClientDatabaseRepository.js +10 -17
  11. package/lib/client/ClientService.d.ts +5 -1
  12. package/lib/client/ClientService.d.ts.map +1 -1
  13. package/lib/client/ClientService.js +11 -9
  14. package/lib/connection/ConnectionService.d.ts +2 -2
  15. package/lib/connection/ConnectionService.d.ts.map +1 -1
  16. package/lib/connection/ConnectionService.js +2 -2
  17. package/lib/conversation/AssetTransferState.js +1 -1
  18. package/lib/conversation/ConversationService/ConversationService.d.ts +12 -5
  19. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  20. package/lib/conversation/ConversationService/ConversationService.js +26 -11
  21. package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
  22. package/lib/conversation/ConversationService/ConversationService.types.d.ts +12 -11
  23. package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
  24. package/lib/conversation/ConversationService/ConversationService.types.js +1 -1
  25. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts +1 -1
  26. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
  27. package/lib/conversation/GenericMessageType.js +1 -1
  28. package/lib/conversation/ReactionType.d.ts +1 -4
  29. package/lib/conversation/ReactionType.d.ts.map +1 -1
  30. package/lib/conversation/ReactionType.js +0 -6
  31. package/lib/conversation/message/Message.types.js +1 -1
  32. package/lib/conversation/message/MessageBuilder.d.ts +1 -1
  33. package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
  34. package/lib/conversation/message/MessageBuilder.js +2 -2
  35. package/lib/conversation/message/MessageService.d.ts +6 -31
  36. package/lib/conversation/message/MessageService.d.ts.map +1 -1
  37. package/lib/conversation/message/MessageService.js +19 -162
  38. package/lib/conversation/message/MessageService.test.js +151 -141
  39. package/lib/conversation/message/PayloadBundle.js +1 -1
  40. package/lib/conversation/message/UserClientsUtil.d.ts +14 -10
  41. package/lib/conversation/message/UserClientsUtil.d.ts.map +1 -1
  42. package/lib/conversation/message/UserClientsUtil.js +21 -11
  43. package/lib/conversation/message/UserClientsUtils.test.js +5 -9
  44. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts +1 -1
  45. package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts.map +1 -1
  46. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +1 -1
  47. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  48. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +7 -2
  49. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  50. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -0
  51. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -1
  52. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +20 -8
  53. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  54. package/lib/messagingProtocols/mls/MLSService/MLSService.js +81 -40
  55. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +9 -0
  56. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts +1 -1
  57. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.d.ts.map +1 -1
  58. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +5 -5
  59. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +3 -3
  60. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +13 -0
  61. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +1 -0
  62. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +67 -0
  63. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +2 -0
  64. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +1 -0
  65. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +72 -0
  66. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +10 -5
  67. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  68. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +33 -11
  69. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts +2 -3
  70. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -1
  71. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +8 -9
  72. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts +4 -9
  73. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -1
  74. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +10 -24
  75. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.js +2 -10
  76. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +1 -2
  77. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
  78. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +3 -3
  79. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +2 -2
  80. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  81. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +1 -1
  82. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -1
  83. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +2 -2
  84. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +14 -7
  85. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  86. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +31 -35
  87. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +1 -1
  88. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  89. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -3
  90. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +109 -89
  91. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +6 -9
  92. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  93. package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts +4 -10
  94. package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
  95. package/lib/messagingProtocols/proteus/Utility/Recipients.js +16 -16
  96. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +15 -10
  97. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
  98. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +80 -92
  99. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +70 -54
  100. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +5 -14
  101. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  102. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +3 -35
  103. package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts +2 -2
  104. package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts.map +1 -1
  105. package/lib/notification/NotificationDatabaseRepository.js +1 -1
  106. package/lib/notification/Notifications.types.js +1 -1
  107. package/lib/user/UserService.d.ts +6 -17
  108. package/lib/user/UserService.d.ts.map +1 -1
  109. package/lib/user/UserService.js +2 -47
  110. package/lib/util/TaskScheduler/TaskScheduler.d.ts +4 -1
  111. package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
  112. package/lib/util/TaskScheduler/TaskScheduler.js +24 -3
  113. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +7 -0
  114. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +1 -0
  115. package/lib/util/TaskScheduler/TaskScheduler.store.js +34 -0
  116. package/lib/util/TypePredicateUtil.d.ts +0 -1
  117. package/lib/util/TypePredicateUtil.d.ts.map +1 -1
  118. package/lib/util/TypePredicateUtil.js +1 -2
  119. package/package.json +5 -5
  120. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts +0 -2
  121. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts.map +0 -1
  122. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.js +0 -35
  123. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +0 -11
  124. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts.map +0 -1
  125. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +0 -50
  126. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts +0 -2
  127. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts.map +0 -1
  128. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.js +0 -39
  129. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts +0 -4
  130. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts.map +0 -1
  131. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.js +0 -35
  132. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts +0 -2
  133. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts.map +0 -1
  134. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.js +0 -35
  135. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts +0 -25
  136. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts.map +0 -1
  137. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.js +0 -93
  138. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts +0 -2
  139. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts.map +0 -1
  140. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.js +0 -66
  141. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts +0 -2
  142. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts.map +0 -1
  143. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.js +0 -35
package/lib/Account.d.ts CHANGED
@@ -95,15 +95,16 @@ export declare class Account extends TypedEventEmitter<Events> {
95
95
  /**
96
96
  * Will set the APIClient to use a specific version of the API (by default uses version 0)
97
97
  * It will fetch the API Config and use the highest possible version
98
- * @param acceptedVersions Which version the consumer supports
99
- * @param useDevVersion allow the api-client to use development version of the api (if present). The dev version also need to be listed on the supportedVersions given as parameters
98
+ * @param min mininum version to use
99
+ * @param max maximum version to use
100
+ * @param allowDev allow the api-client to use development version of the api (if present). The dev version also need to be listed on the supportedVersions given as parameters
100
101
  * If we have version 2 that is a dev version, this is going to be the output of those calls
101
- * - useVersion([0, 1, 2], true) > version 2 is used
102
- * - useVersion([0, 1, 2], false) > version 1 is used
103
- * - useVersion([0, 1], true) > version 1 is used
102
+ * - useVersion(0, 2, true) > version 2 is used
103
+ * - useVersion(0, 2) > version 1 is used
104
+ * - useVersion(0, 1, true) > version 1 is used
104
105
  * @return The highest version that is both supported by client and backend
105
106
  */
106
- useAPIVersion(supportedVersions: number[], useDevVersion?: boolean): Promise<BackendFeatures>;
107
+ useAPIVersion(min: number, max: number, allowDev?: boolean): Promise<BackendFeatures>;
107
108
  private persistCookie;
108
109
  get clientId(): string;
109
110
  get userId(): string;
@@ -136,7 +137,8 @@ export declare class Account extends TypedEventEmitter<Events> {
136
137
  *
137
138
  * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
138
139
  */
139
- initClient(client?: RegisteredClient): Promise<RegisteredClient | undefined>;
140
+ initClient(client: RegisteredClient): Promise<RegisteredClient>;
141
+ initClient(): Promise<RegisteredClient | undefined>;
140
142
  private buildCryptoClient;
141
143
  /**
142
144
  * In order to be able to send MLS messages, the core needs a few information from the consumer.
@@ -1 +1 @@
1
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AGG;IACU,MAAM,CAAC,SAAS,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9D;;OAEG;YACW,IAAI;IAOlB;;;;;;OAMG;IACI,MAAM,CAAC,EACZ,OAAkB,EAClB,wBAAmC,EACnC,4BAAuC,EACvC,qBAAgC,EAChC,MAAc,GACf,GAAE;QACD;;;;WAIG;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;QAE7E;;WAEG;QACH,4BAA4B,CAAC,EAAE,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;QAEtF;;WAEG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
package/lib/Account.js CHANGED
@@ -49,6 +49,7 @@ const linkPreview_1 = require("./linkPreview");
49
49
  const mls_1 = require("./messagingProtocols/mls");
50
50
  const proteus_1 = require("./messagingProtocols/proteus");
51
51
  const CryptoClient_1 = require("./messagingProtocols/proteus/ProteusService/CryptoClient");
52
+ const cryptoMigrationStateStore_1 = require("./messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore");
52
53
  const notification_1 = require("./notification/");
53
54
  const self_1 = require("./self/");
54
55
  const CoreDB_1 = require("./storage/CoreDB");
@@ -62,7 +63,7 @@ var EVENTS;
62
63
  * An unknown client is a client we don't yet have a session with
63
64
  */
64
65
  EVENTS["NEW_SESSION"] = "new_session";
65
- })(EVENTS = exports.EVENTS || (exports.EVENTS = {}));
66
+ })(EVENTS || (exports.EVENTS = EVENTS = {}));
66
67
  var ConnectionState;
67
68
  (function (ConnectionState) {
68
69
  /** The websocket is closed and notifications stream is not being processed */
@@ -73,7 +74,7 @@ var ConnectionState;
73
74
  ConnectionState["PROCESSING_NOTIFICATIONS"] = "processing_notifications";
74
75
  /** The websocket is open and message will go through and notifications stream is fully processed */
75
76
  ConnectionState["LIVE"] = "live";
76
- })(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));
77
+ })(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
77
78
  const coreDefaultClient = {
78
79
  classification: client_1.ClientClassification.DESKTOP,
79
80
  cookieLabel: 'default',
@@ -109,16 +110,17 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
109
110
  /**
110
111
  * Will set the APIClient to use a specific version of the API (by default uses version 0)
111
112
  * It will fetch the API Config and use the highest possible version
112
- * @param acceptedVersions Which version the consumer supports
113
- * @param useDevVersion allow the api-client to use development version of the api (if present). The dev version also need to be listed on the supportedVersions given as parameters
113
+ * @param min mininum version to use
114
+ * @param max maximum version to use
115
+ * @param allowDev allow the api-client to use development version of the api (if present). The dev version also need to be listed on the supportedVersions given as parameters
114
116
  * If we have version 2 that is a dev version, this is going to be the output of those calls
115
- * - useVersion([0, 1, 2], true) > version 2 is used
116
- * - useVersion([0, 1, 2], false) > version 1 is used
117
- * - useVersion([0, 1], true) > version 1 is used
117
+ * - useVersion(0, 2, true) > version 2 is used
118
+ * - useVersion(0, 2) > version 1 is used
119
+ * - useVersion(0, 1, true) > version 1 is used
118
120
  * @return The highest version that is both supported by client and backend
119
121
  */
120
- async useAPIVersion(supportedVersions, useDevVersion) {
121
- const features = await this.apiClient.useVersion(supportedVersions, useDevVersion);
122
+ async useAPIVersion(min, max, allowDev) {
123
+ const features = await this.apiClient.useVersion(min, max, allowDev);
122
124
  this.backendFeatures = features;
123
125
  return features;
124
126
  }
@@ -173,8 +175,9 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
173
175
  if (!this.service || !this.apiClient.context || !this.storeEngine) {
174
176
  throw new Error('Services are not set or context not initialized.');
175
177
  }
178
+ // we reset the services to re-instantiate a new CryptoClient instance
179
+ await this.initServices(this.apiClient.context);
176
180
  const initialPreKeys = await this.service.proteus.createClient(entropyData);
177
- await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
178
181
  const client = await this.service.client.register(loginData, clientInfo, initialPreKeys);
179
182
  if (this.service.mls) {
180
183
  const { userId, domain = '' } = this.apiClient.context;
@@ -182,15 +185,9 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
182
185
  }
183
186
  this.logger.info(`Created new client {mls: ${!!this.service.mls}, id: ${client.id}}`);
184
187
  await this.service.notification.initializeNotificationStream();
185
- await this.service.client.synchronizeClients();
186
- await this.initClient(client);
187
- return client;
188
+ await this.service.client.synchronizeClients(client.id);
189
+ return this.initClient(client);
188
190
  }
189
- /**
190
- * Will initiate all the cryptographic material of the device and setup all the background tasks.
191
- *
192
- * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
193
- */
194
191
  async initClient(client) {
195
192
  if (!this.service || !this.apiClient.context || !this.storeEngine) {
196
193
  throw new Error('Services are not set.');
@@ -211,19 +208,26 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
211
208
  }
212
209
  // initialize schedulers for pending mls proposals once client is initialized
213
210
  await this.service.mls.checkExistingPendingProposals();
214
- // initialize schedulers for renewing key materials
215
- this.service.mls.checkForKeyMaterialsUpdate();
216
211
  // initialize scheduler for syncing key packages with backend
217
212
  this.service.mls.checkForKeyPackagesBackendSync();
213
+ // leave stale conference subconversations (e.g after a crash)
214
+ await this.service.mls.leaveStaleConferenceSubconversations();
218
215
  }
219
216
  return validClient;
220
217
  }
221
- async buildCryptoClient(context, storeEngine, db, enableMLS) {
218
+ async buildCryptoClient(context, storeEngine, enableMLS) {
222
219
  var _a, _b, _c;
223
- const clientType = enableMLS || !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.useCoreCrypto)
220
+ /* There are 3 cases where we want to instantiate CoreCrypto:
221
+ * 1. MLS is enabled
222
+ * 2. The user has enabled CoreCrypto in the config
223
+ * 3. The user has already used CoreCrypto in the past (cannot rollback to using cryptobox)
224
+ */
225
+ const clientType = enableMLS ||
226
+ !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.useCoreCrypto) ||
227
+ cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.isReady(storeEngine.storeName)
224
228
  ? CryptoClient_1.CryptoClientType.CORE_CRYPTO
225
229
  : CryptoClient_1.CryptoClientType.CRYPTOBOX;
226
- return (0, CryptoClient_1.buildCryptoClient)(clientType, db, {
230
+ return (0, CryptoClient_1.buildCryptoClient)(clientType, {
227
231
  storeEngine,
228
232
  nbPrekeys: this.nbPrekeys,
229
233
  coreCryptoWasmFilePath: (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.coreCrypoWasmFilePath,
@@ -253,14 +257,12 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
253
257
  this.db = await (0, CoreDB_1.openDB)(this.generateCoreDbName(context));
254
258
  const accountService = new account_1.AccountService(this.apiClient);
255
259
  const assetService = new conversation_1.AssetService(this.apiClient);
256
- const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine, this.db, enableMLS);
260
+ const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine, enableMLS);
257
261
  const [clientType, cryptoClient] = cryptoClientDef;
258
262
  const mlsService = clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && enableMLS
259
263
  ? new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), Object.assign(Object.assign({}, (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.mls), { nbKeyPackages: this.nbPrekeys }))
260
264
  : undefined;
261
265
  const proteusService = new proteus_1.ProteusService(this.apiClient, cryptoClient, {
262
- // We can use qualified ids to send messages as long as the backend supports federated endpoints
263
- useQualifiedIds: this.backendFeatures.federationEndpoints,
264
266
  onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
265
267
  nbPrekeys: this.nbPrekeys,
266
268
  });
@@ -273,7 +275,7 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
273
275
  const selfService = new self_1.SelfService(this.apiClient);
274
276
  const teamService = new team_1.TeamService(this.apiClient);
275
277
  const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
276
- const userService = new user_1.UserService(this.apiClient, broadcastService, connectionService);
278
+ const userService = new user_1.UserService(this.apiClient);
277
279
  this.service = {
278
280
  mls: mlsService,
279
281
  proteus: proteusService,
@@ -346,16 +348,11 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
346
348
  try {
347
349
  const messages = this.service.notification.handleNotification(notification, source, dryRun);
348
350
  try {
349
- for (var _d = true, messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), _a = messages_1_1.done, !_a;) {
351
+ for (var _d = true, messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), _a = messages_1_1.done, !_a; _d = true) {
350
352
  _c = messages_1_1.value;
351
353
  _d = false;
352
- try {
353
- const message = _c;
354
- await handleEvent(message, source);
355
- }
356
- finally {
357
- _d = true;
358
- }
354
+ const message = _c;
355
+ await handleEvent(message, source);
359
356
  }
360
357
  }
361
358
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
package/lib/CoreError.js CHANGED
@@ -22,4 +22,4 @@ exports.CoreError = void 0;
22
22
  var CoreError;
23
23
  (function (CoreError) {
24
24
  CoreError["NOTIFICATION_ERROR"] = "CoreError.NOTIFICATION_ERROR";
25
- })(CoreError = exports.CoreError || (exports.CoreError = {}));
25
+ })(CoreError || (exports.CoreError = CoreError = {}));
@@ -1,5 +1,4 @@
1
- import { ClientMismatch, MessageSendingStatus, QualifiedUserClients, UserClients } from '@wireapp/api-client/lib/conversation';
2
- import { UserPreKeyBundleMap } from '@wireapp/api-client/lib/user/';
1
+ import { MessageSendingStatus, QualifiedUserClients } from '@wireapp/api-client/lib/conversation';
3
2
  import { APIClient } from '@wireapp/api-client';
4
3
  import { GenericMessage } from '@wireapp/protocol-messaging';
5
4
  import { ProteusService } from '../messagingProtocols/proteus';
@@ -8,14 +7,6 @@ export declare class BroadcastService {
8
7
  private readonly proteusService;
9
8
  private readonly messageService;
10
9
  constructor(apiClient: APIClient, proteusService: ProteusService);
11
- /**
12
- * Will create a key bundle for all the users of the team
13
- *
14
- * @param teamId
15
- * @param skipOwnClients=false
16
- * @param onlyDirectConnections=false Will generate a bundle only for directly connected users (users the self user has conversation with). Allows avoiding broadcasting messages to too many people
17
- */
18
- getPreKeyBundlesFromTeam(teamId: string, skipOwnClients?: boolean, onlyDirectConnections?: boolean): Promise<UserPreKeyBundleMap>;
19
- broadcastGenericMessage(genericMessage: GenericMessage, recipients: UserPreKeyBundleMap | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, onClientMismatch?: (mismatch: ClientMismatch | MessageSendingStatus) => void | boolean | Promise<boolean>): Promise<ClientMismatch | MessageSendingStatus>;
10
+ broadcastGenericMessage(genericMessage: GenericMessage, recipients: QualifiedUserClients, onClientMismatch?: (mismatch: MessageSendingStatus) => void | boolean | Promise<boolean>): Promise<MessageSendingStatus>;
20
11
  }
21
12
  //# sourceMappingURL=BroadcastService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BroadcastService.d.ts","sourceRoot":"","sources":["../../src/broadcast/BroadcastService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAC,cAAc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,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY3F"}
@@ -23,53 +23,19 @@ const protocol_messaging_1 = require("@wireapp/protocol-messaging");
23
23
  const messageSender_1 = require("../conversation/message/messageSender");
24
24
  const MessageService_1 = require("../conversation/message/MessageService");
25
25
  const UserClientsUtil_1 = require("../conversation/message/UserClientsUtil");
26
- const util_1 = require("../util");
27
26
  class BroadcastService {
28
27
  constructor(apiClient, proteusService) {
29
28
  this.apiClient = apiClient;
30
29
  this.proteusService = proteusService;
31
30
  this.messageService = new MessageService_1.MessageService(this.apiClient, this.proteusService);
32
31
  }
33
- /**
34
- * Will create a key bundle for all the users of the team
35
- *
36
- * @param teamId
37
- * @param skipOwnClients=false
38
- * @param onlyDirectConnections=false Will generate a bundle only for directly connected users (users the self user has conversation with). Allows avoiding broadcasting messages to too many people
39
- */
40
- async getPreKeyBundlesFromTeam(teamId, skipOwnClients = false, onlyDirectConnections = false) {
41
- const teamMembers = onlyDirectConnections
42
- ? (await this.apiClient.api.conversation.getConversations()).conversations
43
- .map(({ members }) => members.others.map(user => user.id).concat(members.self.id))
44
- .flat()
45
- : (await this.apiClient.api.teams.member.getAllMembers(teamId)).members.map(({ user }) => user);
46
- let members = Array.from(new Set(teamMembers)).map(member => ({ id: member }));
47
- if (skipOwnClients) {
48
- const selfUser = await this.apiClient.api.self.getSelf();
49
- members = members.filter(member => member.id !== selfUser.id);
50
- }
51
- const preKeys = await Promise.all(members.map(member => this.apiClient.api.user.getUserPreKeys(member.id)));
52
- return preKeys.reduce((bundleMap, bundle) => {
53
- bundleMap[bundle.user] = {};
54
- for (const client of bundle.clients) {
55
- bundleMap[bundle.user][client.client] = client.prekey;
56
- }
57
- return bundleMap;
58
- }, {});
59
- }
60
- async broadcastGenericMessage(genericMessage, recipients, sendAsProtobuf, onClientMismatch) {
32
+ async broadcastGenericMessage(genericMessage, recipients, onClientMismatch) {
61
33
  const plainTextArray = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
62
34
  const send = () => {
63
- return (0, util_1.isQualifiedUserClients)(recipients)
64
- ? this.messageService.sendFederatedMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
65
- reportMissing: (0, UserClientsUtil_1.flattenQualifiedUserClients)(recipients).map(({ userId }) => userId),
66
- onClientMismatch,
67
- })
68
- : this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
69
- sendAsProtobuf,
70
- reportMissing: Object.keys(recipients),
71
- onClientMismatch,
72
- });
35
+ return this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
36
+ reportMissing: (0, UserClientsUtil_1.flattenUserMap)(recipients).map(({ userId }) => userId),
37
+ onClientMismatch,
38
+ });
73
39
  };
74
40
  return (0, messageSender_1.sendMessage)(send);
75
41
  }
@@ -1,4 +1,5 @@
1
1
  import { RegisteredClient } from '@wireapp/api-client/lib/client/';
2
+ import { QualifiedId } from '@wireapp/api-client/lib/user';
2
3
  import { CRUDEngine } from '@wireapp/store-engine';
3
4
  import { MetaClient } from './ClientService';
4
5
  export declare enum DatabaseStores {
@@ -6,21 +7,20 @@ export declare enum DatabaseStores {
6
7
  }
7
8
  export declare class ClientDatabaseRepository {
8
9
  private readonly storeEngine;
9
- private readonly useQualifiedIds;
10
10
  static readonly STORES: typeof DatabaseStores;
11
11
  static KEYS: {
12
12
  LOCAL_IDENTITY: string;
13
13
  };
14
- constructor(storeEngine: CRUDEngine, useQualifiedIds: boolean);
14
+ constructor(storeEngine: CRUDEngine);
15
15
  getLocalClient(): Promise<MetaClient>;
16
16
  getClient(sessionId: string): Promise<MetaClient>;
17
17
  deleteLocalClient(): Promise<string>;
18
18
  deleteClient(sessionId: string): Promise<string>;
19
- createClientList(userId: string, clientList: RegisteredClient[], domain?: string): Promise<MetaClient[]>;
19
+ createClientList(userId: QualifiedId, clientList: RegisteredClient[]): Promise<MetaClient[]>;
20
20
  createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
21
21
  updateLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
22
- updateClient(userId: string, client: RegisteredClient, domain?: string): Promise<MetaClient>;
23
- createClient(userId: string, client: RegisteredClient, domain?: string): Promise<MetaClient>;
22
+ updateClient(userId: QualifiedId, client: RegisteredClient): Promise<MetaClient>;
23
+ createClient(userId: QualifiedId, client: RegisteredClient): Promise<MetaClient>;
24
24
  private transformClient;
25
25
  private transformLocalClient;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClientDatabaseRepository.d.ts","sourceRoot":"","sources":["../../src/client/ClientDatabaseRepository.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAI3C,oBAAY,cAAc;IACxB,OAAO,YAAY;CACpB;AAED,qBAAa,wBAAwB;IAOvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAAc,OAAO,CAAC,QAAQ,CAAC,eAAe;IANtF,gBAAuB,MAAM,wBAAkB;IAE/C,OAAc,IAAI;;MAEhB;gBAE2B,WAAW,EAAE,UAAU,EAAmB,eAAe,EAAE,OAAO;IAExF,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC;IAIrC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjD,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIpC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAQlG,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,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UAAU,EAAE,CAAC;IAQtF,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAUjF,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAUjF,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAahF,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAa7F,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,oBAAoB;CAO7B"}
@@ -23,11 +23,10 @@ const SessionHandler_1 = require("../messagingProtocols/proteus/Utility/SessionH
23
23
  var DatabaseStores;
24
24
  (function (DatabaseStores) {
25
25
  DatabaseStores["CLIENTS"] = "clients";
26
- })(DatabaseStores = exports.DatabaseStores || (exports.DatabaseStores = {}));
26
+ })(DatabaseStores || (exports.DatabaseStores = DatabaseStores = {}));
27
27
  class ClientDatabaseRepository {
28
- constructor(storeEngine, useQualifiedIds) {
28
+ constructor(storeEngine) {
29
29
  this.storeEngine = storeEngine;
30
- this.useQualifiedIds = useQualifiedIds;
31
30
  }
32
31
  getLocalClient() {
33
32
  return this.getClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
@@ -41,10 +40,10 @@ class ClientDatabaseRepository {
41
40
  deleteClient(sessionId) {
42
41
  return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
43
42
  }
44
- createClientList(userId, clientList, domain) {
43
+ createClientList(userId, clientList) {
45
44
  const createClientTasks = [];
46
45
  for (const client of clientList) {
47
- createClientTasks.push(this.createClient(userId, client, domain));
46
+ createClientTasks.push(this.createClient(userId, client));
48
47
  }
49
48
  return Promise.all(createClientTasks);
50
49
  }
@@ -58,34 +57,28 @@ class ClientDatabaseRepository {
58
57
  await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY, transformedClient);
59
58
  return transformedClient;
60
59
  }
61
- async updateClient(userId, client, domain) {
62
- const transformedClient = this.transformClient(userId, client, false, domain);
60
+ async updateClient(userId, client) {
61
+ const transformedClient = this.transformClient(userId, client, false);
63
62
  await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, (0, SessionHandler_1.constructSessionId)({
64
63
  userId,
65
64
  clientId: client.id,
66
- domain,
67
- useQualifiedIds: this.useQualifiedIds,
68
65
  }), transformedClient);
69
66
  return transformedClient;
70
67
  }
71
- async createClient(userId, client, domain) {
72
- const transformedClient = this.transformClient(userId, client, false, domain);
68
+ async createClient(userId, client) {
69
+ const transformedClient = this.transformClient(userId, client, false);
73
70
  await this.storeEngine.create(ClientDatabaseRepository.STORES.CLIENTS, (0, SessionHandler_1.constructSessionId)({
74
71
  userId,
75
72
  clientId: client.id,
76
- domain,
77
- useQualifiedIds: this.useQualifiedIds,
78
73
  }), transformedClient);
79
74
  return transformedClient;
80
75
  }
81
- transformClient(userId, client, verified, domain) {
82
- return Object.assign(Object.assign({}, client), { domain, meta: {
76
+ transformClient(userId, client, verified) {
77
+ return Object.assign(Object.assign({}, client), { domain: userId.domain, meta: {
83
78
  is_verified: verified,
84
79
  primary_key: (0, SessionHandler_1.constructSessionId)({
85
80
  userId,
86
81
  clientId: client.id,
87
- domain,
88
- useQualifiedIds: this.useQualifiedIds,
89
82
  }),
90
83
  } });
91
84
  }
@@ -45,7 +45,11 @@ export declare class ClientService {
45
45
  */
46
46
  loadClient(): Promise<RegisteredClient | undefined>;
47
47
  private createLocalClient;
48
- synchronizeClients(): Promise<MetaClient[]>;
48
+ /**
49
+ * Will download all the clients of the self user (excluding the current client) and will store them in the database
50
+ * @param currentClient - the id of the current client (to be excluded from the list)
51
+ */
52
+ synchronizeClients(currentClient: string): Promise<MetaClient[]>;
49
53
  register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: InitialPrekeys): Promise<RegisteredClient>;
50
54
  }
51
55
  //# sourceMappingURL=ClientService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientService.d.ts","sourceRoot":"","sources":["../../src/client/ClientService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAkC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAMlG,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,cAAc,EAAC,MAAM,2DAA2D,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAoD,MAAM,IAAI,CAAC;AAEjF,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,qBAAa,aAAa;IAStB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAV9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGpB;gBAGgB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,UAAU;IAMnC,UAAU,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIhD;;;;;;;OAOG;IACU,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,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AQ,CAA2B;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGpB;gBAGgB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,UAAU;IAMnC,UAAU,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIhD;;;;;;;OAOG;IACU,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMhF;;;OAGG;IACU,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YASpD,cAAc;IAQ5B;;;;;;OAMG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA0BhE,OAAO,CAAC,iBAAiB;IAIzB;;;OAGG;IACU,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUhE,QAAQ,CACnB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,cAAc,GACpC,OAAO,CAAC,gBAAgB,CAAC;CA4B7B"}
@@ -36,7 +36,7 @@ class ClientService {
36
36
  logger: console,
37
37
  markdown: false,
38
38
  });
39
- this.database = new _1.ClientDatabaseRepository(this.storeEngine, this.apiClient.backendFeatures.federationEndpoints);
39
+ this.database = new _1.ClientDatabaseRepository(this.storeEngine);
40
40
  this.backend = new _1.ClientBackendRepository(this.apiClient);
41
41
  }
42
42
  getClients() {
@@ -98,14 +98,12 @@ class ClientService {
98
98
  if (notFoundOnBackend && this.storeEngine) {
99
99
  this.logger.log('Could not find valid client on backend');
100
100
  const shouldDeleteWholeDatabase = loadedClient.type === client_1.ClientType.TEMPORARY;
101
+ this.logger.log('Deleting previous identity');
102
+ await this.proteusService.wipe(this.storeEngine);
101
103
  if (shouldDeleteWholeDatabase) {
102
- this.logger.log('Last client was temporary - Deleting database');
104
+ this.logger.log('Last client was temporary - Deleting content database');
103
105
  await this.storeEngine.clearTables();
104
106
  }
105
- else {
106
- this.logger.log('Last client was permanent - Deleting previous identity');
107
- await this.proteusService.wipe(this.storeEngine);
108
- }
109
107
  }
110
108
  }
111
109
  return undefined;
@@ -113,11 +111,15 @@ class ClientService {
113
111
  createLocalClient(client, domain) {
114
112
  return this.database.createLocalClient(client, domain);
115
113
  }
116
- async synchronizeClients() {
114
+ /**
115
+ * Will download all the clients of the self user (excluding the current client) and will store them in the database
116
+ * @param currentClient - the id of the current client (to be excluded from the list)
117
+ */
118
+ async synchronizeClients(currentClient) {
117
119
  var _a;
118
120
  const registeredClients = await this.backend.getClients();
119
- const filteredClients = registeredClients.filter(client => client.id !== this.apiClient.context.clientId);
120
- return this.database.createClientList(this.apiClient.context.userId, filteredClients, (_a = this.apiClient.context) === null || _a === void 0 ? void 0 : _a.domain);
121
+ const filteredClients = registeredClients.filter(client => client.id !== currentClient);
122
+ return this.database.createClientList({ id: this.apiClient.context.userId, domain: (_a = this.apiClient.context.domain) !== null && _a !== void 0 ? _a : '' }, filteredClients);
121
123
  }
122
124
  // TODO: Split functionality into "create" and "register" client
123
125
  async register(loginData, clientInfo, { prekeys, lastPrekey }) {
@@ -5,8 +5,8 @@ export declare class ConnectionService {
5
5
  private readonly apiClient;
6
6
  constructor(apiClient: APIClient);
7
7
  getConnections(): Promise<Connection[]>;
8
- acceptConnection(userId: string): Promise<Connection>;
9
- ignoreConnection(userId: string): Promise<Connection>;
8
+ acceptConnection(userId: QualifiedId): Promise<Connection>;
9
+ ignoreConnection(userId: QualifiedId): Promise<Connection>;
10
10
  createConnection(userId: QualifiedId): Promise<Connection>;
11
11
  }
12
12
  //# sourceMappingURL=ConnectionService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionService.d.ts","sourceRoot":"","sources":["../../src/connection/ConnectionService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAmB,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAE1C,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIvC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAMrD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAMrD,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CAGlE"}
1
+ {"version":3,"file":"ConnectionService.d.ts","sourceRoot":"","sources":["../../src/connection/ConnectionService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAmB,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAE1C,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIvC,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAM1D,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAM1D,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CAGlE"}
@@ -25,7 +25,7 @@ class ConnectionService {
25
25
  this.apiClient = apiClient;
26
26
  }
27
27
  getConnections() {
28
- return this.apiClient.api.connection.getAllConnections();
28
+ return this.apiClient.api.connection.getConnectionList();
29
29
  }
30
30
  acceptConnection(userId) {
31
31
  return this.apiClient.api.connection.putConnection(userId, {
@@ -38,7 +38,7 @@ class ConnectionService {
38
38
  });
39
39
  }
40
40
  createConnection(userId) {
41
- return this.apiClient.api.connection.postConnection(userId, '');
41
+ return this.apiClient.api.connection.postConnection(userId);
42
42
  }
43
43
  }
44
44
  exports.ConnectionService = ConnectionService;
@@ -23,4 +23,4 @@ var AssetTransferState;
23
23
  (function (AssetTransferState) {
24
24
  AssetTransferState["NOT_UPLOADED"] = "notUploaded";
25
25
  AssetTransferState["UPLOADED"] = "uploaded";
26
- })(AssetTransferState = exports.AssetTransferState || (exports.AssetTransferState = {}));
26
+ })(AssetTransferState || (exports.AssetTransferState = AssetTransferState = {}));
@@ -1,4 +1,4 @@
1
- import { Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, RemoteConversations } from '@wireapp/api-client/lib/conversation';
1
+ import { Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, RemoteConversations, PostMlsMessageResponse } from '@wireapp/api-client/lib/conversation';
2
2
  import { ConversationMemberLeaveEvent } from '@wireapp/api-client/lib/event';
3
3
  import { QualifiedId } from '@wireapp/api-client/lib/user';
4
4
  import { XOR } from '@wireapp/commons/lib/util/TypeUtil';
@@ -23,7 +23,7 @@ export declare class ConversationService {
23
23
  * @param {string} conversationId
24
24
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
25
25
  */
26
- fetchAllParticipantsClients(conversationId: QualifiedId | string): Promise<UserClients | QualifiedUserClients>;
26
+ fetchAllParticipantsClients(conversationId: QualifiedId): Promise<QualifiedUserClients>;
27
27
  /**
28
28
  * Create a group conversation.
29
29
  *
@@ -63,11 +63,18 @@ export declare class ConversationService {
63
63
  * Will create a conversation on backend and register it to CoreCrypto once created
64
64
  * @param conversationData
65
65
  */
66
- createMLSConversation(conversationData: NewConversation): Promise<MLSReturnType>;
66
+ createMLSConversation(conversationData: NewConversation, selfUserId: QualifiedId, selfClientId: string): Promise<MLSReturnType>;
67
67
  private sendMLSMessage;
68
- addUsersToMLSConversation({ qualifiedUserIds, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
68
+ /**
69
+ * Will add users to existing MLS group by claiming their key packages and passing them to CoreCrypto.addClientsToConversation
70
+ *
71
+ * @param qualifiedUsers List of qualified user ids (with optional skipOwnClientId field - if provided we will not claim key package for this self client)
72
+ * @param groupId Id of the group to which we want to add users
73
+ * @param conversationId Id of the conversation to which we want to add users
74
+ */
75
+ addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
69
76
  removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSReturnType>;
70
- joinByExternalCommit(conversationId: QualifiedId): Promise<import("@wireapp/api-client/lib/conversation").PostMlsMessageResponse | null>;
77
+ joinByExternalCommit(conversationId: QualifiedId): Promise<PostMlsMessageResponse | null>;
71
78
  /**
72
79
  * Will send an external proposal for the current device to join a specific conversation.
73
80
  * In order for the external proposal to be sent correctly, the underlying mls conversation needs to be in a non-established state
@@ -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,EACpB,WAAW,EAEX,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAC,MAAM,6B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wB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,mBAAmB;CA2BjC"}
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,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAE5G,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAuB,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAkC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjG,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sEAAsE,CAAC;AAG9E,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAN/B,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,C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