@wireapp/core 46.23.15 → 46.24.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 (48) hide show
  1. package/lib/Account.d.ts +7 -8
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +21 -23
  4. package/lib/client/ClientService.js +1 -1
  5. package/lib/conversation/ConversationService/ConversationService.d.ts +12 -8
  6. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  7. package/lib/conversation/ConversationService/ConversationService.js +11 -13
  8. package/lib/conversation/ConversationService/ConversationService.test.js +5 -11
  9. package/lib/messagingProtocols/common.types.d.ts +9 -0
  10. package/lib/messagingProtocols/common.types.d.ts.map +1 -1
  11. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
  12. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
  13. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +2 -1
  14. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  15. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +6 -5
  16. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +20 -15
  17. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +9 -3
  18. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
  19. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +30 -12
  20. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  21. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +7 -2
  22. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +0 -34
  23. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +2 -2
  24. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +16 -31
  25. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  26. package/lib/messagingProtocols/mls/MLSService/MLSService.js +74 -171
  27. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +93 -151
  28. package/lib/messagingProtocols/mls/types.d.ts +0 -8
  29. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  30. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +4 -13
  31. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  32. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +79 -62
  33. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +0 -2
  34. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  35. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +5 -3
  36. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  37. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +14 -14
  38. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  39. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +3 -1
  40. package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +3 -0
  41. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +3 -0
  42. package/lib/secretStore/secretKeyGenerator.d.ts +1 -0
  43. package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
  44. package/lib/secretStore/secretKeyGenerator.js +3 -1
  45. package/lib/test/StoreHelper.d.ts +2 -0
  46. package/lib/test/StoreHelper.d.ts.map +1 -0
  47. package/lib/test/StoreHelper.js +27 -0
  48. package/package.json +5 -5
@@ -67,25 +67,34 @@ const defaultMLSInitConfig = {
67
67
  ciphersuites: [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
68
68
  defaultCiphersuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
69
69
  };
70
+ // Needs to be divisible by 4 to be a valid base64 string
71
+ const mockGroupId = 'Z3JvdXAtdGVzdC0x';
72
+ const mockedMLSWelcomeEventData = '';
70
73
  const createMLSService = async () => {
71
74
  const apiClient = new api_client_1.APIClient();
72
- const mockCoreCrypto = {
73
- createConversation: jest.fn(),
74
- conversationExists: jest.fn(),
75
+ const transactionContext = {
76
+ mlsInit: jest.fn(),
75
77
  wipeConversation: jest.fn(),
76
- clientValidKeypackagesCount: jest.fn(),
77
78
  clientKeypackages: jest.fn(),
78
- mlsInit: jest.fn(),
79
- clientPublicKey: jest.fn(),
79
+ createConversation: jest.fn(),
80
+ clientValidKeypackagesCount: jest.fn(),
81
+ conversationExists: jest.fn(),
80
82
  processWelcomeMessage: jest.fn(),
81
- conversationEpoch: jest.fn(),
82
83
  commitPendingProposals: jest.fn(),
83
- registerCallbacks: jest.fn(),
84
+ decryptMessage: jest.fn(),
85
+ updateKeyingMaterial: jest.fn(),
86
+ };
87
+ const mockCoreCrypto = {
88
+ transaction: jest.fn(fn => {
89
+ return fn(transactionContext);
90
+ }),
91
+ registerEpochObserver: jest.fn(),
92
+ provideTransport: jest.fn(),
93
+ version: jest.fn(),
94
+ conversationExists: jest.fn(),
84
95
  e2eiIsEnabled: jest.fn(() => false),
85
- clearPendingGroupFromExternalCommit: async () => { },
86
- clearPendingCommit: async () => { },
87
- commitAccepted: jest.fn(),
88
- transaction: jest.fn(),
96
+ clientPublicKey: jest.fn(),
97
+ conversationEpoch: jest.fn(),
89
98
  };
90
99
  const mockedDb = await (0, CoreDB_1.openDB)('core-test-db');
91
100
  const recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
@@ -97,8 +106,11 @@ const createMLSService = async () => {
97
106
  });
98
107
  const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler);
99
108
  mlsService['_config'] = { ...defaultMLSInitConfig, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 };
100
- return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
109
+ return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler, transactionContext }];
101
110
  };
