@wireapp/core 43.13.1 → 43.14.1
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/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +6 -2
- 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 +27 -34
- package/lib/conversation/ConversationService/ConversationService.test.js +2 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -3
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +30 -46
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +52 -58
- package/lib/messagingProtocols/mls/conversationRejoinQueue.d.ts +10 -0
- package/lib/messagingProtocols/mls/conversationRejoinQueue.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/conversationRejoinQueue.js +46 -0
- package/lib/messagingProtocols/mls/conversationRejoinQueue.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/conversationRejoinQueue.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/conversationRejoinQueue.test.js +39 -0
- package/package.json +2 -2
package/lib/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../src/Account.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAGZ,OAAO,EACP,MAAM,EAEN,SAAS,EAEV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAuB,UAAU,EAAE,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAEnG,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAUxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,C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GED
|
@@ -74,6 +74,7 @@ const SubconversationService_1 = require("./conversation/SubconversationService/
|
|
|
74
74
|
const giphy_1 = require("./giphy/");
|
|
75
75
|
const linkPreview_1 = require("./linkPreview");
|
|
76
76
|
const mls_1 = require("./messagingProtocols/mls");
|
|
77
|
+
const conversationRejoinQueue_1 = require("./messagingProtocols/mls/conversationRejoinQueue");
|
|
77
78
|
const E2EIdentityService_1 = require("./messagingProtocols/mls/E2EIdentityService");
|
|
78
79
|
const proteus_1 = require("./messagingProtocols/proteus");
|
|
79
80
|
const CryptoClient_1 = require("./messagingProtocols/proteus/ProteusService/CryptoClient");
|
|
@@ -478,9 +479,9 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
478
479
|
}
|
|
479
480
|
});
|
|
480
481
|
const handleMissedNotifications = async (notificationId) => {
|
|
481
|
-
var _a
|
|
482
|
+
var _a;
|
|
482
483
|
if ((_a = this.service) === null || _a === void 0 ? void 0 : _a.mls) {
|
|
483
|
-
|
|
484
|
+
(0, conversationRejoinQueue_1.queueConversationRejoin)('all-conversations', () => this.service.conversation.handleConversationsEpochMismatch());
|
|
484
485
|
}
|
|
485
486
|
return onMissedNotifications(notificationId);
|
|
486
487
|
};
|
|
@@ -488,6 +489,8 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
488
489
|
// Lock websocket in order to buffer any message that arrives while we handle the notification stream
|
|
489
490
|
this.apiClient.transport.ws.lock();
|
|
490
491
|
(0, messageSender_1.pauseMessageSending)();
|
|
492
|
+
// We want to avoid triggering rejoins of out-of-sync MLS conversations while we are processing the notification stream
|
|
493
|
+
(0, conversationRejoinQueue_1.pauseRejoiningMLSConversations)();
|
|
491
494
|
onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
|
|
492
495
|
const results = await this.service.notification.processNotificationStream(async (notification, source, progress) => {
|
|
493
496
|
await handleNotification(notification, source);
|
|
@@ -505,6 +508,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
505
508
|
// This is due to the nature of how message are encrypted, any change in mls epoch needs to happen before we start encrypting any kind of messages
|
|
506
509
|
this.logger.info(`Resuming message sending. ${(0, messageSender_1.getQueueLength)()} messages to be sent`);
|
|
507
510
|
(0, messageSender_1.resumeMessageSending)();
|
|
511
|
+
(0, conversationRejoinQueue_1.resumeRejoiningMLSConversations)();
|
|
508
512
|
};
|
|
509
513
|
this.apiClient.connect(processNotificationStream);
|
|
510
514
|
return () => {
|
|
@@ -132,7 +132,7 @@ export declare class ConversationService extends TypedEventEmitter<Events> {
|
|
|
132
132
|
* @param epoch - epoch of the remote conversation
|
|
133
133
|
* @param onEpochMismatch - callback to be called when epochs do not match
|
|
134
134
|
*/
|
|
135
|
-
private
|
|
135
|
+
private hasEpochMismatch;
|
|
136
136
|
/**
|
|
137
137
|
* Get a MLS 1:1-conversation with a given user.
|
|
138
138
|
* @param userId - qualified user id
|
|
@@ -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,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;
|
|
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;AACjG,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAsB,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,kDAAkD,CAAC;AAExF,KAAK,MAAM,GAAG;IACZ,wBAAwB,EAAE;QAAC,cAAc,EAAE,WAAW,CAAA;KAAC,CAAC;CACzD,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Service_types_1 = require("./ConversationService.types");
|
|
34
34
|
const conversation_2 = require("../../conversation/");
|
|
35
35
|
const AssetCryptography_1 = require("../../cryptography/AssetCryptography");
|
|
36
|
+
const conversationRejoinQueue_1 = require("../../messagingProtocols/mls/conversationRejoinQueue");
|
|
36
37
|
const CoreCryptoMLSError_1 = require("../../messagingProtocols/mls/MLSService/CoreCryptoMLSError");
|
|
37
38
|
const proteus_1 = require("../../messagingProtocols/proteus");
|
|
38
39
|
const util_1 = require("../../util");
|
|
@@ -375,22 +376,19 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
375
376
|
*/
|
|
376
377
|
async handleSubconversationEpochMismatch(subconversation) {
|
|
377
378
|
const { parent_qualified_id: parentConversationId, group_id: groupId, epoch, subconv_id: subconversationId, } = subconversation;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
catch (error) {
|
|
393
|
-
this.logger.error(`There was an error while handling epoch mismatch in MLS subconversation (id: ${parentConversationId.id}, subconv: ${subconversationId}):`, error);
|
|
379
|
+
if (await this.hasEpochMismatch(groupId, epoch)) {
|
|
380
|
+
this.logger.log(`Subconversation "${subconversationId}" (parent id: ${parentConversationId.id}) was not established or its epoch number was out of date, joining via external commit`);
|
|
381
|
+
// We only support conference subconversations for now
|
|
382
|
+
if (subconversationId !== conversation_1.SUBCONVERSATION_ID.CONFERENCE) {
|
|
383
|
+
throw new Error('Unexpected subconversation id');
|
|
384
|
+
}
|
|
385
|
+
try {
|
|
386
|
+
await this.subconversationService.joinConferenceSubconversation(parentConversationId);
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
const message = `There was an error while handling epoch mismatch in MLS subconversation (id: ${parentConversationId.id}, subconv: ${subconversationId}):`;
|
|
390
|
+
this.logger.error(message, error);
|
|
391
|
+
}
|
|
394
392
|
}
|
|
395
393
|
}
|
|
396
394
|
/**
|
|
@@ -399,19 +397,16 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
399
397
|
*/
|
|
400
398
|
async handleConversationEpochMismatch(remoteMlsConversation, onSuccessfulRejoin) {
|
|
401
399
|
const { qualified_id: qualifiedId, group_id: groupId, epoch } = remoteMlsConversation;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
catch (error) {
|
|
414
|
-
this.logger.error(`There was an error while handling epoch mismatch in MLS conversation (id: ${qualifiedId.id}):`, error);
|
|
400
|
+
if (await this.hasEpochMismatch(groupId, epoch)) {
|
|
401
|
+
this.logger.log(`Conversation (id ${qualifiedId.id}) was not established or it's epoch number was out of date, joining via external commit`);
|
|
402
|
+
try {
|
|
403
|
+
await this.joinByExternalCommit(qualifiedId);
|
|
404
|
+
onSuccessfulRejoin === null || onSuccessfulRejoin === void 0 ? void 0 : onSuccessfulRejoin();
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
const message = `There was an error while handling epoch mismatch in MLS conversation (id: ${qualifiedId.id}):`;
|
|
408
|
+
this.logger.error(message, error);
|
|
409
|
+
}
|
|
415
410
|
}
|
|
416
411
|
}
|
|
417
412
|
/**
|
|
@@ -422,13 +417,11 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
422
417
|
* @param epoch - epoch of the remote conversation
|
|
423
418
|
* @param onEpochMismatch - callback to be called when epochs do not match
|
|
424
419
|
*/
|
|
425
|
-
async
|
|
420
|
+
async hasEpochMismatch(groupId, epoch) {
|
|
426
421
|
const isEstablished = await this.mlsGroupExistsLocally(groupId);
|
|
427
422
|
const doesEpochMatch = isEstablished && (await this.matchesEpoch(groupId, epoch));
|
|
428
423
|
//if conversation is not established or epoch does not match -> try to rejoin
|
|
429
|
-
|
|
430
|
-
await onEpochMismatch();
|
|
431
|
-
}
|
|
424
|
+
return !isEstablished || !doesEpochMatch;
|
|
432
425
|
}
|
|
433
426
|
/**
|
|
434
427
|
* Get a MLS 1:1-conversation with a given user.
|
|
@@ -481,7 +474,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
481
474
|
if (!conversationId) {
|
|
482
475
|
throw new Error('Qualified conversation id is missing in the event');
|
|
483
476
|
}
|
|
484
|
-
|
|
477
|
+
(0, conversationRejoinQueue_1.queueConversationRejoin)(conversationId.id, () => this.recoverMLSGroupFromEpochMismatch(conversationId, subconv));
|
|
485
478
|
return null;
|
|
486
479
|
}
|
|
487
480
|
throw error;
|
|
@@ -71,10 +71,6 @@ const mockedProteusService = {
|
|
|
71
71
|
sendProteusMessage: () => Promise.resolve({ sentAt: new Date() }),
|
|
72
72
|
};
|
|
73
73
|
describe('ConversationService', () => {
|
|
74
|
-
beforeAll(() => {
|
|
75
|
-
jest.useFakeTimers();
|
|
76
|
-
jest.setSystemTime(new Date(0));
|
|
77
|
-
});
|
|
78
74
|
async function buildConversationService() {
|
|
79
75
|
const client = new api_client_1.APIClient({ urls: api_client_1.APIClient.BACKEND.STAGING });
|
|
80
76
|
jest.spyOn(client.api.conversation, 'postMlsMessage').mockReturnValue(Promise.resolve({
|
|
@@ -386,6 +382,7 @@ describe('ConversationService', () => {
|
|
|
386
382
|
group_id: mockGroupId,
|
|
387
383
|
});
|
|
388
384
|
await conversationService.handleEvent(mockMLSMessageAddEvent);
|
|
385
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
389
386
|
expect(conversationService.joinByExternalCommit).toHaveBeenCalledWith(conversationId);
|
|
390
387
|
expect(conversationService.emit).toHaveBeenCalledWith('MLSConversationRecovered', { conversationId });
|
|
391
388
|
});
|
|
@@ -409,6 +406,7 @@ describe('ConversationService', () => {
|
|
|
409
406
|
};
|
|
410
407
|
jest.spyOn(apiClient.api.conversation, 'getSubconversation').mockResolvedValueOnce(mockedSubconversationResponse);
|
|
411
408
|
await conversationService.handleEvent(mockMLSMessageAddEvent);
|
|
409
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
412
410
|
expect(conversationService.joinByExternalCommit).not.toHaveBeenCalled();
|
|
413
411
|
expect(subconversationService.joinConferenceSubconversation).toHaveBeenCalledWith(conversationId);
|
|
414
412
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AcmeService } from './Connection/AcmeServer';
|
|
1
2
|
import { InitParams, RotateBundle } from './E2EIService.types';
|
|
2
3
|
export declare class E2EIServiceInternal {
|
|
3
4
|
private readonly coreCryptoClient;
|
|
@@ -9,11 +10,10 @@ export declare class E2EIServiceInternal {
|
|
|
9
10
|
private readonly dispatchNewCrlDistributionPoints;
|
|
10
11
|
private static instance;
|
|
11
12
|
private readonly logger;
|
|
12
|
-
private
|
|
13
|
-
private acmeService?;
|
|
14
|
-
private isInitialized;
|
|
13
|
+
private _acmeService?;
|
|
15
14
|
private constructor();
|
|
16
15
|
static getInstance(params?: InitParams): Promise<E2EIServiceInternal>;
|
|
16
|
+
get acmeService(): AcmeService;
|
|
17
17
|
startCertificateProcess(hasActiveCertificate: boolean): Promise<{
|
|
18
18
|
challenge: {
|
|
19
19
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAyD,UAAU,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAcrH,qBAAa,mBAAmB;IAM5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,gCAAgC;IAXnD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAC9E,OAAO,CAAC,YAAY,CAAC,CAAc;IAEnC,OAAO;WAYa,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkClF,IAAI,WAAW,IAAI,WAAW,CAK7B;IAEY,uBAAuB,CAAC,oBAAoB,EAAE,OAAO;;;;;;;;IAOrD,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;YAUlF,YAAY;YAuBZ,IAAI;YASJ,YAAY;YAUZ,eAAe;IAQ7B;;;;;OAKG;YACW,uBAAuB;IA6CrC;;;;;;;OAOG;YACW,sCAAsC;IAiEpD;;;OAGG;YACW,iBAAiB;IAoB/B;;;;;;OAMG;YACW,iBAAiB;IAU/B;;;;;OAKG;IACU,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO;CAQ5F"}
|
|
@@ -45,7 +45,6 @@ class E2EIServiceInternal {
|
|
|
45
45
|
this.keyPackagesAmount = keyPackagesAmount;
|
|
46
46
|
this.dispatchNewCrlDistributionPoints = dispatchNewCrlDistributionPoints;
|
|
47
47
|
this.logger = (0, logdown_1.default)('@wireapp/core/E2EIdentityServiceInternal');
|
|
48
|
-
this.isInitialized = false;
|
|
49
48
|
}
|
|
50
49
|
// ############ Public Functions ############
|
|
51
50
|
static async getInstance(params) {
|
|
@@ -66,11 +65,17 @@ class E2EIServiceInternal {
|
|
|
66
65
|
}
|
|
67
66
|
return E2EIServiceInternal.instance;
|
|
68
67
|
}
|
|
68
|
+
get acmeService() {
|
|
69
|
+
if (!this._acmeService) {
|
|
70
|
+
throw new Error('Error while trying to get AcmeService. E2EIServiceInternal has not been initialized');
|
|
71
|
+
}
|
|
72
|
+
return this._acmeService;
|
|
73
|
+
}
|
|
69
74
|
async startCertificateProcess(hasActiveCertificate) {
|
|
70
75
|
// Step 0: Check if we have a handle in local storage
|
|
71
76
|
// If we don't have a handle, we need to start a new OAuth flow
|
|
72
|
-
await this.initIdentity(hasActiveCertificate);
|
|
73
|
-
return this.startNewOAuthFlow();
|
|
77
|
+
const identity = await this.initIdentity(hasActiveCertificate);
|
|
78
|
+
return this.startNewOAuthFlow(identity);
|
|
74
79
|
}
|
|
75
80
|
async continueCertificateProcess(oAuthIdToken) {
|
|
76
81
|
// If we don't have a handle, we need to start a new OAuth flow
|
|
@@ -84,12 +89,9 @@ class E2EIServiceInternal {
|
|
|
84
89
|
const { user } = E2EIStorage_1.E2EIStorage.get.initialData();
|
|
85
90
|
// How long the issued certificate should be maximal valid
|
|
86
91
|
const ciphersuite = E2EIService_types_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
else {
|
|
91
|
-
this.identity = await this.coreCryptoClient.e2eiNewActivationEnrollment(user.displayName, user.handle, this.certificateTtl, ciphersuite, user.teamId);
|
|
92
|
-
}
|
|
92
|
+
return hasActiveCertificate
|
|
93
|
+
? this.coreCryptoClient.e2eiNewRotateEnrollment(this.certificateTtl, ciphersuite, user.displayName, user.handle, user.teamId)
|
|
94
|
+
: this.coreCryptoClient.e2eiNewActivationEnrollment(user.displayName, user.handle, this.certificateTtl, ciphersuite, user.teamId);
|
|
93
95
|
}
|
|
94
96
|
async init(params) {
|
|
95
97
|
const { user, clientId, discoveryUrl } = params;
|
|
@@ -97,8 +99,7 @@ class E2EIServiceInternal {
|
|
|
97
99
|
this.logger.error('user and clientId are required to initialize E2eIdentityService');
|
|
98
100
|
throw new Error();
|
|
99
101
|
}
|
|
100
|
-
this.
|
|
101
|
-
this.isInitialized = true;
|
|
102
|
+
this._acmeService = new AcmeServer_1.AcmeService(discoveryUrl);
|
|
102
103
|
}
|
|
103
104
|
async getDirectory(identity, connection) {
|
|
104
105
|
const directory = await connection.getDirectory();
|
|
@@ -121,21 +122,18 @@ class E2EIServiceInternal {
|
|
|
121
122
|
*
|
|
122
123
|
* @returns authData
|
|
123
124
|
*/
|
|
124
|
-
async getEnrollmentChallenges() {
|
|
125
|
-
if (!this.isInitialized || !this.identity || !this.acmeService) {
|
|
126
|
-
throw new Error('Error while trying to start OAuth flow. E2eIdentityService is not fully initialized');
|
|
127
|
-
}
|
|
125
|
+
async getEnrollmentChallenges(identity) {
|
|
128
126
|
// Get the directory
|
|
129
|
-
const
|
|
127
|
+
const { acmeService: acmeService } = this;
|
|
128
|
+
const directory = await this.getDirectory(identity, acmeService);
|
|
130
129
|
if (!directory) {
|
|
131
130
|
throw new Error('Error while trying to start OAuth flow. No directory received');
|
|
132
131
|
}
|
|
133
132
|
// Step 1: Get a new nonce from ACME server
|
|
134
|
-
const nonce = await this.getInitialNonce(directory,
|
|
133
|
+
const nonce = await this.getInitialNonce(directory, acmeService);
|
|
135
134
|
if (!nonce) {
|
|
136
135
|
throw new Error('Error while trying to start OAuth flow. No nonce received');
|
|
137
136
|
}
|
|
138
|
-
const { acmeService, identity } = this;
|
|
139
137
|
// Step 2: Create a new account
|
|
140
138
|
const newAccountNonce = await (0, Account_1.createNewAccount)({
|
|
141
139
|
connection: acmeService,
|
|
@@ -170,16 +168,13 @@ class E2EIServiceInternal {
|
|
|
170
168
|
* @param oAuthIdToken
|
|
171
169
|
* @returns RotateBundle
|
|
172
170
|
*/
|
|
173
|
-
async getRotateBundleAndStoreCertificateData(oAuthIdToken, authData) {
|
|
174
|
-
if (!this.isInitialized || !this.identity || !this.acmeService) {
|
|
175
|
-
throw new Error('Error while trying to start OAuth flow. E2eIdentityService is not fully initialized');
|
|
176
|
-
}
|
|
171
|
+
async getRotateBundleAndStoreCertificateData(identity, oAuthIdToken, authData) {
|
|
177
172
|
// Step 7: Do OIDC client challenge
|
|
178
173
|
const oidcData = await (0, OidcChallenge_1.doWireOidcChallenge)({
|
|
179
174
|
oAuthIdToken,
|
|
180
175
|
authData,
|
|
181
176
|
connection: this.acmeService,
|
|
182
|
-
identity
|
|
177
|
+
identity,
|
|
183
178
|
nonce: authData.nonce,
|
|
184
179
|
});
|
|
185
180
|
this.logger.log('received oidcData', oidcData);
|
|
@@ -192,7 +187,7 @@ class E2EIServiceInternal {
|
|
|
192
187
|
authData,
|
|
193
188
|
clientId,
|
|
194
189
|
connection: this.acmeService,
|
|
195
|
-
identity
|
|
190
|
+
identity,
|
|
196
191
|
userDomain: wireUser.domain,
|
|
197
192
|
apiClient: this.apiClient,
|
|
198
193
|
expirySecs: 30,
|
|
@@ -206,7 +201,7 @@ class E2EIServiceInternal {
|
|
|
206
201
|
const orderData = E2EIStorage_1.E2EIStorage.get.orderData();
|
|
207
202
|
const finalizeOrderData = await (0, Order_1.finalizeOrder)({
|
|
208
203
|
connection: this.acmeService,
|
|
209
|
-
identity
|
|
204
|
+
identity,
|
|
210
205
|
nonce: dpopData.nonce,
|
|
211
206
|
orderUrl: orderData.orderUrl,
|
|
212
207
|
});
|
|
@@ -218,13 +213,13 @@ class E2EIServiceInternal {
|
|
|
218
213
|
certificateUrl: finalizeOrderData.certificateUrl,
|
|
219
214
|
nonce: finalizeOrderData.nonce,
|
|
220
215
|
connection: this.acmeService,
|
|
221
|
-
identity
|
|
216
|
+
identity,
|
|
222
217
|
});
|
|
223
218
|
if (!certificate) {
|
|
224
219
|
throw new Error('Error while trying to continue OAuth flow. No certificate received');
|
|
225
220
|
}
|
|
226
221
|
// Step 10: Initialize MLS with the certificate
|
|
227
|
-
const rotateBundle = await this.coreCryptoClient.e2eiRotateAll(
|
|
222
|
+
const rotateBundle = await this.coreCryptoClient.e2eiRotateAll(identity, certificate, this.keyPackagesAmount);
|
|
228
223
|
this.dispatchNewCrlDistributionPoints(rotateBundle);
|
|
229
224
|
return rotateBundle;
|
|
230
225
|
}
|
|
@@ -232,19 +227,16 @@ class E2EIServiceInternal {
|
|
|
232
227
|
* This function starts a new ACME enrollment flow for either a new client
|
|
233
228
|
* or a client that wants to refresh its certificate but has no valid refresh token
|
|
234
229
|
*/
|
|
235
|
-
async startNewOAuthFlow() {
|
|
230
|
+
async startNewOAuthFlow(identity) {
|
|
236
231
|
if (this.e2eiServiceExternal.isEnrollmentInProgress()) {
|
|
237
232
|
throw new Error('Error while trying to start OAuth flow. There is already a flow in progress');
|
|
238
233
|
}
|
|
239
|
-
|
|
240
|
-
throw new Error('Error while trying to start OAuth flow. E2eIdentityService is not fully initialized');
|
|
241
|
-
}
|
|
242
|
-
const { authorization: { oidcChallenge: wireOidcChallenge, keyauth }, } = await this.getEnrollmentChallenges();
|
|
234
|
+
const { authorization: { oidcChallenge: wireOidcChallenge, keyauth }, } = await this.getEnrollmentChallenges(identity);
|
|
243
235
|
if (!wireOidcChallenge || !keyauth) {
|
|
244
236
|
throw new Error('missing wireOidcChallenge or keyauth');
|
|
245
237
|
}
|
|
246
238
|
// stash the identity for later use
|
|
247
|
-
const handle = await this.coreCryptoClient.e2eiEnrollmentStash(
|
|
239
|
+
const handle = await this.coreCryptoClient.e2eiEnrollmentStash(identity);
|
|
248
240
|
// stash the handle in local storage
|
|
249
241
|
E2EIStorage_1.E2EIStorage.store.handle(bazinga64_1.Encoder.toBase64(handle).asString);
|
|
250
242
|
// we need to pass back the aquired wireOidcChallenge to the UI
|
|
@@ -258,15 +250,11 @@ class E2EIServiceInternal {
|
|
|
258
250
|
* @returns RotateBundle | undefined
|
|
259
251
|
*/
|
|
260
252
|
async continueOAuthFlow(oAuthIdToken) {
|
|
261
|
-
// If we have a handle, the user has already started the process to authenticate with the OIDC provider. We can continue the flow.
|
|
262
|
-
if (!this.acmeService) {
|
|
263
|
-
throw new Error('Error while trying to continue OAuth flow. AcmeService is not initialized');
|
|
264
|
-
}
|
|
265
253
|
const handle = E2EIStorage_1.E2EIStorage.get.handle();
|
|
266
254
|
const authData = E2EIStorage_1.E2EIStorage.get.authData();
|
|
267
|
-
|
|
255
|
+
const identity = await this.coreCryptoClient.e2eiEnrollmentStashPop(bazinga64_1.Decoder.fromBase64(handle).asBytes);
|
|
268
256
|
this.logger.log('retrieved identity from stash');
|
|
269
|
-
return this.getRotateBundleAndStoreCertificateData(oAuthIdToken, authData);
|
|
257
|
+
return this.getRotateBundleAndStoreCertificateData(identity, oAuthIdToken, authData);
|
|
270
258
|
}
|
|
271
259
|
/**
|
|
272
260
|
* This function starts a ACME refresh flow for an existing client with a valid refresh token
|
|
@@ -275,14 +263,10 @@ class E2EIServiceInternal {
|
|
|
275
263
|
* @returns
|
|
276
264
|
*/
|
|
277
265
|
async startRefreshCertficateFlow(oAuthIdToken, hasActiveCertificate) {
|
|
278
|
-
// we dont have an oauth flow since we already get the oAuthIdToken from the client
|
|
279
|
-
if (!this.acmeService) {
|
|
280
|
-
throw new Error('Error while trying to continue OAuth flow. AcmeService is not initialized');
|
|
281
|
-
}
|
|
282
266
|
// We need to initialize the identity
|
|
283
|
-
await this.initIdentity(hasActiveCertificate);
|
|
284
|
-
const authData = await this.getEnrollmentChallenges();
|
|
285
|
-
return this.getRotateBundleAndStoreCertificateData(oAuthIdToken, authData);
|
|
267
|
+
const identity = await this.initIdentity(hasActiveCertificate);
|
|
268
|
+
const authData = await this.getEnrollmentChallenges(identity);
|
|
269
|
+
return this.getRotateBundleAndStoreCertificateData(identity, oAuthIdToken, authData);
|
|
286
270
|
}
|
|
287
271
|
}
|
|
288
272
|
exports.E2EIServiceInternal = E2EIServiceInternal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"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AAC;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,mBAAmB,EAAE,mBAAmB,EACxC,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;CA6DnC"}
|
|
@@ -636,67 +636,61 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
636
636
|
* @returns AcmeChallenge if the user is not authenticated, true if the user is authenticated
|
|
637
637
|
*/
|
|
638
638
|
async enrollE2EI(discoveryUrl, e2eiServiceExternal, user, client, nbPrekeys, certificateTtl, oAuthIdToken) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
throw new Error('Not oidc challenge found');
|
|
658
|
-
}
|
|
659
|
-
return { status: 'authentication', authenticationChallenge: data };
|
|
660
|
-
}
|
|
661
|
-
// If we have an OAuth id token, we can continue the certificate process / start a refresh
|
|
662
|
-
const rotateBundle = !hasActiveCertificate
|
|
663
|
-
? // If we are not refreshing the active certificate, we need to continue the certificate process with Oauth
|
|
664
|
-
await instance.continueCertificateProcess(oAuthIdToken)
|
|
665
|
-
: // If we are refreshing the active certificate, can start the refresh process
|
|
666
|
-
await instance.startRefreshCertficateFlow(oAuthIdToken, hasActiveCertificate);
|
|
667
|
-
if (rotateBundle === undefined) {
|
|
668
|
-
throw new Error('Could not get the rotate bundle');
|
|
669
|
-
}
|
|
670
|
-
this.dispatchNewCrlDistributionPoints(rotateBundle);
|
|
671
|
-
// upload the clients public keys
|
|
672
|
-
if (!hasActiveCertificate) {
|
|
673
|
-
// we only upload public keys for the initial certification process. Renewals do not need to upload new public keys
|
|
674
|
-
await this.uploadMLSPublicKeys(client);
|
|
675
|
-
}
|
|
676
|
-
// Remove old key packages
|
|
677
|
-
await this.deleteMLSKeyPackages(client.id, rotateBundle.keyPackageRefsToRemove);
|
|
678
|
-
// Upload new key packages with x509 certificate
|
|
679
|
-
await this.uploadMLSKeyPackages(client.id, rotateBundle.newKeyPackages);
|
|
680
|
-
// Verify that we have enough key packages
|
|
681
|
-
await this.verifyRemoteMLSKeyPackagesAmount(client.id);
|
|
682
|
-
// Update keying material
|
|
683
|
-
for (const [groupId, commitBundle] of rotateBundle.commits) {
|
|
684
|
-
const groupIdAsBytes = bazinga64_1.Converter.hexStringToArrayBufferView(groupId);
|
|
685
|
-
// manual copy of the commit bundle data because of a problem while cloning it
|
|
686
|
-
const newCommitBundle = {
|
|
687
|
-
commit: commitBundle.commit,
|
|
688
|
-
// @ts-ignore
|
|
689
|
-
groupInfo: (commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.group_info) || commitBundle.groupInfo,
|
|
690
|
-
welcome: commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.welcome,
|
|
691
|
-
};
|
|
692
|
-
await this.uploadCommitBundle(groupIdAsBytes, newCommitBundle);
|
|
639
|
+
const hasActiveCertificate = await this.coreCryptoClient.e2eiIsEnabled(this.config.cipherSuite);
|
|
640
|
+
const instance = await E2EIServiceInternal_1.E2EIServiceInternal.getInstance({
|
|
641
|
+
apiClient: this.apiClient,
|
|
642
|
+
coreCryptClient: this.coreCryptoClient,
|
|
643
|
+
e2eiServiceExternal,
|
|
644
|
+
user,
|
|
645
|
+
clientId: client.id,
|
|
646
|
+
discoveryUrl,
|
|
647
|
+
keyPackagesAmount: nbPrekeys,
|
|
648
|
+
dispatchNewCrlDistributionPoints: payload => this.dispatchNewCrlDistributionPoints(payload),
|
|
649
|
+
certificateTtl,
|
|
650
|
+
});
|
|
651
|
+
// If we don't have an OAuth id token, we need to start the certificate process with Oauth
|
|
652
|
+
if (!oAuthIdToken) {
|
|
653
|
+
const data = await instance.startCertificateProcess(hasActiveCertificate);
|
|
654
|
+
const oidcChallenge = data.challenge;
|
|
655
|
+
if (!oidcChallenge) {
|
|
656
|
+
throw new Error('Not oidc challenge found');
|
|
693
657
|
}
|
|
694
|
-
return { status: '
|
|
658
|
+
return { status: 'authentication', authenticationChallenge: data };
|
|
695
659
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
660
|
+
// If we have an OAuth id token, we can continue the certificate process / start a refresh
|
|
661
|
+
const rotateBundle = !hasActiveCertificate
|
|
662
|
+
? // If we are not refreshing the active certificate, we need to continue the certificate process with Oauth
|
|
663
|
+
await instance.continueCertificateProcess(oAuthIdToken)
|
|
664
|
+
: // If we are refreshing the active certificate, can start the refresh process
|
|
665
|
+
await instance.startRefreshCertficateFlow(oAuthIdToken, hasActiveCertificate);
|
|
666
|
+
if (rotateBundle === undefined) {
|
|
667
|
+
throw new Error('Could not get the rotate bundle');
|
|
668
|
+
}
|
|
669
|
+
this.dispatchNewCrlDistributionPoints(rotateBundle);
|
|
670
|
+
// upload the clients public keys
|
|
671
|
+
if (!hasActiveCertificate) {
|
|
672
|
+
// we only upload public keys for the initial certification process. Renewals do not need to upload new public keys
|
|
673
|
+
await this.uploadMLSPublicKeys(client);
|
|
674
|
+
}
|
|
675
|
+
// Remove old key packages
|
|
676
|
+
await this.deleteMLSKeyPackages(client.id, rotateBundle.keyPackageRefsToRemove);
|
|
677
|
+
// Upload new key packages with x509 certificate
|
|
678
|
+
await this.uploadMLSKeyPackages(client.id, rotateBundle.newKeyPackages);
|
|
679
|
+
// Verify that we have enough key packages
|
|
680
|
+
await this.verifyRemoteMLSKeyPackagesAmount(client.id);
|
|
681
|
+
// Update keying material
|
|
682
|
+
for (const [groupId, commitBundle] of rotateBundle.commits) {
|
|
683
|
+
const groupIdAsBytes = bazinga64_1.Converter.hexStringToArrayBufferView(groupId);
|
|
684
|
+
// manual copy of the commit bundle data because of a problem while cloning it
|
|
685
|
+
const newCommitBundle = {
|
|
686
|
+
commit: commitBundle.commit,
|
|
687
|
+
// @ts-ignore
|
|
688
|
+
groupInfo: (commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.group_info) || commitBundle.groupInfo,
|
|
689
|
+
welcome: commitBundle === null || commitBundle === void 0 ? void 0 : commitBundle.welcome,
|
|
690
|
+
};
|
|
691
|
+
await this.uploadCommitBundle(groupIdAsBytes, newCommitBundle);
|
|
699
692
|
}
|
|
693
|
+
return { status: 'successful' };
|
|
700
694
|
}
|
|
701
695
|
}
|
|
702
696
|
exports.MLSService = MLSService;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Task } from '@wireapp/promise-queue';
|
|
2
|
+
/**
|
|
3
|
+
* Will queue a rejoin task for a conversation. This could be useful if conversation is out of sync with current epoch
|
|
4
|
+
* @param groupId the groupId in which we will trigger the rejoin (will be used as ID, in order not to add another rejoin task for the same conversation if it's already in the queue)
|
|
5
|
+
* @param rejoinFn the function to be executed to trigger the rejoin
|
|
6
|
+
*/
|
|
7
|
+
export declare function queueConversationRejoin<T>(groupId: string, rejoinFn: Task<T>): Promise<T | void>;
|
|
8
|
+
export declare function resumeRejoiningMLSConversations(): void;
|
|
9
|
+
export declare function pauseRejoiningMLSConversations(): void;
|
|
10
|
+
//# sourceMappingURL=conversationRejoinQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationRejoinQueue.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/conversationRejoinQueue.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,IAAI,EAAe,MAAM,wBAAwB,CAAC;AAM1D;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAQtG;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD;AAED,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2024 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.pauseRejoiningMLSConversations = exports.resumeRejoiningMLSConversations = exports.queueConversationRejoin = void 0;
|
|
22
|
+
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
23
|
+
const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'mls-conversation-rejoin', paused: false });
|
|
24
|
+
const queuedJobs = new Set();
|
|
25
|
+
/**
|
|
26
|
+
* Will queue a rejoin task for a conversation. This could be useful if conversation is out of sync with current epoch
|
|
27
|
+
* @param groupId the groupId in which we will trigger the rejoin (will be used as ID, in order not to add another rejoin task for the same conversation if it's already in the queue)
|
|
28
|
+
* @param rejoinFn the function to be executed to trigger the rejoin
|
|
29
|
+
*/
|
|
30
|
+
async function queueConversationRejoin(groupId, rejoinFn) {
|
|
31
|
+
if (!queuedJobs.has(groupId)) {
|
|
32
|
+
queuedJobs.add(groupId);
|
|
33
|
+
const result = await sendingQueue.push(rejoinFn);
|
|
34
|
+
queuedJobs.delete(groupId);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.queueConversationRejoin = queueConversationRejoin;
|
|
39
|
+
function resumeRejoiningMLSConversations() {
|
|
40
|
+
sendingQueue.pause(false);
|
|
41
|
+
}
|
|
42
|
+
exports.resumeRejoiningMLSConversations = resumeRejoiningMLSConversations;
|
|
43
|
+
function pauseRejoiningMLSConversations() {
|
|
44
|
+
sendingQueue.pause(true);
|
|
45
|
+
}
|
|
46
|
+
exports.pauseRejoiningMLSConversations = pauseRejoiningMLSConversations;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationRejoinQueue.test.d.ts","sourceRoot":"","sources":["../../../src/messagingProtocols/mls/conversationRejoinQueue.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Wire
|
|
4
|
+
* Copyright (C) 2024 Wire Swiss GmbH
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* This program is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU General Public License
|
|
17
|
+
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const conversationRejoinQueue_1 = require("./conversationRejoinQueue");
|
|
22
|
+
describe('queueConversationRejoin', () => {
|
|
23
|
+
it('should queue conversation rejoin', async () => {
|
|
24
|
+
const rejoinFn = jest.fn(() => Promise.resolve());
|
|
25
|
+
await (0, conversationRejoinQueue_1.queueConversationRejoin)('groupId', rejoinFn);
|
|
26
|
+
expect(rejoinFn).toHaveBeenCalled();
|
|
27
|
+
});
|
|
28
|
+
it('should not queue conversation rejoin if already in queue', async () => {
|
|
29
|
+
const rejoinFn = jest.fn(() => Promise.resolve());
|
|
30
|
+
await Promise.all([1, 2, 3].map(() => (0, conversationRejoinQueue_1.queueConversationRejoin)('groupId', rejoinFn)));
|
|
31
|
+
expect(rejoinFn).toHaveBeenCalledTimes(1);
|
|
32
|
+
});
|
|
33
|
+
it('should run the function a second time if the task has been executed', async () => {
|
|
34
|
+
const rejoinFn = jest.fn(() => Promise.resolve());
|
|
35
|
+
await (0, conversationRejoinQueue_1.queueConversationRejoin)('groupId', rejoinFn);
|
|
36
|
+
await (0, conversationRejoinQueue_1.queueConversationRejoin)('groupId', rejoinFn);
|
|
37
|
+
expect(rejoinFn).toHaveBeenCalledTimes(2);
|
|
38
|
+
});
|
|
39
|
+
});
|
package/package.json
CHANGED