@wireapp/core 40.5.2 → 40.5.3-draft-20-cc.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 (139) hide show
  1. package/lib/Account.d.ts +7 -9
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +35 -32
  4. package/lib/CoreError.js +1 -1
  5. package/lib/broadcast/BroadcastService.d.ts +11 -2
  6. package/lib/broadcast/BroadcastService.d.ts.map +1 -1
  7. package/lib/broadcast/BroadcastService.js +39 -5
  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 +17 -10
  11. package/lib/client/ClientService.d.ts +1 -5
  12. package/lib/client/ClientService.d.ts.map +1 -1
  13. package/lib/client/ClientService.js +9 -11
  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 +5 -12
  19. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  20. package/lib/conversation/ConversationService/ConversationService.js +11 -26
  21. package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
  22. package/lib/conversation/ConversationService/ConversationService.types.d.ts +11 -12
  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 +4 -1
  29. package/lib/conversation/ReactionType.d.ts.map +1 -1
  30. package/lib/conversation/ReactionType.js +6 -0
  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 +31 -6
  36. package/lib/conversation/message/MessageService.d.ts.map +1 -1
  37. package/lib/conversation/message/MessageService.js +162 -19
  38. package/lib/conversation/message/MessageService.test.js +141 -151
  39. package/lib/conversation/message/PayloadBundle.js +1 -1
  40. package/lib/conversation/message/UserClientsUtil.d.ts +10 -14
  41. package/lib/conversation/message/UserClientsUtil.d.ts.map +1 -1
  42. package/lib/conversation/message/UserClientsUtil.js +11 -21
  43. package/lib/conversation/message/UserClientsUtils.test.js +9 -5
  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 +2 -7
  49. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  50. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +0 -2
  51. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +1 -3
  52. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +8 -19
  53. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  54. package/lib/messagingProtocols/mls/MLSService/MLSService.js +37 -79
  55. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +0 -9
  56. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts +2 -0
  57. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts.map +1 -0
  58. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.js +35 -0
  59. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +11 -0
  60. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts.map +1 -0
  61. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +50 -0
  62. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts +2 -0
  63. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts.map +1 -0
  64. package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.js +39 -0
  65. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts +4 -0
  66. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts.map +1 -0
  67. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.js +35 -0
  68. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts +2 -0
  69. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts.map +1 -0
  70. package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.js +35 -0
  71. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +5 -10
  72. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  73. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +11 -33
  74. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts +3 -2
  75. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -1
  76. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +9 -8
  77. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts +9 -4
  78. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -1
  79. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +24 -10
  80. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.js +10 -2
  81. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +2 -1
  82. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
  83. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +3 -3
  84. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +2 -2
  85. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  86. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +1 -1
  87. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -1
  88. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +2 -2
  89. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +7 -14
  90. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  91. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +35 -31
  92. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +1 -1
  93. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  94. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +3 -2
  95. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +89 -109
  96. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +9 -6
  97. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  98. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts +25 -0
  99. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts.map +1 -0
  100. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.js +93 -0
  101. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts +2 -0
  102. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts.map +1 -0
  103. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.js +66 -0
  104. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts +2 -0
  105. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts.map +1 -0
  106. package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.js +35 -0
  107. package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts +10 -4
  108. package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
  109. package/lib/messagingProtocols/proteus/Utility/Recipients.js +16 -16
  110. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +10 -15
  111. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
  112. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +92 -80
  113. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +54 -70
  114. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +14 -5
  115. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  116. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +35 -3
  117. package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts +2 -2
  118. package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts.map +1 -1
  119. package/lib/notification/NotificationDatabaseRepository.js +1 -1
  120. package/lib/notification/Notifications.types.js +1 -1
  121. package/lib/user/UserService.d.ts +17 -6
  122. package/lib/user/UserService.d.ts.map +1 -1
  123. package/lib/user/UserService.js +47 -2
  124. package/lib/util/TaskScheduler/TaskScheduler.d.ts +1 -4
  125. package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
  126. package/lib/util/TaskScheduler/TaskScheduler.js +3 -24
  127. package/lib/util/TypePredicateUtil.d.ts +1 -0
  128. package/lib/util/TypePredicateUtil.d.ts.map +1 -1
  129. package/lib/util/TypePredicateUtil.js +2 -1
  130. package/package.json +3 -3
  131. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +0 -13
  132. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +0 -1
  133. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +0 -67
  134. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +0 -2
  135. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +0 -1
  136. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +0 -72
  137. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +0 -7
  138. package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +0 -1
  139. package/lib/util/TaskScheduler/TaskScheduler.store.js +0 -34
