@wireapp/core 46.0.16 → 46.0.18

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 (117) hide show
  1. package/lib/Account.js +43 -56
  2. package/lib/account/AccountService.js +1 -0
  3. package/lib/broadcast/BroadcastService.js +3 -0
  4. package/lib/client/ClientBackendRepository.js +1 -0
  5. package/lib/client/ClientDatabaseRepository.js +16 -7
  6. package/lib/client/ClientService.d.ts.map +1 -1
  7. package/lib/client/ClientService.js +14 -13
  8. package/lib/connection/ConnectionService.js +1 -0
  9. package/lib/conversation/AssetService/AssetService.d.ts +0 -1
  10. package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
  11. package/lib/conversation/AssetService/AssetService.js +13 -6
  12. package/lib/conversation/AssetService/AssetService.test.js +1 -1
  13. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  14. package/lib/conversation/ConversationService/ConversationService.js +90 -80
  15. package/lib/conversation/ConversationService/ConversationService.test.js +12 -5
  16. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
  17. package/lib/conversation/MessageTimer/MessageTimer.js +2 -0
  18. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  19. package/lib/conversation/SubconversationService/SubconversationService.js +23 -17
  20. package/lib/conversation/content/AssetContent.d.ts +0 -1
  21. package/lib/conversation/content/AssetContent.d.ts.map +1 -1
  22. package/lib/conversation/content/ContentType.js +18 -19
  23. package/lib/conversation/content/FileContent.d.ts +0 -1
  24. package/lib/conversation/content/FileContent.d.ts.map +1 -1
  25. package/lib/conversation/content/ImageContent.d.ts +0 -1
  26. package/lib/conversation/content/ImageContent.d.ts.map +1 -1
  27. package/lib/conversation/message/MessageBuilder.js +22 -23
  28. package/lib/conversation/message/MessageService.js +5 -4
  29. package/lib/conversation/message/MessageService.test.js +20 -9
  30. package/lib/conversation/message/MessageToProtoMapper.js +2 -2
  31. package/lib/conversation/message/RecipientsHelper.js +1 -2
  32. package/lib/conversation/message/TextContentBuilder.js +3 -2
  33. package/lib/conversation/message/UserClientsUtil.js +2 -3
  34. package/lib/conversation/message/messageSender.js +5 -6
  35. package/lib/cryptography/AssetCryptography/AssetCryptography.d.ts.map +1 -1
  36. package/lib/cryptography/GenericMessageMapper.js +74 -22
  37. package/lib/cryptography/MessageHashService.d.ts +0 -1
  38. package/lib/cryptography/MessageHashService.d.ts.map +1 -1
  39. package/lib/cryptography/MessageHashService.js +2 -0
  40. package/lib/errors/DecryptionError.js +2 -0
  41. package/lib/errors/FederatedBackendsError.js +3 -2
  42. package/lib/giphy/GiphyService.js +1 -0
  43. package/lib/linkPreview/LinkPreviewService.js +2 -12
  44. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +4 -4
  45. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.js +9 -8
  46. package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +8 -8
  47. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +33 -3
  48. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +11 -11
  49. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +15 -5
  50. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.d.ts.map +1 -1
  51. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Account.js +1 -1
  52. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts +1 -1
  53. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.d.ts.map +1 -1
  54. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Authorization.js +2 -3
  55. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Certificate.js +1 -1
  56. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.d.ts.map +1 -1
  57. package/lib/messagingProtocols/mls/E2EIdentityService/Steps/Order.js +2 -2
  58. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.d.ts.map +1 -1
  59. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.js +1 -2
  60. package/lib/messagingProtocols/mls/E2EIdentityService/Storage/E2EIStorage.schema.d.ts +4 -4
  61. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -1
  62. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  63. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +1 -1
  64. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  65. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +1 -1
  66. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +7 -3
  67. package/lib/messagingProtocols/mls/MLSService/ClientMLSError.js +1 -0
  68. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
  69. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  70. package/lib/messagingProtocols/mls/MLSService/MLSService.js +109 -114
  71. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +28 -9
  72. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +1 -2
  73. package/lib/messagingProtocols/mls/conversationRejoinQueue.js +3 -4
  74. package/lib/messagingProtocols/mls/utils/MLSId.js +2 -3
  75. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
  76. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +6 -2
  77. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +3 -0
  78. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +1 -1
  79. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +5 -4
  80. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +1 -2
  81. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  82. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +20 -16
  83. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +4 -7
  84. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  85. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +15 -15
  86. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +1 -1
  87. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +1 -2
  88. package/lib/messagingProtocols/proteus/ProteusService/sessionIdMigrator.js +2 -3
  89. package/lib/messagingProtocols/proteus/ProteusService/userDomainFilters.js +1 -2
  90. package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
  91. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
  92. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +14 -14
  93. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +5 -2
  94. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  95. package/lib/notification/NotificationBackendRepository.d.ts +1 -1
  96. package/lib/notification/NotificationBackendRepository.js +1 -0
  97. package/lib/notification/NotificationDatabaseRepository.js +1 -0
  98. package/lib/notification/NotificationService.js +38 -49
  99. package/lib/secretStore/encryptedStore.js +10 -22
  100. package/lib/secretStore/secretKeyGenerator.js +2 -2
  101. package/lib/secretStore/secretKeyGenerator.test.js +1 -1
  102. package/lib/self/SelfService.js +2 -1
  103. package/lib/storage/CoreDB.js +2 -3
  104. package/lib/team/TeamService.js +1 -0
  105. package/lib/test/PayloadHelper.js +3 -4
  106. package/lib/testUtils/index.js +2 -3
  107. package/lib/user/UserService.d.ts +2 -2
  108. package/lib/user/UserService.js +1 -0
  109. package/lib/util/LocalStorageStore/index.d.ts.map +1 -1
  110. package/lib/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +4 -6
  111. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.d.ts.map +1 -1
  112. package/lib/util/RecurringTaskScheduler/RecurringTaskScheduler.js +34 -33
  113. package/lib/util/TaskScheduler/TaskScheduler.d.ts +1 -1
  114. package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
  115. package/lib/util/TypePredicateUtil.js +7 -10
  116. package/lib/util/fullyQualifiedClientIdUtils.js +1 -2
  117. package/package.json +3 -3
