@wireapp/core 38.3.2 → 38.4.0

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 (64) hide show
  1. package/lib/Account.d.ts +1 -1
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +27 -26
  4. package/lib/client/ClientService.d.ts +2 -2
  5. package/lib/client/ClientService.d.ts.map +1 -1
  6. package/lib/conversation/ConversationService/ConversationService.d.ts +3 -2
  7. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  8. package/lib/conversation/ConversationService/ConversationService.js +8 -2
  9. package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
  10. package/lib/messagingProtocols/mls/types.d.ts +1 -0
  11. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  12. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts +40 -0
  13. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.d.ts.map +1 -0
  14. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper.js +98 -0
  15. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +12 -0
  16. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -0
  17. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +29 -0
  18. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +31 -0
  19. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -0
  20. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.js +22 -0
  21. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +40 -0
  22. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -0
  23. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +108 -0
  24. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.d.ts → CryptoClient/PrekeysTracker/PrekeysTracker.d.ts} +6 -14
  25. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.d.ts.map +1 -0
  26. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.js → CryptoClient/PrekeysTracker/PrekeysTracker.js} +9 -23
  27. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.store.d.ts → CryptoClient/PrekeysTracker/PrekeysTracker.store.d.ts} +3 -3
  28. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -0
  29. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.store.js → CryptoClient/PrekeysTracker/PrekeysTracker.store.js} +3 -3
  30. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.d.ts +2 -0
  31. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/PrekeysTracker.test.d.ts.map +1 -0
  32. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator/PrekeysGenerator.test.js → CryptoClient/PrekeysTracker/PrekeysTracker.test.js} +11 -17
  33. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/index.d.ts +2 -0
  34. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/PrekeysTracker/index.d.ts.map +1 -0
  35. package/lib/messagingProtocols/proteus/ProteusService/{PrekeysGenerator → CryptoClient/PrekeysTracker}/index.js +1 -1
  36. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.d.ts +3 -0
  37. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.d.ts.map +1 -0
  38. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/index.js +36 -0
  39. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +1 -1
  40. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +5 -6
  41. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  42. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +39 -60
  43. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +3 -3
  44. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +0 -4
  45. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  46. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +11 -0
  47. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -0
  48. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +53 -0
  49. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +7 -7
  50. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
  51. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +22 -22
  52. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +4 -3
  53. package/lib/notification/NotificationService.d.ts +2 -2
  54. package/lib/notification/NotificationService.d.ts.map +1 -1
  55. package/lib/notification/NotificationService.js +5 -5
  56. package/lib/notification/NotificationService.test.js +4 -4
  57. package/lib/util/encryptedStore.js +1 -1
  58. package/package.json +5 -4
  59. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.d.ts.map +0 -1
  60. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.store.d.ts.map +0 -1
  61. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.test.d.ts +0 -2
  62. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/PrekeysGenerator.test.d.ts.map +0 -1
  63. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/index.d.ts +0 -2
  64. package/lib/messagingProtocols/proteus/ProteusService/PrekeysGenerator/index.d.ts.map +0 -1