package/lib/Account.d.ts CHANGED
@@ -95,16 +95,15 @@ 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 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
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
101
100
  * If we have version 2 that is a dev version, this is going to be the output of those calls
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
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
105
104
  * @return The highest version that is both supported by client and backend
106
105
  */
107
- useAPIVersion(min: number, max: number, allowDev?: boolean): Promise<BackendFeatures>;
106
+ useAPIVersion(supportedVersions: number[], useDevVersion?: boolean): Promise<BackendFeatures>;
108
107
  private persistCookie;
109
108
  get clientId(): string;
110
109
  get userId(): string;
@@ -137,8 +136,7 @@ export declare class Account extends TypedEventEmitter<Events> {
137
136
  *
138
137
  * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
139
138
  */
140
- initClient(client: RegisteredClient): Promise<RegisteredClient>;
141
- initClient(): Promise<RegisteredClient | undefined>;
139
+ initClient(client?: RegisteredClient): Promise<RegisteredClient | undefined>;
142
140
  private buildCryptoClient;
143
141
  /**
144
142
  * In order to be able to send MLS messages, the core needs a few information from the consumer.
@@ -1 +1 @@
1
- {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AACnG,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IG;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,7 +49,6 @@ 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");
53
52
  const notification_1 = require("./notification/");
54
53
  const self_1 = require("./self/");
55
54
  const CoreDB_1 = require("./storage/CoreDB");
@@ -63,7 +62,7 @@ var EVENTS;
63
62
  * An unknown client is a client we don't yet have a session with
64
63
  */
65
64
  EVENTS["NEW_SESSION"] = "new_session";
66
- })(EVENTS || (exports.EVENTS = EVENTS = {}));
65
+ })(EVENTS = exports.EVENTS || (exports.EVENTS = {}));
67
66
  var ConnectionState;
68
67
  (function (ConnectionState) {
69
68
  /** The websocket is closed and notifications stream is not being processed */
@@ -74,7 +73,7 @@ var ConnectionState;
74
73
  ConnectionState["PROCESSING_NOTIFICATIONS"] = "processing_notifications";
75
74
  /** The websocket is open and message will go through and notifications stream is fully processed */
76
75
  ConnectionState["LIVE"] = "live";
77
- })(ConnectionState || (exports.ConnectionState = ConnectionState = {}));
76
+ })(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));
78
77
  const coreDefaultClient = {
79
78
  classification: client_1.ClientClassification.DESKTOP,
80
79
  cookieLabel: 'default',
@@ -110,17 +109,16 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
110
109
  /**
111
110
  * Will set the APIClient to use a specific version of the API (by default uses version 0)
112
111
  * It will fetch the API Config and use the highest possible version
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
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
116
114
  * If we have version 2 that is a dev version, this is going to be the output of those calls
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
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
120
118
  * @return The highest version that is both supported by client and backend
121
119
  */
122
- async useAPIVersion(min, max, allowDev) {
123
- const features = await this.apiClient.useVersion(min, max, allowDev);
120
+ async useAPIVersion(supportedVersions, useDevVersion) {
121
+ const features = await this.apiClient.useVersion(supportedVersions, useDevVersion);
124
122
  this.backendFeatures = features;
125
123
  return features;
126
124
  }
@@ -175,9 +173,8 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
175
173
  if (!this.service || !this.apiClient.context || !this.storeEngine) {
176
174
  throw new Error('Services are not set or context not initialized.');
177
175
  }
178
- // we reset the services to re-instantiate a new CryptoClient instance
179
- await this.initServices(this.apiClient.context);
180
176
  const initialPreKeys = await this.service.proteus.createClient(entropyData);
177
+ await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
181
178
  const client = await this.service.client.register(loginData, clientInfo, initialPreKeys);
182
179
  if (this.service.mls) {
183
180
  const { userId, domain = '' } = this.apiClient.context;
@@ -185,9 +182,15 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
185
182
  }
186
183
  this.logger.info(`Created new client {mls: ${!!this.service.mls}, id: ${client.id}}`);
187
184
  await this.service.notification.initializeNotificationStream();
188
- await this.service.client.synchronizeClients(client.id);
189
- return this.initClient(client);
185
+ await this.service.client.synchronizeClients();
186
+ await this.initClient(client);
187
+ return client;
190
188
  }
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
+ */
191
194
  async initClient(client) {
192
195
  if (!this.service || !this.apiClient.context || !this.storeEngine) {
193
196
  throw new Error('Services are not set.');
@@ -208,26 +211,19 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
208
211
  }
209
212
  // initialize schedulers for pending mls proposals once client is initialized
210
213
  await this.service.mls.checkExistingPendingProposals();
214
+ // initialize schedulers for renewing key materials
215
+ this.service.mls.checkForKeyMaterialsUpdate();
211
216
  // initialize scheduler for syncing key packages with backend
212
217
  this.service.mls.checkForKeyPackagesBackendSync();
213
- // leave stale conference subconversations (e.g after a crash)
214
- await this.service.mls.leaveStaleConferenceSubconversations();
215
218
  }
216
219
  return validClient;
217
220
  }
