@wireapp/core 46.1.0-hotfix-1.5 → 46.1.0-hotfix-1.7
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.
- package/README.md +1 -1
- package/lib/Account.d.ts +8 -5
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +141 -321
- package/lib/Account.test.js +9 -9
- package/lib/conversation/AssetService/AssetService.test.js +3 -3
- package/lib/conversation/ConversationService/ConversationService.d.ts +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +11 -5
- package/lib/conversation/ConversationService/ConversationService.test.js +6 -9
- package/lib/conversation/SubconversationService/SubconversationService.d.ts +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +3 -1
- package/lib/conversation/SubconversationService/SubconversationService.test.js +6 -5
- package/lib/conversation/message/MessageBuilder.js +2 -2
- package/lib/conversation/message/MessageService.test.js +3 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/AcmeService.d.ts +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Connection/AcmeServer/schema.d.ts +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +8 -31
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +56 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +3 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +4 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +24 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/Steps/OidcChallenge.d.ts +1 -1
- package/lib/messagingProtocols/mls/MLSService/ClientMLSError.d.ts +8 -0
- package/lib/messagingProtocols/mls/MLSService/ClientMLSError.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/{MLSService.guards.js → ClientMLSError.js} +12 -7
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +45 -11
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +92 -42
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +109 -10
- package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts +1 -15
- package/lib/messagingProtocols/mls/MLSService/MLSService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/index.d.ts +1 -0
- package/lib/messagingProtocols/mls/MLSService/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/index.js +1 -0
- package/lib/messagingProtocols/mls/types.d.ts +0 -3
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +7 -4
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
- package/lib/test/PayloadHelper.js +2 -2
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/MLSService/MLSService.guards.d.ts +0 -4
- package/lib/messagingProtocols/mls/MLSService/MLSService.guards.d.ts.map +0 -1
|
@@ -21,8 +21,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
const client_1 = require("@wireapp/api-client/lib/client");
|
|
22
22
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
23
23
|
const http_1 = require("@wireapp/api-client/lib/http");
|
|
24
|
+
const TimeUtil_1 = require("@wireapp/commons/lib/util/TimeUtil");
|
|
24
25
|
const crypto_1 = require("crypto");
|
|
25
26
|
const api_client_1 = require("@wireapp/api-client");
|
|
27
|
+
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
26
28
|
const CoreCryptoMLSError_1 = require("./CoreCryptoMLSError");
|
|
27
29
|
const MLSService_1 = require("./MLSService");
|
|
28
30
|
const conversation_1 = require("../../../conversation");
|
|
@@ -33,6 +35,10 @@ jest.createMockFromModule('@wireapp/api-client');
|
|
|
33
35
|
function createUserId() {
|
|
34
36
|
return { id: (0, crypto_1.randomUUID)(), domain: '' };
|
|
35
37
|
}
|
|
38
|
+
const defaultMLSInitConfig = {
|
|
39
|
+
ciphersuites: [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
|
|
40
|
+
defaultCiphersuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
|
|
41
|
+
};
|
|
36
42
|
const createMLSService = async () => {
|
|
37
43
|
const apiClient = new api_client_1.APIClient();
|
|
38
44
|
const mockCoreCrypto = {
|
|
@@ -58,10 +64,11 @@ const createMLSService = async () => {
|
|
|
58
64
|
delete: key => mockedDb.delete('recurringTasks', key),
|
|
59
65
|
get: async (key) => { var _a; return (_a = (await mockedDb.get('recurringTasks', key))) === null || _a === void 0 ? void 0 : _a.firingDate; },
|
|
60
66
|
set: async (key, timestamp) => {
|
|
61
|
-
await mockedDb.put('recurringTasks', { key, firingDate: timestamp });
|
|
67
|
+
await mockedDb.put('recurringTasks', { key, firingDate: timestamp }, key);
|
|
62
68
|
},
|
|
63
69
|
});
|
|
64
|
-
const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler
|
|
70
|
+
const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler);
|
|
71
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
65
72
|
return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
|
|
66
73
|
};
|
|
67
74
|
describe('MLSService', () => {
|
|
@@ -198,7 +205,99 @@ describe('MLSService', () => {
|
|
|
198
205
|
expect(isEstablshed).toBe(true);
|
|
199
206
|
});
|
|
200
207
|
});
|
|
208
|
+
describe('isInitializedMLSClient', () => {
|
|
209
|
+
it.each([
|
|
210
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
|
|
211
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256],
|
|
212
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519],
|
|
213
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448],
|
|
214
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521],
|
|
215
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448],
|
|
216
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384],
|
|
217
|
+
])('always return false for empty mls_public_keys (%d)', async (ciphersuite) => {
|
|
218
|
+
const [mlsService] = await createMLSService();
|
|
219
|
+
const mockClient = { mls_public_keys: {} };
|
|
220
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
221
|
+
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
222
|
+
expect(isInitialized).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
it.each([
|
|
225
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, 'ed25519'],
|
|
226
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256, 'ecdsa_secp256r1_sha256'],
|
|
227
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519, 'ed25519'],
|
|
228
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448, 'ed448'],
|
|
229
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'ecdsa_secp521r1_sha512'],
|
|
230
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'ed448'],
|
|
231
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'ecdsa_secp384r1_sha384'],
|
|
232
|
+
])('returns true if there is a signature corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
233
|
+
const [mlsService] = await createMLSService();
|
|
234
|
+
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
235
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
236
|
+
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
237
|
+
expect(isInitialized).toBe(true);
|
|
238
|
+
});
|
|
239
|
+
it.each([
|
|
240
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519, 'p256'],
|
|
241
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMP256_AES128GCM_SHA256_P256, 'ed25519'],
|
|
242
|
+
[core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519, 'p256'],
|
|
243
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448, 'p384'],
|
|
244
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP521_AES256GCM_SHA512_P521, 'ed448'],
|
|
245
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448, 'p256'],
|
|
246
|
+
[core_crypto_1.Ciphersuite.MLS_256_DHKEMP384_AES256GCM_SHA384_P384, 'p256'],
|
|
247
|
+
])('returns false if there is a signature not corresponding to the ciphersuite used (%d, %s)', async (ciphersuite, signatureAlgo) => {
|
|
248
|
+
const [mlsService] = await createMLSService();
|
|
249
|
+
const mockClient = { mls_public_keys: { [signatureAlgo]: 'signature' } };
|
|
250
|
+
mlsService['_config'] = Object.assign(Object.assign({}, defaultMLSInitConfig), { defaultCiphersuite: ciphersuite, nbKeyPackages: 100, keyingMaterialUpdateThreshold: 1 });
|
|
251
|
+
const isInitialized = mlsService.isInitializedMLSClient(mockClient);
|
|
252
|
+
expect(isInitialized).toBe(false);
|
|
253
|
+
});
|
|
254
|
+
});
|
|
201
255
|
describe('initClient', () => {
|
|
256
|
+
it('uses the default config if config is not provided by the consumer', async () => {
|
|
257
|
+
const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
|
|
258
|
+
const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
|
|
259
|
+
const mockClientId = 'client-1';
|
|
260
|
+
const mockClient = { mls_public_keys: {}, id: mockClientId };
|
|
261
|
+
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
262
|
+
const mockedClientPublicKey = new Uint8Array();
|
|
263
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
264
|
+
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
265
|
+
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
266
|
+
const config = Object.assign({}, defaultMLSInitConfig);
|
|
267
|
+
await mlsService.initClient(mockUserId, mockClient, config);
|
|
268
|
+
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
269
|
+
expect(mlsService.config.nbKeyPackages).toEqual(100);
|
|
270
|
+
});
|
|
271
|
+
it('uses the config provided by the consumer', async () => {
|
|
272
|
+
const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
|
|
273
|
+
const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
|
|
274
|
+
const mockClientId = 'client-1';
|
|
275
|
+
const mockClient = { mls_public_keys: {}, id: mockClientId };
|
|
276
|
+
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
277
|
+
const mockedClientPublicKey = new Uint8Array();
|
|
278
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
279
|
+
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
280
|
+
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
281
|
+
const config = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: 40, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY });
|
|
282
|
+
await mlsService.initClient(mockUserId, mockClient, config);
|
|
283
|
+
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
|
|
284
|
+
expect(mlsService.config).toEqual(config);
|
|
285
|
+
});
|
|
286
|
+
it('uses the default config value when provided with undefined by the consumer', async () => {
|
|
287
|
+
const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
|
|
288
|
+
const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
|
|
289
|
+
const mockClientId = 'client-1';
|
|
290
|
+
const mockClient = { mls_public_keys: {}, id: mockClientId };
|
|
291
|
+
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
292
|
+
const mockedClientPublicKey = new Uint8Array();
|
|
293
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
294
|
+
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
295
|
+
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
296
|
+
const config = Object.assign(Object.assign({}, defaultMLSInitConfig), { nbKeyPackages: undefined, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY });
|
|
297
|
+
await mlsService.initClient(mockUserId, mockClient, config);
|
|
298
|
+
expect(coreCrypto.mlsInit).toHaveBeenCalledWith(expect.any(Uint8Array), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
299
|
+
expect(mlsService.config).toEqual(Object.assign(Object.assign({}, config), { nbKeyPackages: 100 }));
|
|
300
|
+
});
|
|
202
301
|
it('uploads public key only if it was not yet defined on client entity', async () => {
|
|
203
302
|
const [mlsService, { apiClient, coreCrypto }] = await createMLSService();
|
|
204
303
|
const mockUserId = { id: 'user-1', domain: 'local.zinfra.io' };
|
|
@@ -209,7 +308,7 @@ describe('MLSService', () => {
|
|
|
209
308
|
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
210
309
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
211
310
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
212
|
-
await mlsService.initClient(mockUserId, mockClient);
|
|
311
|
+
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
213
312
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
214
313
|
expect(apiClient.api.client.putClient).toHaveBeenCalledWith(mockClientId, expect.anything());
|
|
215
314
|
});
|
|
@@ -223,9 +322,9 @@ describe('MLSService', () => {
|
|
|
223
322
|
jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
|
|
224
323
|
jest
|
|
225
324
|
.spyOn(apiClient.api.client, 'getMLSKeyPackageCount')
|
|
226
|
-
.mockResolvedValueOnce(mlsService
|
|
325
|
+
.mockResolvedValueOnce(mlsService['minRequiredKeyPackages'] - 1);
|
|
227
326
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
228
|
-
await mlsService.initClient(mockUserId, mockClient);
|
|
327
|
+
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
229
328
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
230
329
|
expect(apiClient.api.client.uploadMLSKeyPackages).toHaveBeenCalledWith(mockClientId, expect.anything());
|
|
231
330
|
});
|
|
@@ -239,7 +338,7 @@ describe('MLSService', () => {
|
|
|
239
338
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
240
339
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages');
|
|
241
340
|
jest.spyOn(apiClient.api.client, 'putClient');
|
|
242
|
-
await mlsService.initClient(mockUserId, mockClient);
|
|
341
|
+
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
243
342
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
244
343
|
expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
|
|
245
344
|
expect(apiClient.api.client.putClient).not.toHaveBeenCalled();
|
|
@@ -365,7 +464,7 @@ describe('MLSService', () => {
|
|
|
365
464
|
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
366
465
|
const mockedClientKeyPackages = [new Uint8Array()];
|
|
367
466
|
jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
|
|
368
|
-
const numberOfKeysBelowThreshold = mlsService
|
|
467
|
+
const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
|
|
369
468
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
|
|
370
469
|
jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
|
|
371
470
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
@@ -391,7 +490,7 @@ describe('MLSService', () => {
|
|
|
391
490
|
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
392
491
|
const mockedClientKeyPackages = [new Uint8Array()];
|
|
393
492
|
jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
|
|
394
|
-
const numberOfKeysAboveThreshold = mlsService
|
|
493
|
+
const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
|
|
395
494
|
jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
|
|
396
495
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
|
|
397
496
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
@@ -417,8 +516,8 @@ describe('MLSService', () => {
|
|
|
417
516
|
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
418
517
|
const mockedClientKeyPackages = [new Uint8Array()];
|
|
419
518
|
jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
|
|
420
|
-
const numberOfKeysBelowThreshold = mlsService
|
|
421
|
-
const numberOfKeysAboveThreshold = mlsService
|
|
519
|
+
const numberOfKeysBelowThreshold = mlsService['minRequiredKeyPackages'] - 1;
|
|
520
|
+
const numberOfKeysAboveThreshold = mlsService['minRequiredKeyPackages'] + 1;
|
|
422
521
|
jest.spyOn(coreCrypto, 'clientValidKeypackagesCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
|
|
423
522
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
|
|
424
523
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CommitBundle } from '@wireapp/core-crypto';
|
|
2
2
|
export interface UploadCommitOptions {
|
|
3
3
|
/**
|
|
4
4
|
* If uploading the commit fails and we endup in a scenario where a retrial is possible, then this callback will be called to re-generate a new commit bundle
|
|
@@ -9,20 +9,6 @@ export interface UploadCommitOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
isExternalCommit?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export interface MLSServiceConfig {
|
|
13
|
-
/**
|
|
14
|
-
* (milliseconds) period of time between automatic updates of the keying material (30 days by default)
|
|
15
|
-
*/
|
|
16
|
-
keyingMaterialUpdateThreshold: number;
|
|
17
|
-
/**
|
|
18
|
-
* number of key packages client should upload to the server (100 by default)
|
|
19
|
-
*/
|
|
20
|
-
nbKeyPackages: number;
|
|
21
|
-
/**
|
|
22
|
-
* default ciphersuite to use for MLS (MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 = 1 by default)
|
|
23
|
-
*/
|
|
24
|
-
cipherSuite: Ciphersuite;
|
|
25
|
-
}
|
|
26
12
|
export type NewCrlDistributionPointsPayload = {
|
|
27
13
|
crlNewDistributionPoints?: string[] | undefined;
|
|
28
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"MLSService.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.types.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAErD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,MAAM,+BAA+B,GAAG;IAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/index.ts"],"names":[],"mappings":"AAmBA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
2
|
-
import { MLSServiceConfig } from './MLSService/MLSService.types';
|
|
3
2
|
export type ClientId = string;
|
|
4
3
|
export type SecretCrypto = {
|
|
5
4
|
encrypt: (value: Uint8Array) => Promise<Uint8Array>;
|
|
@@ -28,7 +27,5 @@ export interface CoreCryptoConfig {
|
|
|
28
27
|
* It, thus, needs to know where, on the server, the file can be found
|
|
29
28
|
*/
|
|
30
29
|
wasmFilePath: string;
|
|
31
|
-
/** If set will create an MLS capable device from the current device */
|
|
32
|
-
mls?: Partial<MLSServiceConfig>;
|
|
33
30
|
}
|
|
34
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,OAAO,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,yBAAyB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACzF;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,
|
|
1
|
+
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAIpD,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAoB,YAAY,EAAC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,mBAAmB,GAAG,cAAc,CAAC,GAAG;IACvE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AAEF,wBAAsB,WAAW,CAC/B,WAAW,EAAE,UAAU,EACvB,EAAC,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAC,EAAE,MAAM,GACjE,OAAO,CAAC,iBAAiB,CAAC,CAqB5B;AAED,qBAAa,iBAAkB,YAAW,YAAY;IAKlD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAGb,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY;IAMvC,eAAe;IAIf,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU;IAIjD,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAI9C,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM;IAOxB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU;;;;;;;IAqBpD,cAAc;IAId,oBAAoB,CAAC,SAAS,EAAE,MAAM;IAIhC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAK/D,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IAIvD,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,WAAW,CAAC,SAAS,EAAE,MAAM;IAI7B,aAAa,CAAC,SAAS,EAAE,MAAM;IAI/B,aAAa;IAIP,SAAS;;;;IAKT,iBAAiB,CAAC,SAAS,EAAE,MAAM;IAUnC,kBAAkB;IAIlB,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAIzC;;;;OAIG;IACH,OAAO,CAAC,OAAO;IAgBT,IAAI;CAIX"}
|
|
@@ -45,7 +45,6 @@ async function buildClient(storeEngine, { wasmFilePath, generateSecretKey, nbPre
|
|
|
45
45
|
databaseName: coreCryptoDbName,
|
|
46
46
|
key: bazinga64_1.Encoder.toBase64(key.key).asString,
|
|
47
47
|
wasmFilePath,
|
|
48
|
-
ciphersuites: [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519],
|
|
49
48
|
});
|
|
50
49
|
return new CoreCryptoWrapper(coreCrypto, { nbPrekeys, onNewPrekeys, onWipe: key.deleteKey });
|
|
51
50
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { APIClient } from '@wireapp/api-client';
|
|
2
2
|
import { CryptoClient } from './CryptoClient';
|
|
3
3
|
import { ProteusService } from './ProteusService';
|
|
4
|
-
export declare const buildProteusService: () => Promise<[
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export declare const buildProteusService: () => Promise<[
|
|
5
|
+
ProteusService,
|
|
6
|
+
{
|
|
7
|
+
apiClient: APIClient;
|
|
8
|
+
cryptoClient: CryptoClient;
|
|
9
|
+
}
|
|
10
|
+
]>;
|
|
8
11
|
//# sourceMappingURL=ProteusService.mocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.mocks.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.mocks.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAIhD,eAAO,MAAM,mBAAmB;
|
|
1
|
+
{"version":3,"file":"ProteusService.mocks.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.mocks.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAIhD,eAAO,MAAM,mBAAmB,QAAa,QAC3C;IAAC,cAAc;IAAE;QAAC,SAAS,EAAE,SAAS,CAAC;QAAC,YAAY,EAAE,YAAY,CAAA;KAAC;CAAC,CAgBrE,CAAC"}
|
|
@@ -25,7 +25,7 @@ declare const constructSessionId: ({ userId, clientId }: ConstructSessionIdParam
|
|
|
25
25
|
declare const initSession: ({ userId, clientId, initialPrekey }: {
|
|
26
26
|
userId: QualifiedId;
|
|
27
27
|
clientId: string;
|
|
28
|
-
initialPrekey?: PreKey
|
|
28
|
+
initialPrekey?: PreKey;
|
|
29
29
|
}, { cryptoClient, apiClient }: {
|
|
30
30
|
apiClient: APIClient;
|
|
31
31
|
cryptoClient: CryptoClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionHandler.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK9C,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAE/D,UAAU,wBAAwB;IAChC,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,kBAAkB,GAAG;IACxB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,6EAA6E;IAC7E,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,kBAAkB,yBAAwB,wBAAwB,KAAG,MAI1E,CAAC;AA6BF;;;GAGG;AACH,QAAA,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"SessionHandler.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAEvF,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK9C,OAAO,EAAC,YAAY,EAAC,MAAM,mCAAmC,CAAC;AAE/D,UAAU,wBAAwB;IAChC,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,kBAAkB,GAAG;IACxB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,6EAA6E;IAC7E,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,kBAAkB,yBAAwB,wBAAwB,KAAG,MAI1E,CAAC;AA6BF;;;GAGG;AACH,QAAA,MAAM,WAAW,wCACoB;IAAC,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAC,+BACvE;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,YAAY,CAAA;CAAC,KAC5E,QAAQ,MAAM,CAUhB,CAAC;AAqBF,UAAU,wCAAwC;IAChD,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,CAAC;IAChE,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,QAAA,MAAM,YAAY,qDAKf,wCAAwC,KAAG,QAAQ,kBAAkB,CAwDvE,CAAC;AAEF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC5B;AACD,iBAAe,aAAa,CAAC,MAAM,EAAE,mBAAmB,iBAGvD;AA4CD,KAAK,iBAAiB,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E;;GAEG;AACH,QAAA,MAAM,sBAAsB,gBAAiB,IAAI,MAAM,EAAE,CAAC,CAAC,KAAG,kBAAkB,CAAC,CAYhF,CAAC;AAEF,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAC,CAAC"}
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.mockUserPayload = exports.getUrlParameter = exports.getUUID = void 0;
|
|
22
22
|
const faker_1 = require("@faker-js/faker");
|
|
23
|
-
const
|
|
23
|
+
const uuid_1 = require("uuid");
|
|
24
24
|
function getUUID() {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, uuid_1.v4)();
|
|
26
26
|
}
|
|
27
27
|
exports.getUUID = getUUID;
|
|
28
28
|
function getUrlParameter(url, parameter) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^27.1.0-hotfix-1.
|
|
14
|
+
"@wireapp/api-client": "^27.1.0-hotfix-1.6",
|
|
15
15
|
"@wireapp/commons": "^5.2.8",
|
|
16
16
|
"@wireapp/core-crypto": "1.0.2",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"test:coverage": "jest --coverage",
|
|
63
63
|
"watch": "tsc --watch"
|
|
64
64
|
},
|
|
65
|
-
"version": "46.1.0-hotfix-1.
|
|
66
|
-
"gitHead": "
|
|
65
|
+
"version": "46.1.0-hotfix-1.7",
|
|
66
|
+
"gitHead": "d473f605ef94bbf45ca65116c9e6a6968167486c"
|
|
67
67
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { BackendError } from '@wireapp/api-client/lib/http';
|
|
2
|
-
export declare const isObject: (value: unknown) => value is {};
|
|
3
|
-
export declare function isBackendError(errorCandidate: unknown): errorCandidate is BackendError;
|
|
4
|
-
//# sourceMappingURL=MLSService.guards.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.guards.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.guards.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAE1D,eAAO,MAAM,QAAQ,UAAW,OAAO,gBAA6D,CAAC;AAGrG,wBAAgB,cAAc,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,IAAI,YAAY,CAEtF"}
|