@wireapp/core 44.0.2 → 44.0.3
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/conversation/ConversationService/ConversationService.js +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +2 -4
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +21 -14
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +34 -0
- package/lib/messagingProtocols/mls/types.d.ts +0 -3
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -266,7 +266,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
266
266
|
const { payload, groupId, conversationId } = params;
|
|
267
267
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
268
268
|
// immediately execute pending commits before sending the message
|
|
269
|
-
await this.mlsService.commitPendingProposals(
|
|
269
|
+
await this.mlsService.commitPendingProposals(groupId);
|
|
270
270
|
const encrypted = await this.mlsService.encryptMessage(groupIdBytes, protocol_messaging_1.GenericMessage.encode(payload).finish());
|
|
271
271
|
let response = null;
|
|
272
272
|
let sentAt = '';
|
|
@@ -11,7 +11,7 @@ import { KeyPackageClaimUser } from '../../../conversation';
|
|
|
11
11
|
import { CoreDatabase } from '../../../storage/CoreDB';
|
|
12
12
|
import { RecurringTaskScheduler } from '../../../util/RecurringTaskScheduler';
|
|
13
13
|
import { AcmeChallenge, E2EIServiceExternal, User } from '../E2EIdentityService';
|
|
14
|
-
import { ClientId,
|
|
14
|
+
import { ClientId, HandlePendingProposalsParams } from '../types';
|
|
15
15
|
export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
|
|
16
16
|
type EnrollmentProcessState = {
|
|
17
17
|
status: 'authentication';
|
|
@@ -114,7 +114,6 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
114
114
|
* @param clientIds the list of **qualified** ids of the clients we want to remove from the group
|
|
115
115
|
*/
|
|
116
116
|
removeClientsFromConversation(groupId: string, clientIds: ClientId[]): Promise<PostMlsMessageResponse>;
|
|
117
|
-
private commitProposals;
|
|
118
117
|
/**
|
|
119
118
|
* Will check if mls group exists in corecrypto.
|
|
120
119
|
* @param groupId groupId of the conversation
|
|
@@ -194,9 +193,8 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
194
193
|
* Commit all pending proposals for a given groupId
|
|
195
194
|
*
|
|
196
195
|
* @param groupId groupId of the conversation
|
|
197
|
-
* @param skipDelete if true, do not delete the pending proposals from the database
|
|
198
196
|
*/
|
|
199
|
-
commitPendingProposals(
|
|
197
|
+
commitPendingProposals(groupId: string, shouldRetry?: boolean): Promise<void>;
|
|
200
198
|
/**
|
|
201
199
|
* Get all pending proposals from the database and schedule them
|
|
202
200
|
* Function must only be called once, after application start
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAE1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAW,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,eAAe,EAIf,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAu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M,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAcjF,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE;IASjF;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,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"}
|
|
@@ -321,8 +321,9 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
321
321
|
* @param generateCommit The function that will generate a coreCrypto CommitBundle
|
|
322
322
|
*/
|
|
323
323
|
async processCommitAction(groupId, generateCommit) {
|
|
324
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
324
325
|
return (0, messageSender_1.sendMessage)(async () => {
|
|
325
|
-
await this.
|
|
326
|
+
await this.commitPendingProposals(groupIdStr);
|
|
326
327
|
const commitBundle = await generateCommit();
|
|
327
328
|
return this.uploadCommitBundle(groupId, commitBundle, { regenerateCommitBundle: generateCommit });
|
|
328
329
|
});
|
|
@@ -386,10 +387,6 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
386
387
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
387
388
|
return this.processCommitAction(groupIdBytes, () => this.coreCryptoClient.removeClientsFromConversation(groupIdBytes, clientIds.map(id => this.textEncoder.encode(id))));
|
|
388
389
|
}
|
|
389
|
-
async commitProposals(groupId) {
|
|
390
|
-
const commitBundle = await this.coreCryptoClient.commitPendingProposals(groupId);
|
|
391
|
-
return commitBundle ? void (await this.uploadCommitBundle(groupId, commitBundle)) : undefined;
|
|
392
|
-
}
|
|
393
390
|
/**
|
|
394
391
|
* Will check if mls group exists in corecrypto.
|
|
395
392
|
* @param groupId groupId of the conversation
|
|
@@ -552,13 +549,13 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
552
549
|
await this.schedulePendingProposalsTask(groupId, firingDate);
|
|
553
550
|
}
|
|
554
551
|
else {
|
|
555
|
-
await this.commitPendingProposals(
|
|
552
|
+
await this.commitPendingProposals(groupId);
|
|
556
553
|
}
|
|
557
554
|
}
|
|
558
555
|
async schedulePendingProposalsTask(groupId, firingDate) {
|
|
559
556
|
await this.coreDatabase.put('pendingProposals', { groupId, firingDate }, groupId);
|
|
560
557
|
TaskScheduler_1.TaskScheduler.addTask({
|
|
561
|
-
task: () => this.commitPendingProposals(
|
|
558
|
+
task: () => this.commitPendingProposals(groupId),
|
|
562
559
|
firingDate,
|
|
563
560
|
key: this.createPendingProposalsTaskKey(groupId),
|
|
564
561
|
});
|
|
@@ -574,17 +571,27 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
574
571
|
* Commit all pending proposals for a given groupId
|
|
575
572
|
*
|
|
576
573
|
* @param groupId groupId of the conversation
|
|
577
|
-
* @param skipDelete if true, do not delete the pending proposals from the database
|
|
578
574
|
*/
|
|
579
|
-
async commitPendingProposals(
|
|
575
|
+
async commitPendingProposals(groupId, shouldRetry = true) {
|
|
576
|
+
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
580
577
|
try {
|
|
581
|
-
await this.
|
|
582
|
-
if (
|
|
583
|
-
await this.
|
|
578
|
+
const commitBundle = await this.coreCryptoClient.commitPendingProposals(groupIdBytes);
|
|
579
|
+
if (commitBundle) {
|
|
580
|
+
await this.uploadCommitBundle(groupIdBytes, commitBundle);
|
|
584
581
|
}
|
|
582
|
+
await this.cancelPendingProposalsTask(groupId);
|
|
585
583
|
}
|
|
586
584
|
catch (error) {
|
|
587
|
-
|
|
585
|
+
if (!shouldRetry) {
|
|
586
|
+
throw error;
|
|
587
|
+
}
|
|
588
|
+
this.logger.warn('Failed to commit proposals, clearing the pending commit and retrying', error);
|
|
589
|
+
// If we failed to commit the proposals, we need to clear the pending commit and retry
|
|
590
|
+
// this is to avoid a situation where we are stuck with pending proposals that we can't commit.
|
|
591
|
+
// If there's nothing to clear the methods might throw an error, which we can ignore.
|
|
592
|
+
await this.coreCryptoClient.clearPendingCommit(groupIdBytes).catch(() => undefined);
|
|
593
|
+
await this.coreCryptoClient.clearPendingGroupFromExternalCommit(groupIdBytes).catch(() => undefined);
|
|
594
|
+
return this.commitPendingProposals(groupId, false);
|
|
588
595
|
}
|
|
589
596
|
}
|
|
590
597
|
/**
|
|
@@ -597,7 +604,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
597
604
|
const pendingProposals = await this.coreDatabase.getAll('pendingProposals');
|
|
598
605
|
if (pendingProposals.length > 0) {
|
|
599
606
|
pendingProposals.forEach(({ groupId, firingDate }) => TaskScheduler_1.TaskScheduler.addTask({
|
|
600
|
-
task: () => this.commitPendingProposals(
|
|
607
|
+
task: () => this.commitPendingProposals(groupId),
|
|
601
608
|
firingDate,
|
|
602
609
|
key: this.createPendingProposalsTaskKey(groupId),
|
|
603
610
|
}));
|
|
@@ -48,6 +48,9 @@ const createMLSService = async () => {
|
|
|
48
48
|
commitPendingProposals: jest.fn(),
|
|
49
49
|
registerCallbacks: jest.fn(),
|
|
50
50
|
e2eiIsEnabled: jest.fn(() => false),
|
|
51
|
+
clearPendingGroupFromExternalCommit: async () => { },
|
|
52
|
+
clearPendingCommit: async () => { },
|
|
53
|
+
commitAccepted: jest.fn(),
|
|
51
54
|
};
|
|
52
55
|
const mockedDb = await (0, CoreDB_1.openDB)('core-test-db');
|
|
53
56
|
const recurringTaskScheduler = new RecurringTaskScheduler_1.RecurringTaskScheduler({
|
|
@@ -193,6 +196,37 @@ describe('MLSService', () => {
|
|
|
193
196
|
expect(coreCrypto.wipeConversation).not.toHaveBeenCalled();
|
|
194
197
|
});
|
|
195
198
|
});
|
|
199
|
+
describe('commitPendingProposals', () => {
|
|
200
|
+
it('commits pending proposals and uploads received commit bundle to backend', async () => {
|
|
201
|
+
const [mlsService, { coreCrypto: mockCoreCrypto, apiClient }] = await createMLSService();
|
|
202
|
+
const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
|
|
203
|
+
jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockResolvedValueOnce({
|
|
204
|
+
commit: new Uint8Array(),
|
|
205
|
+
groupInfo: { payload: new Uint8Array() },
|
|
206
|
+
});
|
|
207
|
+
jest.spyOn(apiClient.api.conversation, 'postMlsCommitBundle').mockResolvedValueOnce({ events: [], time: '' });
|
|
208
|
+
await mlsService.commitPendingProposals(mockGroupId);
|
|
209
|
+
expect(mockCoreCrypto.commitPendingProposals).toHaveBeenCalled();
|
|
210
|
+
expect(apiClient.api.conversation.postMlsCommitBundle).toHaveBeenCalled();
|
|
211
|
+
});
|
|
212
|
+
it('clears pending commit and retries when failed committing pending proposals', async () => {
|
|
213
|
+
const [mlsService, { coreCrypto: mockCoreCrypto, apiClient }] = await createMLSService();
|
|
214
|
+
const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
|
|
215
|
+
jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockRejectedValueOnce(new Error('mocked error'));
|
|
216
|
+
jest.spyOn(mockCoreCrypto, 'commitPendingProposals').mockResolvedValueOnce({
|
|
217
|
+
commit: new Uint8Array(),
|
|
218
|
+
groupInfo: { payload: new Uint8Array() },
|
|
219
|
+
});
|
|
220
|
+
jest.spyOn(apiClient.api.conversation, 'postMlsCommitBundle').mockResolvedValueOnce({ events: [], time: '' });
|
|
221
|
+
jest.spyOn(mockCoreCrypto, 'clearPendingCommit');
|
|
222
|
+
jest.spyOn(mockCoreCrypto, 'clearPendingGroupFromExternalCommit');
|
|
223
|
+
await mlsService.commitPendingProposals(mockGroupId);
|
|
224
|
+
expect(mockCoreCrypto.clearPendingCommit).toHaveBeenCalledTimes(1);
|
|
225
|
+
expect(mockCoreCrypto.clearPendingGroupFromExternalCommit).toHaveBeenCalledTimes(1);
|
|
226
|
+
expect(mockCoreCrypto.commitPendingProposals).toHaveBeenCalledTimes(2);
|
|
227
|
+
expect(apiClient.api.conversation.postMlsCommitBundle).toHaveBeenCalledTimes(1);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
196
230
|
describe('handleMLSMessageAddEvent', () => {
|
|
197
231
|
it('decrypts a message and emits new epoch event if epoch has changed', async () => {
|
|
198
232
|
const [mlsService, { coreCrypto: mockCoreCrypto }] = await createMLSService();
|
|
@@ -21,9 +21,6 @@ export type HandlePendingProposalsParams = {
|
|
|
21
21
|
delayInMs: number;
|
|
22
22
|
eventTime: string;
|
|
23
23
|
} & CommonMLS;
|
|
24
|
-
export type CommitPendingProposalsParams = {
|
|
25
|
-
skipDelete?: boolean;
|
|
26
|
-
} & CommonMLS;
|
|
27
24
|
export interface CoreCryptoConfig {
|
|
28
25
|
/**
|
|
29
26
|
* path on the public server to the core crypto wasm file.
|
|
@@ -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,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,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CAAC;CACnB,GAAG,SAAS,CAAC;AAEd,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACjC"}
|
package/package.json
CHANGED