@@ -18,11 +18,13 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.isNonFederatingBackendsError = exports.NonFederatingBackendsError = void 0;
21
+ exports.NonFederatingBackendsError = void 0;
22
+ exports.isNonFederatingBackendsError = isNonFederatingBackendsError;
22
23
  /**
23
24
  * This error means we are trying to add users that are parts of 2 backends that are not federating with each other to a new conversation.
24
25
  */
25
26
  class NonFederatingBackendsError extends Error {
27
+ backends;
26
28
  constructor(backends) {
27
29
  super('2 backends are not connected');
28
30
  this.backends = backends;
@@ -33,4 +35,3 @@ exports.NonFederatingBackendsError = NonFederatingBackendsError;
33
35
  function isNonFederatingBackendsError(error) {
34
36
  return !!error && typeof error === 'object' && 'name' in error && error.name === 'NonFederatingBackendError';
35
37
  }
36
- exports.isNonFederatingBackendsError = isNonFederatingBackendsError;
@@ -20,6 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.GiphyService = void 0;
22
22
  class GiphyService {
23
+ apiClient;
23
24
  constructor(apiClient) {
24
25
  this.apiClient = apiClient;
25
26
  }
@@ -17,25 +17,15 @@
17
17
  * along with this program. If not, see http://www.gnu.org/licenses/.
18
18
  *
19
19
  */
20
- var __rest = (this && this.__rest) || function (s, e) {
21
- var t = {};
22
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23
- t[p] = s[p];
24
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
25
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
27
- t[p[i]] = s[p[i]];
28
- }
29
- return t;
30
- };
31
20
  Object.defineProperty(exports, "__esModule", { value: true });
32
21
  exports.LinkPreviewService = void 0;
33
22
  class LinkPreviewService {
23
+ assetService;
34
24
  constructor(assetService) {
35
25
  this.assetService = assetService;
36
26
  }
37
27
  async uploadLinkPreviewImage(linkPreview, domain) {
38
- const { image } = linkPreview, preview = __rest(linkPreview, ["image"]);
28
+ const { image, ...preview } = linkPreview;
39
29
  if (!image) {
40
30
  return preview;
41
31
  }
@@ -26,8 +26,8 @@ export declare class AcmeService {
26
26
  }>>;
27
27
  createNewOrder(url: AcmeDirectory['newOrder'], payload: Uint8Array): Promise<PostJoseRequestReturnValue<{
28
28
  status: string;
29
- expires: string;
30
29
  authorizations: string[];
30
+ expires: string;
31
31
  notBefore: string;
32
32
  notAfter: string;
33
33
  identifiers: {
@@ -38,11 +38,11 @@ export declare class AcmeService {
38
38
  }>>;
39
39
  getAuthorization(url: string, payload: Uint8Array): Promise<PostJoseRequestReturnValue<{
40
40
  status: string;
41
- expires: string;
42
41
  identifier: {
43
42
  type: string;
44
43
  value: string;
45
44
  };
45
+ expires: string;
46
46
  challenges: {
47
47
  type: string;
48
48
  url: string;
@@ -73,8 +73,8 @@ export declare class AcmeService {
73
73
  checkStatusOfOrder(url: string, payload: Uint8Array): Promise<PostJoseRequestReturnValue<{
74
74
  id: string;
75
75
  status: string;
76
- expires: string;
77
76
  authorizations: string[];
77
+ expires: string;
78
78
  notBefore: string;
79
79
  notAfter: string;
80
80
  identifiers: {
@@ -87,8 +87,8 @@ export declare class AcmeService {
87
87
  id: string;
88
88
  certificate: string;
89
89
  status: string;
90
- expires: string;
91
90
  authorizations: string[];
91
+ expires: string;
92
92
  notBefore: string;
93
93
  notAfter: string;
94
94
  identifiers: {
@@ -26,16 +26,17 @@ const axios_1 = __importDefault(require("axios"));
26
26
  const logdown_1 = __importDefault(require("logdown"));
27
27
  const schema_1 = require("./schema");
28
28
  class AcmeService {
29
+ discoveryUrl;
30
+ logger = (0, logdown_1.default)('@wireapp/core/AcmeService');
31
+ axiosInstance = axios_1.default.create();
32
+ url = {
33
+ ROOTS: '/roots.pem',
34
+ CRL: '/crl',
35
+ PROXY_CRL: '/proxyCrl',
36
+ FEDERATION: '/federation',
37
+ };
29
38
  constructor(discoveryUrl) {
30
39
  this.discoveryUrl = discoveryUrl;
31
- this.logger = (0, logdown_1.default)('@wireapp/core/AcmeService');
32
- this.axiosInstance = axios_1.default.create();
33
- this.url = {
34
- ROOTS: '/roots.pem',
35
- CRL: '/crl',
36
- PROXY_CRL: '/proxyCrl',
37
- FEDERATION: '/federation',
38
- };
39
40
  }
40
41
  get acmeBaseUrl() {
41
42
  const { origin } = new URL(this.discoveryUrl);
@@ -80,8 +80,8 @@ export declare const NewOrderResponseSchema: z.ZodObject<{
80
80
  finalize: z.ZodString;
81
81
  }, "strip", z.ZodTypeAny, {
82
82
  status: string;
83
- expires: string;
84
83
  authorizations: string[];
84
+ expires: string;
85
85
  notBefore: string;
86
86
  notAfter: string;
87
87
  identifiers: {
@@ -91,8 +91,8 @@ export declare const NewOrderResponseSchema: z.ZodObject<{
91
91
  finalize: string;
92
92
  }, {
93
93
  status: string;
94
- expires: string;
95
94
  authorizations: string[];
95
+ expires: string;
96
96
  notBefore: string;
97
97
  notAfter: string;
98
98
  identifiers: {
@@ -136,11 +136,11 @@ export declare const AuthorizationResponseSchema: z.ZodObject<{
136
136
  }>, "many">;
137
137
  }, "strip", z.ZodTypeAny, {
138
138
  status: string;
139
- expires: string;
140
139
  identifier: {
141
140
  type: string;
142
141
  value: string;
143
142
  };
143
+ expires: string;
144
144
  challenges: {
145
145
  type: string;
146
146
  url: string;
@@ -150,11 +150,11 @@ export declare const AuthorizationResponseSchema: z.ZodObject<{
150
150
  }[];
151
151
  }, {
152
152
  status: string;
153
- expires: string;
154
153
  identifier: {
155
154
  type: string;
156
155
  value: string;
157
156
  };
157
+ expires: string;
158
158
  challenges: {
159
159
  type: string;
160
160
  url: string;
@@ -246,8 +246,8 @@ export declare const CheckStatusOfOrderResponseSchema: z.ZodObject<{
246
246
  }, "strip", z.ZodTypeAny, {
247
247
  id: string;
248
248
  status: string;
249
- expires: string;
250
249
  authorizations: string[];
250
+ expires: string;
251
251
  notBefore: string;
252
252
  notAfter: string;
253
253
  identifiers: {
@@ -258,8 +258,8 @@ export declare const CheckStatusOfOrderResponseSchema: z.ZodObject<{
258
258
  }, {
259
259
  id: string;
260
260
  status: string;
261
- expires: string;
262
261
  authorizations: string[];
262
+ expires: string;
263
263
  notBefore: string;
264
264
  notAfter: string;
265
265
  identifiers: {
@@ -292,8 +292,8 @@ export declare const FinalizeOrderResponseSchema: z.ZodObject<{
292
292
  id: string;
293
293
  certificate: string;
294
294
  status: string;
295
- expires: string;
296
295
  authorizations: string[];
296
+ expires: string;
297
297
  notBefore: string;
298
298
  notAfter: string;
299
299
  identifiers: {
@@ -305,8 +305,8 @@ export declare const FinalizeOrderResponseSchema: z.ZodObject<{
305
305
  id: string;
306
306
  certificate: string;
307
307
  status: string;
308
- expires: string;
309
308
  authorizations: string[];
309
+ expires: string;
310
310
  notBefore: string;
311
311
  notAfter: string;
312
312
  identifiers: {
@@ -31,6 +31,13 @@ const LowPrecisionTaskScheduler_1 = require("../../../util/LowPrecisionTaskSched
31
31
  const qualifiedIdUtil_1 = require("../../../util/qualifiedIdUtil");
32
32
  // This export is meant to be accessible from the outside (e.g the Webapp / UI)
33
33
  class E2EIServiceExternal extends commons_1.TypedEventEmitter {
34
+ coreCryptoClient;
35
+ coreDatabase;
36
+ recurringTaskScheduler;
37
+ clientService;
38
+ mlsService;
39
+ _acmeService;
40
+ enrollmentStorage;
34
41
  constructor(coreCryptoClient, coreDatabase, recurringTaskScheduler, clientService, mlsService) {
35
42
  super();
36
43
  this.coreCryptoClient = coreCryptoClient;
@@ -83,13 +90,31 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
83
90
  .map(fullyQualifiedId => (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(fullyQualifiedId));
84
91
  const mappedUserIdentities = new Map();
85
92
  for (const userId of userIds) {
86
- const identities = (userIdentities.get(userId.id) || []).map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client, qualifiedUserId: userId })));
93
+ const identities = (userIdentities.get(userId.id) || []).map(identity => ({
94
+ ...identity,
95
+ deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client,
96
+ qualifiedUserId: userId,
97
+ }));
87
98
  const basicMLSDevices = allUsersMLSDevices
88
99
  .filter(({ user }) => user === userId.id)
89
100
  // filtering devices that have a valid identity
90
101
  .filter(({ client }) => !identities.map(identity => identity.deviceId).includes(client))
91
102
  // map basic MLS devices to "fake" identity object
92
- .map(id => (Object.assign(Object.assign({}, id), { deviceId: id.client, thumbprint: '', user: '', certificate: '', displayName: '', handle: '', notAfter: BigInt(0), notBefore: BigInt(0), serialNumber: '', clientId: id.client, qualifiedUserId: userId, credentialType: core_crypto_1.CredentialType.Basic })));
103
+ .map(id => ({
104
+ ...id,
105
+ deviceId: id.client,
106
+ thumbprint: '',
107
+ user: '',
108
+ certificate: '',
109
+ displayName: '',
110
+ handle: '',
111
+ notAfter: BigInt(0),
112
+ notBefore: BigInt(0),
113
+ serialNumber: '',
114
+ clientId: id.client,
115
+ qualifiedUserId: userId,
116
+ credentialType: core_crypto_1.CredentialType.Basic,
117
+ }));
93
118
  mappedUserIdentities.set((0, qualifiedIdUtil_1.stringifyQualifiedId)(userId), [...identities, ...basicMLSDevices]);
94
119
  }
95
120
  return mappedUserIdentities;
@@ -98,7 +123,12 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
98
123
  async getDevicesIdentities(groupId, userClientsMap) {
99
124
  const clientIds = Object.entries(userClientsMap).map(([clientId, userId]) => (0, Helper_1.getE2EIClientId)(clientId, userId.id, userId.domain).asBytes);
100
125
  const deviceIdentities = await this.coreCryptoClient.getDeviceIdentities(bazinga64_1.Decoder.fromBase64(groupId).asBytes, clientIds);
101
- return deviceIdentities.map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client, credentialType: identity.credentialType, qualifiedUserId: userClientsMap[identity.clientId] })));
126
+ return deviceIdentities.map(identity => ({
127
+ ...identity,
128
+ deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client,
129
+ credentialType: identity.credentialType,
130
+ qualifiedUserId: userClientsMap[identity.clientId],
131
+ }));
102
132
  }
103
133
  async isFreshMLSSelfClient() {
104
134
  const client = await this.clientService.loadClient();
@@ -46,7 +46,7 @@ async function buildE2EIService(dbName = 'core-test-db') {
46
46
  };
47
47
  const recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
48
48
  delete: key => mockedDb.delete('recurringTasks', key),
49
- get: async (key) => { var _a; return (_a = (await mockedDb.get('recurringTasks', key))) === null || _a === void 0 ? void 0 : _a.firingDate; },
49
+ get: async (key) => (await mockedDb.get('recurringTasks', key))?.firingDate,
50
50
  set: async (key, timestamp) => {
51
51
  await mockedDb.put('recurringTasks', { key, firingDate: timestamp }, key);
52
52
  },
@@ -78,8 +78,8 @@ describe('E2EIServiceExternal', () => {
78
78
  const userIds = [user1, user2];
79
79
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(false);
80
80
  const userIdentities = await service.getUsersIdentities(groupId, userIds);
81
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toEqual(undefined);
82
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toEqual(undefined);
81
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toEqual(undefined);
82
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toEqual(undefined);
83
83
  });
84
84
  it('returns the user identities', async () => {
85
85
  const [service, { coreCrypto, mlsService }] = await buildE2EIService();
@@ -92,8 +92,8 @@ describe('E2EIServiceExternal', () => {
92
92
  ]));
93
93
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(true);
94
94
  const userIdentities = await service.getUsersIdentities(groupId, userIds);
95
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(2);
96
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
95
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(2);
96
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
97
97
  });
98
98
  it('returns MLS basic devices with empty identity', async () => {
99
99
  const [service, { coreCrypto, mlsService }] = await buildE2EIService();
@@ -114,8 +114,8 @@ describe('E2EIServiceExternal', () => {
114
114
  coreCrypto.getClientIds.mockResolvedValue(allClients.map(clientId => encoder.encode(clientId)));
115
115
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(true);
116
116
  const userIdentities = await service.getUsersIdentities(groupId, userIds);
117
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(3);
118
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
117
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(3);
118
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
119
119
  });
120
120
  });
121
121
  describe('getAllGroupUsersIdentities', () => {
@@ -135,8 +135,8 @@ describe('E2EIServiceExternal', () => {
135
135
  jest.spyOn(mlsService, 'getClientIds').mockResolvedValue(clientIds);
136
136
  jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(false);
137
137
  const userIdentities = await service.getAllGroupUsersIdentities(groupId);
138
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user1.domain, id: user1.userId }))).toEqual(undefined);
139
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user2.domain, id: user2.userId }))).toEqual(undefined);
138
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user1.domain, id: user1.userId }))).toEqual(undefined);
139
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user2.domain, id: user2.userId }))).toEqual(undefined);
140
140
  });
141
141
  it('returns all the user identities of a mls group', async () => {
142
142
  const [service, { coreCrypto, mlsService }] = await buildE2EIService();
@@ -161,8 +161,8 @@ describe('E2EIServiceExternal', () => {
161
161
  [user2.userId, [generateCoreCryptoIdentity({ userId: user2.userId })]],
162
162
  ]));
163
163
  const userIdentities = await service.getAllGroupUsersIdentities(groupId);
164
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user1.userId, domain: user1.domain }))).toHaveLength(2);
165
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user2.userId, domain: user2.domain }))).toHaveLength(1);
164
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user1.userId, domain: user1.domain }))).toHaveLength(2);
165
+ expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user2.userId, domain: user2.domain }))).toHaveLength(1);
166
166
  });
