@wireapp/core 44.0.7 → 44.0.9

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 (33) hide show
  1. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  2. package/lib/conversation/ConversationService/ConversationService.js +12 -6
  3. package/lib/conversation/ConversationService/ConversationService.test.js +8 -4
  4. package/lib/conversation/SubconversationService/SubconversationService.d.ts +2 -1
  5. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  6. package/lib/conversation/SubconversationService/SubconversationService.js +6 -5
  7. package/lib/conversation/SubconversationService/SubconversationService.test.js +16 -10
  8. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +11 -3
  9. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  10. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +14 -4
  11. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -1
  12. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
  13. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +18 -21
  14. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts +2 -2
  15. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts.map +1 -1
  16. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts +2 -2
  17. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.d.ts.map +1 -1
  18. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts +2 -2
  19. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts.map +1 -1
  20. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts +6 -19
  21. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts.map +1 -1
  22. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.js +17 -62
  23. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts +8 -9
  24. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts.map +1 -1
  25. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.js +5 -7
  26. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +11 -6
  27. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  28. package/lib/messagingProtocols/mls/MLSService/MLSService.js +18 -8
  29. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +1 -1
  30. package/lib/storage/CoreDB.d.ts +5 -0
  31. package/lib/storage/CoreDB.d.ts.map +1 -1
  32. package/lib/storage/CoreDB.js +3 -1
  33. package/package.json +2 -2
@@ -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,EACtB,eAAe,EACf,kBAAkB,EAEnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAEL,cAAc,EAEd,6BAA6B,EAC7B,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC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,CAoDzB;IAEF;;;;;;;;OAQG;IACU,uBAAuB,CAAC,EACnC,OAAO,EACP,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,WAAW,CAAC;QACxB,cAAc,EAAE,WAAW,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BH,wBAAwB;YAsBxB,gCAAgC;YAqBhC,4BAA4B;YAI5B,wBAAwB;YAIxB,yBAAyB;IAKvC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoB3E"}
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,EACtB,eAAe,EACf,kBAAkB,EAEnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAEL,cAAc,EAEd,6BAA6B,EAC7B,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAGxD,OAAO,EAAkC,cAAc,EAAC,MAAM,kCAAkC,CAAC;A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W,CAAC;QAC5B,UAAU,EAAE,WAAW,CAAC;QACxB,cAAc,EAAE,WAAW,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BH,wBAAwB;YAsBxB,gCAAgC;YAyBhC,4BAA4B;YAI5B,wBAAwB;YAIxB,yBAAyB;IAKvC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoB3E"}
@@ -96,7 +96,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
96
96
  // we wipe the it locally (in case it exsits in the local store) and try to register it.
97
97
  await this.mlsService.wipeConversation(groupId);
98
98
  try {
99
- await this.mlsService.registerConversation(groupId, [otherUserId, selfUser.user], selfUser);
99
+ await this.mlsService.registerConversation(groupId, [otherUserId, selfUser.user], { creator: selfUser });
100
100
  this.logger.info(`Conversation (id ${mlsConversation.qualified_id.id}) established successfully.`);
101
101
  return this.getMLS1to1Conversation(otherUserId);
102
102
  }
@@ -248,8 +248,10 @@ class ConversationService extends commons_1.TypedEventEmitter {
248
248
  throw new Error('No group_id found in response which is required for creating MLS conversations.');
249
249
  }
250
250
  const response = await this.mlsService.registerConversation(groupId, qualifiedUsers.concat(selfUserId), {
251
- user: selfUserId,
252
- client: selfClientId,
251
+ creator: {
252
+ user: selfUserId,
253
+ client: selfClientId,
254
+ },
253
255
  });
254
256
  // We fetch the fresh version of the conversation created on backend with the newly added users
255
257
  const conversation = await this.apiClient.api.conversation.getConversation(qualifiedId);
@@ -374,7 +376,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
374
376
  * Handles epoch mismatch in a subconversation.
375
377
  * @param subconversation - subconversation
376
378
  */