218
- async buildCryptoClient(context, storeEngine, enableMLS) {
221
+ async buildCryptoClient(context, storeEngine, db, enableMLS) {
219
222
  var _a, _b, _c;
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)
223
+ const clientType = enableMLS || !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.useCoreCrypto)
228
224
  ? CryptoClient_1.CryptoClientType.CORE_CRYPTO
229
225
  : CryptoClient_1.CryptoClientType.CRYPTOBOX;
230
- return (0, CryptoClient_1.buildCryptoClient)(clientType, {
226
+ return (0, CryptoClient_1.buildCryptoClient)(clientType, db, {
231
227
  storeEngine,
232
228
  nbPrekeys: this.nbPrekeys,
233
229
  coreCryptoWasmFilePath: (_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.coreCrypoWasmFilePath,
@@ -257,12 +253,14 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
257
253
  this.db = await (0, CoreDB_1.openDB)(this.generateCoreDbName(context));
258
254
  const accountService = new account_1.AccountService(this.apiClient);
259
255
  const assetService = new conversation_1.AssetService(this.apiClient);
260
- const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine, enableMLS);
256
+ const cryptoClientDef = await this.buildCryptoClient(context, this.storeEngine, this.db, enableMLS);
261
257
  const [clientType, cryptoClient] = cryptoClientDef;
262
258
  const mlsService = clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && enableMLS
263
259
  ? 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 }))
264
260
  : undefined;
265
261
  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,
266
264
  onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
267
265
  nbPrekeys: this.nbPrekeys,
268
266
  });
@@ -275,7 +273,7 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
275
273
  const selfService = new self_1.SelfService(this.apiClient);
276
274
  const teamService = new team_1.TeamService(this.apiClient);
277
275
  const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
278
- const userService = new user_1.UserService(this.apiClient);
276
+ const userService = new user_1.UserService(this.apiClient, broadcastService, connectionService);
279
277
  this.service = {
280
278
  mls: mlsService,
281
279
  proteus: proteusService,
@@ -348,11 +346,16 @@ class Account extends TypedEventEmitter_1.TypedEventEmitter {
348
346
  try {
349
347
  const messages = this.service.notification.handleNotification(notification, source, dryRun);
350
348
  try {
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) {
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;) {
352
350
  _c = messages_1_1.value;
353
351
  _d = false;
354
- const message = _c;
355
- await handleEvent(message, source);
352
+ try {
353
+ const message = _c;
354
+ await handleEvent(message, source);
355
+ }
356
+ finally {
357
+ _d = true;
358
+ }
356
359
  }
357
360
  }
358
361
  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 = CoreError = {}));