111
+ afterAll(() => {
112
+ jest.clearAllTimers();
113
+ });
102
114
  describe('MLSService', () => {
103
115
  describe('registerConversation', () => {
104
116
  let mlsService;
@@ -112,12 +124,6 @@ describe('MLSService', () => {
112
124
  .mockResolvedValue({ removal: { ed25519: 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=' } });
113
125
  jest.spyOn(apiClient.api.client, 'claimMLSKeyPackages').mockResolvedValue({ key_packages: [] });
114
126
  jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation();
115
- jest.spyOn(mlsService, 'processCommitAction').mockImplementation(() => ({
116
- failed_to_send: [],
117
- failed: [],
118
- events: [],
119
- time: '',
120
- }));
121
127
  jest.spyOn(mlsService, 'cancelKeyMaterialRenewal').mockImplementation();
122
128
  });
123
129
  it('creates a new mls conversation and avoid adding the selfUser', async () => {
@@ -145,37 +151,10 @@ describe('MLSService', () => {
145
151
  keyPackages: [],
146
152
  failures: [failure],
147
153
  });
148
- const { failures } = await mlsService.registerConversation(groupId, [...users, selfUser], { creator });
154
+ const failures = await mlsService.registerConversation(groupId, [...users, selfUser], { creator });
149
155
  expect(failures).toEqual([failure]);
150
156
  expect(mlsService.scheduleKeyMaterialRenewal).toHaveBeenCalledWith(groupId);
151
157
  });
152
- it("returns a list of failure reasons if it was not possible to upload users' keys", async () => {
153
- const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
154
- const selfUser = createUserId();
155
- const creator = { user: selfUser, client: 'client-1' };
156
- const users = [createUserId(), createUserId()];
157
- const failureKeysClaiming = {
158
- reason: conversation_1.AddUsersFailureReasons.OFFLINE_FOR_TOO_LONG,
159
- users: [users[0]],
160
- };
161
- const failureKeysUpload = {
162
- reason: conversation_1.AddUsersFailureReasons.UNREACHABLE_BACKENDS,
163
- users: [users[1]],
164
- backends: [users[1].domain],
165
- };
166
- jest.spyOn(mlsService, 'getKeyPackagesPayload').mockResolvedValueOnce({
167
- keyPackages: [new Uint8Array()],
168
- failures: [failureKeysClaiming],
169
- });
170
- jest.spyOn(mlsService, 'addUsersToExistingConversation').mockResolvedValueOnce({
171
- failures: [failureKeysUpload],
172
- events: [],
173
- time: '',
174
- });
175
- const { failures } = await mlsService.registerConversation(groupId, [...users, selfUser], { creator });
176
- expect(failures).toEqual([failureKeysClaiming, failureKeysUpload]);
177
- expect(mlsService.scheduleKeyMaterialRenewal).toHaveBeenCalledWith(groupId);
178
- });
179
158
  });
180
159
  describe('getKeyPackagesPayload', () => {
181
160
  it('succesfully claims keys for all users', async () => {
@@ -210,24 +189,24 @@ describe('MLSService', () => {
210
189
  });
211
190
  describe('isConversationEstablished', () => {
212
191
  it('returns false if conversation does not exist locally', async () => {
213
- const [mlsService] = await createMLSService();
192
+ const [mlsService, { coreCrypto }] = await createMLSService();
214
193
  const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
215
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
194
+ jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(false);
216
195
  const isEstablshed = await mlsService.isConversationEstablished(groupId);
217
196
  expect(isEstablshed).toBe(false);
218
197
  });
219
198
  it('returns false if epoch number is 0', async () => {
220
- const [mlsService] = await createMLSService();
199
+ const [mlsService, { coreCrypto }] = await createMLSService();
221
200
  const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
222
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(true);
201
+ jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(true);
223
202
  jest.spyOn(mlsService, 'getEpoch').mockResolvedValueOnce(0);
224
203
  const isEstablshed = await mlsService.isConversationEstablished(groupId);
225
204
  expect(isEstablshed).toBe(false);
226
205
  });
227
206
  it.each([1, 2, 100])('returns false if epoch number is 1 or more', async (epoch) => {
228
- const [mlsService] = await createMLSService();
207
+ const [mlsService, { coreCrypto }] = await createMLSService();
229
208
  const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
230
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(true);
209
+ jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(true);
231
210
  jest.spyOn(mlsService, 'getEpoch').mockResolvedValueOnce(epoch);
232
211
  const isEstablshed = await mlsService.isConversationEstablished(groupId);
233
212
  expect(isEstablshed).toBe(true);
@@ -297,7 +276,7 @@ describe('MLSService', () => {
297
276
  });
298
277
  describe('initClient', () => {
299
278
  it('uses the default config if config is not provided by the consumer', async () => {
300
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
279
+ const [mlsService, { apiClient, coreCrypto, transactionContext }] = await createMLSService();
301
280
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
302
281
  const mockClientId = 'client-1';
303
282
  const mockClient = { mls_public_keys: {}, id: mockClientId };
@@ -308,11 +287,11 @@ describe('MLSService', () => {
308
287
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
309
288
  const config = { ...defaultMLSInitConfig };
310
289
  await mlsService.initClient(mockUserId, mockClient, config);
311
- expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
290
+ expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
312
291
  expect(mlsService.config.nbKeyPackages).toEqual(100);
313
292
  });
314
293
  it('uses the config provided by the consumer', async () => {
315
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
294
+ const [mlsService, { apiClient, transactionContext, coreCrypto }] = await createMLSService();
316
295
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
317
296
  const mockClientId = 'client-1';
318
297
  const mockClient = { mls_public_keys: {}, id: mockClientId };
@@ -323,11 +302,11 @@ describe('MLSService', () => {
323
302
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
324
303
  const config = { ...defaultMLSInitConfig, nbKeyPackages: 40, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY };
325
304
  await mlsService.initClient(mockUserId, mockClient, config);
326
- expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
305
+ expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
327
306
  expect(mlsService.config).toEqual(config);
328
307
  });
329
308
  it('uses the default config value when provided with undefined by the consumer', async () => {
330
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
309
+ const [mlsService, { apiClient, transactionContext, coreCrypto }] = await createMLSService();
331
310
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
332
311
  const mockClientId = 'client-1';
333
312
  const mockClient = { mls_public_keys: {}, id: mockClientId };
@@ -342,11 +321,11 @@ describe('MLSService', () => {
342
321
  keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY,
343
322
  };
344
323
  await mlsService.initClient(mockUserId, mockClient, config);
345
- expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
324
+ expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
346
325
  expect(mlsService.config).toEqual({ ...config, nbKeyPackages: 100 });
347
326
  });
348
327
  it('uploads public key only if it was not yet defined on client entity', async () => {
349
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
328
+ const [mlsService, { apiClient, transactionContext, coreCrypto }] = await createMLSService();
350
329
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
351
330
  const mockClientId = 'client-1';
352
331
  const mockClient = { mls_public_keys: {}, id: mockClientId };
@@ -356,17 +335,17 @@ describe('MLSService', () => {
356
335
  jest.spyOn(Helper, 'getMLSDeviceStatus').mockReturnValueOnce(Helper.MLSDeviceStatus.FRESH);
357
336
  jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValue(new Uint8Array());
358
337
  await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
359
- expect(coreCrypto.mlsInit).toHaveBeenCalled();
338
+ expect(transactionContext.mlsInit).toHaveBeenCalled();
360
339
  expect(apiClient.api.client.putClient).toHaveBeenCalledWith(mockClientId, expect.anything());
361
340
  });
362
341
  it('uploads key packages if there are not enough keys on backend', async () => {
363
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
342
+ const [mlsService, { apiClient, transactionContext, coreCrypto }] = await createMLSService();
364
343
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
365
344
  const mockClientId = 'client-1';
366
345
  const mockClient = { mls_public_keys: { ed25519: 'key' }, id: mockClientId };
367
346
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
368
347
  const mockedClientKeyPackages = [new Uint8Array()];
369
- jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
348
+ jest.spyOn(transactionContext, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
370
349
  jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(new Uint8Array());
371
350
  jest.spyOn(Helper, 'getMLSDeviceStatus').mockReturnValueOnce(Helper.MLSDeviceStatus.REGISTERED);
372
351
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
@@ -374,11 +353,11 @@ describe('MLSService', () => {
374
353
  .spyOn(apiClient.api.client, 'getMLSKeyPackageCount')
375
354
  .mockResolvedValueOnce(mlsService['minRequiredKeyPackages'] - 1);
376
355
  await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
377
- expect(coreCrypto.mlsInit).toHaveBeenCalled();
356
+ expect(transactionContext.mlsInit).toHaveBeenCalled();
378
357
  expect(apiClient.api.client.uploadMLSKeyPackages).toHaveBeenCalledWith(mockClientId, expect.anything());
379
358
  });
380
359
  it('does not upload public key or key packages if both are already uploaded', async () => {
381
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
360
+ const [mlsService, { apiClient, transactionContext, coreCrypto }] = await createMLSService();
382
361
  const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
383
362
  const mockClientId = 'client-1';
384
363
  const mockClient = { mls_public_keys: { ed25519: 'key' }, id: mockClientId };
@@ -389,97 +368,67 @@ describe('MLSService', () => {
389
368
  jest.spyOn(apiClient.api.client, 'putClient');
390
369
  jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(new Uint8Array());
391
370
  await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
392
- expect(coreCrypto.mlsInit).toHaveBeenCalled();
371
+ expect(transactionContext.mlsInit).toHaveBeenCalled();
393
372
  expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
394
373
  expect(apiClient.api.client.putClient).not.toHaveBeenCalled();
395
374
  });
396
375
  });
397
376
  describe('wipeConversation', () => {
398
377
  it('wipes a group and cancels its timers', async () => {
399
- const [mlsService, { coreCrypto, recurringTaskScheduler }] = await createMLSService();
378
+ const [mlsService, { recurringTaskScheduler, coreCrypto, transactionContext }] = await createMLSService();
400
379
  const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm4OQFc=';
401
- jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(true);
380
+ coreCrypto.conversationExists = jest.fn().mockResolvedValue(true);
381
+ transactionContext.wipeConversation = jest.fn().mockResolvedValue(undefined);
402
382
  jest.spyOn(recurringTaskScheduler, 'cancelTask');
403
383
  jest.spyOn(TaskScheduler_1.TaskScheduler, 'cancelTask');
404
384
  await mlsService.wipeConversation(groupId);
405
385
  expect(recurringTaskScheduler.cancelTask).toHaveBeenCalledWith(expect.stringContaining(groupId));
406
386
  expect(TaskScheduler_1.TaskScheduler.cancelTask).toHaveBeenCalledWith(expect.stringContaining(groupId));
407
- expect(coreCrypto.wipeConversation).toHaveBeenCalled();
387
+ expect(transactionContext.wipeConversation).toHaveBeenCalled();
408
388
  });
409
389
  it('does not try to wipe a group if it does not exist already', async () => {
410
- const [mlsService, { coreCrypto, recurringTaskScheduler }] = await createMLSService();
390
+ const [mlsService, { recurringTaskScheduler, transactionContext, coreCrypto }] = await createMLSService();
411
391
  const groupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm4OQFc=';
412
- jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(false);
392
+ coreCrypto.conversationExists = jest.fn().mockResolvedValue(false);
393
+ transactionContext.wipeConversation = jest.fn().mockResolvedValue(undefined);
413
394
  jest.spyOn(recurringTaskScheduler, 'cancelTask');
414
395
  jest.spyOn(TaskScheduler_1.TaskScheduler, 'cancelTask');
415
396
  await mlsService.wipeConversation(groupId);
416
397
  expect(recurringTaskScheduler.cancelTask).toHaveBeenCalledWith(expect.stringContaining(groupId));
417
398
  expect(TaskScheduler_1.TaskScheduler.cancelTask).toHaveBeenCalledWith(expect.stringContaining(groupId));
418
- expect(coreCrypto.wipeConversation).not.toHaveBeenCalled();
419
- });
420
- });
421
- describe('commitPendingProposals', () => {
422
- it('commits pending proposals and uploads received commit bundle to backend', async () => {
423
- const [mlsService, { coreCrypto: mockCoreCrypto, apiClient }] = await createMLSService();
424
- const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
425
- jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockResolvedValueOnce({
426
- commit: new Uint8Array(),
427
- groupInfo: { payload: new Uint8Array() },
428
- });
429
- jest.spyOn(apiClient.api.conversation, 'postMlsCommitBundle').mockResolvedValueOnce({ events: [], time: '' });
430
- await mlsService.commitPendingProposals(mockGroupId);
431
- expect(mockCoreCrypto.commitPendingProposals).toHaveBeenCalled();
432
- expect(apiClient.api.conversation.postMlsCommitBundle).toHaveBeenCalled();
433
- });
434
- it('clears pending commit and retries when failed committing pending proposals', async () => {
435
- const [mlsService, { coreCrypto: mockCoreCrypto, apiClient }] = await createMLSService();
436
- const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
437
- jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockRejectedValueOnce(new Error('mocked error'));
438
- jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockResolvedValueOnce({
439
- commit: new Uint8Array(),
440
- groupInfo: { payload: new Uint8Array() },
441
- });
442
- jest.spyOn(apiClient.api.conversation, 'postMlsCommitBundle').mockResolvedValueOnce({ events: [], time: '' });
443
- jest.spyOn(mockCoreCrypto, 'clearPendingCommit');
444
- jest.spyOn(mockCoreCrypto, 'clearPendingGroupFromExternalCommit');
445
- await mlsService.commitPendingProposals(mockGroupId);
446
- expect(mockCoreCrypto.clearPendingCommit).toHaveBeenCalledTimes(1);
447
- expect(mockCoreCrypto.clearPendingGroupFromExternalCommit).toHaveBeenCalledTimes(1);
448
- expect(mockCoreCrypto.commitPendingProposals).toHaveBeenCalledTimes(2);
449
- expect(apiClient.api.conversation.postMlsCommitBundle).toHaveBeenCalledTimes(1);
399
+ expect(transactionContext.wipeConversation).not.toHaveBeenCalled();
450
400
  });
451
401
  });
452
402
  describe('handleMLSMessageAddEvent', () => {
453
403
  it('decrypts a message and emits new epoch event if epoch has changed', async () => {
454
- const [mlsService, { coreCrypto: mockCoreCrypto }] = await createMLSService();
404
+ const [mlsService, { transactionContext, coreCrypto }] = await createMLSService();
455
405
  const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
456
406
  const mockedNewEpoch = 3;
457
407
  const getGroupIdFromConversationId = () => Promise.resolve(mockGroupId);
458
408
  const mockedDecryptoedMessage = {
459
409
  hasEpochChanged: true,
460
410
  isActive: false,
461
- proposals: [],
462
411
  };
463
- jest.spyOn(mockCoreCrypto, 'transaction').mockResolvedValueOnce(mockedDecryptoedMessage);
464
- jest.spyOn(mockCoreCrypto, 'conversationEpoch').mockResolvedValueOnce(mockedNewEpoch);
412
+ jest.spyOn(transactionContext, 'decryptMessage').mockResolvedValueOnce(mockedDecryptoedMessage);
413
+ jest.spyOn(coreCrypto, 'conversationEpoch').mockResolvedValueOnce(mockedNewEpoch);
465
414
  jest.spyOn(mlsService, 'emit').mockImplementation(jest.fn());
466
415
  const mockedMLSWelcomeEvent = {
467
416
  type: event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD,
468
417
  senderClientId: '',
469
418
  conversation: '',
470
- data: '',
419
+ data: mockedMLSWelcomeEventData,
471
420
  from: '',
472
421
  time: '',
473
422
  };
474
423
  await mlsService.handleMLSMessageAddEvent(mockedMLSWelcomeEvent, getGroupIdFromConversationId);
475
- expect(mockCoreCrypto.transaction).toHaveBeenCalled();
424
+ expect(transactionContext.decryptMessage).toHaveBeenCalled();
476
425
  expect(mlsService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
477
426
  epoch: mockedNewEpoch,
478
427
  groupId: mockGroupId,
479
428
  });
480
429
  });
481
430
  it('handles pending propoals with a delay after decrypting a message', async () => {
482
- const [mlsService, { coreCrypto: mockCoreCrypto }] = await createMLSService();
431
+ const [mlsService, { transactionContext, coreCrypto }] = await createMLSService();
483
432
  jest.useFakeTimers();
484
433
  const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
485
434
  const mockedNewEpoch = 3;
@@ -488,122 +437,117 @@ describe('MLSService', () => {
488
437
  const mockedDecryptoedMessage = {
489
438
  hasEpochChanged: true,
490
439
  isActive: false,
491
- proposals: [],
492
440
  commitDelay,
493
441
  };
494
- jest.spyOn(mockCoreCrypto, 'transaction').mockResolvedValueOnce(mockedDecryptoedMessage);
495
- jest.spyOn(mockCoreCrypto, 'conversationEpoch').mockResolvedValueOnce(mockedNewEpoch);
442
+ jest.spyOn(transactionContext, 'decryptMessage').mockResolvedValueOnce(mockedDecryptoedMessage);
443
+ jest.spyOn(coreCrypto, 'conversationEpoch').mockResolvedValueOnce(mockedNewEpoch);
496
444
  jest.spyOn(mlsService, 'commitPendingProposals');
497
445
  const mockedMLSWelcomeEvent = {
498
446
  type: event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD,
499
447
  senderClientId: '',
500
448
  conversation: '',
501
- data: '',
449
+ data: mockedMLSWelcomeEventData,
502
450
  from: '',
503
451
  time: new Date().toISOString(),
504
452
  };
505
453
  await mlsService.handleMLSMessageAddEvent(mockedMLSWelcomeEvent, getGroupIdFromConversationId);
506
- expect(mockCoreCrypto.commitPendingProposals).not.toHaveBeenCalled();
507
454
  jest.advanceTimersByTime(commitDelay);
508
- expect(mockCoreCrypto.transaction).toHaveBeenCalled();
509
- expect(mockCoreCrypto.commitPendingProposals).toHaveBeenCalled();
455
+ expect(transactionContext.decryptMessage).toHaveBeenCalled();
510
456
  });
511
457
  });
512
458
  describe('handleMLSWelcomeMessageEvent', () => {
513
459
  it("before processing welcome it verifies that there's enough key packages locally", async () => {
514
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
460
+ const [mlsService, { apiClient, transactionContext }] = await createMLSService();
515
461
  const mockClientId = 'client-1';
516
462
  const mockClient = { mls_public_keys: { ed25519: 'key' }, id: mockClientId };
517
463
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
518
464
  const mockedClientKeyPackages = [new Uint8Array()];
519
- jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
465
+ jest.spyOn(transactionContext, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
520
466
  const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
521
467
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
522
- jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
468
+ jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysBelowThreshold);
523
469
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
524
470
  jest
525
- .spyOn(coreCrypto, 'processWelcomeMessage')
526
- .mockResolvedValueOnce({ id: new Uint8Array(), crlNewDistributionPoints: [] });
471
+ .spyOn(transactionContext, 'processWelcomeMessage')
472
+ .mockResolvedValue({ id: new Uint8Array(), crlNewDistributionPoints: [] });
527
473
  jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
528
474
  const mockedMLSWelcomeEvent = {
529
475
  type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
530
476
  conversation: '',
531
- data: '',
477
+ data: mockedMLSWelcomeEventData,
532
478
  from: '',
533
479
  time: '',
534
480
  };
535
481
  await mlsService.handleMLSWelcomeMessageEvent(mockedMLSWelcomeEvent, mockClient.id);
536
- expect(coreCrypto.processWelcomeMessage).toHaveBeenCalled();
482
+ expect(transactionContext.processWelcomeMessage).toHaveBeenCalled();
537
483
  expect(apiClient.api.client.uploadMLSKeyPackages).toHaveBeenCalledWith(mockClientId, expect.anything());
538
484
  });
539
485
  it('before processing welcome it does not generate new keys if there is enough key packages locally', async () => {
540
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
486
+ const [mlsService, { apiClient, transactionContext }] = await createMLSService();
541
487
  const mockClientId = 'client-1';
542
488
  const mockClient = { mls_public_keys: { ed25519: 'key' }, id: mockClientId };
543
489
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
544
490
  const mockedClientKeyPackages = [new Uint8Array()];
545
- jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
491
+ jest.spyOn(transactionContext, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
546
492
  const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
547
- jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
493
+ jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysAboveThreshold);
548
494
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
549
495
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
550
496
  jest
551
- .spyOn(coreCrypto, 'processWelcomeMessage')
552
- .mockResolvedValueOnce({ id: new Uint8Array(), crlNewDistributionPoints: [] });
497
+ .spyOn(transactionContext, 'processWelcomeMessage')
498
+ .mockResolvedValue({ id: new Uint8Array(), crlNewDistributionPoints: [] });
553
499
  jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
554
500
  const mockedMLSWelcomeEvent = {
555
501
  type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
556
502
  conversation: '',
557
- data: '',
503
+ data: mockedMLSWelcomeEventData,
558
504
  from: '',
559
505
  time: '',
560
506
  };
561
507
  await mlsService.handleMLSWelcomeMessageEvent(mockedMLSWelcomeEvent, mockClient.id);
562
- expect(coreCrypto.processWelcomeMessage).toHaveBeenCalled();
508
+ expect(transactionContext.processWelcomeMessage).toHaveBeenCalled();
563
509
  expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
564
510
  });
565
511
  it('before processing welcome it does not generate new keys if there is enough key packages uploaded to backend', async () => {
566
- const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
512
+ const [mlsService, { apiClient, transactionContext }] = await createMLSService();
567
513
  const mockClientId = 'client-1';
568
514
  const mockClient = { mls_public_keys: { ed25519: 'key' }, id: mockClientId };
569
515
  apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
570
516
  const mockedClientKeyPackages = [new Uint8Array()];
571
- jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
517
+ jest.spyOn(transactionContext, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
572
518
  const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
573
519
  const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
574
- jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
520
+ jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysBelowThreshold);
575
521
  jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
576
522
  jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
577
523
  jest
578
- .spyOn(coreCrypto, 'processWelcomeMessage')
579
- .mockResolvedValueOnce({ id: new Uint8Array(), crlNewDistributionPoints: [] });
524
+ .spyOn(transactionContext, 'processWelcomeMessage')
525
+ .mockResolvedValue({ id: new Uint8Array(), crlNewDistributionPoints: [] });
580
526
  jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
581
527
  const mockedMLSWelcomeEvent = {
582
528
  type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
583
529
  conversation: '',
584
- data: '',
530
+ data: mockedMLSWelcomeEventData,
585
531
  from: '',
586
532
  time: '',
587
533
  };
588
534
  await mlsService.handleMLSWelcomeMessageEvent(mockedMLSWelcomeEvent, mockClient.id);
589
- expect(coreCrypto.processWelcomeMessage).toHaveBeenCalled();
535
+ expect(transactionContext.processWelcomeMessage).toHaveBeenCalled();
590
536
  expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
591
537
  });
592
538
  });
593
539
  describe('tryEstablishingMLSGroup', () => {
594
540
  it('returns false if group did already exist locally', async () => {
595
- const [mlsService] = await createMLSService();
596
- const mockGroupId = 'mock-group-id';
597
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(true);
541
+ const [mlsService, { coreCrypto }] = await createMLSService();
542
+ jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(true);
598
543
  jest.spyOn(mlsService, 'registerConversation').mockImplementation(jest.fn());
599
544
  const wasConversationEstablished = await mlsService.tryEstablishingMLSGroup(mockGroupId);
600
545
  expect(mlsService.registerConversation).not.toHaveBeenCalled();
601
546
  expect(wasConversationEstablished).toBe(false);
602
547
  });
603
548
  it('returns false if corecrypto has thrown an error when trying to register group locally', async () => {
604
- const [mlsService] = await createMLSService();
605
- const mockGroupId = 'mock-group-id';
606
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
549
+ const [mlsService, { coreCrypto }] = await createMLSService();
550
+ jest.spyOn(coreCrypto, 'conversationExists').mockResolvedValueOnce(false);
607
551
  const conversationAlreadyExistsError = new Error();
608
552
  conversationAlreadyExistsError.name = CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorConversationAlreadyExists;
609
553
  jest.spyOn(mlsService, 'registerConversation').mockRejectedValueOnce(conversationAlreadyExistsError);
@@ -612,9 +556,8 @@ describe('MLSService', () => {
612
556
  expect(wasConversationEstablished).toBe(false);
613
557
  });
614
558
  it('returns false and wipes group locally if any backend error was thrown', async () => {
615
- const [mlsService] = await createMLSService();
616
- const mockGroupId = 'mock-group-id2';
617
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
559
+ const [mlsService, { transactionContext }] = await createMLSService();
560
+ jest.spyOn(transactionContext, 'conversationExists').mockResolvedValueOnce(false);
618
561
  jest
619
562
  .spyOn(mlsService, 'registerConversation')
620
563
  .mockRejectedValueOnce(new http_1.BackendError('', http_1.BackendErrorLabel.MLS_STALE_MESSAGE, http_1.StatusCode.CONFLICT));
@@ -625,10 +568,9 @@ describe('MLSService', () => {
625
568
  expect(wasConversationEstablished).toBe(false);
626
569
  });
627
570
  it('returns true after MLS group was etablished successfully', async () => {
628
- const [mlsService] = await createMLSService();
629
- const mockGroupId = 'mock-group-id2';
630
- jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
631
- jest.spyOn(mlsService, 'registerConversation').mockResolvedValueOnce({ events: [], time: '', failures: [] });
571
+ const [mlsService, { transactionContext }] = await createMLSService();
572
+ jest.spyOn(transactionContext, 'conversationExists').mockResolvedValueOnce(false);
573
+ jest.spyOn(mlsService, 'registerConversation').mockResolvedValueOnce([]);
632
574
  jest.spyOn(mlsService, 'wipeConversation').mockImplementation(jest.fn());
633
575
  const wasConversationEstablished = await mlsService.tryEstablishingMLSGroup(mockGroupId);
634
576
  expect(mlsService.registerConversation).toHaveBeenCalledWith(mockGroupId, []);
@@ -20,12 +20,4 @@ export type HandlePendingProposalsParams = {
20
20
  delayInMs: number;
21
21
  eventTime: string;
22
22
  } & CommonMLS;
23
- export interface CoreCryptoConfig {
24
- /**
25
- * path on the public server to the core crypto wasm file.
26
- * This file will be downloaded lazily when corecrypto is needed.
27
- * It, thus, needs to know where, on the server, the file can be found
28
- */
29
- wasmFilePath: string;
30
- }
31
23
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,yBAAyB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,yBAAyB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,SAAS,CAAC"}
@@ -2,20 +2,19 @@ import { PreKey } from '@wireapp/api-client/lib/auth';
2
2
  import { CoreCrypto } from '@wireapp/core-crypto';
3
3
  import type { CRUDEngine } from '@wireapp/store-engine';
4
4
  import { GeneratedKey } from '../../../../../secretStore/secretKeyGenerator';
5
+ import { CoreCryptoConfig } from '../../../../common.types';
5
6
  import { CryptoClient } from '../CryptoClient.types';
6
7
  type Config = {
7
- generateSecretKey: (keyId: string) => Promise<GeneratedKey>;
8
+ generateSecretKey: (keyId: string, keySize: 16 | 32) => Promise<GeneratedKey>;
8
9
  nbPrekeys: number;
9
10
  onNewPrekeys: (prekeys: PreKey[]) => void;
10
- wasmFilePath: string;
11
11
  };
12
- type ClientConfig = Omit<Config, 'generateSecretKey' | 'wasmFilePath'> & {
12
+ type ClientConfig = Omit<Config, 'generateSecretKey'> & {
13
13
  onWipe: () => Promise<void>;
14
14
  };
15
- export declare function buildClient(storeEngine: CRUDEngine, { wasmFilePath, generateSecretKey, nbPrekeys, onNewPrekeys }: Config): Promise<CoreCryptoWrapper>;
15
+ export declare function buildClient(storeEngine: CRUDEngine, { generateSecretKey, nbPrekeys, onNewPrekeys }: Config, { wasmFilePath }: CoreCryptoConfig): Promise<CoreCryptoWrapper>;
16
16
  export declare class CoreCryptoWrapper implements CryptoClient {
17
17
  private readonly coreCrypto;
18
- private readonly config;
19
18
  private readonly prekeyTracker;
20
19
  readonly version: string;
21
20
  constructor(coreCrypto: CoreCrypto, config: ClientConfig);
@@ -43,15 +42,7 @@ export declare class CoreCryptoWrapper implements CryptoClient {
43
42
  key: string;
44
43
  }>;
45
44
  debugBreakSession(sessionId: string): Promise<void>;
46
- debugResetIdentity(): Promise<void>;
47
45
  migrateFromCryptobox(dbName: string): Promise<void>;
48
- /**
49
- * Will call the callback once corecrypto is ready.
50
- * @param callback - Function to be called once corecrypto is ready.
51
- * @see https://github.com/wireapp/wire-web-packages/pull/4972
52
- */
53
- private onReady;
54
- wipe(): Promise<void>;
55
46
  }
56
47
  export {};
57
48
  //# sourceMappingURL=CoreCryptoWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAKpD,OAAO,EAAC,UAAU,EAAgD,MAAM,sBAAsB,CAAC;AAC/F,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAoB,YAAY,EAAC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,cAAc,CAAC,GAAG;IACvE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AAmBF,wBAAsB,WAAW,CAC/B,WAAW,EAAE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