377
- async handleSubconversationEpochMismatch(subconversation) {
379
+ async handleSubconversationEpochMismatch(subconversation, parentGroupId) {
378
380
  const { parent_qualified_id: parentConversationId, group_id: groupId, epoch, subconv_id: subconversationId, } = subconversation;
379
381
  if (await this.hasEpochMismatch(groupId, epoch)) {
380
382
  this.logger.log(`Subconversation "${subconversationId}" (parent id: ${parentConversationId.id}) was not established or its epoch number was out of date, joining via external commit`);
@@ -383,7 +385,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
383
385
  throw new Error('Unexpected subconversation id');
384
386
  }
385
387
  try {
386
- await this.subconversationService.joinConferenceSubconversation(parentConversationId);
388
+ await this.subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
387
389
  }
388
390
  catch (error) {
389
391
  const message = `There was an error while handling epoch mismatch in MLS subconversation (id: ${parentConversationId.id}, subconv: ${subconversationId}):`;
@@ -482,8 +484,12 @@ class ConversationService extends commons_1.TypedEventEmitter {
482
484
  }
483
485
  async recoverMLSGroupFromEpochMismatch(conversationId, subconversationId) {
484
486
  if (subconversationId) {
487
+ const parentGroupId = await this.groupIdFromConversationId(conversationId);
485
488
  const subconversation = await this.apiClient.api.conversation.getSubconversation(conversationId, subconversationId);
486
- return this.handleSubconversationEpochMismatch(subconversation);
489
+ if (!parentGroupId) {
490
+ throw new Error('Could not find parent group id for the subconversation');
491
+ }
492
+ return this.handleSubconversationEpochMismatch(subconversation, parentGroupId);
487
493
  }
488
494
  const mlsConversation = await this.apiClient.api.conversation.getConversation(conversationId);
489
495
  if (!(0, util_1.isMLSConversation)(mlsConversation)) {
@@ -109,7 +109,7 @@ describe('ConversationService', () => {
109
109
  resetKeyMaterialRenewal: jest.fn(),
110
110
  };
111
111
  const mockedDb = await (0, CoreDB_1.openDB)('core-test-db');
112
- const groupIdFromConversationId = jest.fn();
112
+ const groupIdFromConversationId = jest.fn(async () => 'groupId');
113
113
  const mockedSubconversationService = {
114
114
  joinConferenceSubconversation: jest.fn(),
115
115
  };
@@ -320,7 +320,9 @@ describe('ConversationService', () => {
320
320
  const establishedConversation = await conversationService.establishMLS1to1Conversation(mockGroupId, selfUser, otherUserId);
321
321
  expect(mlsService.wipeConversation).toHaveBeenCalledWith(mockGroupId);
322
322
  expect(mlsService.registerConversation).toHaveBeenCalledTimes(1);
323
- expect(mlsService.registerConversation).toHaveBeenCalledWith(mockGroupId, [otherUserId, selfUser.user], selfUser);
323
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(mockGroupId, [otherUserId, selfUser.user], {
324
+ creator: selfUser,
325
+ });
324
326
  expect(conversationService.joinByExternalCommit).not.toHaveBeenCalled();
325
327
  expect(establishedConversation.epoch).toEqual(updatedEpoch);
326
328
  });
@@ -357,7 +359,9 @@ describe('ConversationService', () => {
357
359
  const establishedConversation = await conversationService.establishMLS1to1Conversation(mockGroupId, selfUser, otherUserId);
358
360
  expect(mlsService.wipeConversation).toHaveBeenCalledWith(mockGroupId);
359
361
  expect(mlsService.registerConversation).toHaveBeenCalledTimes(2);
360
- expect(mlsService.registerConversation).toHaveBeenCalledWith(mockGroupId, [otherUserId, selfUser.user], selfUser);
362
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(mockGroupId, [otherUserId, selfUser.user], {
363
+ creator: selfUser,
364
+ });
361
365
  expect(conversationService.joinByExternalCommit).not.toHaveBeenCalled();
362
366
  expect(establishedConversation.epoch).toEqual(updatedEpoch);
363
367
  });
@@ -408,7 +412,7 @@ describe('ConversationService', () => {
408
412
  await conversationService.handleEvent(mockMLSMessageAddEvent);
409
413
  await new Promise(resolve => setImmediate(resolve));
410
414
  expect(conversationService.joinByExternalCommit).not.toHaveBeenCalled();
411
- expect(subconversationService.joinConferenceSubconversation).toHaveBeenCalledWith(conversationId);
415
+ expect(subconversationService.joinConferenceSubconversation).toHaveBeenCalledWith(conversationId, 'groupId');
412
416
  });
413
417
  });
414
418
  describe('getConversations', () => {
@@ -26,8 +26,9 @@ export declare class SubconversationService extends TypedEventEmitter<Events> {
26
26
  * Will return the secret key derived from the subconversation
27
27
  *
28
28
  * @param conversationId Id of the parent conversation in which the call should happen
29
+ * @param groupId groupId of the parent conversation in which the call should happen
29
30
  */
30
- joinConferenceSubconversation(conversationId: QualifiedId, shouldRetry?: boolean): Promise<{
31
+ joinConferenceSubconversation(conversationId: QualifiedId, groupId: string, shouldRetry?: boolean): Promise<{
31
32
  groupId: string;
32
33
  epoch: number;
33
34
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"SubconversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/SubconversationService/SubconversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAkB,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGlD,KAAK,MAAM,GAAG;IACZ,wBAAwB,EAAE;QAAC,cAAc,EAAE,WAAW,CAAA;KAAC,CAAC;CACzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAID,qBAAa,sBAAuB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAIjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAL/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmD;gBAGvD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,WAAW,CAAC,wBAAY;IAK3C,IAAI,UAAU,IAAI,UAAU,CAK3B;IAED;;;;;OAKG;IACU,6BAA6B,CACxC,cAAc,EAAE,WAAW,EAC3B,WAAW,UAAO,GACjB,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;IAiD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AMrC;CACH"}
1
+ {"version":3,"file":"SubconversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/SubconversationService/SubconversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAkB,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGlD,KAAK,MAAM,GAAG;IACZ,wBAAwB,EAAE;QAAC,cAAc,EAAE,WAAW,CAAA;KAAC,CAAC;CACzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAID,qBAAa,sBAAuB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAIjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAL/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmD;gBAGvD,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,WAAW,CAAC,wBAAY;IAK3C,IAAI,UAAU,IAAI,UAAU,CAK3B;IAED;;;;;;OAMG;IACU,6BAA6B,CACxC,cAAc,EAAE,WAAW,EAC3B,OAAO,EAAE,MAAM,EACf,WAAW,UAAO,GACjB,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC;IAiD5C;;;;OAIG;IACU,8BAA8B,CAAC,cA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ubconversationService extends commons_1.TypedEventEmitter {
63
63
  * Will return the secret key derived from the subconversation
64
64
  *
65
65
  * @param conversationId Id of the parent conversation in which the call should happen
66
+ * @param groupId groupId of the parent conversation in which the call should happen
66
67
  */
67
- async joinConferenceSubconversation(conversationId, shouldRetry = true) {
68
+ async joinConferenceSubconversation(conversationId, groupId, shouldRetry = true) {
68
69
  try {
69
70
  const { group_id: subconversationGroupId, epoch: subconversationEpoch, epoch_timestamp: subconversationEpochTimestamp, subconv_id: subconversationId, } = await this.getConferenceSubconversation(conversationId);
70
71
  if (subconversationEpoch === 0) {
@@ -73,7 +74,7 @@ class SubconversationService extends commons_1.TypedEventEmitter {
73
74
  await this.mlsService.wipeConversation(subconversationGroupId);
74
75
  }
75
76
  // If subconversation is not yet established, create it and upload the commit bundle.
76
- await this.mlsService.registerConversation(subconversationGroupId, []);
77
+ await this.mlsService.registerConversation(subconversationGroupId, [], { parentGroupId: groupId });
77
78
  }
78
79
  else {
79
80
  const epochUpdateTime = new Date(subconversationEpochTimestamp).getTime();
@@ -85,7 +86,7 @@ class SubconversationService extends commons_1.TypedEventEmitter {
85
86
  epoch: subconversationEpoch,
86
87
  });
87
88
  await this.mlsService.wipeConversation(subconversationGroupId);
88
- return this.joinConferenceSubconversation(conversationId);
89
+ return this.joinConferenceSubconversation(conversationId, groupId);
89
90
  }
90
91
  await this.joinSubconversationByExternalCommit(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
91
92
  }
@@ -96,7 +97,7 @@ class SubconversationService extends commons_1.TypedEventEmitter {
96
97
  }
97
98
  catch (error) {
98
99
  if (shouldRetry) {
99
- return this.joinConferenceSubconversation(conversationId, false);
100
+ return this.joinConferenceSubconversation(conversationId, groupId, false);
100
101
  }
101
102
  throw error;
102
103
  }
@@ -153,7 +154,7 @@ class SubconversationService extends commons_1.TypedEventEmitter {
153
154
  return { members, epoch, keyLength: MLS_CONVERSATION_KEY_LENGTH, secretKey };
154
155
  }
155
156
  async subscribeToEpochUpdates(parentConversationId, parentConversationGroupId, findConversationByGroupId, onEpochUpdate) {
156
- const { epoch: initialEpoch, groupId: subconversationGroupId } = await this.joinConferenceSubconversation(parentConversationId);
157
+ const { epoch: initialEpoch, groupId: subconversationGroupId } = await this.joinConferenceSubconversation(parentConversationId, parentConversationGroupId);
157
158
  const forwardNewEpoch = async ({ groupId }) => {
158
159
  if (groupId !== subconversationGroupId) {
159
160
  // if the epoch update did not happen in the subconversation directly, check if it happened in the parent conversation
@@ -64,6 +64,7 @@ describe('SubconversationService', () => {
64
64
  it('wipes group locally (if it exists) before registering a group if remote epoch is equal 0', async () => {
65
65
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
66
66
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
67
+ const parentGroupId = 'parentGroupId';
67
68
  const subconversationGroupId = 'subconversationGroupId';
68
69
  const subconversationResponse = getSubconversationResponse({
69
70
  epoch: 0,
@@ -74,13 +75,14 @@ describe('SubconversationService', () => {
74
75
  });
75
76
  jest.spyOn(apiClient.api.conversation, 'getSubconversation').mockResolvedValueOnce(subconversationResponse);
76
77
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(true);
77
- await subconversationService.joinConferenceSubconversation(parentConversationId);
78
+ await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
78
79
  expect(mlsService.wipeConversation).toHaveBeenCalledWith(subconversationGroupId);
79
- expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, []);
80
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, [], { parentGroupId });
80
81
  });
81
82
  it('registers a group if remote epoch is 0 and group does not exist locally', async () => {
82
83
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
83
84
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
85
+ const parentGroupId = 'parentGroupId';
84
86
  const subconversationGroupId = 'subconversationGroupId';
85
87
  const subconversationResponse = getSubconversationResponse({
86
88
  epoch: 0,
@@ -91,14 +93,15 @@ describe('SubconversationService', () => {
91
93
  });
92
94
  jest.spyOn(apiClient.api.conversation, 'getSubconversation').mockResolvedValueOnce(subconversationResponse);
93
95
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
94
- await subconversationService.joinConferenceSubconversation(parentConversationId);
96
+ await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
95
97
  expect(mlsService.wipeConversation).not.toHaveBeenCalled();
96
- expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, []);
98
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, [], { parentGroupId });
97
99
  });
98
100
  it('deletes conference subconversation from backend if group is already established and epoch is older than one day, then rejoins', async () => {
99
101
  jest.useFakeTimers();
100
102
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
101
103
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
104
+ const parentGroupId = 'parentGroupId';
102
105
  const subconversationGroupId = 'subconversationGroupId';
103
106
  const initialSubconversationEpoch = 1;
104
107
  const currentTimeISO = '2023-10-24T12:00:00.000Z';
@@ -124,7 +127,7 @@ describe('SubconversationService', () => {
124
127
  subconversationId: conversation_1.SUBCONVERSATION_ID.CONFERENCE,
125
128
  });
126
129
  jest.spyOn(apiClient.api.conversation, 'getSubconversation').mockResolvedValueOnce(subconversationResponse2);
127
- await subconversationService.joinConferenceSubconversation(parentConversationId);
130
+ await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
128
131
  expect(apiClient.api.conversation.deleteSubconversation).toHaveBeenCalledWith(parentConversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE, {
129
132
  groupId: subconversationGroupId,
130
133
  epoch: initialSubconversationEpoch,
@@ -137,6 +140,7 @@ describe('SubconversationService', () => {
137
140
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
138
141
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
139
142
  const subconversationGroupId = 'subconversationGroupId';
143
+ const parentGroupId = 'parentGroupId';
140
144
  const subconversationEpoch = 1;
141
145
  const currentTimeISO = '2023-10-24T12:00:00.000Z';
142
146
  jest.setSystemTime(new Date(currentTimeISO));
@@ -151,7 +155,7 @@ describe('SubconversationService', () => {
151
155
  subconversationId: conversation_1.SUBCONVERSATION_ID.CONFERENCE,
152
156
  });
153
157
  jest.spyOn(apiClient.api.conversation, 'getSubconversation').mockResolvedValueOnce(subconversationResponse);
154
- await subconversationService.joinConferenceSubconversation(parentConversationId);
158
+ await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
155
159
  expect(apiClient.api.conversation.deleteSubconversation).not.toHaveBeenCalled();
156
160
  expect(mlsService.registerConversation).not.toHaveBeenCalled();
157
161
  expect(mlsService.wipeConversation).not.toHaveBeenCalled();
@@ -160,6 +164,7 @@ describe('SubconversationService', () => {
160
164
  it('retries to join if registering a conversations throws an error', async () => {
161
165
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
162
166
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
167
+ const parentGroupId = 'parentGroupId';
163
168
  const subconversationGroupId = 'subconversationGroupId';
164
169
  const subconversationResponse = getSubconversationResponse({
165
170
  epoch: 0,
@@ -173,14 +178,15 @@ describe('SubconversationService', () => {
173
178
  jest
174
179
  .spyOn(mlsService, 'registerConversation')
175
180
  .mockRejectedValueOnce(new http_1.BackendError('', http_1.BackendErrorLabel.MLS_STALE_MESSAGE, http_1.StatusCode.CONFLICT));
176
- await subconversationService.joinConferenceSubconversation(parentConversationId);
181
+ await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
177
182
  expect(mlsService.wipeConversation).not.toHaveBeenCalled();
178
- expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, []);
183
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, [], { parentGroupId });
179
184
  expect(mlsService.registerConversation).toHaveBeenCalledTimes(2);
180
185
  });
181
186
  it('returns fresh epoch number after joining the group', async () => {
182
187
  const [subconversationService, { apiClient, mlsService }] = await buildSubconversationService();
183
188
  const parentConversationId = { id: 'parentConversationId', domain: 'domain' };
189
+ const parentGroupId = 'parentGroupId';
184
190
  const subconversationGroupId = 'subconversationGroupId';
185
191
  const subconversationResponse = getSubconversationResponse({
186
192
  epoch: 0,
@@ -193,9 +199,9 @@ describe('SubconversationService', () => {
193
199
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValueOnce(false);
194
200
  const updatedEpoch = 1;
195
201
  jest.spyOn(mlsService, 'getEpoch').mockResolvedValueOnce(updatedEpoch);
196
- const response = await subconversationService.joinConferenceSubconversation(parentConversationId);
202
+ const response = await subconversationService.joinConferenceSubconversation(parentConversationId, parentGroupId);
197
203
  expect(mlsService.wipeConversation).not.toHaveBeenCalled();
198
- expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, []);
204
+ expect(mlsService.registerConversation).toHaveBeenCalledWith(subconversationGroupId, [], { parentGroupId });
199
205
  expect(response).toEqual({ epoch: updatedEpoch, groupId: subconversationGroupId });
200
206
  });
201
207
  });
@@ -20,9 +20,10 @@ export declare class E2EIServiceExternal extends TypedEventEmitter<Events> {
20
20
  private readonly clientService;
21
21
  private readonly mlsService;
22
22
  private _acmeService?;
23
+ private readonly enrollmentStorage;
23
24
  constructor(coreCryptoClient: CoreCrypto, coreDatabase: CoreDatabase, recurringTaskScheduler: RecurringTaskScheduler, clientService: ClientService, mlsService: MLSService);
24
- isEnrollmentInProgress(): boolean;
25
- clearAllProgress(): void;
25
+ isEnrollmentInProgress(): Promise<boolean>;
26
+ clearAllProgress(): Promise<void>;
26
27
  getConversationState(conversationId: Uint8Array): Promise<E2eiConversationState>;
27
28
  isE2EIEnabled(): Promise<boolean>;
28
29
  getAllGroupUsersIdentities(groupId: string): Promise<Map<string, DeviceIdentity[]>>;
@@ -30,6 +31,13 @@ export declare class E2EIServiceExternal extends TypedEventEmitter<Events> {
30
31
  getDevicesIdentities(groupId: string, userClientsMap: Record<string, QualifiedId>): Promise<DeviceIdentity[]>;
31
32
  isFreshMLSSelfClient(): Promise<boolean>;
32
33
  private registerLocalCertificateRoot;
34
+ /**
35
+ * will initialize the E2EIServiceExternal with the given discoveryUrl and userId.
36
+ * It will also register the server certificates in CoreCrypto.
37
+ *
38
+ * @param discoveryUrl the discovery url of the acme server
39
+ * @param userId the user that is concerned by the enrollment
40
+ */
33
41
  initialize(discoveryUrl: string): Promise<void>;
34
42
  private get acmeService();
35
43
  private registerCrossSignedCertificates;
@@ -46,7 +54,7 @@ export declare class E2EIServiceExternal extends TypedEventEmitter<Events> {
46
54
  *
47
55
  * Both must be registered before the first enrollment.
48
56
  */
49
- registerServerCertificates(): Promise<void>;
57
+ private registerServerCertificates;
50
58
  private scheduleCrlDistributionTimer;
51
59
  private initialiseCrlDistributionTimers;
52
60
  private addCrlDistributionTimer;
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAMnG,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAKrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAE/G,KAAK,MAAM,GA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class E2EIServiceExternal extends commons_1.TypedEventEmitter {
39
39
  this.clientService = clientService;
40
40
  this.mlsService = mlsService;
41
41
  void this.initialiseCrlDistributionTimers();
42
+ this.enrollmentStorage = (0, E2EIStorage_1.createE2EIEnrollmentStorage)(coreDatabase);
42
43
  mlsService.on('newCrlDistributionPoints', distributionPoints => this.handleNewCrlDistributionPoints(distributionPoints));
43
44
  }
44
45
  // If we have a handle in the local storage, we are in the enrollment process (this handle is saved before oauth redirect)
45
- isEnrollmentInProgress() {
46
- return E2EIStorage_1.E2EIStorage.has.handle();
46
+ async isEnrollmentInProgress() {
47
+ const data = await this.enrollmentStorage.getPendingEnrollmentData();
48
+ return !!data;
47
49
  }
48
50
  clearAllProgress() {
49
- E2EIStorage_1.E2EIStorage.remove.temporaryData();
51
+ return this.enrollmentStorage.deletePendingEnrollmentData();
50
52
  }
51
53
  getConversationState(conversationId) {
52
54
  return this.coreCryptoClient.e2eiConversationState(conversationId);
@@ -104,8 +106,16 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
104
106
  await this.coreCryptoClient.e2eiRegisterAcmeCA(localCertificateRoot);
105
107
  return localCertificateRoot;
106
108
  }
109
+ /**
110
+ * will initialize the E2EIServiceExternal with the given discoveryUrl and userId.
111
+ * It will also register the server certificates in CoreCrypto.
112
+ *
113
+ * @param discoveryUrl the discovery url of the acme server
114
+ * @param userId the user that is concerned by the enrollment
115
+ */
107
116
  async initialize(discoveryUrl) {
108
117
  this._acmeService = new Connection_1.AcmeService(discoveryUrl);
118
+ await this.registerServerCertificates();
109
119
  }
110
120
  get acmeService() {
111
121
  if (!this._acmeService) {
@@ -132,7 +142,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
132
142
  */
133
143
  async registerServerCertificates() {
134
144
  const ROOT_CA_KEY = 'e2ei_root-registered';
135
- const store = (0, LocalStorageStore_1.LocalStorageStore)(ROOT_CA_KEY);
145
+ const store = (0, LocalStorageStore_1.LocalStorageStore)(this.coreDatabase.name);
136
146
  // Register root certificate if not already registered
137
147
  if (!store.has(ROOT_CA_KEY)) {
138
148
  await this.registerLocalCertificateRoot(this.acmeService);
@@ -1,6 +1,7 @@
1
1
  import { APIClient } from '@wireapp/api-client';
2
2
  import { CoreCrypto, RotateBundle } from './E2EIService.types';
3
3
  import { InitialData } from './Storage/E2EIStorage.schema';
4
+ import { CoreDatabase } from '../../../storage/CoreDB';
4
5
  export declare class E2EIServiceInternal {
5
6
  private readonly coreCryptoClient;
6
7
  private readonly apiClient;
@@ -10,7 +11,8 @@ export declare class E2EIServiceInternal {
10
11
  private readonly initialData;
11
12
  private readonly logger;
12
13
  private acmeService;
13
- constructor(coreCryptoClient: CoreCrypto, apiClient: APIClient,
14
+ private enrollmentStorage;
15
+ constructor(coreDb: CoreDatabase, coreCryptoClient: CoreCrypto, apiClient: APIClient,
14
16
  /** number of seconds the certificate should be valid */
15
17
  certificateTtl: number, keyPackagesAmount: number, initialData: InitialData);
16
18
  startCertificateProcess(hasActiveCertificate: boolean): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAA6B,UAAU,EAAkB,YAAY,EAAC,MAAM,qBAAqB,CAAC;AASzG,OAAO,EAAW,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEnE,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAC9E,OAAO,CAAC,WAAW,CAAc;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,wDAAwD;IACvC,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,WAAW;IAO9B,uBAAuB,CAAC,oBAAoB,EAAE,OAAO;;;;;;;;IAiBrD,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAYhG;;;;;OAKG;IACU,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO;YASnE,YAAY;YAuBZ,YAAY;YAUZ,eAAe;IAQ7B;;;;;OAKG;YACW,uBAAuB;IAyCrC;;;;;;;OAOG;YACW,eAAe;CAgE9B"}
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.E2EIServiceInternal = void 0;
25
- const bazinga64_1 = require("bazinga64");
26
25
  const logdown_1 = __importDefault(require("logdown"));
27
26
  const AcmeServer_1 = require("./Connection/AcmeServer");
28
27
  const E2EIService_types_1 = require("./E2EIService.types");
@@ -35,7 +34,7 @@ const OidcChallenge_1 = require("./Steps/OidcChallenge");
35
34
  const Order_1 = require("./Steps/Order");
36
35
  const E2EIStorage_1 = require("./Storage/E2EIStorage");
37
36
  class E2EIServiceInternal {
38
- constructor(coreCryptoClient, apiClient,
37
+ constructor(coreDb, coreCryptoClient, apiClient,
39
38
  /** number of seconds the certificate should be valid */
40
39
  certificateTtl, keyPackagesAmount, initialData) {
41
40
  this.coreCryptoClient = coreCryptoClient;
@@ -46,27 +45,26 @@ class E2EIServiceInternal {
46
45
  this.logger = (0, logdown_1.default)('@wireapp/core/E2EIdentityServiceInternal');
47
46
  const { discoveryUrl } = initialData;
48
47
  this.acmeService = new AcmeServer_1.AcmeService(discoveryUrl);
48
+ this.enrollmentStorage = (0, E2EIStorage_1.createE2EIEnrollmentStorage)(coreDb);
49
49
  }
50
50
  async startCertificateProcess(hasActiveCertificate) {
51
51
  const identity = await this.initIdentity(hasActiveCertificate);
52
52
  // Store the values in local storage for later use (e.g. in the continue flow)
53
- const { orderUrl, authChallenges } = await this.getEnrollmentChallenges(identity);
54
- const { authorization: { keyauth, oidcChallenge }, } = authChallenges;
53
+ const enrollmentData = await this.getEnrollmentChallenges(identity);
54
+ const { keyauth, oidcChallenge } = enrollmentData.authorization;
55
55
  // store auth data for continuing the flow later on
56
56
  const handle = await this.coreCryptoClient.e2eiEnrollmentStash(identity);
57
- E2EIStorage_1.E2EIStorage.store.handle(bazinga64_1.Encoder.toBase64(handle).asString);
58
- E2EIStorage_1.E2EIStorage.store.authData(authChallenges);
59
- E2EIStorage_1.E2EIStorage.store.orderData({ orderUrl });
57
+ await this.enrollmentStorage.savePendingEnrollmentData(Object.assign({ handle }, enrollmentData));
60
58
  return { challenge: oidcChallenge, keyAuth: keyauth };
61
59
  }
62
60
  async continueCertificateProcess(oAuthIdToken) {
63
- const handle = E2EIStorage_1.E2EIStorage.get.handle();
64
- const identity = await this.coreCryptoClient.e2eiEnrollmentStashPop(bazinga64_1.Decoder.fromBase64(handle).asBytes);
65
- if (!identity) {
61
+ const enrollmentData = await this.enrollmentStorage.getPendingEnrollmentData();
62
+ if (!enrollmentData) {
66
63
  throw new Error('Error while trying to continue OAuth flow. No enrollment in progress found');
67
64
  }
68
- const authData = E2EIStorage_1.E2EIStorage.get.authData();
69
- return this.getRotateBundle(identity, oAuthIdToken, authData);
65
+ const { handle } = enrollmentData;
66
+ const identity = await this.coreCryptoClient.e2eiEnrollmentStashPop(handle);
67
+ return this.getRotateBundle(identity, oAuthIdToken, enrollmentData);
70
68
  }
71
69
  /**
72
70
  * This function starts a ACME refresh flow for an existing client with a valid refresh token
@@ -76,8 +74,8 @@ class E2EIServiceInternal {
76
74
  */
77
75
  async renewCertificate(oAuthIdToken, hasActiveCertificate) {
78
76
  const identity = await this.initIdentity(hasActiveCertificate);
79
- const authData = await this.getEnrollmentChallenges(identity);
80
- return this.getRotateBundle(identity, oAuthIdToken, authData.authChallenges);
77
+ const enrollmentData = await this.getEnrollmentChallenges(identity);
78
+ return this.getRotateBundle(identity, oAuthIdToken, enrollmentData);
81
79
  }
82
80
  // ############ Internal Functions ############
83
81
  async initIdentity(hasActiveCertificate) {
@@ -142,7 +140,7 @@ class E2EIServiceInternal {
142
140
  authzUrls: orderData.authzUrls,
143
141
  nonce: orderData.nonce,
144
142
  });
145
- return { authChallenges, orderUrl: orderData.orderUrl };
143
+ return Object.assign({ orderUrl: orderData.orderUrl }, authChallenges);
146
144
  }
147
145
  /**
148
146
  * Continuation of the ACME enrollment flow
@@ -152,14 +150,14 @@ class E2EIServiceInternal {
152
150
  * @param oAuthIdToken
153
151
  * @returns RotateBundle
154
152
  */
155
- async getRotateBundle(identity, oAuthIdToken, authData) {
153
+ async getRotateBundle(identity, oAuthIdToken, enrollmentData) {
156
154
  // Step 7: Do OIDC client challenge
157
155
  const oidcData = await (0, OidcChallenge_1.doWireOidcChallenge)({
158
156
  oAuthIdToken,
159
- authData,
157
+ authData: enrollmentData,
160
158
  connection: this.acmeService,
161
159
  identity,
162
- nonce: authData.nonce,
160
+ nonce: enrollmentData.nonce,
163
161
  });
164
162
  this.logger.log('oidc data', oidcData);
165
163
  if (!oidcData.data.validated) {
@@ -168,7 +166,7 @@ class E2EIServiceInternal {
168
166
  const { user: wireUser, clientId } = this.initialData;
169
167
  //Step 8: Do DPOP Challenge
170
168
  const dpopData = await (0, DpopChallenge_1.doWireDpopChallenge)({
171
- authData,
169
+ authData: enrollmentData,
172
170
  clientId,
173
171
  connection: this.acmeService,
174
172
  identity,
@@ -182,12 +180,11 @@ class E2EIServiceInternal {
182
180
  throw new Error('Error while trying to continue OAuth flow. DPOP challenge not validated');
183
181
  }
184
182
  //Step 9: Finalize Order
185
- const orderData = E2EIStorage_1.E2EIStorage.get.orderData();
186
183
  const finalizeOrderData = await (0, Order_1.finalizeOrder)({
187
184
  connection: this.acmeService,
188
185
  identity,
189
186
  nonce: dpopData.nonce,
190
- orderUrl: orderData.orderUrl,
187
+ orderUrl: enrollmentData.orderUrl,
191
188
  });
192
189
  if (!finalizeOrderData.certificateUrl) {
193
190
  throw new Error('Error while trying to continue OAuth flow. No certificateUrl received');
@@ -1,12 +1,12 @@
1
1
  import { AcmeService } from '../Connection';
2
2
  import { E2eiEnrollment, Nonce } from '../E2EIService.types';
3
- import { AuthData } from '../Storage/E2EIStorage.schema';
3
+ import { EnrollmentFlowData } from '../Storage/E2EIStorage.schema';
4
4
  interface GetAuthorizationParams {
5
5
  nonce: Nonce;
6
6
  authzUrls: string[];
7
7
  identity: E2eiEnrollment;
8
8
  connection: AcmeService;
9
9
  }
10
- export declare const getAuthorizationChallenges: ({ authzUrls, nonce, identity, connection, }: GetAuthorizationParams) => Promise<AuthData>;
10
+ export declare const getAuthorizationChallenges: ({ authzUrls, nonce, identity, connection, }: GetAuthorizationParams) => Promise<Pick<EnrollmentFlowData, 'authorization' | 'nonce'>>;
11
11
  export {};
12
12
  //# sourceMappingURL=Authorization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAgB,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAEvD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;CACzB;AAED,eAAO,MAAM,0BAA0B,gDAKpC,sBAAsB,KAAG,QAAQ,QAAQ,CAsC3C,CAAC"}
1
+ {"version":3,"file":"Authorization.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAgB,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;CACzB;AAED,eAAO,MAAM,0BAA0B,gDAKpC,sBAAsB,KAAG,QAAQ,KAAK,kBAAkB,EAAE,eAAe,GAAG,OAAO,CAAC,CAsCtF,CAAC"}
@@ -2,12 +2,12 @@ import { APIClient } from '@wireapp/api-client';
2
2
  import { ClientId } from '../../../types';
3
3
  import { AcmeService } from '../../Connection/AcmeServer';
4
4
  import { E2eiEnrollment, Nonce, User } from '../../E2EIService.types';
5
- import { AuthData } from '../../Storage/E2EIStorage.schema';
5
+ import { UnidentifiedEnrollmentFlowData } from '../../Storage/E2EIStorage.schema';
6
6
  export interface DoWireDpopChallengeParams {
7
7
  apiClient: APIClient;
8
8
  clientId: ClientId;
9
9
  userDomain: User['domain'];
10
- authData: AuthData;
10
+ authData: UnidentifiedEnrollmentFlowData;
11
11
  identity: E2eiEnrollment;
12
12
  connection: AcmeService;
13
13
  nonce: Nonce;
@@ -1 +1 @@
1
- {"version":3,"file":"DpopChallenge.types.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAC,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAE1D,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC;AAE7F,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,yBAAyB,EACzB,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CACpE,GAAG;IACF,WAAW,EAAE,KAAK,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"DpopChallenge.types.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/DpopChallenge/DpopChallenge.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAC,8BAA8B,EAAC,MAAM,kCAAkC,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,QAAQ,EAAE,8BAA8B,CAAC;IACzC,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,yBAAyB,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC;AAE7F,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,yBAAyB,EACzB,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,CACpE,GAAG;IACF,WAAW,EAAE,KAAK,CAAC;CACpB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { AcmeService } from '../Connection/AcmeServer';
2
2
  import { E2eiEnrollment, Nonce } from '../E2EIService.types';
3
- import { AuthData } from '../Storage/E2EIStorage.schema';
3
+ import { UnidentifiedEnrollmentFlowData } from '../Storage/E2EIStorage.schema';
4
4
  interface DoWireOidcChallengeParams {
5
- authData: AuthData;
5
+ authData: UnidentifiedEnrollmentFlowData;
6
6
  identity: E2eiEnrollment;
7
7
  connection: AcmeService;
8
8
  nonce: Nonce;
@@ -1 +1 @@
1
- {"version":3,"file":"OidcChallenge.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AAEvD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,6DAM7B,yBAAyB;;;;;;;;;;;GAiB3B,CAAC"}
1
+ {"version":3,"file":"OidcChallenge.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAE7E,UAAU,yBAAyB;IACjC,QAAQ,EAAE,8BAA8B,CAAC;IACzC,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,6DAM7B,yBAAyB;;;;;;;;;;;GAiB3B,CAAC"}
@@ -1,21 +1,8 @@
1
- import { AuthData, OrderData } from './E2EIStorage.schema';
2
- export declare const E2EIStorage: {
3
- store: {
4
- handle: (handle: string) => void;
5
- authData: (data: AuthData) => void;
6
- orderData: (data: OrderData) => void;
7
- };
8
- get: {
9
- handle: () => string;
10
- authData: () => AuthData;
11
- orderData: () => OrderData;
12
- };
13
- has: {
14
- handle: () => boolean;
15
- };
16
- remove: {
17
- temporaryData: () => void;
18
- all: () => void;
19
- };
1
+ import { EnrollmentFlowData } from './E2EIStorage.schema';
2
+ import { CoreDatabase } from '../../../../storage/CoreDB';
3
+ export declare function createE2EIEnrollmentStorage(coreDB: CoreDatabase): {
4
+ getPendingEnrollmentData(): Promise<EnrollmentFlowData | undefined>;
5
+ savePendingEnrollmentData(data: EnrollmentFlowData): Promise<void>;
6
+ deletePendingEnrollmentData(): Promise<void>;
20
7
  };
21
8
  //# sourceMappingURL=E2EIStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIStorage.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,QAAQ,EAAkB,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAqDzE,eAAO,MAAM,WAAW;;yBA3CK,MAAM;yBAEN,QAAQ;0BADP,SAAS;;;;wBAcN,QAAQ;yBASP,SAAS;;;;;;;;;CAqC1C,CAAC"}
1
+ {"version":3,"file":"E2EIStorage.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAKxD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY;gCAE1B,QAAQ,kBAAkB,GAAG,SAAS,CAAC;oCAGnC,kBAAkB,GAAG,QAAQ,IAAI,CAAC;mCAGnC,QAAQ,IAAI,CAAC;EAIrD"}
@@ -18,65 +18,20 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.E2EIStorage = void 0;
22
- const bazinga64_1 = require("bazinga64");
23
- const E2EIStorage_schema_1 = require("./E2EIStorage.schema");
24
- const LocalStorageStore_1 = require("../../../../util/LocalStorageStore");
25
- const HandleKey = 'Handle';
26
- const AuthDataKey = 'AuthData';
27
- const OderDataKey = 'OrderData';
28
- const storage = (0, LocalStorageStore_1.LocalStorageStore)('E2EIStorage');
29
- const storeHandle = (handle) => storage.add(HandleKey, bazinga64_1.Encoder.toBase64(handle).asString);
30
- const storeOrderData = (data) => storage.add(OderDataKey, bazinga64_1.Encoder.toBase64(JSON.stringify(data)).asString);
31
- const storeAuthData = (data) => storage.add(AuthDataKey, bazinga64_1.Encoder.toBase64(JSON.stringify(data)).asString);
32
- const hasHandle = () => storage.has(HandleKey);
33
- const getAndVerifyHandle = () => {
34
- const handle = storage.get(HandleKey);
35
- if (!handle) {
36
- throw new Error('ACME: No handle found');
37
- }
38
- return bazinga64_1.Decoder.fromBase64(handle).asString;
39
- };
40
- const getAndVerifyAuthData = () => {
41
- const data = storage.get(AuthDataKey);
42
- if (!data) {
43
- throw new Error('ACME: AuthData not found');
44
- }
45
- const decodedData = bazinga64_1.Decoder.fromBase64(data).asString;
46
- return E2EIStorage_schema_1.AuthDataSchema.parse(JSON.parse(decodedData));
47
- };
48
- const getAndVerifyOrderData = () => {
49
- const data = storage.get(OderDataKey);
50
- if (!data) {
51
- throw new Error('ACME: OrderData not found');
52
- }
53
- const decodedData = bazinga64_1.Decoder.fromBase64(data).asString;
54
- return JSON.parse(decodedData);
55
- };
56
- const removeTemporaryData = () => {
57
- storage.remove(HandleKey);
58
- storage.remove(AuthDataKey);
59
- storage.remove(OderDataKey);
60
- };
61
- const removeAll = () => {
62
- removeTemporaryData();
63
- };
64
- exports.E2EIStorage = {
65
- store: {
66
- handle: storeHandle,
67
- authData: storeAuthData,
68
- orderData: storeOrderData,
69
- },
70
- get: {
71
- handle: getAndVerifyHandle,
72
- authData: getAndVerifyAuthData,
73
- orderData: getAndVerifyOrderData,
74
- },
75
- has: {
76
- handle: hasHandle,
77
- },
78
- remove: {
79
- temporaryData: removeTemporaryData,
80
- all: removeAll,
81
- },
82
- };
21
+ exports.createE2EIEnrollmentStorage = void 0;
22
+ const PENDING_ENROLLMENT_TABLE = 'pendingEnrollmentData';
23
+ const STORAGE_KEY = 'data';
24
+ function createE2EIEnrollmentStorage(coreDB) {
25
+ return {
26
+ async getPendingEnrollmentData() {
27
+ return coreDB.get(PENDING_ENROLLMENT_TABLE, STORAGE_KEY);
28
+ },
29
+ async savePendingEnrollmentData(data) {
30
+ await coreDB.put(PENDING_ENROLLMENT_TABLE, data, STORAGE_KEY);
31
+ },
32
+ async deletePendingEnrollmentData() {
33
+ return coreDB.delete(PENDING_ENROLLMENT_TABLE, STORAGE_KEY);
34
+ },
35
+ };
36
+ }
37
+ exports.createE2EIEnrollmentStorage = createE2EIEnrollmentStorage;
@@ -43,7 +43,9 @@ export declare const InitialDataSchema: z.ZodObject<{
43
43
  discoveryUrl: string;
44
44
  }>;
45
45
  export type InitialData = z.infer<typeof InitialDataSchema>;
46
- export declare const AuthDataSchema: z.ZodObject<{
46
+ export declare const EnrollmentFlowDataSchema: z.ZodObject<{
47
+ handle: z.ZodType<Uint8Array, z.ZodTypeDef, Uint8Array>;
48
+ orderUrl: z.ZodString;
47
49
  authorization: z.ZodObject<{
48
50
  keyauth: z.ZodString;
49
51
  dpopChallenge: z.ZodObject<{
@@ -113,6 +115,8 @@ export declare const AuthDataSchema: z.ZodObject<{
113
115
  delegate: Uint8Array;
114
116
  };
115
117
  };
118
+ handle: Uint8Array;
119
+ orderUrl: string;
116
120
  }, {
117
121
  nonce: string;
118
122
  authorization: {
@@ -128,14 +132,9 @@ export declare const AuthDataSchema: z.ZodObject<{
128
132
  delegate: Uint8Array;
129
133
  };
130
134
  };
131
- }>;
132
- export type AuthData = z.infer<typeof AuthDataSchema>;
133
- export declare const OrderDataSchema: z.ZodObject<{
134
- orderUrl: z.ZodString;
135
- }, "strip", z.ZodTypeAny, {
136
- orderUrl: string;
137
- }, {
135
+ handle: Uint8Array;
138
136
  orderUrl: string;
139
137
  }>;
140
- export type OrderData = z.infer<typeof OrderDataSchema>;
138
+ export type EnrollmentFlowData = z.infer<typeof EnrollmentFlowDataSchema>;
139
+ export type UnidentifiedEnrollmentFlowData = Omit<EnrollmentFlowData, 'handle'>;
141
140
  //# sourceMappingURL=E2EIStorage.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"E2EIStorage.schema.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAU5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"E2EIStorage.schema.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAO5D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.OrderDataSchema = exports.AuthDataSchema = exports.InitialDataSchema = void 0;
21
+ exports.EnrollmentFlowDataSchema = exports.InitialDataSchema = void 0;
22
22
  const zod_1 = require("zod");
23
23
  exports.InitialDataSchema = zod_1.z.object({
24
24
  discoveryUrl: zod_1.z.string(),
@@ -31,13 +31,14 @@ exports.InitialDataSchema = zod_1.z.object({
31
31
  teamId: zod_1.z.string(),
32
32
  }),
33
33
  });
34
- const Uint8ArraySchema = zod_1.z.custom(value => value instanceof Uint8Array ? { success: true } : { success: false, message: 'Expected Uint8Array' });
35
34
  const AcmeChallengeSchema = zod_1.z.object({
36
- delegate: Uint8ArraySchema,
35
+ delegate: zod_1.z.instanceof(Uint8Array),
37
36
  url: zod_1.z.string(),
38
37
  target: zod_1.z.string(),
39
38
  });
40
- exports.AuthDataSchema = zod_1.z.object({
39
+ exports.EnrollmentFlowDataSchema = zod_1.z.object({
40
+ handle: zod_1.z.instanceof(Uint8Array),
41
+ orderUrl: zod_1.z.string().url(),
41
42
  authorization: zod_1.z.object({
42
43
  keyauth: zod_1.z.string(),
43
44
  dpopChallenge: AcmeChallengeSchema,
@@ -45,6 +46,3 @@ exports.AuthDataSchema = zod_1.z.object({
45
46
  }),
46
47
  nonce: zod_1.z.string(),
47
48
  });
48
- exports.OrderDataSchema = zod_1.z.object({
49
- orderUrl: zod_1.z.string().url(),
50
- });
@@ -89,17 +89,22 @@ export declare class MLSService extends TypedEventEmitter<Events> {
89
89
  /**
90
90
  * Will create an empty conversation inside of coreCrypto.
91
91
  * @param groupId the id of the group to create inside of coreCrypto
92
+ * @param parentGroupId in case the conversation is a subconversation, the id of the parent conversation
92
93
  */
93
- registerEmptyConversation(groupId: string): Promise<void>;
94
+ registerEmptyConversation(groupId: string, parentGroupId?: string): Promise<void>;
94
95
  /**
95
96
  * Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
96
97
  * @param groupId the id of the group to create inside of coreCrypto
97
98
  * @param users the list of users that will be members of the conversation (including the self user)
98
- * @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
99
- */
100
- registerConversation(groupId: string, users: QualifiedId[], creator?: {
101
- user: QualifiedId;
102
- client?: string;
99
+ * @param options.creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
100
+ * @param options.parentGroupId in case the conversation is a subconversation, the id of the parent conversation
101
+ */
102
+ registerConversation(groupId: string, users: QualifiedId[], options?: {
103
+ creator?: {
104
+ user: QualifiedId;
105
+ client?: string;
106
+ };
107
+ parentGroupId?: string;
103
108
  }): Promise<PostMlsMessageResponse>;
104
109
  /**
105
110
  * Will try to register mls group and send an empty commit to establish it.
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAE1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAW,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,eAAe,EAIf,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAuD,MAAM,oBAAoB,CAAC;AAE1G,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAC,aAAa,EAAE,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAQ1D,OAAO,EAAC,QAAQ,EAAE,4BAA4B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AAoB;IAOrB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7D;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;YAWnF,4BAA4B;YAU5B,0BAA0B;IAKxC,OAAO,CAAC,6BAA6B;IAIrC;;;;OAIG;IACU,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BvF;;;;OAIG;IACU,+BAA+B;IAiB5C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAcjF,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE;IASjF;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,sBAAsB,CAAC;CAsDnC"}
@@ -335,13 +335,21 @@ class MLSService extends commons_1.TypedEventEmitter {
335
335
  /**
336
336
  * Will create an empty conversation inside of coreCrypto.
337
337
  * @param groupId the id of the group to create inside of coreCrypto
338
+ * @param parentGroupId in case the conversation is a subconversation, the id of the parent conversation
338
339
  */
339
- async registerEmptyConversation(groupId) {
340
+ async registerEmptyConversation(groupId, parentGroupId) {
340
341
  const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
341
- const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
342
- const mlsKeyBytes = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
342
+ let externalSenders = [];
343
+ if (parentGroupId) {
344
+ const parentGroupIdBytes = bazinga64_1.Decoder.fromBase64(parentGroupId).asBytes;
345
+ externalSenders = [await this.coreCryptoClient.getExternalSender(parentGroupIdBytes)];
346
+ }
347
+ else {
348
+ const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
349
+ externalSenders = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
350
+ }
343
351
  const configuration = {
344
- externalSenders: mlsKeyBytes,
352
+ externalSenders,
345
353
  ciphersuite: this.config.cipherSuite,
346
354
  };
347
355
  const credentialType = await this.getCredentialType();
@@ -351,10 +359,12 @@ class MLSService extends commons_1.TypedEventEmitter {
351
359
  * Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
352
360
  * @param groupId the id of the group to create inside of coreCrypto
353
361
  * @param users the list of users that will be members of the conversation (including the self user)
354
- * @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
362
+ * @param options.creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
363
+ * @param options.parentGroupId in case the conversation is a subconversation, the id of the parent conversation
355
364
  */
356
- async registerConversation(groupId, users, creator) {
357
- await this.registerEmptyConversation(groupId);
365
+ async registerConversation(groupId, users, options) {
366
+ await this.registerEmptyConversation(groupId, options === null || options === void 0 ? void 0 : options.parentGroupId);
367
+ const creator = options === null || options === void 0 ? void 0 : options.creator;
358
368
  const { coreCryptoKeyPackagesPayload: keyPackages, failedToFetchKeyPackages } = await this.getKeyPackagesPayload(users.map(user => {
359
369
  if (user.id === (creator === null || creator === void 0 ? void 0 : creator.user.id)) {
360
370
  /**
@@ -667,7 +677,7 @@ class MLSService extends commons_1.TypedEventEmitter {
667
677
  */
668
678
  async enrollE2EI(discoveryUrl, user, client, nbPrekeys, certificateTtl, oAuthIdToken) {
669
679
  const hasActiveCertificate = await this.coreCryptoClient.e2eiIsEnabled(this.config.cipherSuite);
670
- const e2eiServiceInternal = new E2EIServiceInternal_1.E2EIServiceInternal(this.coreCryptoClient, this.apiClient, certificateTtl, nbPrekeys, { user, clientId: client.id, discoveryUrl });
680
+ const e2eiServiceInternal = new E2EIServiceInternal_1.E2EIServiceInternal(this.coreDatabase, this.coreCryptoClient, this.apiClient, certificateTtl, nbPrekeys, { user, clientId: client.id, discoveryUrl });
671
681
  // If we don't have an OAuth id token, we need to start the certificate process with Oauth
672
682
  if (!oAuthIdToken) {
673
683
  const data = await e2eiServiceInternal.startCertificateProcess(hasActiveCertificate);
@@ -89,7 +89,7 @@ describe('MLSService', () => {
89
89
  const selfUser = createUserId();
90
90
  const creator = { user: selfUser, client: 'client-1' };
91
91
  const users = [createUserId(), createUserId()];
92
- await mlsService.registerConversation(groupId, [...users, selfUser], creator);
92
+ await mlsService.registerConversation(groupId, [...users, selfUser], { creator });
93
93
  expect(apiClient.api.client.claimMLSKeyPackages).toHaveBeenCalledTimes(3);
94
94
  expect(apiClient.api.client.claimMLSKeyPackages).toHaveBeenCalledWith(selfUser.id, selfUser.domain, '0x1', creator.client);
95
95
  expect(mlsService.scheduleKeyMaterialRenewal).toHaveBeenCalledWith(groupId);
@@ -1,6 +1,7 @@
1
1
  import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
2
2
  import { QualifiedId } from '@wireapp/api-client/lib/user';
3
3
  import { DBSchema, IDBPDatabase } from 'idb';
4
+ import { EnrollmentFlowData } from '../messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema';
4
5
  interface CoreDBSchema extends DBSchema {
5
6
  prekeys: {
6
7
  key: string;
@@ -45,6 +46,10 @@ interface CoreDBSchema extends DBSchema {
45
46
  url: string;
46
47
  };
47
48
  };
49
+ pendingEnrollmentData: {
50
+ key: string;
51
+ value: EnrollmentFlowData;
52
+ };
48
53
  }
49
54
  export type CoreDatabase = IDBPDatabase<CoreDBSchema>;
50
55
  export declare function openDB(dbName: string): Promise<CoreDatabase>;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreDB.d.ts","sourceRoot":"","sources":["../../src/storage/CoreDB.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,QAAQ,EAA2B,YAAY,EAAsB,MAAM,KAAK,CAAC;AAGzF,UAAU,YAAa,SAAQ,QAAQ;IACrC,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAC,CAAC;KAC/C,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC9C,CAAC;IACF,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC1C,CAAC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAC;KACrC,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,oBAAoB,EAAE,WAAW,CAAC;YAAC,iBAAiB,EAAE,kB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AC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAC;KACrC,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,oBAAoB,EAAE,WAAW,CAAC;YAAC,iBAAiB,EAAE,kBAAkB,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,CAAC;KACpG,CAAC;IACF,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAC,CAAC;KACzC,CAAC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,kBAAkB,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEtD,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAuBlE;AAED,wBAAsB,QAAQ,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
@@ -20,7 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.deleteDB = exports.openDB = void 0;
22
22
  const idb_1 = require("idb");
23
- const VERSION = 5;
23
+ const VERSION = 6;
24
24
  async function openDB(dbName) {
25
25
  const db = await (0, idb_1.openDB)(dbName, VERSION, {
26
26
  upgrade: (db, oldVersion) => {
@@ -38,6 +38,8 @@ async function openDB(dbName) {
38
38
  db.createObjectStore('subconversations');
39
39
  case 5:
40
40
  db.createObjectStore('crls');
41
+ case 6:
42
+ db.createObjectStore('pendingEnrollmentData');
41
43
  }
42
44
  },
43
45
  });
package/package.json CHANGED
@@ -60,6 +60,6 @@
60
60
  "test:coverage": "jest --coverage",
61
61
  "watch": "tsc --watch"
62
62
  },
63
- "version": "44.0.7",
64
- "gitHead": "68a211bf9ec5451d5ff85dbea8ecfb7be0440d2f"
63
+ "version": "44.0.9",
64
+ "gitHead": "6b4860506c8ed1840691715fe84fffaafd7d7fe6"
65
65
  }