25
+ })(CoreError = exports.CoreError || (exports.CoreError = {}));
@@ -1,4 +1,5 @@
1
- import { MessageSendingStatus, QualifiedUserClients } from '@wireapp/api-client/lib/conversation';
1
+ import { ClientMismatch, MessageSendingStatus, QualifiedUserClients, UserClients } from '@wireapp/api-client/lib/conversation';
2
+ import { UserPreKeyBundleMap } from '@wireapp/api-client/lib/user/';
2
3
  import { APIClient } from '@wireapp/api-client';
3
4
  import { GenericMessage } from '@wireapp/protocol-messaging';
4
5
  import { ProteusService } from '../messagingProtocols/proteus';
@@ -7,6 +8,14 @@ export declare class BroadcastService {
7
8
  private readonly proteusService;
8
9
  private readonly messageService;
9
10
  constructor(apiClient: APIClient, proteusService: ProteusService);
10
- broadcastGenericMessage(genericMessage: GenericMessage, recipients: QualifiedUserClients, onClientMismatch?: (mismatch: MessageSendingStatus) => void | boolean | Promise<boolean>): Promise<MessageSendingStatus>;
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>;
11
20
  }
12
21
  //# sourceMappingURL=BroadcastService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BroadcastService.d.ts","sourceRoot":"","sources":["../../src/broadcast/BroadcastService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,qBAAa,gBAAgB;IAGf,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;IAFlF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAEnB,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAIrF,uBAAuB,CAClC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,oBAAoB,EAChC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY3F"}
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,EAAC,MAAM,+BAA+B,CAAC;AAG7D,qBAAa,gBAAgB;IAGf,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAa,OAAO,CAAC,QAAQ,CAAC,cAAc;IAFlF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAEnB,SAAS,EAAE,SAAS,EAAmB,cAAc,EAAE,cAAc;IAIlG;;;;;;OAMG;IACU,wBAAwB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,UAAQ,EACtB,qBAAqB,UAAQ,GAC5B,OAAO,CAAC,mBAAmB,CAAC;IAyBlB,uBAAuB,CAClC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,mBAAmB,GAAG,WAAW,GAAG,oBAAoB,EACpE,cAAc,CAAC,EAAE,OAAO,EACxB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,GAAG,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkB5G"}
@@ -23,19 +23,53 @@ 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");
26
27
  class BroadcastService {
27
28
  constructor(apiClient, proteusService) {
28
29
  this.apiClient = apiClient;
29
30
  this.proteusService = proteusService;
30
31
  this.messageService = new MessageService_1.MessageService(this.apiClient, this.proteusService);
31
32
  }
32
- async broadcastGenericMessage(genericMessage, recipients, onClientMismatch) {
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) {
33
61
  const plainTextArray = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
34
62
  const send = () => {
35
- return this.messageService.sendMessage(this.apiClient.validatedClientId, recipients, plainTextArray, {
36
- reportMissing: (0, UserClientsUtil_1.flattenUserMap)(recipients).map(({ userId }) => userId),
37
- onClientMismatch,
38
- });
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
+ });
39
73
  };
40
74
  return (0, messageSender_1.sendMessage)(send);
41
75
  }
@@ -1,5 +1,4 @@
1
1
  import { RegisteredClient } from '@wireapp/api-client/lib/client/';
2
- import { QualifiedId } from '@wireapp/api-client/lib/user';
3
2
  import { CRUDEngine } from '@wireapp/store-engine';
4
3
  import { MetaClient } from './ClientService';
5
4
  export declare enum DatabaseStores {
@@ -7,20 +6,21 @@ export declare enum DatabaseStores {
7
6
  }
8
7
  export declare class ClientDatabaseRepository {
9
8
  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);
14
+ constructor(storeEngine: CRUDEngine, useQualifiedIds: boolean);
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: QualifiedId, clientList: RegisteredClient[]): Promise<MetaClient[]>;
19
+ createClientList(userId: string, clientList: RegisteredClient[], domain?: string): Promise<MetaClient[]>;
20
20
  createLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