167
167
  });
168
168
  describe('initialize', () => {
@@ -33,6 +33,14 @@ const OidcChallenge_1 = require("./Steps/OidcChallenge");
33
33
  const Order_1 = require("./Steps/Order");
34
34
  const E2EIStorage_1 = require("./Storage/E2EIStorage");
35
35
  class E2EIServiceInternal {
36
+ coreCryptoClient;
37
+ apiClient;
38
+ certificateTtl;
39
+ keyPackagesAmount;
40
+ initialData;
41
+ logger = (0, logdown_1.default)('@wireapp/core/E2EIdentityServiceInternal');
42
+ acmeService;
43
+ enrollmentStorage;
36
44
  constructor(coreDb, coreCryptoClient, apiClient,
37
45
  /** number of seconds the certificate should be valid */
38
46
  certificateTtl, keyPackagesAmount, initialData) {
@@ -41,7 +49,6 @@ class E2EIServiceInternal {
41
49
  this.certificateTtl = certificateTtl;
42
50
  this.keyPackagesAmount = keyPackagesAmount;
43
51
  this.initialData = initialData;
44
- this.logger = (0, logdown_1.default)('@wireapp/core/E2EIdentityServiceInternal');
45
52
  const { discoveryUrl } = initialData;
46
53
  this.acmeService = new AcmeServer_1.AcmeService(discoveryUrl);
47
54
  this.enrollmentStorage = (0, E2EIStorage_1.createE2EIEnrollmentStorage)(coreDb);
@@ -68,7 +75,10 @@ class E2EIServiceInternal {
68
75
  const challengeData = { challenge: oidcChallenge, keyAuth: keyauth };
69
76
  // store auth data for continuing the flow later on (in case we are redirected to the identity provider)
70
77
  const handle = await this.coreCryptoClient.e2eiEnrollmentStash(identity);
71
- const enrollmentData = Object.assign({ handle }, enrollmentChallenges);
78
+ const enrollmentData = {
79
+ handle,
80
+ ...enrollmentChallenges,
81
+ };
72
82
  await this.enrollmentStorage.savePendingEnrollmentData(enrollmentData);
73
83
  // At this point we might be redirected to the identity provider. We have
74
84
  const oAuthToken = await getOAuthToken(challengeData);
@@ -143,7 +153,7 @@ class E2EIServiceInternal {
143
153
  authzUrls: orderData.authzUrls,
144
154
  nonce: orderData.nonce,
145
155
  });
146
- return Object.assign({ orderUrl: orderData.orderUrl }, authChallenges);
156
+ return { orderUrl: orderData.orderUrl, ...authChallenges };
147
157
  }
148
158
  /**
149
159
  * Continuation of the ACME enrollment flow
@@ -162,7 +172,7 @@ class E2EIServiceInternal {
162
172
  identity,
163
173
  nonce: enrollmentData.nonce,
164
174
  });
165
- this.logger.log('oidc data', oidcData);
175
+ this.logger.debug('oidc data', oidcData);
166
176
  if (!oidcData.data.validated) {
167
177
  throw new Error('Error while trying to continue OAuth flow. OIDC challenge not validated');
168
178
  }
@@ -178,7 +188,7 @@ class E2EIServiceInternal {
178
188
  expirySecs: 30,
179
189
  nonce: oidcData.nonce,
180
190
  });
181
- this.logger.log('dpop data', dpopData);
191
+ this.logger.debug('dpop data', dpopData);
182
192
  if (!(0, Helper_1.isResponseStatusValid)(dpopData.data.status)) {
183
193
  throw new Error('Error while trying to continue OAuth flow. DPOP challenge not validated');
184
194
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAG1E,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AACF,KAAK,2BAA2B,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAElD,eAAO,MAAM,gBAAgB,gDAK1B,sBAAsB,gCAUxB,CAAC"}
1
+ {"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAG1E,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AACF,KAAK,2BAA2B,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAElD,eAAO,MAAM,gBAAgB,gDAK1B,sBAAsB,KAAG,2BAU3B,CAAC"}
@@ -23,7 +23,7 @@ const Helper_1 = require("../Helper");
23
23
  const createNewAccount = async ({ nonce, connection, directory, identity, }) => {
24
24
  const reqBody = await identity.newAccountRequest(nonce);
25
25
  const response = await connection.createNewAccount(directory.newAccount, reqBody);
26
- if ((response === null || response === void 0 ? void 0 : response.data) && !!response.data.status.length && !!response.nonce.length) {
26
+ if (response?.data && !!response.data.status.length && !!response.nonce.length) {
27
27
  await identity.newAccountResponse((0, Helper_1.jsonToByteArray)(response.data));
28
28
  return response.nonce;
29
29
  }
@@ -7,6 +7,6 @@ interface GetAuthorizationParams {
7
7
  identity: E2eiEnrollment;
8
8
  connection: AcmeService;
9
9
  }
10
- export declare const getAuthorizationChallenges: ({ authzUrls, nonce, identity, connection, }: GetAuthorizationParams) => Promise<Pick<EnrollmentFlowData, 'authorization' | 'nonce'>>;
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,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"}
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,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,OAAO,CAAC,CAsCtF,CAAC"}
@@ -21,7 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.getAuthorizationChallenges = void 0;
22
22
  const Helper_1 = require("../Helper");
23
23
  const getAuthorizationChallenges = async ({ authzUrls, nonce, identity, connection, }) => {
24
- var _a, _b;
25
24
  const challenges = [];
26
25
  for (const authzUrl of authzUrls) {
27
26
  const reqBody = await identity.newAuthzRequest(authzUrl, nonce);
@@ -32,8 +31,8 @@ const getAuthorizationChallenges = async ({ authzUrls, nonce, identity, connecti
32
31
  challenges.push({ type: backendChallenge.type, challenge });
33
32
  nonce = response.nonce;
34
33
  }
35
- const { challenge: oidcChallenge } = (_a = challenges.find(challenge => challenge.type.includes('oidc'))) !== null && _a !== void 0 ? _a : {};
36
- const { challenge: dpopChallenge } = (_b = challenges.find(challenge => challenge.type.includes('dpop'))) !== null && _b !== void 0 ? _b : {};
34
+ const { challenge: oidcChallenge } = challenges.find(challenge => challenge.type.includes('oidc')) ?? {};
35
+ const { challenge: dpopChallenge } = challenges.find(challenge => challenge.type.includes('dpop')) ?? {};
37
36
  if (!dpopChallenge || !oidcChallenge) {
38
37
  throw new Error('missing dpop or oidc challenge');
39
38
  }
@@ -22,7 +22,7 @@ exports.getCertificate = void 0;
22
22
  const getCertificate = async ({ certificateUrl, connection, identity, nonce }) => {
23
23
  const reqBody = await identity.certificateRequest(nonce);
24
24
  const certificateResponse = await connection.getCertificate(certificateUrl, reqBody);
25
- if (certificateResponse === null || certificateResponse === void 0 ? void 0 : certificateResponse.data) {
25
+ if (certificateResponse?.data) {
26
26
  return {
27
27
  certificate: certificateResponse.data,
28
28
  nonce: certificateResponse.nonce,
@@ -1 +1 @@
1
- {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Order.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAGxF,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;CACzB;AACD,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,gDAKxB,oBAAoB,KAAG,QAAQ,yBAAyB,CAY1D,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AACD,eAAO,MAAM,aAAa,8CAAmD,mBAAmB;;;EAqB/F,CAAC"}
1
+ {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Steps/Order.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAC;AAGxF,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;CACzB;AACD,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,gDAKxB,oBAAoB,KAAG,OAAO,CAAC,yBAAyB,CAY1D,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AACD,eAAO,MAAM,aAAa,8CAAmD,mBAAmB;;;EAqB/F,CAAC"}
@@ -37,11 +37,11 @@ exports.createNewOrder = createNewOrder;
37
37
  const finalizeOrder = async ({ identity, nonce, orderUrl, connection }) => {
38
38
  const statusReqBody = await identity.checkOrderRequest(orderUrl, nonce);
39
39
  const statusResponse = await connection.checkStatusOfOrder(orderUrl, statusReqBody);
40
- if ((statusResponse === null || statusResponse === void 0 ? void 0 : statusResponse.data) && !!statusResponse.data.status.length && !!statusResponse.nonce.length) {
40
+ if (statusResponse?.data && !!statusResponse.data.status.length && !!statusResponse.nonce.length) {
41
41
  const finalizeUrl = await identity.checkOrderResponse((0, Helper_1.jsonToByteArray)(statusResponse.data));
42
42
  const finalizeReqBody = await identity.finalizeRequest(statusResponse.nonce);
43
43
  const finalizeResponse = await connection.finalizeOrder(finalizeUrl, finalizeReqBody);
44
- if ((finalizeResponse === null || finalizeResponse === void 0 ? void 0 : finalizeResponse.data) && !!finalizeResponse.data.status.length && !!finalizeResponse.nonce.length) {
44
+ if (finalizeResponse?.data && !!finalizeResponse.data.status.length && !!finalizeResponse.nonce.length) {
45
45
  const certificateUrl = await identity.finalizeResponse((0, Helper_1.jsonToByteArray)(finalizeResponse.data));
46
46
  return {
47
47
  certificateUrl,
@@ -1 +1 @@
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"}
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,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;oCAGnC,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;mCAGnC,OAAO,CAAC,IAAI,CAAC;EAIrD"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.createE2EIEnrollmentStorage = void 0;
21
+ exports.createE2EIEnrollmentStorage = createE2EIEnrollmentStorage;
22
22
  const PENDING_ENROLLMENT_TABLE = 'pendingEnrollmentData';
23
23
  const STORAGE_KEY = 'data';
24
24
  function createE2EIEnrollmentStorage(coreDB) {
@@ -34,4 +34,3 @@ function createE2EIEnrollmentStorage(coreDB) {
34
34
  },
35
35
  };
36
36
  }
37
- exports.createE2EIEnrollmentStorage = createE2EIEnrollmentStorage;
@@ -102,6 +102,8 @@ export declare const EnrollmentFlowDataSchema: z.ZodObject<{
102
102
  nonce: z.ZodString;
103
103
  }, "strip", z.ZodTypeAny, {
104
104
  nonce: string;
105
+ handle: Uint8Array;
106
+ orderUrl: string;
105
107
  authorization: {
106
108
  keyauth: string;
107
109
  dpopChallenge: {
@@ -115,10 +117,10 @@ export declare const EnrollmentFlowDataSchema: z.ZodObject<{
115
117
  delegate: Uint8Array;
116
118
  };
117
119
  };
118
- handle: Uint8Array;
119
- orderUrl: string;
120
120
  }, {
121
121
  nonce: string;
122
+ handle: Uint8Array;
123
+ orderUrl: string;
122
124
  authorization: {
123
125
  keyauth: string;
124
126
  dpopChallenge: {
@@ -132,8 +134,6 @@ export declare const EnrollmentFlowDataSchema: z.ZodObject<{
132
134
  delegate: Uint8Array;
133
135
  };
134
136
  };
135
- handle: Uint8Array;
136
- orderUrl: string;
137
137
  }>;
138
138
  export type EnrollmentFlowData = z.infer<typeof EnrollmentFlowDataSchema>;
139
139
  export type UnidentifiedEnrollmentFlowData = Omit<EnrollmentFlowData, 'handle'>;
@@ -1 +1 @@
1
- {"version":3,"file":"IncomingMesssagesQueue.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.ts"],"names":[],"mappings":"AA2CA,eAAO,MAAM,uBAAuB,kCAAyC,GAAG,EAAE,KAAK,GAAG,WAC/E,MAAM,WACN,YAAY,KACpB,QAAQ,WAAW,YAAY,CAAC,CAGlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,SAErD,CAAC;AAcF,eAAO,MAAM,0BAA0B,eAAsB,MAAM,MAAM,MAAM,QAAQ,CAAC,CAAC,KAAG,QAAQ,CAAC,CAUpG,CAAC"}
1
+ {"version":3,"file":"IncomingMesssagesQueue.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.ts"],"names":[],"mappings":"AA2CA,eAAO,MAAM,uBAAuB,GAAU,YAAY,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,WAC/E,MAAM,WACN,YAAY,KACpB,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAGlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,SAErD,CAAC;AAcF,eAAO,MAAM,0BAA0B,GAAU,CAAC,WAAW,MAAM,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAUpG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAEhF,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,oCAI7B,yBAAyB,KAAG,QAAQ,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
1
+ {"version":3,"file":"messageAdd.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAK7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAEhF,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,oCAI7B,yBAAyB,KAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
@@ -37,7 +37,7 @@ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
37
37
  // Those proposals are stored inside of coreCrypto and will be handled after a timeout
38
38
  await mlsService.handlePendingProposals({
39
39
  groupId,
40
- delayInMs: commitDelay !== null && commitDelay !== void 0 ? commitDelay : 0,
40
+ delayInMs: commitDelay ?? 0,
41
41
  eventTime: event.time,
42
42
  });
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAE/C,UAAU,0BAA0B;IAClC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,2BAGjC,0BAA0B,KAAG,QAAQ,mBAAmB,CAiB1D,CAAC"}
1
+ {"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAE/C,UAAU,0BAA0B;IAClC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,2BAGjC,0BAA0B,KAAG,OAAO,CAAC,mBAAmB,CAiB1D,CAAC"}
@@ -31,7 +31,7 @@ const handleMLSWelcomeMessage = async ({ mlsService, event, }) => {
31
31
  const newEpoch = await mlsService.getEpoch(groupIdStr);
32
32
  mlsService.emit('newEpoch', { groupId: groupIdStr, epoch: newEpoch });
33
33
  return {
34
- event: Object.assign(Object.assign({}, event), { data: groupIdStr }),
34
+ event: { ...event, data: groupIdStr },
35
35
  };
36
36
  };
37
37
  exports.handleMLSWelcomeMessage = handleMLSWelcomeMessage;
@@ -20,15 +20,19 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const event_1 = require("@wireapp/api-client/lib/event");
22
22
  const welcomeMessage_1 = require("./welcomeMessage");
23
- jest.mock('bazinga64', () => (Object.assign(Object.assign({}, jest.requireActual('bazinga64')), { Decoder: {
23
+ jest.mock('bazinga64', () => ({
24
+ ...jest.requireActual('bazinga64'),
25
+ Decoder: {
24
26
  fromBase64: jest.fn().mockImplementation((value) => ({
25
27
  asBytes: jest.fn().mockReturnValue(value),
26
28
  })),
27
- }, Encoder: {
29
+ },
30
+ Encoder: {
28
31
  toBase64: jest.fn().mockImplementation((value) => ({
29
32
  asString: value,
30
33
  })),
31
- } })));
34
+ },
35
+ }));
32
36
  const mockParams = {
33
37
  event: {
34
38
  type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
@@ -24,6 +24,7 @@ var ClientMLSErrorLabel;
24
24
  ClientMLSErrorLabel["NO_KEY_PACKAGES_AVAILABLE"] = "no-key-packages-available";
25
25
  })(ClientMLSErrorLabel || (exports.ClientMLSErrorLabel = ClientMLSErrorLabel = {}));
26
26
  class ClientMLSError extends Error {
27
+ label;
27
28
  constructor(label) {
28
29
  super();
29
30
  this.label = label;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreCryptoMLSError.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/CoreCryptoMLSError.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;CAcrB,CAAC;AAEX,eAAO,MAAM,8BAA8B,UAAW,OAAO,KAAG,OAE/D,CAAC;AAEF,eAAO,MAAM,6CAA6C,UAAW,OAAO,KAAG,OAE9E,CAAC;AAEF,eAAO,MAAM,wCAAwC,UAAW,OAAO,KAAG,OAEzE,CAAC;AAWF,eAAO,MAAM,iCAAiC,UAAW,OAAO,mBAE/D,CAAC"}
1
+ {"version":3,"file":"CoreCryptoMLSError.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/CoreCryptoMLSError.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;CAcrB,CAAC;AAEX,eAAO,MAAM,8BAA8B,UAAW,OAAO,KAAG,OAE/D,CAAC;AAEF,eAAO,MAAM,6CAA6C,UAAW,OAAO,KAAG,OAE9E,CAAC;AAEF,eAAO,MAAM,wCAAwC,UAAW,OAAO,KAAG,OAEzE,CAAC;AAWF,eAAO,MAAM,iCAAiC,UAAW,OAAO,KAAG,KAAK,IAAI,KAE3E,CAAC"}