@wireapp/core 42.23.1 → 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.js +4 -4
- 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.js
CHANGED
|
@@ -324,10 +324,6 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
324
324
|
const [clientType, cryptoClient] = await this.buildCryptoClient(context, this.storeEngine);
|
|
325
325
|
let mlsService;
|
|
326
326
|
let e2eIdentityService;
|
|
327
|
-
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.isMlsEnabled())) {
|
|
328
|
-
e2eIdentityService = new E2EIdentityService_1.E2EIServiceExternal(cryptoClient.getNativeClient());
|
|
329
|
-
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));
|
|
330
|
-
}
|
|
331
327
|
const proteusService = new proteus_1.ProteusService(this.apiClient, cryptoClient, {
|
|
332
328
|
onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
|
|
333
329
|
nbPrekeys: this.nbPrekeys,
|
|
@@ -343,6 +339,10 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
343
339
|
const teamService = new team_2.TeamService(this.apiClient);
|
|
344
340
|
const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
|
|
345
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
|
+
}
|
|
346
346
|
this.service = {
|
|
347
347
|
e2eIdentity: e2eIdentityService,
|
|
348
348
|
mls: mlsService,
|
|
@@ -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
|
}
|