package/lib/Account.d.ts CHANGED
@@ -73,7 +73,7 @@ export declare class Account<T = any> extends EventEmitter {
73
73
  private readonly cryptoProtocolConfig?;
74
74
  private coreCryptoClient?;
75
75
  service?: {
76
- mls: MLSService;
76
+ mls?: MLSService;
77
77
  proteus: ProteusService;
78
78
  account: AccountService;
79
79
  asset: AssetService;
@@ -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;AASnG,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,YAAY,EAAE,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAC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ACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,kBAAkB;YAIZ,UAAU;CAqBzB"}
package/lib/Account.js CHANGED
@@ -39,6 +39,7 @@ const logdown_1 = __importDefault(require("logdown"));
39
39
  const events_1 = require("events");
40
40
  const api_client_1 = require("@wireapp/api-client");
41
41
  const core_crypto_1 = require("@wireapp/core-crypto");
42
+ const cryptobox_1 = require("@wireapp/cryptobox");
42
43
  const store_engine_1 = require("@wireapp/store-engine");
43
44
  const account_1 = require("./account/");
44
45
  const auth_2 = require("./auth/");
@@ -168,23 +169,17 @@ class Account extends events_1.EventEmitter {
168
169
  * Will register a new client for the current user
169
170
  */
170
171
  async registerClient(loginData, clientInfo = coreDefaultClient, entropyData) {
171
- var _a;
172
- if (!this.service || !this.apiClient.context || !this.coreCryptoClient || !this.storeEngine) {
172
+ if (!this.service || !this.apiClient.context || !this.storeEngine) {
173
173
  throw new Error('Services are not set or context not initialized.');
174
174
  }
175
- const shouldCreateMlsClient = !!((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls);
176
- this.logger.info(`Creating new client {mls: ${shouldCreateMlsClient}}`);
177
- if (entropyData) {
178
- await this.coreCryptoClient.reseedRng(entropyData);
179
- }
175
+ const initialPreKeys = await this.service.proteus.createClient(entropyData);
180
176
  await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
181
- const initialPreKeys = await this.service.proteus.createClient();
182
177
  const client = await this.service.client.register(loginData, clientInfo, initialPreKeys);
183
- if (shouldCreateMlsClient) {
178
+ if (this.service.mls) {
184
179
  const { userId, domain = '' } = this.apiClient.context;
185
180
  await this.service.mls.createClient({ id: userId, domain }, client.id);
186
181
  }
187
- this.logger.info('Client is created');
182
+ this.logger.info(`Created new client {mls: ${!!this.service.mls}, id: ${client.id}}`);
188
183
  await this.service.notification.initializeNotificationStream();
189
184
  await this.service.client.synchronizeClients();
190
185
  await this.initClient(client);
@@ -196,8 +191,7 @@ class Account extends events_1.EventEmitter {
196
191
  * @returns The local existing client or undefined if the client does not exist or is not valid (non existing on backend)
197
192
  */
198
193
  async initClient(client) {
199
- var _a;
200
- if (!this.service || !this.apiClient.context || !this.coreCryptoClient || !this.storeEngine) {
194
+ if (!this.service || !this.apiClient.context || !this.storeEngine) {
201
195
  throw new Error('Services are not set.');
202
196
  }
203
197
  const validClient = client !== null && client !== void 0 ? client : (await this.service.client.loadClient());
@@ -208,7 +202,7 @@ class Account extends events_1.EventEmitter {
208
202
  // Call /access endpoint with client_id after client initialisation
209
203
  await this.apiClient.transport.http.associateClientWithSession(validClient.id);
210
204
  await this.service.proteus.initClient(this.storeEngine, this.apiClient.context);
211
- if (this.backendFeatures.supportsMLS && ((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls)) {
205
+ if (this.service.mls) {
212
206
  const { userId, domain = '' } = this.apiClient.context;
213
207
  await this.service.mls.initClient({ id: userId, domain }, validClient.id);
214
208
  // initialize schedulers for pending mls proposals once client is initialized
@@ -244,18 +238,25 @@ class Account extends events_1.EventEmitter {
244
238
  * @param mlsCallbacks
245
239
  */
246
240
  configureMLSCallbacks(mlsCallbacks) {
247
- var _a;
248
- (_a = this.service) === null || _a === void 0 ? void 0 : _a.mls.configureMLSCallbacks(mlsCallbacks);
241
+ var _a, _b;
242
+ (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.mls) === null || _b === void 0 ? void 0 : _b.configureMLSCallbacks(mlsCallbacks);
249
243
  }
250
244
  async initServices(context) {
251
- var _a;
252
- this.coreCryptoClient = await this.initCoreCrypto(context);
245
+ var _a, _b, _c, _d;
246
+ const enableMLS = this.backendFeatures.supportsMLS && ((_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls);
247
+ this.coreCryptoClient =
248
+ enableMLS || ((_b = this.cryptoProtocolConfig) === null || _b === void 0 ? void 0 : _b.useCoreCrypto) ? await this.initCoreCrypto(context) : undefined;
253
249
  this.storeEngine = await this.initEngine(context);
254
250
  this.db = await (0, CoreDB_1.openDB)(this.generateCoreDbName(context));
255
251
  const accountService = new account_1.AccountService(this.apiClient);
256
252
  const assetService = new conversation_1.AssetService(this.apiClient);
257
- const mlsService = new mls_1.MLSService(this.apiClient, this.coreCryptoClient, Object.assign(Object.assign({}, (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls), { nbKeyPackages: this.nbPrekeys }));
258
- const proteusService = new proteus_1.ProteusService(this.apiClient, this.coreCryptoClient, this.db, {
253
+ const mlsService = this.coreCryptoClient && enableMLS
254
+ ? new mls_1.MLSService(this.apiClient, this.coreCryptoClient, Object.assign(Object.assign({}, (_c = this.cryptoProtocolConfig) === null || _c === void 0 ? void 0 : _c.mls), { nbKeyPackages: this.nbPrekeys }))
255
+ : undefined;
256
+ const proteusCryptoClient = ((_d = this.cryptoProtocolConfig) === null || _d === void 0 ? void 0 : _d.useCoreCrypto) && this.coreCryptoClient
257
+ ? this.coreCryptoClient
258
+ : new cryptobox_1.Cryptobox(this.storeEngine, this.nbPrekeys);
259
+ const proteusService = new proteus_1.ProteusService(this.apiClient, proteusCryptoClient, this.db, {
259
260
  // We can use qualified ids to send messages as long as the backend supports federated endpoints
260
261
  useQualifiedIds: this.backendFeatures.federationEndpoints,
261
262
  onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
@@ -270,11 +271,11 @@ class Account extends events_1.EventEmitter {
270
271
  const connectionService = new connection_1.ConnectionService(this.apiClient);
271
272
  const giphyService = new giphy_1.GiphyService(this.apiClient);
272
273
  const linkPreviewService = new linkPreview_1.LinkPreviewService(assetService);
273
- const notificationService = new notification_1.NotificationService(this.apiClient, mlsService, proteusService, this.storeEngine);
274
+ const notificationService = new notification_1.NotificationService(this.apiClient, proteusService, this.storeEngine, mlsService);
274
275
  const conversationService = new conversation_1.ConversationService(this.apiClient, {
275
276
  // We can use qualified ids to send messages as long as the backend supports federated endpoints
276
277
  useQualifiedIds: this.backendFeatures.federationEndpoints,
277
- }, mlsService, proteusService);
278
+ }, proteusService, mlsService);
278
279
  const selfService = new self_1.SelfService(this.apiClient);
279
280
  const teamService = new team_1.TeamService(this.apiClient);
280
281
  const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
@@ -307,9 +308,9 @@ class Account extends events_1.EventEmitter {
307
308
  async logout(clearData = false) {
308
309
  var _a, _b;
309
310
  (_a = this.db) === null || _a === void 0 ? void 0 : _a.close();
310
- (_b = this.secretsDb) === null || _b === void 0 ? void 0 : _b.close();
311
+ await ((_b = this.secretsDb) === null || _b === void 0 ? void 0 : _b.close());
311
312
  if (clearData) {
312
- this.wipe();
313
+ await this.wipe();
313
314
  }
314
315
  await this.apiClient.logout();
315
316
  this.resetContext();
@@ -404,7 +405,7 @@ class Account extends events_1.EventEmitter {
404
405
  await handleNotification(notification, source);
405
406
  onNotificationStreamProgress(progress);
406
407
  }, handleMissedNotifications, abortHandler);
407
- this.logger.log(`Finished processing notifications ${JSON.stringify(results)}`, results);
408
+ this.logger.info(`Finished processing notifications ${JSON.stringify(results)}`, results);
408
409
  if (abortHandler.isAborted()) {
409
410
  this.logger.warn('Ending connection process as websocket was closed');
410
411
  return;
@@ -440,10 +441,10 @@ class Account extends events_1.EventEmitter {
440
441
  const openDb = async () => {
441
442
  const initializedDb = await this.createStore(dbName, context);
442
443
  if (initializedDb) {
443
- this.logger.log(`Initialized store with existing engine "${dbName}".`);
444
+ this.logger.info(`Initialized store with existing engine "${dbName}".`);
444
445
  return initializedDb;
445
446
  }
446
- this.logger.log(`Initialized store with new memory engine "${dbName}".`);
447
+ this.logger.info(`Initialized store with new memory engine "${dbName}".`);
447
448
  const memoryEngine = new store_engine_1.MemoryEngine();
448
449
  await memoryEngine.init(dbName);
449
450
  return memoryEngine;
@@ -3,7 +3,7 @@ import { RegisteredClient } from '@wireapp/api-client/lib/client/';
3
3
  import { APIClient } from '@wireapp/api-client';
4
4
  import { CRUDEngine } from '@wireapp/store-engine';
5
5
  import type { ProteusService } from '../messagingProtocols/proteus';
6
- import { NewDevicePrekeys } from '../messagingProtocols/proteus/ProteusService';
6
+ import { InitialPrekeys } from '../messagingProtocols/proteus/ProteusService/CryptoClient';
7
7
  import { ClientInfo } from './';
8
8
  export interface MetaClient extends RegisteredClient {
9
9
  domain?: string;
@@ -46,6 +46,6 @@ export declare class ClientService {
46
46
  loadClient(): Promise<RegisteredClient | undefined>;
47
47
  private createLocalClient;
48
48
  synchronizeClients(): Promise<MetaClient[]>;
49
- register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: NewDevicePrekeys): Promise<RegisteredClient>;
49
+ register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: InitialPrekeys): Promise<RegisteredClient>;
50
50
  }
51
51
  //# 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;AAGjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAC,MAAM,8CAA8C,CAAC;AAE9E,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,C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../content';
12
12
  export declare class ConversationService {
13
13
  private readonly apiClient;
14
14
  private readonly config;
15
- private readonly mlsService;
16
15
  private readonly proteusService;
16
+ private readonly _mlsService?;
17
17
  readonly messageTimer: MessageTimer;
18
18
  private readonly messageService;
19
19
  private readonly logger;
20
20
  constructor(apiClient: APIClient, config: {
21
21
  useQualifiedIds?: boolean;
22
- }, mlsService: MLSService, proteusService: ProteusService);
22
+ }, proteusService: ProteusService, _mlsService?: MLSService | undefined);
23
+ get mlsService(): MLSService;
23
24
  /**
24
25
  * Get a fresh list from backend of clients for all the participants of the conversation.
25
26
  * This is a hacky way of getting all the clients for a conversation.
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,WAAW,EAGZ,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;AAItC,qBAAa,mBAAmB;IAM5B,OAA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mB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;YAItD,YAAY;IAYb,mBAAmB;CA2BjC"}
1
+ {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,WAAW,EAGZ,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;AAItC,qBAAa,mBAAmB;IAM5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAR/B,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAGpD,SAAS,EAAE,SAAS,EACpB,MA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;IAIjE;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAIpB,0BAA0B,CAC/B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,GAAE,MAAM,GAAG,IAAiB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IAEH;;;OAGG;IACU,qBAAqB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;YAmC/E,cAAc;IAqBf,yBAAyB,CAAC,EACrC,gBAAgB,EAChB,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAcvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAiBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAK5C,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;YAItD,YAAY;IAYb,mBAAmB;CA2BjC"}
@@ -37,15 +37,21 @@ const fullyQualifiedClientIdUtils_1 = require("../../util/fullyQualifiedClientId
37
37
  const messageSender_1 = require("../message/messageSender");
38
38
  const MessageService_1 = require("../message/MessageService");
39
39
  class ConversationService {
40
- constructor(apiClient, config, mlsService, proteusService) {
40
+ constructor(apiClient, config, proteusService, _mlsService) {
41
41
  this.apiClient = apiClient;
42
42
  this.config = config;
43
- this.mlsService = mlsService;
44
43
  this.proteusService = proteusService;
44
+ this._mlsService = _mlsService;
45
45
  this.logger = (0, logdown_1.default)('@wireapp/core/ConversationService');
46
46
  this.messageTimer = new conversation_2.MessageTimer();
47
47
  this.messageService = new MessageService_1.MessageService(this.apiClient, this.proteusService);
48
48
  }
49
+ get mlsService() {
50
+ if (!this._mlsService) {
51
+ throw new Error('Cannot do MLS operations on a non-mls environment');
52
+ }
53
+ return this._mlsService;
54
+ }
49
55
  /**
50
56
  * Get a fresh list from backend of clients for all the participants of the conversation.
51
57
  * This is a hacky way of getting all the clients for a conversation.
@@ -90,7 +90,7 @@ describe('ConversationService', () => {
90
90
  };
91
91
  const conversationService = new __1.ConversationService(client, {
92
92
  useQualifiedIds: federated,
93
- }, mockedMLSService, mockedProteusService);
93
+ }, mockedProteusService, mockedMLSService);
94
94
  jest.spyOn(conversationService, 'joinByExternalCommit');
95
95
  return [conversationService, { apiClient: client, mlsService: mockedMLSService }];
96
96
  }
@@ -30,6 +30,7 @@ export interface CryptoProtocolConfig<T = any> {
30
30
  * If not provided will use the built in encryption mechanism
31
31
  */
32
32
  systemCrypto?: SecretCrypto<T>;
33
+ useCoreCrypto?: boolean;
33
34
  /**
34
35
  * path on the public server to the core crypto wasm file.
35
36
  * This file will be downloaded lazily when corecrypto is needed.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEzD,KAAK,YAAY,CAAC,CAAC,IAAI;IACrB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,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CAAC,GAAG,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { PreKey } from '@wireapp/api-client/lib/auth';
2
+ import { CoreCrypto } from '@wireapp/core-crypto';
3
+ import { CryptoClient } from './CryptoClient.types';
4
+ import { CoreDatabase } from '../../../../storage/CoreDB';
5
+ type Config = {
6
+ nbPrekeys: number;
7
+ onNewPrekeys: (prekeys: PreKey[]) => void;
8
+ };
9
+ export declare class CoreCryptoWrapper implements CryptoClient {
10
+ private readonly coreCrypto;
11
+ private readonly prekeyTracker;
12
+ constructor(coreCrypto: CoreCrypto, db: CoreDatabase, config: Config);
13
+ encrypt(sessions: string[], plainText: Uint8Array): Promise<Map<string, Uint8Array>>;
14
+ decrypt(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
15
+ init(): Promise<void>;
16
+ create(nbPrekeys: number, entropy?: Uint8Array): Promise<{
17
+ prekeys: PreKey[];
18
+ lastPrekey: {
19
+ id: number;
20
+ key: string;
21
+ };
22
+ }>;
23
+ getFingerprint(): Promise<string>;
24
+ getRemoteFingerprint(sessionId: string): Promise<string>;
25
+ sessionFromMessage(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
26
+ sessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
27
+ sessionExists(sessionId: string): Promise<boolean>;
28
+ saveSession(sessionId: string): Promise<void>;
29
+ deleteSession(sessionId: string): Promise<void>;
30
+ consumePrekey(): Promise<void>;
31
+ newPrekey(id: number): Promise<{
32
+ id: number;
33
+ key: string;
34
+ }>;
35
+ debugBreakSession(sessionId: string): Promise<void>;
36
+ migrateToCoreCrypto(dbName: string): Promise<void>;
37
+ get isCoreCrypto(): boolean;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=CoreCryptoWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../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E,MAAM;IAIxC,IAAI,YAAY,YAEf;CACF"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2023 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.CoreCryptoWrapper = void 0;
22
+ const bazinga64_1 = require("bazinga64");
23
+ const CryptoClient_types_1 = require("./CryptoClient.types");
24
+ const PrekeysTracker_1 = require("./PrekeysTracker");
25
+ class CoreCryptoWrapper {
26
+ constructor(coreCrypto, db, config) {
27
+ this.coreCrypto = coreCrypto;
28
+ this.prekeyTracker = new PrekeysTracker_1.PrekeyTracker(this, db, config);
29
+ }
30
+ encrypt(sessions, plainText) {
31
+ return this.coreCrypto.proteusEncryptBatched(sessions, plainText);
32
+ }
33
+ decrypt(sessionId, message) {
34
+ return this.coreCrypto.proteusDecrypt(sessionId, message);
35
+ }
36
+ init() {
37
+ return this.coreCrypto.proteusInit();
38
+ }
39
+ async create(nbPrekeys, entropy) {
40
+ if (entropy) {
41
+ await this.coreCrypto.reseedRng(entropy);
42
+ }
43
+ const prekeys = [];
44
+ for (let id = 0; id < nbPrekeys; id++) {
45
+ prekeys.push(await this.newPrekey(id));
46
+ }
47
+ await this.prekeyTracker.setInitialState(prekeys.length);
48
+ return {
49
+ prekeys,
50
+ lastPrekey: await this.newPrekey(CryptoClient_types_1.LAST_PREKEY_ID),
51
+ };
52
+ }
53
+ getFingerprint() {
54
+ return this.coreCrypto.proteusFingerprint();
55
+ }
56
+ getRemoteFingerprint(sessionId) {
57
+ return this.coreCrypto.proteusFingerprintRemote(sessionId);
58
+ }
59
+ async sessionFromMessage(sessionId, message) {
60
+ await this.consumePrekey(); // we need to mark a prekey as consumed since if we create a session from a message, it means the sender has consumed one of our prekeys
61
+ return this.coreCrypto.proteusSessionFromMessage(sessionId, message);
62
+ }
63
+ sessionFromPrekey(sessionId, prekey) {
64
+ return this.coreCrypto.proteusSessionFromPrekey(sessionId, prekey);
65
+ }
66
+ sessionExists(sessionId) {
67
+ return this.coreCrypto.proteusSessionExists(sessionId);
68
+ }
69
+ saveSession(sessionId) {
70
+ return this.coreCrypto.proteusSessionSave(sessionId);
71
+ }
72
+ deleteSession(sessionId) {
73
+ return this.coreCrypto.proteusSessionDelete(sessionId);
74
+ }
75
+ consumePrekey() {
76
+ return this.prekeyTracker.consumePrekey();
77
+ }
78
+ async newPrekey(id) {
79
+ const key = await this.coreCrypto.proteusNewPrekey(id);
80
+ return { id, key: bazinga64_1.Encoder.toBase64(key).asString };
81
+ }
82
+ async debugBreakSession(sessionId) {
83
+ const fakePrekey = [
84
+ 165, 0, 1, 1, 24, 57, 2, 161, 0, 88, 32, 212, 202, 30, 83, 242, 93, 67, 164, 202, 137, 214, 167, 166, 183, 236,
85
+ 249, 32, 21, 117, 247, 56, 223, 135, 170, 3, 151, 16, 228, 165, 186, 124, 208, 3, 161, 0, 161, 0, 88, 32, 123,
86
+ 200, 16, 166, 184, 70, 21, 81, 43, 80, 21, 231, 182, 142, 51, 220, 131, 162, 11, 255, 162, 74, 78, 162, 95, 156,
87
+ 131, 48, 203, 5, 77, 122, 4, 246,
88
+ ];
89
+ await this.coreCrypto.proteusSessionFromPrekey(sessionId, Uint8Array.from(fakePrekey));
90
+ }
91
+ async migrateToCoreCrypto(dbName) {
92
+ return this.coreCrypto.proteusCryptoboxMigrate(dbName);
93
+ }
94
+ get isCoreCrypto() {
95
+ return true;
96
+ }
97
+ }
98
+ exports.CoreCryptoWrapper = CoreCryptoWrapper;
@@ -0,0 +1,12 @@
1
+ import { PreKey } from '@wireapp/api-client/src/auth';
2
+ import { CoreCrypto } from '@wireapp/core-crypto';
3
+ import { Cryptobox } from '@wireapp/cryptobox';
4
+ import { CryptoClient } from './CryptoClient.types';
5
+ import { CoreDatabase } from '../../../../storage/CoreDB';
6
+ type Config = {
7
+ nbPrekeys: number;
8
+ onNewPrekeys: (prekeys: PreKey[]) => void;
9
+ };
10
+ export declare function wrapCryptoClient(cryptoClient: CoreCrypto | Cryptobox, db: CoreDatabase, config: Config): CryptoClient;
11
+ export {};
12
+ //# sourceMappingURL=CryptoClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CryptoClient.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAI7C,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAExD,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAGrH"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2023 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.wrapCryptoClient = void 0;
22
+ const core_crypto_1 = require("@wireapp/core-crypto");
23
+ const CoreCryptoWrapper_1 = require("./CoreCryptoWrapper");
24
+ const CryptoboxWrapper_1 = require("./CryptoboxWrapper");
25
+ function wrapCryptoClient(cryptoClient, db, config) {
26
+ const isCoreCrypto = cryptoClient instanceof core_crypto_1.CoreCrypto;
27
+ return isCoreCrypto ? new CoreCryptoWrapper_1.CoreCryptoWrapper(cryptoClient, db, config) : new CryptoboxWrapper_1.CryptoboxWrapper(cryptoClient, config);
28
+ }
29
+ exports.wrapCryptoClient = wrapCryptoClient;
@@ -0,0 +1,31 @@
1
+ import { PreKey } from '@wireapp/api-client/lib/auth';
2
+ export declare const LAST_PREKEY_ID = 65535;
3
+ export type InitialPrekeys = {
4
+ prekeys: PreKey[];
5
+ lastPrekey: PreKey;
6
+ };
7
+ export interface CryptoClient {
8
+ encrypt(sessions: string[], plainText: Uint8Array): Promise<Map<string, Uint8Array>>;
9
+ decrypt(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
10
+ /**
11
+ * Will init an already existing client. The client should already exist in the database
12
+ */
13
+ init(): Promise<void>;
14
+ /**
15
+ * Will create a new client and store it in the database
16
+ */
17
+ create(nbPrekeys: number, entropy?: Uint8Array): Promise<InitialPrekeys>;
18
+ getFingerprint(): Promise<string>;
19
+ getRemoteFingerprint(sessionId: string): Promise<string>;
20
+ sessionFromMessage(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
21
+ sessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<void>;
22
+ sessionExists(sessionId: string): Promise<boolean>;
23
+ saveSession(sessionId: string): Promise<void>;
24
+ consumePrekey: () => Promise<void>;
25
+ deleteSession(sessionId: string): Promise<void>;
26
+ newPrekey(id: number): Promise<PreKey>;
27
+ debugBreakSession(sessionId: string): void;
28
+ migrateToCoreCrypto(dbName: string): Promise<void>;
29
+ get isCoreCrypto(): boolean;
30
+ }
31
+ //# sourceMappingURL=CryptoClient.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAErE;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChF,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,IAAI,YAAY,IAAI,OAAO,CAAC;CAC7B"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2023 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.LAST_PREKEY_ID = void 0;
22
+ exports.LAST_PREKEY_ID = 65535;
@@ -0,0 +1,40 @@
1
+ import { PreKey } from '@wireapp/api-client/lib/auth';
2
+ import { Cryptobox } from '@wireapp/cryptobox';
3
+ import { CryptoClient } from './CryptoClient.types';
4
+ type Config = {
5
+ onNewPrekeys: (prekeys: PreKey[]) => void;
6
+ };
7
+ export declare class CryptoboxWrapper implements CryptoClient {
8
+ private readonly cryptobox;
9
+ constructor(cryptobox: Cryptobox, config: Config);
10
+ encrypt(sessions: string[], plainText: Uint8Array): Promise<Map<string, Uint8Array>>;
11
+ decrypt(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
12
+ init(): Promise<void>;
13
+ create(_nbPrekeys: number, entropy?: Uint8Array): Promise<{
14
+ prekeys: {
15
+ id: number;
16
+ key: string;
17
+ }[];
18
+ lastPrekey: {
19
+ id: number;
20
+ key: string;
21
+ };
22
+ }>;
23
+ getFingerprint(): Promise<string>;
24
+ getRemoteFingerprint(sessionId: string): Promise<string>;
25
+ sessionFromMessage(sessionId: string, message: Uint8Array): Promise<Uint8Array>;
26
+ consumePrekey(): Promise<void>;
27
+ sessionFromPrekey(sessionId: string, prekey: Uint8Array): Promise<undefined>;
28
+ sessionExists(sessionId: string): Promise<boolean>;
29
+ saveSession(): Promise<void>;
30
+ deleteSession(sessionId: string): Promise<void>;
31
+ newPrekey(id: number): Promise<{
32
+ id: number;
33
+ key: string;
34
+ }>;
35
+ debugBreakSession(sessionId: string): Promise<void>;
36
+ migrateToCoreCrypto(): Promise<void>;
37
+ get isCoreCrypto(): boolean;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=CryptoboxWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CryptoboxWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAC,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAElE,KAAK,MAAM,GAAG;IACZ,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,qBAAa,gBAAiB,YAAW,YAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;IAO3D,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU;IASvD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAIxC,IAAI;IAIJ,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;;;;;;;;;;IAkB/C,cAAc;IAId,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAK5C,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAInD,aAAa;IAIb,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAIvD,aAAa,CAAC,SAAS,EAAE,MAAM;IAQ/B,WAAW;IAIX,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,SAAS,CAAC,EAAE,EAAE,MAAM;;;;IAKpB,iBAAiB,CAAC,SAAS,EAAE,MAAM;IAOnC,mBAAmB;IAIzB,IAAI,YAAY,YAEf;CACF"}