@wireapp/core 42.23.0 → 42.24.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 +3 -1
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +13 -8
- package/lib/Account.test.js +12 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +5 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +6 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +2 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +1 -2
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +1 -1
- package/package.json +3 -3
package/lib/Account.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
72
72
|
private readonly nbPrekeys;
|
|
73
73
|
private readonly cryptoProtocolConfig?;
|
|
74
74
|
private readonly isMlsEnabled;
|
|
75
|
+
/** this is the client the consumer is currently using. Will be set as soon as `initClient` is called and will be rest upon logout */
|
|
76
|
+
private currentClient?;
|
|
75
77
|
private storeEngine?;
|
|
76
78
|
private db?;
|
|
77
79
|
private coreCallbacks?;
|
|
@@ -115,7 +117,7 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
115
117
|
useAPIVersion(min: number, max: number, allowDev?: boolean): Promise<BackendFeatures>;
|
|
116
118
|
private persistCookie;
|
|
117
119
|
private getE2EIStatus;
|
|
118
|
-
enrollE2EI(displayName: string, handle: string, discoveryUrl: string,
|
|
120
|
+
enrollE2EI(displayName: string, handle: string, discoveryUrl: string, oAuthIdToken?: string): Promise<AcmeChallenge | boolean>;
|
|
119
121
|
get clientId(): string;
|
|
120
122
|
get userId(): string;
|
|
121
123
|
/**
|
package/lib/Account.d.ts.map
CHANGED
|
@@ -1 +1 @@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H,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;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;IAsBxB,OAAO,CAAC,yBAAyB,CAS/B;CACH"}
|
package/lib/Account.js
CHANGED
|
@@ -162,10 +162,13 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
162
162
|
isFeatureEnabled: ((_a = features[team_1.FEATURE_KEY.MLSE2EID]) === null || _a === void 0 ? void 0 : _a.status) === team_1.FeatureStatus.ENABLED,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
async enrollE2EI(displayName, handle, discoveryUrl,
|
|
165
|
+
async enrollE2EI(displayName, handle, discoveryUrl, oAuthIdToken) {
|
|
166
166
|
var _a, _b, _c;
|
|
167
167
|
const context = this.apiClient.context;
|
|
168
168
|
const domain = (_a = context === null || context === void 0 ? void 0 : context.domain) !== null && _a !== void 0 ? _a : '';
|
|
169
|
+
if (!this.currentClient) {
|
|
170
|
+
throw new Error('Client has not been initialized - please login first');
|
|
171
|
+
}
|
|
169
172
|
if (!((_b = this.service) === null || _b === void 0 ? void 0 : _b.mls) || !((_c = this.service) === null || _c === void 0 ? void 0 : _c.e2eIdentity)) {
|
|
170
173
|
this.logger.info('MLS not initialized, unable to enroll E2EI');
|
|
171
174
|
return false;
|
|
@@ -176,7 +179,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
176
179
|
domain,
|
|
177
180
|
id: this.userId,
|
|
178
181
|
};
|
|
179
|
-
return this.service.mls.enrollE2EI(discoveryUrl, this.service.e2eIdentity, user,
|
|
182
|
+
return this.service.mls.enrollE2EI(discoveryUrl, this.service.e2eIdentity, user, this.currentClient, this.nbPrekeys, oAuthIdToken);
|
|
180
183
|
}
|
|
181
184
|
get clientId() {
|
|
182
185
|
return this.apiClient.validatedClientId;
|
|
@@ -275,6 +278,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
275
278
|
// leave stale conference subconversations (e.g after a crash)
|
|
276
279
|
await this.service.subconversation.leaveStaleConferenceSubconversations();
|
|
277
280
|
}
|
|
281
|
+
this.currentClient = validClient;
|
|
278
282
|
return validClient;
|
|
279
283
|
}
|
|
280
284
|
async buildCryptoClient(context, storeEngine) {
|
|
@@ -320,10 +324,6 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
320
324
|
const [clientType, cryptoClient] = await this.buildCryptoClient(context, this.storeEngine);
|
|
321
325
|
let mlsService;
|
|
322
326
|
let e2eIdentityService;
|
|
323
|
-
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.isMlsEnabled())) {
|
|
324
|
-
e2eIdentityService = new E2EIdentityService_1.E2EIServiceExternal(cryptoClient.getNativeClient());
|
|
325
|
-
mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, Object.assign({}, (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls));
|
|
326
|
-
}
|
|
327
327
|
const proteusService = new proteus_1.ProteusService(this.apiClient, cryptoClient, {
|
|
328
328
|
onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
|
|
329
329
|
nbPrekeys: this.nbPrekeys,
|
|
@@ -339,6 +339,10 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
339
339
|
const teamService = new team_2.TeamService(this.apiClient);
|
|
340
340
|
const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
|
|
341
341
|
const userService = new user_1.UserService(this.apiClient);
|
|
342
|
+
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.isMlsEnabled())) {
|
|
343
|
+
e2eIdentityService = new E2EIdentityService_1.E2EIServiceExternal(cryptoClient.getNativeClient(), clientService);
|
|
344
|
+
mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, Object.assign({}, (_a = this.cryptoProtocolConfig) === null || _a === void 0 ? void 0 : _a.mls));
|
|
345
|
+
}
|
|
342
346
|
this.service = {
|
|
343
347
|
e2eIdentity: e2eIdentityService,
|
|
344
348
|
mls: mlsService,
|
|
@@ -359,6 +363,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
359
363
|
};
|
|
360
364
|
}
|
|
361
365
|
resetContext() {
|
|
366
|
+
this.currentClient = undefined;
|
|
362
367
|
delete this.apiClient.context;
|
|
363
368
|
delete this.service;
|
|
364
369
|
}
|
|
@@ -393,8 +398,8 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
393
398
|
* @returns close a function that will disconnect from the websocket
|
|
394
399
|
*/
|
|
395
400
|
listen({ onEvent = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, dryRun = false, } = {}) {
|
|
396
|
-
if (!this.
|
|
397
|
-
throw new Error('
|
|
401
|
+
if (!this.currentClient) {
|
|
402
|
+
throw new Error('Client has not been initialized - please login first');
|
|
398
403
|
}
|
|
399
404
|
const handleEvent = async (payload, source) => {
|
|
400
405
|
const { event } = payload;
|
package/lib/Account.test.js
CHANGED
|
@@ -162,6 +162,14 @@ describe('Account', () => {
|
|
|
162
162
|
afterEach(() => {
|
|
163
163
|
(0, nock_1.cleanAll)();
|
|
164
164
|
});
|
|
165
|
+
const currentClient = {
|
|
166
|
+
id: CLIENT_ID,
|
|
167
|
+
cookie: '',
|
|
168
|
+
time: '',
|
|
169
|
+
type: client_1.ClientType.TEMPORARY,
|
|
170
|
+
class: client_1.ClientClassification.DESKTOP,
|
|
171
|
+
mls_public_keys: {},
|
|
172
|
+
};
|
|
165
173
|
describe('"init"', () => {
|
|
166
174
|
it('initializes the Protocol buffers', async () => {
|
|
167
175
|
const account = new Account_1.Account();
|
|
@@ -218,6 +226,7 @@ describe('Account', () => {
|
|
|
218
226
|
email: 'hello@example.com',
|
|
219
227
|
password: 'my-secret',
|
|
220
228
|
});
|
|
229
|
+
account['currentClient'] = currentClient;
|
|
221
230
|
jest.spyOn(apiClient, 'connect').mockImplementation();
|
|
222
231
|
jest.spyOn(account.service.notification, 'handleEvent').mockReturnValue({
|
|
223
232
|
status: 'handled',
|
|
@@ -265,11 +274,13 @@ describe('Account', () => {
|
|
|
265
274
|
});
|
|
266
275
|
beforeEach(async () => {
|
|
267
276
|
dependencies = await createAccount();
|
|
268
|
-
|
|
277
|
+
const { account } = dependencies;
|
|
278
|
+
await account.login({
|
|
269
279
|
clientType: client_1.ClientType.TEMPORARY,
|
|
270
280
|
email: 'hello@example.com',
|
|
271
281
|
password: 'my-secret',
|
|
272
282
|
});
|
|
283
|
+
account['currentClient'] = currentClient;
|
|
273
284
|
jest
|
|
274
285
|
.spyOn(dependencies.account.service.notification, 'handleNotification')
|
|
275
286
|
.mockImplementation(notif => notif.payload);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
2
2
|
import { Ciphersuite, CoreCrypto, E2eiConversationState, WireIdentity } from '@wireapp/core-crypto';
|
|
3
|
+
import { ClientService } from '../../../client';
|
|
3
4
|
export type DeviceIdentity = Omit<WireIdentity, 'free'> & {
|
|
4
5
|
deviceId: string;
|
|
5
6
|
};
|
|
6
7
|
export declare class E2EIServiceExternal {
|
|
7
|
-
private coreCryptoClient;
|
|
8
|
+
private readonly coreCryptoClient;
|
|
9
|
+
private readonly clientService;
|
|
8
10
|
private readonly logger;
|
|
9
|
-
constructor(coreCryptoClient: CoreCrypto);
|
|
11
|
+
constructor(coreCryptoClient: CoreCrypto, clientService: ClientService);
|
|
10
12
|
hasActiveCertificate(): boolean;
|
|
11
13
|
getCertificateData(): string | undefined;
|
|
12
14
|
isEnrollmentInProgress(): boolean;
|
|
@@ -15,5 +17,6 @@ export declare class E2EIServiceExternal {
|
|
|
15
17
|
isE2EIEnabled(ciphersuite: Ciphersuite): Promise<boolean>;
|
|
16
18
|
getUsersIdentities(groupId: string, userIds: QualifiedId[]): Promise<Map<string, DeviceIdentity[]>>;
|
|
17
19
|
getDevicesIdentities(groupId: string, userClientsMap: Record<string, QualifiedId>): Promise<DeviceIdentity[]>;
|
|
20
|
+
isFreshMLSSelfClient(): Promise<boolean>;
|
|
18
21
|
}
|
|
19
22
|
//# sourceMappingURL=E2EIServiceExternal.d.ts.map
|
|
@@ -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,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;
|
|
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,WAAW,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAKlG,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAG7E,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAJhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;gBAG3D,gBAAgB,EAAE,UAAU,EAC5B,aAAa,EAAE,aAAa;IAIxC,oBAAoB,IAAI,OAAO;IAK/B,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAUxC,sBAAsB,IAAI,OAAO;IAIjC,gBAAgB,IAAI,IAAI;IAIxB,oBAAoB,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhF,aAAa,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAInD,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IA4BnG,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAef,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;CAItD"}
|
|
@@ -29,8 +29,9 @@ const E2EIStorage_1 = require("./Storage/E2EIStorage");
|
|
|
29
29
|
const fullyQualifiedClientIdUtils_1 = require("../../../util/fullyQualifiedClientIdUtils");
|
|
30
30
|
// This export is meant to be accessible from the outside (e.g the Webapp / UI)
|
|
31
31
|
class E2EIServiceExternal {
|
|
32
|
-
constructor(coreCryptoClient) {
|
|
32
|
+
constructor(coreCryptoClient, clientService) {
|
|
33
33
|
this.coreCryptoClient = coreCryptoClient;
|
|
34
|
+
this.clientService = clientService;
|
|
34
35
|
this.logger = (0, logdown_1.default)('@wireapp/core/E2EIdentityServiceExternal');
|
|
35
36
|
}
|
|
36
37
|
// Checks if there is a certificate stored in the local storage
|
|
@@ -80,5 +81,9 @@ class E2EIServiceExternal {
|
|
|
80
81
|
const deviceIdentities = await this.coreCryptoClient.getDeviceIdentities(bazinga64_1.Decoder.fromBase64(groupId).asBytes, clientIds);
|
|
81
82
|
return deviceIdentities.map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.client_id).client })));
|
|
82
83
|
}
|
|
84
|
+
async isFreshMLSSelfClient() {
|
|
85
|
+
const client = await this.clientService.loadClient();
|
|
86
|
+
return !!client && typeof client.mls_public_keys.ed25519 === 'string' && client.mls_public_keys.ed25519.length > 0;
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
exports.E2EIServiceExternal = E2EIServiceExternal;
|
|
@@ -23,7 +23,8 @@ function buildE2EIService() {
|
|
|
23
23
|
const coreCrypto = {
|
|
24
24
|
getUserIdentities: jest.fn(),
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const clientService = {};
|
|
27
|
+
return [new E2EIServiceExternal_1.E2EIServiceExternal(coreCrypto, clientService), { coreCrypto }];
|
|
27
28
|
}
|
|
28
29
|
function generateCoreCryptoIdentity({ status = 'Valid', deviceId = 'aaaaa' } = {}) {
|
|
29
30
|
return {
|
|
@@ -473,9 +473,8 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
473
473
|
* @param client Backend client data
|
|
474
474
|
*/
|
|
475
475
|
async uploadMLSPublicKeys(client) {
|
|
476
|
-
var _a;
|
|
477
476
|
// If we've already updated a client with its public key, there's no need to do it again.
|
|
478
|
-
if (
|
|
477
|
+
if (typeof client.mls_public_keys.ed25519 === 'string' && client.mls_public_keys.ed25519.length > 0) {
|
|
479
478
|
return;
|
|
480
479
|
}
|
|
481
480
|
const publicKey = await this.coreCryptoClient.clientPublicKey(this.config.defaultCiphersuite);
|
|
@@ -69,7 +69,7 @@ describe('MLSService', () => {
|
|
|
69
69
|
apiClient = mockApiClient;
|
|
70
70
|
jest
|
|
71
71
|
.spyOn(apiClient.api.client, 'getPublicKeys')
|
|
72
|
-
.mockResolvedValue({ removal: {
|
|
72
|
+
.mockResolvedValue({ removal: { ed25519: 'mXOagqRIX/RFd7QyXJA8/Ed8X+hvQgLXIiwYHm3OQFc=' } });
|
|
73
73
|
jest.spyOn(apiClient.api.client, 'claimMLSKeyPackages').mockResolvedValue({ key_packages: [] });
|
|
74
74
|
jest.spyOn(mlsService, 'scheduleKeyMaterialRenewal').mockImplementation();
|
|
75
75
|
jest.spyOn(mlsService, 'processCommitAction').mockImplementation(() => ({
|
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": "^26.
|
|
14
|
+
"@wireapp/api-client": "^26.6.0",
|
|
15
15
|
"@wireapp/commons": "^5.2.3",
|
|
16
16
|
"@wireapp/core-crypto": "1.0.0-rc.19",
|
|
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": "42.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "42.24.0",
|
|
65
|
+
"gitHead": "0399e255f145bc060cdfba9517d0c015ee38ec26"
|
|
66
66
|
}
|