@wireapp/core 46.35.4 → 46.36.0
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.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +2 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +6 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +2 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +3 -2
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +4 -3
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +33 -21
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +15 -12
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +2 -2
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +4 -4
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +0 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +0 -4
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +0 -13
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +0 -4
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +0 -5
- package/package.json +3 -3
|
@@ -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,EAEnB,eAAe,EACf,kBAAkB,EAGnB,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;AAGvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,iBAAiB,EAAC,MAAM,kBAAkB,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,EAEnB,eAAe,EACf,kBAAkB,EAGnB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,YAAY,EAIZ,4BAA4B,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,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MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,gCAAgC;IAe7C;;;OAGG;YACW,kCAAkC;IA2BhD;;;OAGG;YACW,+BAA+B;IAqB7C;;;;;;;OAOG;YACW,gBAAgB;IAQ9B;;;OAGG;IACG,sBAAsB,CAAC,MAAM,EAAE,WAAW;IAShD;;;;;;;OAOG;IACH,SAAgB,4BAA4B,YACjC,MAAM,YACL;QAAC,IAAI,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,eAChC,WAAW,4BAEvB,OAAO,CAAC,eAAe,CAAC,CAwDzB;IAEF;;;;;;;;OAQG;IACU,uBAAuB,CAAC,EACnC,OAAO,EACP,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,WAAW,CAAC;QACxB,cAAc,EAAE,WAAW,EAAE,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BH,wBAAwB;YAsBxB,gCAAgC;YAyBhC,4BAA4B;YA4B5B,wBAAwB;YAIxB,yBAAyB;IAKvC;;;;OAIG;IACU,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAoB3E"}
|
|
@@ -25,6 +25,7 @@ const event_1 = require("@wireapp/api-client/lib/event");
|
|
|
25
25
|
const http_1 = require("@wireapp/api-client/lib/http");
|
|
26
26
|
const bazinga64_1 = require("bazinga64");
|
|
27
27
|
const commons_1 = require("@wireapp/commons");
|
|
28
|
+
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
28
29
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
29
30
|
const conversation_2 = require("../../conversation/");
|
|
30
31
|
const mls_1 = require("../../messagingProtocols/mls");
|
|
@@ -228,7 +229,7 @@ class ConversationService extends commons_1.TypedEventEmitter {
|
|
|
228
229
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
229
230
|
// immediately execute pending commits before sending the message
|
|
230
231
|
await this.mlsService.commitPendingProposals(groupId);
|
|
231
|
-
const encrypted = await this.mlsService.encryptMessage(groupIdBytes, protocol_messaging_1.GenericMessage.encode(payload).finish());
|
|
232
|
+
const encrypted = await this.mlsService.encryptMessage(new core_crypto_1.ConversationId(groupIdBytes), protocol_messaging_1.GenericMessage.encode(payload).finish());
|
|
232
233
|
let response = null;
|
|
233
234
|
let sentAt = '';
|
|
234
235
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"E2EIServiceExternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAuB,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAmB,MAAM,eAAe,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,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AAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAiBf,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;YAKvC,4BAA4B;IAO1C;;;;;OAKG;IACU,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,OAAO,KAAK,WAAW,GAKtB;YAEa,+BAA+B;IAO7C;;;;;;;;;;;;OAYG;YACW,0BAA0B;IA2BxC,OAAO,CAAC,4BAA4B;YAStB,+BAA+B;YAQ/B,uBAAuB;YAKvB,0BAA0B;YAI1B,4BAA4B;YAO5B,WAAW;YAoBX,8BAA8B;CAM7C"}
|
|
@@ -57,7 +57,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
57
57
|
return this.enrollmentStorage.deletePendingEnrollmentData();
|
|
58
58
|
}
|
|
59
59
|
async getConversationState(conversationId) {
|
|
60
|
-
return this.coreCryptoClient.transaction(cx => cx.e2eiConversationState(conversationId));
|
|
60
|
+
return this.coreCryptoClient.transaction(cx => cx.e2eiConversationState(new core_crypto_1.ConversationId(conversationId)));
|
|
61
61
|
}
|
|
62
62
|
isE2EIEnabled() {
|
|
63
63
|
return this.coreCryptoClient.e2eiIsEnabled(this.mlsService.config.defaultCiphersuite);
|
|
@@ -84,10 +84,10 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
84
84
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
85
85
|
const textDecoder = new TextDecoder();
|
|
86
86
|
// we get all the devices that have an identity (either valid, expired or revoked)
|
|
87
|
-
const userIdentities = await this.coreCryptoClient.getUserIdentities(groupIdBytes, userIds.map(userId => userId.id));
|
|
87
|
+
const userIdentities = await this.coreCryptoClient.getUserIdentities(new core_crypto_1.ConversationId(groupIdBytes), userIds.map(userId => userId.id));
|
|
88
88
|
// We get all the devices in the conversation (in order to get devices that have no identity)
|
|
89
|
-
const allUsersMLSDevices = (await this.coreCryptoClient.getClientIds(groupIdBytes))
|
|
90
|
-
.map(id => textDecoder.decode(id))
|
|
89
|
+
const allUsersMLSDevices = (await this.coreCryptoClient.getClientIds(new core_crypto_1.ConversationId(groupIdBytes)))
|
|
90
|
+
.map(id => textDecoder.decode(id.copyBytes()))
|
|
91
91
|
.map(fullyQualifiedId => (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(fullyQualifiedId));
|
|
92
92
|
const mappedUserIdentities = new Map();
|
|
93
93
|
for (const userId of userIds) {
|
|
@@ -123,8 +123,8 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
123
123
|
}
|
|
124
124
|
// Returns devices e2ei certificates
|
|
125
125
|
async getDevicesIdentities(groupId, userClientsMap) {
|
|
126
|
-
const clientIds = Object.entries(userClientsMap).map(([clientId, userId]) => (0, Helper_1.getE2EIClientId)(clientId, userId.id, userId.domain).asBytes);
|
|
127
|
-
const deviceIdentities = await this.coreCryptoClient.getDeviceIdentities(bazinga64_1.Decoder.fromBase64(groupId).asBytes, clientIds);
|
|
126
|
+
const clientIds = Object.entries(userClientsMap).map(([clientId, userId]) => new core_crypto_1.ClientId((0, Helper_1.getE2EIClientId)(clientId, userId.id, userId.domain).asBytes));
|
|
127
|
+
const deviceIdentities = await this.coreCryptoClient.getDeviceIdentities(new core_crypto_1.ConversationId(bazinga64_1.Decoder.fromBase64(groupId).asBytes), clientIds);
|
|
128
128
|
return deviceIdentities.map(identity => ({
|
|
129
129
|
...identity,
|
|
130
130
|
deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client,
|
|
@@ -116,7 +116,7 @@ describe('E2EIServiceExternal', () => {
|
|
|
116
116
|
`${user1.id}:74a50c1f4352b41f@elna.wire.link`,
|
|
117
117
|
`${user2.id}:452cb4c65f0369a8@elna.wire.link`,
|
|
118
118
|
];
|
|
119
|
-
coreCrypto.getClientIds.mockResolvedValue(allClients.map(clientId => encoder.encode(clientId)));
|
|
119
|
+
coreCrypto.getClientIds.mockResolvedValue(allClients.map(clientId => new core_crypto_1.ClientId(encoder.encode(clientId))));
|
|
120
120
|
jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(true);
|
|
121
121
|
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
122
122
|
expect(userIdentities?.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK9C,OAAO,EAAgB,WAAW,EAAE,UAAU,EAAiC,MAAM,qBAAqB,CAAC;AAS3G,OAAO,EAAqB,WAAW,EAAiC,MAAM,8BAA8B,CAAC;AAE7G,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG,CAAC,cAAc,CAAC,EAAE;IAAC,SAAS,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEnH,MAAM,MAAM,2BAA2B,GAAG,MAAM,OAAO,CACrD;IACE,QAAQ,EAAE,MAAM,CAAC;CAClB,EAAE,CACJ,CAAC;AACF,qBAAa,mBAAmB;IAO5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAX9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoE;IAC3F,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAiD;gBAGxE,MAAM,EAAE,YAAY,EACH,gBAAgB,EAAE,UAAU,EAC5B,SAAS,EAAE,SAAS;IACrC,wDAAwD;IACvC,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,EACzB,WAAW,EAAE,WAAW;IAO3C;;;;OAIG;IACU,mBAAmB,CAC9B,aAAa,EAAE,gBAAgB,EAC/B,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,2BAA2B,EAChD,WAAW,EAAE,WAAW;;;;YAoCZ,6BAA6B;YAa7B,YAAY;YAYZ,YAAY;YAUZ,eAAe;IAQ7B;;;;;OAKG;YACW,uBAAuB;IAyCrC;;;;;;;OAOG;YACW,cAAc;CAoF7B"}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.E2EIServiceInternal = void 0;
|
|
22
22
|
const commons_1 = require("@wireapp/commons");
|
|
23
|
+
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
23
24
|
const AcmeServer_1 = require("./Connection/AcmeServer");
|
|
24
25
|
const E2EIService_types_1 = require("./E2EIService.types");
|
|
25
26
|
const Helper_1 = require("./Helper");
|
|
@@ -217,7 +218,7 @@ class E2EIServiceInternal {
|
|
|
217
218
|
for (const conversation of conversations) {
|
|
218
219
|
if (Boolean(conversation.group_id?.length)) {
|
|
219
220
|
const idAsBytes = new TextEncoder().encode(conversation.group_id);
|
|
220
|
-
await cx.e2eiRotate(idAsBytes);
|
|
221
|
+
await cx.e2eiRotate(new core_crypto_1.ConversationId(idAsBytes));
|
|
221
222
|
}
|
|
222
223
|
else {
|
|
223
224
|
this.logger.error('No group id found in conversation');
|
|
@@ -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;
|
|
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;AAS7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAuB,MAAM,gCAAgC,CAAC;AAIhF,UAAU,yBAAyB;IACjC,KAAK,EAAE,8BAA8B,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,oCAI7B,yBAAyB,KAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAoChE,CAAC"}
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
exports.handleMLSMessageAdd = void 0;
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
23
|
const commons_1 = require("@wireapp/commons");
|
|
24
|
+
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
24
25
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
25
26
|
const IncomingProposalsQueue_1 = require("./IncomingProposalsQueue");
|
|
26
27
|
const MLSService_1 = require("../../../MLSService/MLSService");
|
|
@@ -28,7 +29,7 @@ const logger = commons_1.LogFactory.getLogger('@wireapp/core/mls/messageAdd');
|
|
|
28
29
|
const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
|
|
29
30
|
const encryptedData = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
|
|
30
31
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
31
|
-
const decryptedMessage = await mlsService.decryptMessage(groupIdBytes, encryptedData);
|
|
32
|
+
const decryptedMessage = await mlsService.decryptMessage(new core_crypto_1.ConversationId(groupIdBytes), encryptedData);
|
|
32
33
|
if (!decryptedMessage) {
|
|
33
34
|
// If the message is not decrypted, we return null
|
|
34
35
|
return null;
|
|
@@ -36,7 +37,7 @@ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
|
|
|
36
37
|
const { message, commitDelay, senderClientId: encodedSenderClientId } = decryptedMessage;
|
|
37
38
|
if (encodedSenderClientId) {
|
|
38
39
|
const decoder = new TextDecoder();
|
|
39
|
-
const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId));
|
|
40
|
+
const senderClientId = decoder.decode((0, MLSService_1.optionalToUint8Array)(encodedSenderClientId.copyBytes()));
|
|
40
41
|
event.senderClientId = senderClientId;
|
|
41
42
|
}
|
|
42
43
|
// Check if the message includes proposals
|
|
@@ -25,7 +25,7 @@ const handleMLSWelcomeMessage = async ({ mlsService, event, }) => {
|
|
|
25
25
|
const data = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
|
|
26
26
|
// We extract the groupId from the welcome message and let coreCrypto store this group
|
|
27
27
|
const newGroupId = await mlsService.processWelcomeMessage(data);
|
|
28
|
-
const groupIdStr = bazinga64_1.Encoder.toBase64(newGroupId).asString;
|
|
28
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(newGroupId.copyBytes()).asString;
|
|
29
29
|
// The groupId can then be sent back to the consumer
|
|
30
30
|
// After we were added to the group we need to schedule a periodic key material renewal
|
|
31
31
|
await mlsService.scheduleKeyMaterialRenewal(groupIdStr);
|
package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
22
|
+
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
22
23
|
const welcomeMessage_1 = require("./welcomeMessage");
|
|
23
24
|
const MLSService_1 = require("../../../MLSService");
|
|
24
25
|
jest.mock('bazinga64', () => ({
|
|
@@ -40,7 +41,7 @@ const mockParams = {
|
|
|
40
41
|
},
|
|
41
42
|
source: {},
|
|
42
43
|
mlsService: {
|
|
43
|
-
processWelcomeMessage: jest.fn().mockResolvedValue(
|
|
44
|
+
processWelcomeMessage: jest.fn().mockResolvedValue(new core_crypto_1.Welcome(Uint8Array.from([1, 2, 3]))),
|
|
44
45
|
scheduleKeyMaterialRenewal: jest.fn(),
|
|
45
46
|
getEpoch: jest.fn(),
|
|
46
47
|
emit: jest.fn(),
|
|
@@ -62,13 +63,13 @@ describe('MLS welcomeMessage eventHandler', () => {
|
|
|
62
63
|
it('returns a eventHandlerResult', async () => {
|
|
63
64
|
const eventHandlerResult = await (0, welcomeMessage_1.handleMLSWelcomeMessage)(mockParams);
|
|
64
65
|
expect(eventHandlerResult).toBeDefined();
|
|
65
|
-
expect(eventHandlerResult.event).toEqual({ data:
|
|
66
|
+
expect(eventHandlerResult.event).toEqual({ data: Uint8Array.from([1, 2, 3]), type: 'conversation.mls-welcome' });
|
|
66
67
|
});
|
|
67
68
|
it('emits new epoch event after processing a welcome message', async () => {
|
|
68
69
|
jest.spyOn(mockParams.mlsService, 'getEpoch').mockResolvedValue(1);
|
|
69
70
|
await (0, welcomeMessage_1.handleMLSWelcomeMessage)(mockParams);
|
|
70
71
|
expect(mockParams.mlsService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
|
|
71
|
-
groupId:
|
|
72
|
+
groupId: Uint8Array.from([1, 2, 3]),
|
|
72
73
|
epoch: 1,
|
|
73
74
|
});
|
|
74
75
|
});
|
|
@@ -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;AAC9C,OAAO,EAAuB,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,WAAW,
|
|
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;AAC9C,OAAO,EAAuB,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,WAAW,EAIX,cAAc,EACd,UAAU,EAEV,gBAAgB,EAOjB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,eAAe,EAA0B,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAC,IAAI,EAAC,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAEL,2BAA2B,EAC3B,gBAAgB,EACjB,MAA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AE,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"}
|
|
@@ -70,10 +70,13 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
70
70
|
sendMessage: async () => {
|
|
71
71
|
return 'success';
|
|
72
72
|
},
|
|
73
|
+
prepareForTransport: async () => {
|
|
74
|
+
throw new Error('Method not implemented.');
|
|
75
|
+
},
|
|
73
76
|
};
|
|
74
77
|
const epochObserver = {
|
|
75
78
|
epochChanged: async (groupId, epoch) => {
|
|
76
|
-
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId).asString;
|
|
79
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(groupId.copyBytes()).asString;
|
|
77
80
|
this.logger.info(`Epoch changed for group ${groupIdStr}, new epoch: ${epoch}`);
|
|
78
81
|
this.emit(MLSServiceEvents.NEW_EPOCH, { epoch, groupId: groupIdStr });
|
|
79
82
|
},
|
|
@@ -109,7 +112,10 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
109
112
|
...defaultConfig,
|
|
110
113
|
...filteredMLSConfig,
|
|
111
114
|
};
|
|
112
|
-
await this.coreCryptoClient.transaction(cx =>
|
|
115
|
+
await this.coreCryptoClient.transaction(cx => {
|
|
116
|
+
const clientId = new core_crypto_1.ClientId((0, MLSId_1.generateMLSDeviceId)(userId, client.id));
|
|
117
|
+
return cx.mlsInit(clientId, this.config.ciphersuites, this.config.nbKeyPackages);
|
|
118
|
+
});
|
|
113
119
|
try {
|
|
114
120
|
const ccClientSignature = await this.getCCClientSignatureString();
|
|
115
121
|
const mlsDeviceStatus = (0, Helper_1.getMLSDeviceStatus)(client, this.config.defaultCiphersuite, ccClientSignature);
|
|
@@ -152,7 +158,11 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
152
158
|
: core_crypto_1.CredentialType.Basic;
|
|
153
159
|
}
|
|
154
160
|
_uploadCommitBundle = async ({ commit, groupInfo, welcome, }) => {
|
|
155
|
-
const bundlePayload = new Uint8Array([
|
|
161
|
+
const bundlePayload = new Uint8Array([
|
|
162
|
+
...commit,
|
|
163
|
+
...groupInfo.payload.copyBytes(),
|
|
164
|
+
...(welcome?.copyBytes() || []),
|
|
165
|
+
]);
|
|
156
166
|
try {
|
|
157
167
|
const response = await this.apiClient.api.conversation.postMlsCommitBundle(bundlePayload);
|
|
158
168
|
if (response.failed_to_send) {
|
|
@@ -182,7 +192,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
182
192
|
if (keyPackages.length < 1) {
|
|
183
193
|
throw new Error('Empty list of keys provided to addUsersToExistingConversation');
|
|
184
194
|
}
|
|
185
|
-
const crlNewDistributionPoints = await this.coreCryptoClient.transaction(cx => cx.addClientsToConversation(groupIdBytes, keyPackages));
|
|
195
|
+
const crlNewDistributionPoints = await this.coreCryptoClient.transaction(cx => cx.addClientsToConversation(new core_crypto_1.ConversationId(groupIdBytes), keyPackages));
|
|
186
196
|
this.dispatchNewCrlDistributionPoints(crlNewDistributionPoints);
|
|
187
197
|
}
|
|
188
198
|
/**
|
|
@@ -194,10 +204,10 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
194
204
|
async getClientIdsInGroup(groupId) {
|
|
195
205
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
196
206
|
const currentClientIdsInGroup = [];
|
|
197
|
-
for (const clientId of await this.coreCryptoClient.getClientIds(groupIdBytes)) {
|
|
207
|
+
for (const clientId of await this.coreCryptoClient.getClientIds(new core_crypto_1.ConversationId(groupIdBytes))) {
|
|
198
208
|
// [user-id]:[client-id]@[domain] -> [client-id]
|
|
199
209
|
// example: fb880fac-b549-4d8b-9398-4246324c7b85:67f41928e2844b6c@staging.zinfra.io -> 67f41928e2844b6c
|
|
200
|
-
currentClientIdsInGroup.push(bazinga64_1.Converter.arrayBufferViewToStringUTF8(clientId).split('@')[0].split(':')[1]);
|
|
210
|
+
currentClientIdsInGroup.push(bazinga64_1.Converter.arrayBufferViewToStringUTF8(clientId.copyBytes()).split('@')[0].split(':')[1]);
|
|
201
211
|
}
|
|
202
212
|
return currentClientIdsInGroup;
|
|
203
213
|
}
|
|
@@ -263,16 +273,16 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
263
273
|
}
|
|
264
274
|
getEpoch(groupId) {
|
|
265
275
|
const groupIdBytes = typeof groupId === 'string' ? bazinga64_1.Decoder.fromBase64(groupId).asBytes : groupId;
|
|
266
|
-
return this.coreCryptoClient.conversationEpoch(groupIdBytes);
|
|
276
|
+
return this.coreCryptoClient.conversationEpoch(new core_crypto_1.ConversationId(groupIdBytes));
|
|
267
277
|
}
|
|
268
278
|
async joinByExternalCommit(getGroupInfo) {
|
|
269
279
|
const credentialType = await this.getCredentialType();
|
|
270
280
|
const groupInfo = await getGroupInfo();
|
|
271
|
-
const welcomeBundle = await this.coreCryptoClient.transaction(cx => cx.joinByExternalCommit(groupInfo, credentialType));
|
|
281
|
+
const welcomeBundle = await this.coreCryptoClient.transaction(cx => cx.joinByExternalCommit(new core_crypto_1.ConversationId(groupInfo), credentialType));
|
|
272
282
|
await this.dispatchNewCrlDistributionPoints(welcomeBundle.crlNewDistributionPoints);
|
|
273
283
|
if (welcomeBundle.id) {
|
|
274
284
|
//after we've successfully joined via external commit, we schedule periodic key material renewal
|
|
275
|
-
const groupIdStr = bazinga64_1.Encoder.toBase64(welcomeBundle.id).asString;
|
|
285
|
+
const groupIdStr = bazinga64_1.Encoder.toBase64(welcomeBundle.id.copyBytes()).asString;
|
|
276
286
|
const newEpoch = await this.getEpoch(groupIdStr);
|
|
277
287
|
// Schedule the next key material renewal
|
|
278
288
|
await this.scheduleKeyMaterialRenewal(groupIdStr);
|
|
@@ -283,7 +293,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
283
293
|
}
|
|
284
294
|
async exportSecretKey(groupId, keyLength) {
|
|
285
295
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
286
|
-
const key = await this.coreCryptoClient.exportSecretKey(groupIdBytes, keyLength);
|
|
296
|
+
const key = await this.coreCryptoClient.exportSecretKey(new core_crypto_1.ConversationId(groupIdBytes), keyLength);
|
|
287
297
|
return bazinga64_1.Encoder.toBase64(key).asString;
|
|
288
298
|
}
|
|
289
299
|
dispatchNewCrlDistributionPoints(crlNewDistributionPoints) {
|
|
@@ -292,7 +302,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
292
302
|
}
|
|
293
303
|
}
|
|
294
304
|
async processWelcomeMessage(welcomeMessage) {
|
|
295
|
-
const welcomeBundle = await this.coreCryptoClient.transaction(cx => cx.processWelcomeMessage(welcomeMessage));
|
|
305
|
+
const welcomeBundle = await this.coreCryptoClient.transaction(cx => cx.processWelcomeMessage(new core_crypto_1.Welcome(welcomeMessage)));
|
|
296
306
|
this.dispatchNewCrlDistributionPoints(welcomeBundle.crlNewDistributionPoints);
|
|
297
307
|
return welcomeBundle.id;
|
|
298
308
|
}
|
|
@@ -322,7 +332,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
322
332
|
}
|
|
323
333
|
async updateKeyingMaterial(groupId) {
|
|
324
334
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
325
|
-
await this.coreCryptoClient.transaction(cx => cx.updateKeyingMaterial(groupIdBytes));
|
|
335
|
+
await this.coreCryptoClient.transaction(cx => cx.updateKeyingMaterial(new core_crypto_1.ConversationId(groupIdBytes)));
|
|
326
336
|
}
|
|
327
337
|
/**
|
|
328
338
|
* Will create an empty conversation inside of coreCrypto.
|
|
@@ -334,7 +344,9 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
334
344
|
let externalSenders = [];
|
|
335
345
|
if (parentGroupId) {
|
|
336
346
|
const parentGroupIdBytes = bazinga64_1.Decoder.fromBase64(parentGroupId).asBytes;
|
|
337
|
-
externalSenders = [
|
|
347
|
+
externalSenders = [
|
|
348
|
+
new core_crypto_1.ExternalSenderKey(await this.coreCryptoClient.getExternalSender(new core_crypto_1.ConversationId(parentGroupIdBytes))),
|
|
349
|
+
];
|
|
338
350
|
}
|
|
339
351
|
else {
|
|
340
352
|
const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
|
|
@@ -343,14 +355,14 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
343
355
|
if (!removalKeyForSignature) {
|
|
344
356
|
throw new Error(`Cannot create conversation: No backend removal key found for the signature ${ciphersuiteSignature}`);
|
|
345
357
|
}
|
|
346
|
-
externalSenders = [bazinga64_1.Decoder.fromBase64(removalKeyForSignature).asBytes];
|
|
358
|
+
externalSenders = [new core_crypto_1.ExternalSenderKey(bazinga64_1.Decoder.fromBase64(removalKeyForSignature).asBytes)];
|
|
347
359
|
}
|
|
348
360
|
const configuration = {
|
|
349
361
|
externalSenders,
|
|
350
362
|
ciphersuite: this.config.defaultCiphersuite,
|
|
351
363
|
};
|
|
352
364
|
const credentialType = await this.getCredentialType();
|
|
353
|
-
return this.coreCryptoClient.transaction(cx => cx.createConversation(groupIdBytes, credentialType, configuration));
|
|
365
|
+
return this.coreCryptoClient.transaction(cx => cx.createConversation(new core_crypto_1.ConversationId(groupIdBytes), credentialType, configuration));
|
|
354
366
|
}
|
|
355
367
|
/**
|
|
356
368
|
* Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
|
|
@@ -457,7 +469,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
457
469
|
*/
|
|
458
470
|
removeClientsFromConversation(groupId, clientIds) {
|
|
459
471
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
460
|
-
return this.coreCryptoClient.transaction(cx => cx.removeClientsFromConversation(groupIdBytes, clientIds.map(id => this.textEncoder.encode(id))));
|
|
472
|
+
return this.coreCryptoClient.transaction(cx => cx.removeClientsFromConversation(new core_crypto_1.ConversationId(groupIdBytes), clientIds.map(id => new core_crypto_1.ClientId(this.textEncoder.encode(id)))));
|
|
461
473
|
}
|
|
462
474
|
/**
|
|
463
475
|
* Will check if mls group exists in corecrypto.
|
|
@@ -465,7 +477,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
465
477
|
*/
|
|
466
478
|
async conversationExists(groupId) {
|
|
467
479
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
468
|
-
return this.coreCryptoClient.conversationExists(groupIdBytes);
|
|
480
|
+
return this.coreCryptoClient.conversationExists(new core_crypto_1.ConversationId(groupIdBytes));
|
|
469
481
|
}
|
|
470
482
|
/**
|
|
471
483
|
* Will check if mls group is established in coreCrypto.
|
|
@@ -628,7 +640,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
628
640
|
return;
|
|
629
641
|
}
|
|
630
642
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
631
|
-
return this.coreCryptoClient.transaction(cx => cx.wipeConversation(groupIdBytes));
|
|
643
|
+
return this.coreCryptoClient.transaction(cx => cx.wipeConversation(new core_crypto_1.ConversationId(groupIdBytes)));
|
|
632
644
|
}
|
|
633
645
|
/**
|
|
634
646
|
* If there are pending proposals, we need to either process them,
|
|
@@ -671,7 +683,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
671
683
|
async commitPendingProposals(groupId, shouldRetry = true) {
|
|
672
684
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
673
685
|
try {
|
|
674
|
-
await this.coreCryptoClient.transaction(cx => cx.commitPendingProposals(groupIdBytes));
|
|
686
|
+
await this.coreCryptoClient.transaction(cx => cx.commitPendingProposals(new core_crypto_1.ConversationId(groupIdBytes)));
|
|
675
687
|
await this.cancelPendingProposalsTask(groupId);
|
|
676
688
|
}
|
|
677
689
|
catch (error) {
|
|
@@ -709,9 +721,9 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
709
721
|
*/
|
|
710
722
|
async getClientIds(groupId) {
|
|
711
723
|
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
712
|
-
const rawClientIds = await this.coreCryptoClient.getClientIds(groupIdBytes);
|
|
724
|
+
const rawClientIds = await this.coreCryptoClient.getClientIds(new core_crypto_1.ConversationId(groupIdBytes));
|
|
713
725
|
const clientIds = rawClientIds.map(id => {
|
|
714
|
-
const { user, client, domain } = (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(this.textDecoder.decode(id));
|
|
726
|
+
const { user, client, domain } = (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(this.textDecoder.decode(id.copyBytes()));
|
|
715
727
|
return { userId: user, clientId: client, domain };
|
|
716
728
|
});
|
|
717
729
|
return clientIds;
|
|
@@ -287,7 +287,7 @@ describe('MLSService', () => {
|
|
|
287
287
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
288
288
|
const config = { ...defaultMLSInitConfig };
|
|
289
289
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
290
|
-
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(
|
|
290
|
+
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(core_crypto_1.ClientId), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
291
291
|
expect(mlsService.config.nbKeyPackages).toEqual(100);
|
|
292
292
|
});
|
|
293
293
|
it('uses the config provided by the consumer', async () => {
|
|
@@ -302,7 +302,7 @@ describe('MLSService', () => {
|
|
|
302
302
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
303
303
|
const config = { ...defaultMLSInitConfig, nbKeyPackages: 40, keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY };
|
|
304
304
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
305
|
-
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(
|
|
305
|
+
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(core_crypto_1.ClientId), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], config.nbKeyPackages);
|
|
306
306
|
expect(mlsService.config).toEqual(config);
|
|
307
307
|
});
|
|
308
308
|
it('uses the default config value when provided with undefined by the consumer', async () => {
|
|
@@ -321,7 +321,7 @@ describe('MLSService', () => {
|
|
|
321
321
|
keyingMaterialUpdateThreshold: TimeUtil_1.TimeInMillis.DAY,
|
|
322
322
|
};
|
|
323
323
|
await mlsService.initClient(mockUserId, mockClient, config);
|
|
324
|
-
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(
|
|
324
|
+
expect(transactionContext.mlsInit).toHaveBeenCalledWith(expect.any(core_crypto_1.ClientId), [core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519], 100);
|
|
325
325
|
expect(mlsService.config).toEqual({ ...config, nbKeyPackages: 100 });
|
|
326
326
|
});
|
|
327
327
|
it('uploads public key only if it was not yet defined on client entity', async () => {
|
|
@@ -462,9 +462,10 @@ describe('MLSService', () => {
|
|
|
462
462
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysBelowThreshold);
|
|
463
463
|
jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysBelowThreshold);
|
|
464
464
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
465
|
-
jest
|
|
466
|
-
.
|
|
467
|
-
|
|
465
|
+
jest.spyOn(transactionContext, 'processWelcomeMessage').mockResolvedValue({
|
|
466
|
+
id: new core_crypto_1.ConversationId(new Uint8Array()),
|
|
467
|
+
crlNewDistributionPoints: [],
|
|
468
|
+
});
|
|
468
469
|
jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
|
|
469
470
|
const mockedMLSWelcomeEvent = {
|
|
470
471
|
type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
|
|
@@ -488,9 +489,10 @@ describe('MLSService', () => {
|
|
|
488
489
|
jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysAboveThreshold);
|
|
489
490
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
|
|
490
491
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
491
|
-
jest
|
|
492
|
-
.
|
|
493
|
-
|
|
492
|
+
jest.spyOn(transactionContext, 'processWelcomeMessage').mockResolvedValue({
|
|
493
|
+
id: new core_crypto_1.ConversationId(new Uint8Array()),
|
|
494
|
+
crlNewDistributionPoints: [],
|
|
495
|
+
});
|
|
494
496
|
jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
|
|
495
497
|
const mockedMLSWelcomeEvent = {
|
|
496
498
|
type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
|
|
@@ -515,9 +517,10 @@ describe('MLSService', () => {
|
|
|
515
517
|
jest.spyOn(transactionContext, 'clientValidKeypackagesCount').mockResolvedValue(numberOfKeysBelowThreshold);
|
|
516
518
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(numberOfKeysAboveThreshold);
|
|
517
519
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
518
|
-
jest
|
|
519
|
-
.
|
|
520
|
-
|
|
520
|
+
jest.spyOn(transactionContext, 'processWelcomeMessage').mockResolvedValue({
|
|
521
|
+
id: new core_crypto_1.ConversationId(new Uint8Array()),
|
|
522
|
+
crlNewDistributionPoints: [],
|
|
523
|
+
});
|
|
521
524
|
jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation(jest.fn());
|
|
522
525
|
const mockedMLSWelcomeEvent = {
|
|
523
526
|
type: event_1.CONVERSATION_EVENT.MLS_WELCOME_MESSAGE,
|
|
@@ -40,10 +40,10 @@ function toProtobufCommitBundle({ commit, welcome, groupInfo }) {
|
|
|
40
40
|
return mls_1.mls.CommitBundle.encode({
|
|
41
41
|
groupInfoBundle: {
|
|
42
42
|
ratchetTreeType: ratchetTreeMapping[ratchetTreeType],
|
|
43
|
-
groupInfo: groupInfo.payload,
|
|
43
|
+
groupInfo: groupInfo.payload.copyBytes(),
|
|
44
44
|
groupInfoType: groupInfoType[encryptionType],
|
|
45
45
|
},
|
|
46
46
|
commit,
|
|
47
|
-
welcome,
|
|
47
|
+
welcome: welcome?.copyBytes(),
|
|
48
48
|
}).finish();
|
|
49
49
|
}
|
|
@@ -26,18 +26,18 @@ describe('toProtobufCommitBundle', () => {
|
|
|
26
26
|
it('encode commit bundles', () => {
|
|
27
27
|
const payload = {
|
|
28
28
|
commit: Uint8Array.from([0]),
|
|
29
|
-
welcome: Uint8Array.from([1]),
|
|
29
|
+
welcome: new core_crypto_1.Welcome(Uint8Array.from([1])),
|
|
30
30
|
groupInfo: {
|
|
31
31
|
ratchetTreeType: core_crypto_1.RatchetTreeType.Full,
|
|
32
|
-
payload: Uint8Array.from([2]),
|
|
32
|
+
payload: new core_crypto_1.GroupInfo(Uint8Array.from([2])),
|
|
33
33
|
encryptionType: core_crypto_1.GroupInfoEncryptionType.Plaintext,
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
const result = (0, commitBundleUtil_1.toProtobufCommitBundle)(payload);
|
|
37
37
|
const { commit, welcome, groupInfoBundle } = mls_1.mls.CommitBundle.decode(result);
|
|
38
38
|
expect(bazinga64_1.Encoder.toBase64(commit)).toEqual(bazinga64_1.Encoder.toBase64(payload.commit));
|
|
39
|
-
expect(bazinga64_1.Encoder.toBase64(welcome)).toEqual(bazinga64_1.Encoder.toBase64(payload.welcome));
|
|
40
|
-
expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.groupInfo.payload));
|
|
39
|
+
expect(bazinga64_1.Encoder.toBase64(welcome)).toEqual(bazinga64_1.Encoder.toBase64(payload.welcome?.copyBytes()));
|
|
40
|
+
expect(bazinga64_1.Encoder.toBase64(groupInfoBundle.groupInfo)).toEqual(bazinga64_1.Encoder.toBase64(payload.groupInfo.payload.copyBytes()));
|
|
41
41
|
expect(groupInfoBundle.ratchetTreeType).toEqual(mls_1.mls.RatchetTreeType.FULL);
|
|
42
42
|
expect(groupInfoBundle.groupInfoType).toEqual(mls_1.mls.GroupInfoType.PUBLIC_GROUP_STATE);
|
|
43
43
|
});
|
|
@@ -44,7 +44,6 @@ export declare class CoreCryptoWrapper implements CryptoClient {
|
|
|
44
44
|
key: string;
|
|
45
45
|
}>;
|
|
46
46
|
debugBreakSession(sessionId: string): Promise<void>;
|
|
47
|
-
migrateFromCryptobox(dbName: string): Promise<void>;
|
|
48
47
|
}
|
|
49
48
|
export {};
|
|
50
49
|
//# sourceMappingURL=CoreCryptoWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreCryptoWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.ts"],"names":[],"m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,EAAE,YAAY;IAMtB,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;
|
|
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;AAKpD,OAAO,EACL,UAAU,EAQX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAItD,OAAO,EAAoB,YAAY,EAAC,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,KAAK,MAAM,GAAG;IACZ,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,YAAY,CA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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;CAS1C"}
|
|
@@ -208,8 +208,5 @@ class CoreCryptoWrapper {
|
|
|
208
208
|
];
|
|
209
209
|
await this.coreCrypto.transaction(cx => cx.proteusSessionFromPrekey(sessionId, Uint8Array.from(fakePrekey)));
|
|
210
210
|
}
|
|
211
|
-
async migrateFromCryptobox(dbName) {
|
|
212
|
-
return this.coreCrypto.transaction(cx => cx.proteusCryptoboxMigrate(dbName));
|
|
213
|
-
}
|
|
214
211
|
}
|
|
215
212
|
exports.CoreCryptoWrapper = CoreCryptoWrapper;
|
|
@@ -30,9 +30,5 @@ export interface CryptoClient<T = unknown> {
|
|
|
30
30
|
deleteSession(sessionId: string): Promise<void>;
|
|
31
31
|
newPrekey(): Promise<PreKey>;
|
|
32
32
|
debugBreakSession(sessionId: string): void;
|
|
33
|
-
/**
|
|
34
|
-
* Will migrate the database from a different client type
|
|
35
|
-
*/
|
|
36
|
-
migrateFromCryptobox?(dbName: string): Promise<void>;
|
|
37
33
|
}
|
|
38
34
|
//# sourceMappingURL=CryptoClient.types.d.ts.map
|
package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,oBAAY,gBAAgB;IAC1B,WAAW,IAAA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C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"CryptoClient.types.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC;AAErE,oBAAY,gBAAgB;IAC1B,WAAW,IAAA;IACX,SAAS,IAAA;CACV;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,eAAe,IAAI,CAAC,CAAC;IACrB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAErE;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACzE,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAChF,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAC,MAAM,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAGL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAC,WAAW,EAAE,4BAA4B,EAAC,MAAM,8BAA8B,CAAC;AAG5F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,OAAO,KAAK,EACV,mCAAmC,EACnC,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAEL,iCAAiC,EAEjC,UAAU,EACV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAY1D,MAAM,MAAM,gBAAgB,G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BAAkB,CAAC,gBAAgB,EAAE,eAAe,GAAG,OAAO,CAAC,iCAAiC,CAAC;IAwC9G;;;OAGG;IACU,sBAAsB,CAAC,EAClC,cAAc,EACd,cAAc,GACf,EAAE,mCAAmC,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoD5D,WAAW,CAAC,EACvB,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;IA6CpC,OAAO,CAAC,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAuB9E,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM;IAQ7C,OAAO,CAClB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,4BAA4B,GAAG,oBAAoB,GAC9D,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,IAAI;CAGX"}
|
|
@@ -65,19 +65,6 @@ class ProteusService {
|
|
|
65
65
|
this.logger.info(`Successfully migrated session ids to qualified ids.`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
if (!cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.isReady(this.dbName) && this.cryptoClient.migrateFromCryptobox) {
|
|
69
|
-
this.logger.info(`Migrating from cryptobox to corecrypto.`);
|
|
70
|
-
try {
|
|
71
|
-
const startTime = Date.now();
|
|
72
|
-
await this.cryptoClient.migrateFromCryptobox(this.dbName);
|
|
73
|
-
cryptoMigrationStateStore_1.cryptoMigrationStore.coreCrypto.markAsReady(this.dbName);
|
|
74
|
-
this.logger.info(`Successfully migrated from cryptobox to corecrypto (took ${Date.now() - startTime}ms).`);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
this.logger.error('Client was not able to perform DB migration: ', error);
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
68
|
const backendPrekeys = await this.apiClient.api.client.getClientPreKeys(context.clientId ?? '');
|
|
82
69
|
const totalUsableBackedPrekeys = backendPrekeys.length - 1; // we remove the last resort prekey from the total number of available prekeys
|
|
83
70
|
return this.cryptoClient.init(totalUsableBackedPrekeys);
|
|
@@ -3,9 +3,5 @@ export declare const cryptoMigrationStore: {
|
|
|
3
3
|
isReady: (dbName: string) => boolean;
|
|
4
4
|
markAsReady: (dbName: string) => void;
|
|
5
5
|
};
|
|
6
|
-
coreCrypto: {
|
|
7
|
-
isReady: (dbName: string) => boolean;
|
|
8
|
-
markAsReady: (dbName: string) => void;
|
|
9
|
-
};
|
|
10
6
|
};
|
|
11
7
|
//# sourceMappingURL=cryptoMigrationStateStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptoMigrationStateStore.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cryptoMigrationStateStore.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,oBAAoB;;0BAPyC,MAAM;8BANJ,MAAM;;CAkBjF,CAAC"}
|
|
@@ -29,7 +29,6 @@ function getLocalStorage() {
|
|
|
29
29
|
}
|
|
30
30
|
const MIGRATION_READY_STATE = '1';
|
|
31
31
|
const getQualifiedSessionsReadyKey = (dbName) => `${dbName}-qualified-sessions-ready`;
|
|
32
|
-
const getCoreCryptoReadyKey = (dbName) => `${dbName}-corecrypto-ready`;
|
|
33
32
|
const markMigrationReady = (getKey) => (dbName) => {
|
|
34
33
|
const key = getKey(dbName);
|
|
35
34
|
const localStorage = getLocalStorage();
|
|
@@ -46,8 +45,4 @@ exports.cryptoMigrationStore = {
|
|
|
46
45
|
isReady: isMigrationReady(getQualifiedSessionsReadyKey),
|
|
47
46
|
markAsReady: markMigrationReady(getQualifiedSessionsReadyKey),
|
|
48
47
|
},
|
|
49
|
-
coreCrypto: {
|
|
50
|
-
isReady: isMigrationReady(getCoreCryptoReadyKey),
|
|
51
|
-
markAsReady: markMigrationReady(getCoreCryptoReadyKey),
|
|
52
|
-
},
|
|
53
48
|
};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@wireapp/api-client": "^27.75.10",
|
|
15
15
|
"@wireapp/commons": "^5.4.5",
|
|
16
|
-
"@wireapp/core-crypto": "
|
|
16
|
+
"@wireapp/core-crypto": "9.0.1",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/priority-queue": "^2.1.12",
|
|
19
19
|
"@wireapp/promise-queue": "^2.4.5",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "46.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "46.36.0",
|
|
65
|
+
"gitHead": "5a822877f840be6a33fc78e9c88d3734c8fc1bfa"
|
|
66
66
|
}
|