@wireapp/core 46.29.1 → 46.29.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/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +1 -5
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +1 -0
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +1 -6
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +0 -65
|
@@ -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,
|
|
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,CAgChE,CAAC"}
|
|
@@ -30,7 +30,7 @@ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
|
|
|
30
30
|
// If the message is not decrypted, we return null
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
const { message, commitDelay,
|
|
33
|
+
const { message, commitDelay, senderClientId: encodedSenderClientId } = decryptedMessage;
|
|
34
34
|
if (encodedSenderClientId) {
|
|
35
35
|
const decoder = new TextDecoder();
|
|
36
36
|
const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId));
|
|
@@ -46,10 +46,6 @@ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
|
|
|
46
46
|
eventTime: event.time,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
if (hasEpochChanged) {
|
|
50
|
-
const newEpoch = await mlsService.getEpoch(groupId);
|
|
51
|
-
mlsService.emit(MLSService_1.MLSServiceEvents.NEW_EPOCH, { groupId, epoch: newEpoch });
|
|
52
|
-
}
|
|
53
49
|
return message ? { event, decryptedData: protocol_messaging_1.GenericMessage.decode(message) } : null;
|
|
54
50
|
};
|
|
55
51
|
exports.handleMLSMessageAdd = handleMLSMessageAdd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAC7G,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,8BAA8B,EAAE,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1G,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC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AC,EAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;YAWnF,4BAA4B;YAU5B,0BAA0B;IAKxC,OAAO,CAAC,6BAA6B;IAIrC;;;;OAIG;IACU,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBvF;;;;OAIG;IACU,+BAA+B;IAiB5C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAY9F,wBAAwB,CACnC,KAAK,EAAE,8BAA8B,EACrC,yBAAyB,EAAE,CACzB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,CAAC,EAAE,kBAAkB,KACnC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAgBrB,4BAA4B,CAAC,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM;IAc9F;;;;;;;;OAQG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,gBAAgB,EAC/B,mBAAmB,EAAE,2BAA2B,GAC/C,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
|
@@ -75,6 +75,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
75
75
|
const epochObserver = {
|
|
76
76
|
epochChanged: async (groupId, epoch) => {
|
|
77
77
|
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
78
|
+
this.logger.info(`Epoch changed for group ${groupIdStr}, new epoch: ${epoch}`);
|
|
78
79
|
this.emit(MLSServiceEvents.NEW_EPOCH, { epoch, groupId: groupIdStr });
|
|
79
80
|
},
|
|
80
81
|
};
|
|
@@ -400,7 +400,7 @@ describe('MLSService', () => {
|
|
|
400
400
|
});
|
|
401
401
|
});
|
|
402
402
|
describe('handleMLSMessageAddEvent', () => {
|
|
403
|
-
it('decrypts a message
|
|
403
|
+
it('decrypts a message', async () => {
|
|
404
404
|
const [mlsService, { transactionContext, coreCrypto }] = await createMLSService();
|
|
405
405
|
const mockGroupId = 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=';
|
|
406
406
|
const mockedNewEpoch = 3;
|
|
@@ -411,7 +411,6 @@ describe('MLSService', () => {
|
|
|
411
411
|
};
|
|
412
412
|
jest.spyOn(transactionContext, 'decryptMessage').mockResolvedValueOnce(mockedDecryptoedMessage);
|
|
413
413
|
jest.spyOn(coreCrypto, 'conversationEpoch').mockResolvedValueOnce(mockedNewEpoch);
|
|
414
|
-
jest.spyOn(mlsService, 'emit').mockImplementation(jest.fn());
|
|
415
414
|
const mockedMLSWelcomeEvent = {
|
|
416
415
|
type: event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD,
|
|
417
416
|
senderClientId: '',
|
|
@@ -422,10 +421,6 @@ describe('MLSService', () => {
|
|
|
422
421
|
};
|
|
423
422
|
await mlsService.handleMLSMessageAddEvent(mockedMLSWelcomeEvent, getGroupIdFromConversationId);
|
|
424
423
|
expect(transactionContext.decryptMessage).toHaveBeenCalled();
|
|
425
|
-
expect(mlsService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
|
|
426
|
-
epoch: mockedNewEpoch,
|
|
427
|
-
groupId: mockGroupId,
|
|
428
|
-
});
|
|
429
424
|
});
|
|
430
425
|
it('handles pending propoals with a delay after decrypting a message', async () => {
|
|
431
426
|
const [mlsService, { transactionContext, coreCrypto }] = await createMLSService();
|
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.
|
|
14
|
+
"@wireapp/api-client": "^27.66.0",
|
|
15
15
|
"@wireapp/commons": "^5.4.2",
|
|
16
16
|
"@wireapp/core-crypto": "7.0.1",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "46.29.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "46.29.3",
|
|
65
|
+
"gitHead": "e587e16017137049033de64a688d597320bf9021"
|
|
66
66
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageAdd.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 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 event_1 = require("@wireapp/api-client/lib/event");
|
|
22
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
|
-
const messageAdd_1 = require("./messageAdd");
|
|
24
|
-
const MLSService_1 = require("../../../MLSService");
|
|
25
|
-
const mockedMLSService = {
|
|
26
|
-
getGroupIdFromConversationId: jest.fn(),
|
|
27
|
-
decryptMessage: jest.fn(),
|
|
28
|
-
handlePendingProposals: jest.fn(),
|
|
29
|
-
getEpoch: jest.fn(),
|
|
30
|
-
emit: jest.fn(),
|
|
31
|
-
};
|
|
32
|
-
const createMLSMessageAddEventMock = (conversationId) => ({
|
|
33
|
-
data: '',
|
|
34
|
-
conversation: conversationId.id,
|
|
35
|
-
qualified_conversation: conversationId,
|
|
36
|
-
from: '',
|
|
37
|
-
senderClientId: '',
|
|
38
|
-
type: event_1.CONVERSATION_EVENT.MLS_MESSAGE_ADD,
|
|
39
|
-
time: '2023-08-21T06:47:43.387Z',
|
|
40
|
-
});
|
|
41
|
-
const createMockedMessage = () => {
|
|
42
|
-
return protocol_messaging_1.GenericMessage.encode(protocol_messaging_1.GenericMessage.create({
|
|
43
|
-
messageId: '2d7cb6d8-118f-11e8-b642-0ed5f89f718b',
|
|
44
|
-
text: protocol_messaging_1.Text.create({ content: 'Hello, World!' }),
|
|
45
|
-
})).finish();
|
|
46
|
-
};
|
|
47
|
-
describe('handleMLSMessageAdd', () => {
|
|
48
|
-
it('emits "newEpoch" event if incoming message has advanced epoch number', async () => {
|
|
49
|
-
const event = createMLSMessageAddEventMock({ id: 'conversationId', domain: 'staging.zinfra.io' });
|
|
50
|
-
const mockGroupId = 'AAEAAH87aajaQ011i+rNLmwpy0sAZGl5YS53aXJlLmxpbms=';
|
|
51
|
-
const message = createMockedMessage();
|
|
52
|
-
jest.spyOn(mockedMLSService, 'decryptMessage').mockResolvedValueOnce({
|
|
53
|
-
message,
|
|
54
|
-
hasEpochChanged: true,
|
|
55
|
-
isActive: true,
|
|
56
|
-
});
|
|
57
|
-
const mockedNewEpoch = 5;
|
|
58
|
-
jest.spyOn(mockedMLSService, 'getEpoch').mockResolvedValueOnce(mockedNewEpoch);
|
|
59
|
-
await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
|
|
60
|
-
expect(mockedMLSService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
|
|
61
|
-
groupId: mockGroupId,
|
|
62
|
-
epoch: mockedNewEpoch,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|