21
21
  updateLocalClient(client: RegisteredClient, domain?: string): Promise<MetaClient>;
22
- updateClient(userId: QualifiedId, client: RegisteredClient): Promise<MetaClient>;
23
- createClient(userId: QualifiedId, client: RegisteredClient): Promise<MetaClient>;
22
+ updateClient(userId: string, client: RegisteredClient, domain?: string): Promise<MetaClient>;
23
+ createClient(userId: string, client: RegisteredClient, domain?: string): 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;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,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;IANxC,gBAAuB,MAAM,wBAAkB;IAE/C,OAAc,IAAI;;MAEhB;gBAE2B,WAAW,EAAE,UAAU;IAE7C,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,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,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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F,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAe5F,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAezG,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,oBAAoB;CAO7B"}
@@ -23,10 +23,11 @@ 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 = DatabaseStores = {}));
26
+ })(DatabaseStores = exports.DatabaseStores || (exports.DatabaseStores = {}));
27
27
  class ClientDatabaseRepository {
28
- constructor(storeEngine) {
28
+ constructor(storeEngine, useQualifiedIds) {
29
29
  this.storeEngine = storeEngine;
30
+ this.useQualifiedIds = useQualifiedIds;
30
31
  }
31
32
  getLocalClient() {
32
33
  return this.getClient(ClientDatabaseRepository.KEYS.LOCAL_IDENTITY);
@@ -40,10 +41,10 @@ class ClientDatabaseRepository {
40
41
  deleteClient(sessionId) {
41
42
  return this.storeEngine.delete(ClientDatabaseRepository.STORES.CLIENTS, sessionId);
42
43
  }
43
- createClientList(userId, clientList) {
44
+ createClientList(userId, clientList, domain) {
44
45
  const createClientTasks = [];
45
46
  for (const client of clientList) {
46
- createClientTasks.push(this.createClient(userId, client));
47
+ createClientTasks.push(this.createClient(userId, client, domain));
47
48
  }
48
49
  return Promise.all(createClientTasks);
49
50
  }
@@ -57,28 +58,34 @@ class ClientDatabaseRepository {
57
58
  await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, ClientDatabaseRepository.KEYS.LOCAL_IDENTITY, transformedClient);
58
59
  return transformedClient;
59
60
  }
60
- async updateClient(userId, client) {
61
- const transformedClient = this.transformClient(userId, client, false);
61
+ async updateClient(userId, client, domain) {
62
+ const transformedClient = this.transformClient(userId, client, false, domain);
62
63
  await this.storeEngine.update(ClientDatabaseRepository.STORES.CLIENTS, (0, SessionHandler_1.constructSessionId)({
63
64
  userId,
64
65
  clientId: client.id,
66
+ domain,
67
+ useQualifiedIds: this.useQualifiedIds,
65
68
  }), transformedClient);
66
69
  return transformedClient;
67
70
  }
68
- async createClient(userId, client) {
69
- const transformedClient = this.transformClient(userId, client, false);
71
+ async createClient(userId, client, domain) {
72
+ const transformedClient = this.transformClient(userId, client, false, domain);
70
73
  await this.storeEngine.create(ClientDatabaseRepository.STORES.CLIENTS, (0, SessionHandler_1.constructSessionId)({
71
74
  userId,
72
75
  clientId: client.id,
76
+ domain,
77
+ useQualifiedIds: this.useQualifiedIds,
73
78
  }), transformedClient);
74
79
  return transformedClient;
75
80
  }
76
- transformClient(userId, client, verified) {
77
- return Object.assign(Object.assign({}, client), { domain: userId.domain, meta: {
81
+ transformClient(userId, client, verified, domain) {
82
+ return Object.assign(Object.assign({}, client), { domain, meta: {
78
83
  is_verified: verified,
79
84
  primary_key: (0, SessionHandler_1.constructSessionId)({
80
85
  userId,
81
86
  clientId: client.id,
87
+ domain,
88
+ useQualifiedIds: this.useQualifiedIds,
82
89
  }),
83
90
  } });
84
91
  }
@@ -45,11 +45,7 @@ export declare class ClientService {
45
45
  */
46
46
  loadClient(): Promise<RegisteredClient | undefined>;
47
47
  private createLocalClient;
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[]>;
48
+ synchronizeClients(): Promise<MetaClient[]>;
53
49
  register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: InitialPrekeys): Promise<RegisteredClient>;
54
50
  }
55
51
  //# sourceMappingURL=ClientService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientService.d.ts","sourceRoot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S,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;IA2BhE,OAAO,CAAC,iBAAiB;IAIZ,kBAAkB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAW3C,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);
39
+ this.database = new _1.ClientDatabaseRepository(this.storeEngine, this.apiClient.backendFeatures.federationEndpoints);
40
40
  this.backend = new _1.ClientBackendRepository(this.apiClient);
41
41
  }
42
42
  getClients() {
@@ -98,12 +98,14 @@ 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);
103
101
  if (shouldDeleteWholeDatabase) {
104
- this.logger.log('Last client was temporary - Deleting content database');
102
+ this.logger.log('Last client was temporary - Deleting database');
105
103
  await this.storeEngine.clearTables();
106
104
  }
105
+ else {
106
+ this.logger.log('Last client was permanent - Deleting previous identity');
107
+ await this.proteusService.wipe(this.storeEngine);
108
+ }
107
109
  }
108
110
  }
109
111
  return undefined;
@@ -111,15 +113,11 @@ class ClientService {
111
113
  createLocalClient(client, domain) {
112
114
  return this.database.createLocalClient(client, domain);
113
115
  }
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) {
116
+ async synchronizeClients() {
119
117
  var _a;
120
118
  const registeredClients = await this.backend.getClients();
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);
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);
123
121
  }
124
122
  // TODO: Split functionality into "create" and "register" client
125
123
  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: QualifiedId): Promise<Connection>;
9
- ignoreConnection(userId: QualifiedId): Promise<Connection>;
8
+ acceptConnection(userId: string): Promise<Connection>;
9
+ ignoreConnection(userId: string): 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,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"}
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"}
@@ -25,7 +25,7 @@ class ConnectionService {
25
25
  this.apiClient = apiClient;
26
26
  }
27
27
  getConnections() {
28
- return this.apiClient.api.connection.getConnectionList();
28
+ return this.apiClient.api.connection.getAllConnections();
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 = AssetTransferState = {}));
26
+ })(AssetTransferState = exports.AssetTransferState || (exports.AssetTransferState = {}));
@@ -1,4 +1,4 @@
1
- import { Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, RemoteConversations, PostMlsMessageResponse } from '@wireapp/api-client/lib/conversation';
1
+ import { Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, RemoteConversations } 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): Promise<QualifiedUserClients>;
26
+ fetchAllParticipantsClients(conversationId: QualifiedId | string): Promise<UserClients | QualifiedUserClients>;
27
27
  /**
28
28
  * Create a group conversation.
29
29
  *
@@ -63,18 +63,11 @@ 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, selfUserId: QualifiedId, selfClientId: string): Promise<MLSReturnType>;
66
+ createMLSConversation(conversationData: NewConversation): Promise<MLSReturnType>;
67
67
  private sendMLSMessage;
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>;
68
+ addUsersToMLSConversation({ qualifiedUserIds, groupId, conversationId, }: Required<AddUsersParams>): Promise<MLSReturnType>;
76
69
  removeUsersFromMLSConversation({ groupId, conversationId, qualifiedUserIds, }: RemoveUsersParams): Promise<MLSReturnType>;
77
- joinByExternalCommit(conversationId: QualifiedId): Promise<PostMlsMessageResponse | null>;
70
+ joinByExternalCommit(conversationId: QualifiedId): Promise<import("@wireapp/api-client/lib/conversation").PostMlsMessageResponse | null>;
78
71
  /**
79
72
  * Will send an external proposal for the current device to join a specific conversation.
80
73
  * 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,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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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,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,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,CAAgD;gBAGpD,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,CAAC,wBAAY;IAK3C,IAAI,UAAU,IAAI,UAAU,CAK3B;IAED;;;;;OAKG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