@wireapp/core 46.21.4 → 46.22.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/Account.d.ts +19 -10
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +35 -15
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +3 -2
- package/lib/conversation/SubconversationService/SubconversationService.test.js +3 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +2 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +6 -0
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +19 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +2 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +5 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +9 -2
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +56 -19
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +38 -4
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +2 -1
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +8 -2
- package/package.json +3 -3
package/lib/Account.d.ts
CHANGED
|
@@ -23,13 +23,6 @@ import { TeamService } from './team/';
|
|
|
23
23
|
import { UserService } from './user/';
|
|
24
24
|
import { RecurringTaskScheduler } from './util/RecurringTaskScheduler';
|
|
25
25
|
export type ProcessedEventPayload = HandledEventPayload;
|
|
26
|
-
export declare enum EVENTS {
|
|
27
|
-
/**
|
|
28
|
-
* event triggered when a message from an unknown client is received.
|
|
29
|
-
* An unknown client is a client we don't yet have a session with
|
|
30
|
-
*/
|
|
31
|
-
NEW_SESSION = "new_session"
|
|
32
|
-
}
|
|
33
26
|
export declare enum ConnectionState {
|
|
34
27
|
/** The websocket is closed and notifications stream is not being processed */
|
|
35
28
|
CLOSED = "closed",
|
|
@@ -64,6 +57,13 @@ type InitOptions = {
|
|
|
64
57
|
/** cookie used to identify the current user. Will use the browser cookie if not defined */
|
|
65
58
|
cookie?: Cookie;
|
|
66
59
|
};
|
|
60
|
+
export declare enum EVENTS {
|
|
61
|
+
/**
|
|
62
|
+
* event triggered when a message from an unknown client is received.
|
|
63
|
+
* An unknown client is a client we don't yet have a session with
|
|
64
|
+
*/
|
|
65
|
+
NEW_SESSION = "new_session"
|
|
66
|
+
}
|
|
67
67
|
type Events = {
|
|
68
68
|
[EVENTS.NEW_SESSION]: NewClient;
|
|
69
69
|
};
|
|
@@ -180,11 +180,20 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
180
180
|
* Will logout the current user
|
|
181
181
|
* @param clearData if set to `true` will completely wipe any database that was created by the Account
|
|
182
182
|
*/
|
|
183
|
-
logout(
|
|
183
|
+
logout(data?: {
|
|
184
|
+
clearAllData?: boolean;
|
|
185
|
+
clearCryptoData?: boolean;
|
|
186
|
+
}): Promise<void>;
|
|
187
|
+
private wipeCommonData;
|
|
188
|
+
/**
|
|
189
|
+
* Will delete the identity and history of the current user
|
|
190
|
+
*/
|
|
191
|
+
private wipeAllData;
|
|
184
192
|
/**
|
|
185
|
-
* Will delete the
|
|
193
|
+
* Will delete the cryptography and client of the current user
|
|
194
|
+
* Will keep the history intact
|
|
186
195
|
*/
|
|
187
|
-
private
|
|
196
|
+
private wipeCryptoData;
|
|
188
197
|
/**
|
|
189
198
|
* return true if the current user has a MLS device that is initialized and ready to use
|
|
190
199
|
*/
|
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,CAAC;AAC/D,OAAO,EAAa,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAe,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,sBAAsB,EAAC,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAMvE,OAAO,EAAC,mBAAmB,EAAO,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAC,gBAAg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AAG,OAAO,CAAC,IAAI,CAAC;YAYhF,cAAc;IAM5B;;OAEG;YACW,WAAW;IAQzB;;;OAGG;YACW,cAAc;IAQ5B;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,EACZ,OAAkB,EAClB,wBAAmC,EACnC,4BAAuC,EACvC,qBAAgC,EAChC,MAAc,GACf,GAAE;QACD;;;;WAIG;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;QAE7E;;WAEG;QACH,4BAA4B,CAAC,EAAE,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,EAAE;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI,CAAC;QAEtF;;WAEG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;QAE5D;;;;;;WAMG;QACH,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM,IAAI;IAiGnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,uBAAuB;YAIjB,UAAU;IAuBxB,OAAO,CAAC,yBAAyB,CAS/B;IAEW,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;CAmBtD"}
|
package/lib/Account.js
CHANGED
|
@@ -41,7 +41,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.Account = exports.
|
|
44
|
+
exports.Account = exports.EVENTS = exports.ConnectionState = void 0;
|
|
45
45
|
const auth_1 = require("@wireapp/api-client/lib/auth");
|
|
46
46
|
const client_1 = require("@wireapp/api-client/lib/client/");
|
|
47
47
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
@@ -67,6 +67,7 @@ const conversationRejoinQueue_1 = require("./messagingProtocols/mls/conversation
|
|
|
67
67
|
const E2EIdentityService_1 = require("./messagingProtocols/mls/E2EIdentityService");
|
|
68
68
|
const proteus_1 = require("./messagingProtocols/proteus");
|
|
69
69
|
const CryptoClient_1 = require("./messagingProtocols/proteus/ProteusService/CryptoClient");
|
|
70
|
+
const identityClearer_1 = require("./messagingProtocols/proteus/ProteusService/identityClearer");
|
|
70
71
|
const notification_1 = require("./notification/");
|
|
71
72
|
const encryptedStore_1 = require("./secretStore/encryptedStore");
|
|
72
73
|
const secretKeyGenerator_1 = require("./secretStore/secretKeyGenerator");
|
|
@@ -75,14 +76,6 @@ const CoreDB_1 = require("./storage/CoreDB");
|
|
|
75
76
|
const team_2 = require("./team/");
|
|
76
77
|
const user_1 = require("./user/");
|
|
77
78
|
const RecurringTaskScheduler_1 = require("./util/RecurringTaskScheduler");
|
|
78
|
-
var EVENTS;
|
|
79
|
-
(function (EVENTS) {
|
|
80
|
-
/**
|
|
81
|
-
* event triggered when a message from an unknown client is received.
|
|
82
|
-
* An unknown client is a client we don't yet have a session with
|
|
83
|
-
*/
|
|
84
|
-
EVENTS["NEW_SESSION"] = "new_session";
|
|
85
|
-
})(EVENTS || (exports.EVENTS = EVENTS = {}));
|
|
86
79
|
var ConnectionState;
|
|
87
80
|
(function (ConnectionState) {
|
|
88
81
|
/** The websocket is closed and notifications stream is not being processed */
|
|
@@ -99,6 +92,14 @@ const coreDefaultClient = {
|
|
|
99
92
|
cookieLabel: 'default',
|
|
100
93
|
model: '@wireapp/core',
|
|
101
94
|
};
|
|
95
|
+
var EVENTS;
|
|
96
|
+
(function (EVENTS) {
|
|
97
|
+
/**
|
|
98
|
+
* event triggered when a message from an unknown client is received.
|
|
99
|
+
* An unknown client is a client we don't yet have a session with
|
|
100
|
+
*/
|
|
101
|
+
EVENTS["NEW_SESSION"] = "new_session";
|
|
102
|
+
})(EVENTS || (exports.EVENTS = EVENTS = {}));
|
|
102
103
|
class Account extends commons_1.TypedEventEmitter {
|
|
103
104
|
options;
|
|
104
105
|
apiClient;
|
|
@@ -366,24 +367,43 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
366
367
|
* Will logout the current user
|
|
367
368
|
* @param clearData if set to `true` will completely wipe any database that was created by the Account
|
|
368
369
|
*/
|
|
369
|
-
async logout(
|
|
370
|
+
async logout(data) {
|
|
370
371
|
this.db?.close();
|
|
371
372
|
this.encryptedDb?.close();
|
|
372
|
-
if (
|
|
373
|
-
await this.
|
|
373
|
+
if (data?.clearAllData) {
|
|
374
|
+
await this.wipeAllData();
|
|
375
|
+
}
|
|
376
|
+
else if (data?.clearCryptoData) {
|
|
377
|
+
await this.wipeCryptoData();
|
|
374
378
|
}
|
|
375
379
|
await this.apiClient.logout();
|
|
376
380
|
this.resetContext();
|
|
377
381
|
}
|
|
382
|
+
async wipeCommonData() {
|
|
383
|
+
await this.service?.client.deleteLocalClient();
|
|
384
|
+
// needs to be wiped last
|
|
385
|
+
await this.encryptedDb?.wipe();
|
|
386
|
+
}
|
|
378
387
|
/**
|
|
379
|
-
* Will delete the identity of the current user
|
|
388
|
+
* Will delete the identity and history of the current user
|
|
380
389
|
*/
|
|
381
|
-
async
|
|
390
|
+
async wipeAllData() {
|
|
382
391
|
await this.service?.proteus.wipe(this.storeEngine);
|
|
383
392
|
if (this.db) {
|
|
384
393
|
await (0, CoreDB_1.deleteDB)(this.db);
|
|
385
394
|
}
|
|
386
|
-
await this.
|
|
395
|
+
await this.wipeCommonData();
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Will delete the cryptography and client of the current user
|
|
399
|
+
* Will keep the history intact
|
|
400
|
+
*/
|
|
401
|
+
async wipeCryptoData() {
|
|
402
|
+
await this.service?.proteus.wipe();
|
|
403
|
+
if (this.storeEngine) {
|
|
404
|
+
await (0, identityClearer_1.deleteIdentity)(this.storeEngine, true);
|
|
405
|
+
}
|
|
406
|
+
await this.wipeCommonData();
|
|
387
407
|
}
|
|
388
408
|
/**
|
|
389
409
|
* return true if the current user has a MLS device that is initialized and ready to use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubconversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/SubconversationService/SubconversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAkB,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAI/D,OAAO,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"SubconversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/SubconversationService/SubconversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAkB,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAGzD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAa,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAI/D,OAAO,EAAC,UAAU,EAAmB,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAGlD,KAAK,MAAM,GAAG;IACZ,wBAAwB,EAAE;QAAC,cAAc,EAAE,WAAW,CAAA;KAAC,CAAC;CACzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAID,qBAAa,sBAAuB,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAIjE,OAAO,CAAC,QAAQ,CAAC,SAAS;IA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,cAAc,EAAE;QAAC,IAAI,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAC,GACpD,OAAO,CAAC,IAAI,CAAC;YAgCF,mCAAmC;YAMnC,4BAA4B;YAI5B,+BAA+B;YAO/B,8BAA8B;IAwBrC,yBAAyB,yBACR,WAAW,qBACd,kBAAkB,KACpC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO5B;IAEK,iCAAiC,sBACnB,kBAAkB,KACpC,OAAO,CACR;QACE,oBAAoB,EAAE,WAAW,CAAC;QAClC,iBAAiB,EAAE,kBAAkB,CAAC;QACtC,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CACJ,CAOC;IAEK,0BAA0B,yBACT,WAAW,qBACd,kBAAkB,WAC5B,MAAM,qBAOf;IAEK,2BAA2B,yBACV,WAAW,qBACd,kBAAkB,mBAMrC;CACH"}
|
|
@@ -23,6 +23,7 @@ const conversation_1 = require("@wireapp/api-client/lib/conversation");
|
|
|
23
23
|
const TimeUtil_1 = require("@wireapp/commons/lib/util/TimeUtil");
|
|
24
24
|
const commons_1 = require("@wireapp/commons");
|
|
25
25
|
const subconversationUtil_1 = require("./subconversationUtil");
|
|
26
|
+
const mls_1 = require("../../messagingProtocols/mls");
|
|
26
27
|
const fullyQualifiedClientIdUtils_1 = require("../../util/fullyQualifiedClientIdUtils");
|
|
27
28
|
const MLS_CONVERSATION_KEY_LENGTH = 32;
|
|
28
29
|
class SubconversationService extends commons_1.TypedEventEmitter {
|
|
@@ -162,9 +163,9 @@ class SubconversationService extends commons_1.TypedEventEmitter {
|
|
|
162
163
|
epoch: newSubconversationEpoch,
|
|
163
164
|
});
|
|
164
165
|
};
|
|
165
|
-
this.mlsService.on(
|
|
166
|
+
this.mlsService.on(mls_1.MLSServiceEvents.NEW_EPOCH, forwardNewEpoch);
|
|
166
167
|
await forwardNewEpoch({ groupId: subconversationGroupId, epoch: initialEpoch });
|
|
167
|
-
return () => this.mlsService.off(
|
|
168
|
+
return () => this.mlsService.off(mls_1.MLSServiceEvents.NEW_EPOCH, forwardNewEpoch);
|
|
168
169
|
}
|
|
169
170
|
async removeClientFromConferenceSubconversation(conversationId, clientToRemove) {
|
|
170
171
|
const subconversationGroupId = await this.getSubconversationGroupId(conversationId, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
@@ -22,6 +22,7 @@ const conversation_1 = require("@wireapp/api-client/lib/conversation");
|
|
|
22
22
|
const http_1 = require("@wireapp/api-client/lib/http");
|
|
23
23
|
const api_client_1 = require("@wireapp/api-client");
|
|
24
24
|
const SubconversationService_1 = require("./SubconversationService");
|
|
25
|
+
const mls_1 = require("../../messagingProtocols/mls");
|
|
25
26
|
const CoreDB_1 = require("../../storage/CoreDB");
|
|
26
27
|
const fullyQualifiedClientIdUtils_1 = require("../../util/fullyQualifiedClientIdUtils");
|
|
27
28
|
const getSubconversationResponse = ({ epoch, epochTimestamp, parentConversationId, groupId, members = [], subconversationId = conversation_1.SUBCONVERSATION_ID.CONFERENCE, }) => {
|
|
@@ -313,11 +314,11 @@ describe('SubconversationService', () => {
|
|
|
313
314
|
const onEpochUpdateCallback = jest.fn();
|
|
314
315
|
const unsubscribe = await subconversationService.subscribeToEpochUpdates(parentConversationId, parentConversationGroupId, findConversationByGroupId, onEpochUpdateCallback);
|
|
315
316
|
expect(mlsService.getEpoch).toHaveBeenCalledWith(subconversationGroupId);
|
|
316
|
-
expect(mlsService.on).toHaveBeenCalledWith(
|
|
317
|
+
expect(mlsService.on).toHaveBeenCalledWith(mls_1.MLSServiceEvents.NEW_EPOCH, expect.any(Function));
|
|
317
318
|
expect(subconversationService.getSubconversationEpochInfo).toHaveBeenCalledWith(parentConversationId, parentConversationGroupId);
|
|
318
319
|
expect(onEpochUpdateCallback).toHaveBeenCalledWith(mockedEpochInfo);
|
|
319
320
|
unsubscribe();
|
|
320
|
-
expect(mlsService.off).toHaveBeenCalledWith(
|
|
321
|
+
expect(mlsService.off).toHaveBeenCalledWith(mls_1.MLSServiceEvents.NEW_EPOCH, expect.any(Function));
|
|
321
322
|
});
|
|
322
323
|
});
|
|
323
324
|
describe('removeClientFromConferenceSubconversation', () => {
|
|
@@ -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,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAMnH,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,
|
|
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,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAMnH,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,UA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CAAC;IAyDxD,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,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;IAK7C;;;;;;;;;;;;OAYG;YACW,0BAA0B;IA2BxC,OAAO,CAAC,4BAA4B;YAStB,+BAA+B;YAQ/B,uBAAuB;YAKvB,0BAA0B;YAI1B,4BAA4B;YAO5B,WAAW;YAkBX,8BAA8B;CAM7C"}
|
|
@@ -29,6 +29,7 @@ const E2EIStorage_1 = require("./Storage/E2EIStorage");
|
|
|
29
29
|
const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
|
|
30
30
|
const LowPrecisionTaskScheduler_1 = require("../../../util/LowPrecisionTaskScheduler");
|
|
31
31
|
const qualifiedIdUtil_1 = require("../../../util/qualifiedIdUtil");
|
|
32
|
+
const MLSService_1 = require("../MLSService");
|
|
32
33
|
// This export is meant to be accessible from the outside (e.g the Webapp / UI)
|
|
33
34
|
class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
34
35
|
coreCryptoClient;
|
|
@@ -147,7 +148,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
147
148
|
*/
|
|
148
149
|
async initialize(discoveryUrl) {
|
|
149
150
|
this._acmeService = new Connection_1.AcmeService(discoveryUrl);
|
|
150
|
-
this.mlsService.on(
|
|
151
|
+
this.mlsService.on(MLSService_1.MLSServiceEvents.NEW_CRL_DISTRIBUTION_POINTS, distributionPoints => this.handleNewCrlDistributionPoints(distributionPoints));
|
|
151
152
|
await this.registerServerCertificates();
|
|
152
153
|
await this.initialiseCrlDistributionTimers();
|
|
153
154
|
}
|
|
@@ -9,6 +9,12 @@ type GetE2EIClientIdReturnType = {
|
|
|
9
9
|
export declare const getE2EIClientId: (clientId: string, userId: string, userDomain: string) => GetE2EIClientIdReturnType;
|
|
10
10
|
export declare const getSignatureAlgorithmForCiphersuite: (ciphersuite: Ciphersuite) => MLSPublicKeyAlgorithmKeys;
|
|
11
11
|
export declare const isMLSDevice: ({ mls_public_keys }: RegisteredClient, ciphersuite: Ciphersuite) => boolean;
|
|
12
|
+
export declare enum MLSDeviceStatus {
|
|
13
|
+
REGISTERED = "registered",
|
|
14
|
+
FRESH = "fresh",
|
|
15
|
+
MISMATCH = "mismatch"
|
|
16
|
+
}
|
|
17
|
+
export declare const getMLSDeviceStatus: ({ mls_public_keys }: RegisteredClient, ciphersuite: Ciphersuite, existingClientSignature: string) => MLSDeviceStatus;
|
|
12
18
|
export declare const isResponseStatusValid: (status: string | undefined) => boolean | "" | undefined;
|
|
13
19
|
export {};
|
|
14
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Helper/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,yBAAyB,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAE3F,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAC,kBAAkB,EAAkC,MAAM,8CAA8C,CAAC;AAEjH,eAAO,MAAM,eAAe,SAAU,GAAG,KAAG,UAG3C,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,eAAe,aAAc,MAAM,UAAU,MAAM,cAAc,MAAM,KAAG,yBAOtF,CAAC;AAeF,eAAO,MAAM,mCAAmC,gBAAiB,WAAW,KAAG,yBAE9E,CAAC;AAEF,eAAO,MAAM,WAAW,wBAAuB,gBAAgB,eAAe,WAAW,YAIxF,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,GAAG,SAAS,6BAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/messagingProtocols/mls/E2EIdentityService/Helper/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,yBAAyB,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAE3F,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAC,kBAAkB,EAAkC,MAAM,8CAA8C,CAAC;AAEjH,eAAO,MAAM,eAAe,SAAU,GAAG,KAAG,UAG3C,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AACF,eAAO,MAAM,eAAe,aAAc,MAAM,UAAU,MAAM,cAAc,MAAM,KAAG,yBAOtF,CAAC;AAeF,eAAO,MAAM,mCAAmC,gBAAiB,WAAW,KAAG,yBAE9E,CAAC;AAEF,eAAO,MAAM,WAAW,wBAAuB,gBAAgB,eAAe,WAAW,YAIxF,CAAC;AAEF,oBAAY,eAAe;IACzB,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AACD,eAAO,MAAM,kBAAkB,wBACV,gBAAgB,eACtB,WAAW,2BACC,MAAM,KAC9B,eAWF,CAAC;AAEF,eAAO,MAAM,qBAAqB,WAAY,MAAM,GAAG,SAAS,6BAAiC,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.isResponseStatusValid = exports.isMLSDevice = exports.getSignatureAlgorithmForCiphersuite = exports.getE2EIClientId = exports.jsonToByteArray = void 0;
|
|
21
|
+
exports.isResponseStatusValid = exports.getMLSDeviceStatus = exports.MLSDeviceStatus = exports.isMLSDevice = exports.getSignatureAlgorithmForCiphersuite = exports.getE2EIClientId = exports.jsonToByteArray = void 0;
|
|
22
22
|
const client_1 = require("@wireapp/api-client/lib/client");
|
|
23
23
|
const core_crypto_1 = require("@wireapp/core-crypto");
|
|
24
24
|
const fullyQualifiedClientIdUtils_1 = require("../../../../util/fullyQualifiedClientIdUtils");
|
|
@@ -58,5 +58,23 @@ const isMLSDevice = ({ mls_public_keys }, ciphersuite) => {
|
|
|
58
58
|
return typeof signature === 'string' && signature.length > 0;
|
|
59
59
|
};
|
|
60
60
|
exports.isMLSDevice = isMLSDevice;
|
|
61
|
+
var MLSDeviceStatus;
|
|
62
|
+
(function (MLSDeviceStatus) {
|
|
63
|
+
MLSDeviceStatus["REGISTERED"] = "registered";
|
|
64
|
+
MLSDeviceStatus["FRESH"] = "fresh";
|
|
65
|
+
MLSDeviceStatus["MISMATCH"] = "mismatch";
|
|
66
|
+
})(MLSDeviceStatus || (exports.MLSDeviceStatus = MLSDeviceStatus = {}));
|
|
67
|
+
const getMLSDeviceStatus = ({ mls_public_keys }, ciphersuite, existingClientSignature) => {
|
|
68
|
+
const signatureAlogrithm = (0, exports.getSignatureAlgorithmForCiphersuite)(ciphersuite);
|
|
69
|
+
const signature = mls_public_keys[signatureAlogrithm];
|
|
70
|
+
if (!signature || !existingClientSignature) {
|
|
71
|
+
return MLSDeviceStatus.FRESH;
|
|
72
|
+
}
|
|
73
|
+
if (signature !== existingClientSignature) {
|
|
74
|
+
return MLSDeviceStatus.MISMATCH;
|
|
75
|
+
}
|
|
76
|
+
return MLSDeviceStatus.REGISTERED;
|
|
77
|
+
};
|
|
78
|
+
exports.getMLSDeviceStatus = getMLSDeviceStatus;
|
|
61
79
|
const isResponseStatusValid = (status) => status && status === 'valid';
|
|
62
80
|
exports.isResponseStatusValid = isResponseStatusValid;
|
|
@@ -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,EAAyC,MAAM,gCAAgC,CAAC;AAElG,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"}
|
|
@@ -43,7 +43,7 @@ const handleMLSMessageAdd = async ({ event, groupId, mlsService, }) => {
|
|
|
43
43
|
}
|
|
44
44
|
if (hasEpochChanged) {
|
|
45
45
|
const newEpoch = await mlsService.getEpoch(groupId);
|
|
46
|
-
mlsService.emit(
|
|
46
|
+
mlsService.emit(MLSService_1.MLSServiceEvents.NEW_EPOCH, { groupId, epoch: newEpoch });
|
|
47
47
|
}
|
|
48
48
|
return message ? { event, decryptedData: protocol_messaging_1.GenericMessage.decode(message) } : null;
|
|
49
49
|
};
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
22
22
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
23
|
const messageAdd_1 = require("./messageAdd");
|
|
24
|
+
const MLSService_1 = require("../../../MLSService");
|
|
24
25
|
const mockedMLSService = {
|
|
25
26
|
getGroupIdFromConversationId: jest.fn(),
|
|
26
27
|
decryptMessage: jest.fn(),
|
|
@@ -90,7 +91,7 @@ describe('handleMLSMessageAdd', () => {
|
|
|
90
91
|
const mockedNewEpoch = 5;
|
|
91
92
|
jest.spyOn(mockedMLSService, 'getEpoch').mockResolvedValueOnce(mockedNewEpoch);
|
|
92
93
|
await (0, messageAdd_1.handleMLSMessageAdd)({ event, mlsService: mockedMLSService, groupId: mockGroupId });
|
|
93
|
-
expect(mockedMLSService.emit).toHaveBeenCalledWith(
|
|
94
|
+
expect(mockedMLSService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
|
|
94
95
|
groupId: mockGroupId,
|
|
95
96
|
epoch: mockedNewEpoch,
|
|
96
97
|
});
|
package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"welcomeMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAG1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAC,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEjE,UAAU,0BAA0B;IAClC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,uBAAuB,2BAGjC,0BAA0B,KAAG,OAAO,CAAC,mBAAmB,CAiB1D,CAAC"}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.handleMLSWelcomeMessage = void 0;
|
|
22
22
|
const bazinga64_1 = require("bazinga64");
|
|
23
|
+
const MLSService_1 = require("../../../MLSService");
|
|
23
24
|
const handleMLSWelcomeMessage = async ({ mlsService, event, }) => {
|
|
24
25
|
const data = bazinga64_1.Decoder.fromBase64(event.data).asBytes;
|
|
25
26
|
// We extract the groupId from the welcome message and let coreCrypto store this group
|
|
@@ -29,7 +30,7 @@ const handleMLSWelcomeMessage = async ({ mlsService, event, }) => {
|
|
|
29
30
|
// After we were added to the group we need to schedule a periodic key material renewal
|
|
30
31
|
await mlsService.scheduleKeyMaterialRenewal(groupIdStr);
|
|
31
32
|
const newEpoch = await mlsService.getEpoch(groupIdStr);
|
|
32
|
-
mlsService.emit(
|
|
33
|
+
mlsService.emit(MLSService_1.MLSServiceEvents.NEW_EPOCH, { groupId: groupIdStr, epoch: newEpoch });
|
|
33
34
|
return {
|
|
34
35
|
event: { ...event, data: groupIdStr },
|
|
35
36
|
};
|
package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
22
22
|
const welcomeMessage_1 = require("./welcomeMessage");
|
|
23
|
+
const __1 = require("../../..");
|
|
23
24
|
jest.mock('bazinga64', () => ({
|
|
24
25
|
...jest.requireActual('bazinga64'),
|
|
25
26
|
Decoder: {
|
|
@@ -61,7 +62,10 @@ describe('MLS welcomeMessage eventHandler', () => {
|
|
|
61
62
|
it('emits new epoch event after processing a welcome message', async () => {
|
|
62
63
|
jest.spyOn(mockParams.mlsService, 'getEpoch').mockResolvedValue(1);
|
|
63
64
|
await (0, welcomeMessage_1.handleMLSWelcomeMessage)(mockParams);
|
|
64
|
-
expect(mockParams.mlsService.emit).toHaveBeenCalledWith(
|
|
65
|
+
expect(mockParams.mlsService.emit).toHaveBeenCalledWith(__1.MLSServiceEvents.NEW_EPOCH, {
|
|
66
|
+
groupId: 'conversationId',
|
|
67
|
+
epoch: 1,
|
|
68
|
+
});
|
|
65
69
|
});
|
|
66
70
|
});
|
|
67
71
|
});
|
|
@@ -30,12 +30,18 @@ export type InitClientOptions = Optional<MLSConfig, 'keyingMaterialUpdateThresho
|
|
|
30
30
|
skipInitIdentity?: boolean;
|
|
31
31
|
};
|
|
32
32
|
export declare const optionalToUint8Array: (array: Uint8Array | []) => Uint8Array;
|
|
33
|
+
export declare enum MLSServiceEvents {
|
|
34
|
+
NEW_EPOCH = "newEpoch",
|
|
35
|
+
MLS_CLIENT_MISMATCH = "mlsClientMismatch",
|
|
36
|
+
NEW_CRL_DISTRIBUTION_POINTS = "newCrlDistributionPoints"
|
|
37
|
+
}
|
|
33
38
|
type Events = {
|
|
34
|
-
|
|
39
|
+
[MLSServiceEvents.NEW_EPOCH]: {
|
|
35
40
|
epoch: number;
|
|
36
41
|
groupId: string;
|
|
37
42
|
};
|
|
38
|
-
|
|
43
|
+
[MLSServiceEvents.NEW_CRL_DISTRIBUTION_POINTS]: string[];
|
|
44
|
+
[MLSServiceEvents.MLS_CLIENT_MISMATCH]: void;
|
|
39
45
|
};
|
|
40
46
|
export declare class MLSService extends TypedEventEmitter<Events> {
|
|
41
47
|
private readonly apiClient;
|
|
@@ -204,6 +210,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
204
210
|
private verifyLocalMLSKeyPackagesAmount;
|
|
205
211
|
private verifyRemoteMLSKeyPackagesAmount;
|
|
206
212
|
private getRemoteMLSKeyPackageCount;
|
|
213
|
+
private getCCClientSignatureString;
|
|
207
214
|
/**
|
|
208
215
|
* Will update the given client on backend with its public key.
|
|
209
216
|
*
|
|
@@ -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,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,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAuB,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EACL,eAAe,EACf,WAAW,EAGX,cAAc,EACd,UAAU,EAEV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAC,eAAe,EAA0B,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAEnG,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,EAAsB,gBAAgB,EAAC,MAAM,2CAA2C,CAAC;
|
|
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,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAC,8BA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7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.MLSService = exports.optionalToUint8Array = void 0;
|
|
21
|
+
exports.MLSService = exports.MLSServiceEvents = exports.optionalToUint8Array = void 0;
|
|
22
22
|
const http_1 = require("@wireapp/api-client/lib/http");
|
|
23
23
|
const TimeUtil_1 = require("@wireapp/commons/lib/util/TimeUtil");
|
|
24
24
|
const bazinga64_1 = require("bazinga64");
|
|
@@ -47,6 +47,12 @@ const defaultConfig = {
|
|
|
47
47
|
keyingMaterialUpdateThreshold: 1000 * 60 * 60 * 24 * 30, //30 days
|
|
48
48
|
nbKeyPackages: 100,
|
|
49
49
|
};
|
|
50
|
+
var MLSServiceEvents;
|
|
51
|
+
(function (MLSServiceEvents) {
|
|
52
|
+
MLSServiceEvents["NEW_EPOCH"] = "newEpoch";
|
|
53
|
+
MLSServiceEvents["MLS_CLIENT_MISMATCH"] = "mlsClientMismatch";
|
|
54
|
+
MLSServiceEvents["NEW_CRL_DISTRIBUTION_POINTS"] = "newCrlDistributionPoints";
|
|
55
|
+
})(MLSServiceEvents || (exports.MLSServiceEvents = MLSServiceEvents = {}));
|
|
50
56
|
class MLSService extends commons_1.TypedEventEmitter {
|
|
51
57
|
apiClient;
|
|
52
58
|
coreCryptoClient;
|
|
@@ -104,17 +110,35 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
104
110
|
authorize: async () => true,
|
|
105
111
|
userAuthorize: async () => true,
|
|
106
112
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
try {
|
|
114
|
+
const ccClientSignature = await this.getCCClientSignatureString();
|
|
115
|
+
const mlsDeviceStatus = (0, Helper_1.getMLSDeviceStatus)(client, this.config.defaultCiphersuite, ccClientSignature);
|
|
116
|
+
switch (mlsDeviceStatus) {
|
|
117
|
+
case Helper_1.MLSDeviceStatus.REGISTERED:
|
|
118
|
+
if (!skipInitIdentity) {
|
|
119
|
+
await this.verifyRemoteMLSKeyPackagesAmount(client.id);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.logger.info(`Blocked initial key package upload for client ${client.id} as E2EI is enabled`);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case Helper_1.MLSDeviceStatus.MISMATCH:
|
|
126
|
+
this.logger.error(`Client ${client.id} is registered but with a different signature`);
|
|
127
|
+
this.emit(MLSServiceEvents.MLS_CLIENT_MISMATCH);
|
|
128
|
+
break;
|
|
129
|
+
case Helper_1.MLSDeviceStatus.FRESH:
|
|
130
|
+
if (!skipInitIdentity) {
|
|
131
|
+
await this.uploadMLSPublicKeys(client);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this.logger.info(`Blocked initial key package upload for client ${client.id} as E2EI is enabled`);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
113
137
|
}
|
|
114
|
-
await this.verifyRemoteMLSKeyPackagesAmount(client.id);
|
|
115
138
|
}
|
|
116
|
-
|
|
117
|
-
this.logger.
|
|
139
|
+
catch (error) {
|
|
140
|
+
this.logger.error(`Error while initializing client ${client.id}`, error);
|
|
141
|
+
throw error;
|
|
118
142
|
}
|
|
119
143
|
}
|
|
120
144
|
/**
|
|
@@ -154,7 +178,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
154
178
|
await this.coreCryptoClient.commitAccepted(groupId);
|
|
155
179
|
}
|
|
156
180
|
const newEpoch = await this.getEpoch(groupId);
|
|
157
|
-
this.emit(
|
|
181
|
+
this.emit(MLSServiceEvents.NEW_EPOCH, { epoch: newEpoch, groupId: groupIdStr });
|
|
158
182
|
return response;
|
|
159
183
|
}
|
|
160
184
|
catch (error) {
|
|
@@ -292,7 +316,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
292
316
|
dispatchNewCrlDistributionPoints(payload) {
|
|
293
317
|
const { crlNewDistributionPoints } = payload;
|
|
294
318
|
if (crlNewDistributionPoints && crlNewDistributionPoints.length > 0) {
|
|
295
|
-
this.emit(
|
|
319
|
+
this.emit(MLSServiceEvents.NEW_CRL_DISTRIBUTION_POINTS, crlNewDistributionPoints);
|
|
296
320
|
}
|
|
297
321
|
}
|
|
298
322
|
async processWelcomeMessage(welcomeMessage) {
|
|
@@ -610,6 +634,14 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
610
634
|
async getRemoteMLSKeyPackageCount(clientId) {
|
|
611
635
|
return this.apiClient.api.client.getMLSKeyPackageCount(clientId, (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite));
|
|
612
636
|
}
|
|
637
|
+
async getCCClientSignatureString() {
|
|
638
|
+
const credentialType = await this.getCredentialType();
|
|
639
|
+
const publicKey = await this.coreCryptoClient.clientPublicKey(this.config.defaultCiphersuite, credentialType);
|
|
640
|
+
if (!publicKey) {
|
|
641
|
+
throw new Error('No public key found for client');
|
|
642
|
+
}
|
|
643
|
+
return btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(publicKey));
|
|
644
|
+
}
|
|
613
645
|
/**
|
|
614
646
|
* Will update the given client on backend with its public key.
|
|
615
647
|
*
|
|
@@ -618,13 +650,18 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
618
650
|
*/
|
|
619
651
|
async uploadMLSPublicKeys(client) {
|
|
620
652
|
// If we've already updated a client with its public key, there's no need to do it again.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
653
|
+
try {
|
|
654
|
+
const clientSignature = await this.getCCClientSignatureString();
|
|
655
|
+
return this.apiClient.api.client.putClient(client.id, {
|
|
656
|
+
mls_public_keys: {
|
|
657
|
+
[(0, Helper_1.getSignatureAlgorithmForCiphersuite)(this.config.defaultCiphersuite)]: clientSignature,
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
catch (error) {
|
|
662
|
+
this.logger.error(`Failed to upload public keys for client ${client.id}`, error);
|
|
663
|
+
throw error;
|
|
664
|
+
}
|
|
628
665
|
}
|
|
629
666
|
async replaceKeyPackages(clientId, keyPackages) {
|
|
630
667
|
return this.apiClient.api.client.replaceMLSKeyPackages(clientId, keyPackages.map(keyPackage => btoa(bazinga64_1.Converter.arrayBufferViewToBaselineString(keyPackage))), (0, numberToHex_1.numberToHex)(this.config.defaultCiphersuite));
|
|
@@ -17,6 +17,29 @@
|
|
|
17
17
|
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
+
}) : function(o, v) {
|
|
34
|
+
o["default"] = v;
|
|
35
|
+
});
|
|
36
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
20
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
44
|
const client_1 = require("@wireapp/api-client/lib/client");
|
|
22
45
|
const event_1 = require("@wireapp/api-client/lib/event");
|
|
@@ -31,6 +54,11 @@ const conversation_1 = require("../../../conversation");
|
|
|
31
54
|
const CoreDB_1 = require("../../../storage/CoreDB");
|
|
32
55
|
const RecurringTaskScheduler_1 = require("../../../util/RecurringTaskScheduler");
|
|
33
56
|
const TaskScheduler_1 = require("../../../util/TaskScheduler");
|
|
57
|
+
const Helper = __importStar(require("../E2EIdentityService/Helper"));
|
|
58
|
+
jest.mock('../E2EIdentityService/Helper', () => ({
|
|
59
|
+
...jest.requireActual('../E2EIdentityService/Helper'),
|
|
60
|
+
getMLSDeviceStatus: jest.fn(),
|
|
61
|
+
}));
|
|
34
62
|
jest.createMockFromModule('@wireapp/api-client');
|
|
35
63
|
function createUserId() {
|
|
36
64
|
return { id: (0, crypto_1.randomUUID)(), domain: '' };
|
|
@@ -323,10 +351,10 @@ describe('MLSService', () => {
|
|
|
323
351
|
const mockClientId = 'client-1';
|
|
324
352
|
const mockClient = { mls_public_keys: {}, id: mockClientId };
|
|
325
353
|
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
326
|
-
const mockedClientPublicKey = new Uint8Array();
|
|
327
|
-
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(mockedClientPublicKey);
|
|
328
354
|
jest.spyOn(apiClient.api.client, 'putClient').mockResolvedValueOnce(undefined);
|
|
329
355
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
356
|
+
jest.spyOn(Helper, 'getMLSDeviceStatus').mockReturnValueOnce(Helper.MLSDeviceStatus.FRESH);
|
|
357
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValue(new Uint8Array());
|
|
330
358
|
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
331
359
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
332
360
|
expect(apiClient.api.client.putClient).toHaveBeenCalledWith(mockClientId, expect.anything());
|
|
@@ -339,10 +367,12 @@ describe('MLSService', () => {
|
|
|
339
367
|
apiClient.context = { clientType: client_1.ClientType.PERMANENT, clientId: mockClientId, userId: '' };
|
|
340
368
|
const mockedClientKeyPackages = [new Uint8Array()];
|
|
341
369
|
jest.spyOn(coreCrypto, 'clientKeypackages').mockResolvedValueOnce(mockedClientKeyPackages);
|
|
370
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(new Uint8Array());
|
|
371
|
+
jest.spyOn(Helper, 'getMLSDeviceStatus').mockReturnValueOnce(Helper.MLSDeviceStatus.REGISTERED);
|
|
372
|
+
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
342
373
|
jest
|
|
343
374
|
.spyOn(apiClient.api.client, 'getMLSKeyPackageCount')
|
|
344
375
|
.mockResolvedValueOnce(mlsService['minRequiredKeyPackages'] - 1);
|
|
345
|
-
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages').mockResolvedValueOnce(undefined);
|
|
346
376
|
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
347
377
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
348
378
|
expect(apiClient.api.client.uploadMLSKeyPackages).toHaveBeenCalledWith(mockClientId, expect.anything());
|
|
@@ -357,6 +387,7 @@ describe('MLSService', () => {
|
|
|
357
387
|
jest.spyOn(apiClient.api.client, 'getMLSKeyPackageCount').mockResolvedValueOnce(mlsService.config.nbKeyPackages);
|
|
358
388
|
jest.spyOn(apiClient.api.client, 'uploadMLSKeyPackages');
|
|
359
389
|
jest.spyOn(apiClient.api.client, 'putClient');
|
|
390
|
+
jest.spyOn(coreCrypto, 'clientPublicKey').mockResolvedValueOnce(new Uint8Array());
|
|
360
391
|
await mlsService.initClient(mockUserId, mockClient, defaultMLSInitConfig);
|
|
361
392
|
expect(coreCrypto.mlsInit).toHaveBeenCalled();
|
|
362
393
|
expect(apiClient.api.client.uploadMLSKeyPackages).not.toHaveBeenCalled();
|
|
@@ -442,7 +473,10 @@ describe('MLSService', () => {
|
|
|
442
473
|
};
|
|
443
474
|
await mlsService.handleMLSMessageAddEvent(mockedMLSWelcomeEvent, getGroupIdFromConversationId);
|
|
444
475
|
expect(mockCoreCrypto.transaction).toHaveBeenCalled();
|
|
445
|
-
expect(mlsService.emit).toHaveBeenCalledWith(
|
|
476
|
+
expect(mlsService.emit).toHaveBeenCalledWith(MLSService_1.MLSServiceEvents.NEW_EPOCH, {
|
|
477
|
+
epoch: mockedNewEpoch,
|
|
478
|
+
groupId: mockGroupId,
|
|
479
|
+
});
|
|
446
480
|
});
|
|
447
481
|
it('handles pending propoals with a delay after decrypting a message', async () => {
|
|
448
482
|
const [mlsService, { coreCrypto: mockCoreCrypto }] = await createMLSService();
|
|
@@ -2,6 +2,7 @@ import { CRUDEngine } from '@wireapp/store-engine';
|
|
|
2
2
|
/**
|
|
3
3
|
* Will remove any information relative to the client identity.
|
|
4
4
|
* @param storeEngine The engine that currently holds the identity information
|
|
5
|
+
* @param spareKeys If true, the keys table will not be deleted
|
|
5
6
|
*/
|
|
6
|
-
export declare function deleteIdentity(storeEngine: CRUDEngine): Promise<boolean[]>;
|
|
7
|
+
export declare function deleteIdentity(storeEngine: CRUDEngine, spareKeys?: boolean): Promise<boolean[]>;
|
|
7
8
|
//# sourceMappingURL=identityClearer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityClearer.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/identityClearer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKjD
|
|
1
|
+
{"version":3,"file":"identityClearer.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/identityClearer.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKjD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAW7F"}
|
|
@@ -24,9 +24,15 @@ const IDENTITY_STORES = ['amplify', 'clients', 'keys', 'prekeys', 'sessions', 'g
|
|
|
24
24
|
/**
|
|
25
25
|
* Will remove any information relative to the client identity.
|
|
26
26
|
* @param storeEngine The engine that currently holds the identity information
|
|
27
|
+
* @param spareKeys If true, the keys table will not be deleted
|
|
27
28
|
*/
|
|
28
|
-
function deleteIdentity(storeEngine) {
|
|
29
|
+
function deleteIdentity(storeEngine, spareKeys = false) {
|
|
29
30
|
return Promise.all(
|
|
30
31
|
//make sure we use enum's lowercase values, not uppercase keys
|
|
31
|
-
IDENTITY_STORES.map(store =>
|
|
32
|
+
IDENTITY_STORES.map(store => {
|
|
33
|
+
if (store === 'keys' && spareKeys) {
|
|
34
|
+
return Promise.resolve(true);
|
|
35
|
+
}
|
|
36
|
+
return storeEngine.deleteAll(store);
|
|
37
|
+
}));
|
|
32
38
|
}
|
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.40.0",
|
|
15
15
|
"@wireapp/commons": "^5.4.2",
|
|
16
16
|
"@wireapp/core-crypto": "3.1.0",
|
|
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.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "46.22.0",
|
|
65
|
+
"gitHead": "d8caceea19fd33982ceae59e6bdf4d9e863d3c6f"
|
|
66
66
|
}
|