@wireapp/core 43.1.3 → 43.2.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 +1 -2
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +6 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +3 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +17 -3
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +29 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +19 -7
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +3 -2
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +5 -4
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +7 -1
- package/lib/util/fullyQualifiedClientIdUtils.d.ts +3 -2
- package/lib/util/fullyQualifiedClientIdUtils.d.ts.map +1 -1
- package/package.json +6 -6
package/lib/Account.d.ts
CHANGED
|
@@ -117,11 +117,10 @@ export declare class Account extends TypedEventEmitter<Events> {
|
|
|
117
117
|
useAPIVersion(min: number, max: number, allowDev?: boolean): Promise<BackendFeatures>;
|
|
118
118
|
private persistCookie;
|
|
119
119
|
private getE2EIStatus;
|
|
120
|
-
enrollE2EI({ displayName, handle, discoveryUrl,
|
|
120
|
+
enrollE2EI({ displayName, handle, discoveryUrl, oAuthIdToken, }: {
|
|
121
121
|
displayName: string;
|
|
122
122
|
handle: string;
|
|
123
123
|
discoveryUrl: string;
|
|
124
|
-
refreshActiveCertificate?: boolean;
|
|
125
124
|
oAuthIdToken?: string;
|
|
126
125
|
}): Promise<AcmeChallenge | boolean>;
|
|
127
126
|
get clientId(): string;
|
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;AASxD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,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,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAO,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,8BAA8B,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AmB,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;IA2FnB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,kBAAkB;YAIZ,UAAU;IAsBxB,OAAO,CAAC,yBAAyB,CAS/B;CACH"}
|
package/lib/Account.js
CHANGED
|
@@ -186,7 +186,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
186
186
|
isFeatureEnabled: clientCanUseE2EI && teamCanUseE2EI,
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
async enrollE2EI({ displayName, handle, discoveryUrl,
|
|
189
|
+
async enrollE2EI({ displayName, handle, discoveryUrl, oAuthIdToken, }) {
|
|
190
190
|
var _a, _b, _c;
|
|
191
191
|
const context = this.apiClient.context;
|
|
192
192
|
const domain = (_a = context === null || context === void 0 ? void 0 : context.domain) !== null && _a !== void 0 ? _a : '';
|
|
@@ -203,7 +203,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
203
203
|
domain,
|
|
204
204
|
id: this.userId,
|
|
205
205
|
};
|
|
206
|
-
return this.service.mls.enrollE2EI(discoveryUrl, this.service.e2eIdentity, user, this.currentClient, this.nbPrekeys,
|
|
206
|
+
return this.service.mls.enrollE2EI(discoveryUrl, this.service.e2eIdentity, user, this.currentClient, this.nbPrekeys, oAuthIdToken);
|
|
207
207
|
}
|
|
208
208
|
get clientId() {
|
|
209
209
|
return this.apiClient.validatedClientId;
|
|
@@ -343,15 +343,15 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
343
343
|
const assetService = new conversation_1.AssetService(this.apiClient);
|
|
344
344
|
const [clientType, cryptoClient] = await this.buildCryptoClient(context, this.storeEngine);
|
|
345
345
|
let mlsService;
|
|
346
|
-
let
|
|
346
|
+
let e2eServiceExternal;
|
|
347
347
|
const proteusService = new proteus_1.ProteusService(this.apiClient, cryptoClient, {
|
|
348
348
|
onNewClient: payload => this.emit(EVENTS.NEW_SESSION, payload),
|
|
349
349
|
nbPrekeys: this.nbPrekeys,
|
|
350
350
|
});
|
|
351
351
|
const clientService = new client_2.ClientService(this.apiClient, proteusService, this.storeEngine);
|
|
352
352
|
if (clientType === CryptoClient_1.CryptoClientType.CORE_CRYPTO && (await this.isMlsEnabled())) {
|
|
353
|
-
|
|
354
|
-
mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, Object.assign({}, (_a = this.coreCryptoConfig) === null || _a === void 0 ? void 0 : _a.mls));
|
|
353
|
+
e2eServiceExternal = new E2EIdentityService_1.E2EIServiceExternal(cryptoClient.getNativeClient(), clientService);
|
|
354
|
+
mlsService = new mls_1.MLSService(this.apiClient, cryptoClient.getNativeClient(), this.db, this.recurringTaskScheduler, e2eServiceExternal, Object.assign({}, (_a = this.coreCryptoConfig) === null || _a === void 0 ? void 0 : _a.mls));
|
|
355
355
|
}
|
|
356
356
|
const connectionService = new connection_1.ConnectionService(this.apiClient);
|
|
357
357
|
const giphyService = new giphy_1.GiphyService(this.apiClient);
|
|
@@ -364,7 +364,7 @@ class Account extends commons_1.TypedEventEmitter {
|
|
|
364
364
|
const broadcastService = new broadcast_1.BroadcastService(this.apiClient, proteusService);
|
|
365
365
|
const userService = new user_1.UserService(this.apiClient);
|
|
366
366
|
this.service = {
|
|
367
|
-
e2eIdentity:
|
|
367
|
+
e2eIdentity: e2eServiceExternal,
|
|
368
368
|
mls: mlsService,
|
|
369
369
|
proteus: proteusService,
|
|
370
370
|
account: accountService,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
2
|
-
import { Ciphersuite, CoreCrypto, E2eiConversationState, WireIdentity } from '@wireapp/core-crypto';
|
|
2
|
+
import { Ciphersuite, CoreCrypto, E2eiConversationState, WireIdentity, DeviceStatus } from '@wireapp/core-crypto';
|
|
3
3
|
import { ClientService } from '../../../client';
|
|
4
|
-
export type DeviceIdentity = Omit<WireIdentity, 'free'> & {
|
|
4
|
+
export type DeviceIdentity = Omit<WireIdentity, 'free' | 'status'> & {
|
|
5
|
+
status?: DeviceStatus;
|
|
5
6
|
deviceId: string;
|
|
6
7
|
};
|
|
7
8
|
export declare class E2EIServiceExternal {
|
|
@@ -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,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAKhH,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC;AAG/G,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;IA6CnG,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"}
|
|
@@ -62,10 +62,24 @@ class E2EIServiceExternal {
|
|
|
62
62
|
return this.coreCryptoClient.e2eiIsEnabled(ciphersuite);
|
|
63
63
|
}
|
|
64
64
|
async getUsersIdentities(groupId, userIds) {
|
|
65
|
-
const
|
|
65
|
+
const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
|
|
66
|
+
const textDecoder = new TextDecoder();
|
|
67
|
+
// we get all the devices that have an identity (either valid, expired or revoked)
|
|
68
|
+
const userIdentities = await this.coreCryptoClient.getUserIdentities(groupIdBytes, userIds.map(userId => userId.id));
|
|
69
|
+
// We get all the devices in the conversation (in order to get devices that have no identity)
|
|
70
|
+
const allUsersMLSDevices = (await this.coreCryptoClient.getClientIds(groupIdBytes))
|
|
71
|
+
.map(id => textDecoder.decode(id))
|
|
72
|
+
.map(fullyQualifiedId => (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(fullyQualifiedId));
|
|
66
73
|
const mappedUserIdentities = new Map();
|
|
67
|
-
for (const
|
|
68
|
-
|
|
74
|
+
for (const userId of userIds) {
|
|
75
|
+
const identities = (userIdentities.get(userId.id) || []).map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.client_id).client })));
|
|
76
|
+
const basicMLSDevices = allUsersMLSDevices
|
|
77
|
+
.filter(({ user }) => user === userId.id)
|
|
78
|
+
// filtering devices that have a valid identity
|
|
79
|
+
.filter(({ client }) => !identities.map(identity => identity.deviceId).includes(client))
|
|
80
|
+
// map basic MLS devices to "fake" identity object
|
|
81
|
+
.map(id => (Object.assign(Object.assign({}, id), { deviceId: id.client, thumbprint: '', user: '', certificate: '', displayName: '', handle: '', clientId: id.client })));
|
|
82
|
+
mappedUserIdentities.set(userId.id, [...identities, ...basicMLSDevices]);
|
|
69
83
|
}
|
|
70
84
|
return mappedUserIdentities;
|
|
71
85
|
}
|
|
@@ -19,16 +19,18 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
const E2EIServiceExternal_1 = require("./E2EIServiceExternal");
|
|
22
|
+
const PayloadHelper_1 = require("../../../test/PayloadHelper");
|
|
22
23
|
function buildE2EIService() {
|
|
23
24
|
const coreCrypto = {
|
|
24
25
|
getUserIdentities: jest.fn(),
|
|
26
|
+
getClientIds: jest.fn().mockResolvedValue([]),
|
|
25
27
|
};
|
|
26
28
|
const clientService = {};
|
|
27
29
|
return [new E2EIServiceExternal_1.E2EIServiceExternal(coreCrypto, clientService), { coreCrypto }];
|
|
28
30
|
}
|
|
29
|
-
function generateCoreCryptoIdentity({ status = 'Valid', deviceId =
|
|
31
|
+
function generateCoreCryptoIdentity({ userId, status = 'Valid', deviceId = (0, PayloadHelper_1.getUUID)(), }) {
|
|
30
32
|
return {
|
|
31
|
-
client_id:
|
|
33
|
+
client_id: `${userId}:${deviceId}@elna.wire.link`,
|
|
32
34
|
handle: 'adrian_wire2@elna.wire.link',
|
|
33
35
|
display_name: 'Adrian Weiss 2',
|
|
34
36
|
domain: 'elna.wire.link',
|
|
@@ -46,12 +48,33 @@ describe('E2EIServiceExternal', () => {
|
|
|
46
48
|
const user2 = { domain: 'elna.wire.link', id: 'b7d287e4-7bbd-40e0-a550-6b18dcaf5f31' };
|
|
47
49
|
const userIds = [user1, user2];
|
|
48
50
|
coreCrypto.getUserIdentities.mockResolvedValue(new Map([
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
+
[user1.id, [generateCoreCryptoIdentity({ userId: user1.id }), generateCoreCryptoIdentity({ userId: user1.id })]],
|
|
52
|
+
[user2.id, [generateCoreCryptoIdentity({ userId: user2.id })]],
|
|
51
53
|
]));
|
|
52
54
|
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
53
|
-
expect(userIdentities.get(user1.id)).
|
|
54
|
-
expect(userIdentities.get(user2.id)).
|
|
55
|
+
expect(userIdentities.get(user1.id)).toHaveLength(2);
|
|
56
|
+
expect(userIdentities.get(user2.id)).toHaveLength(1);
|
|
57
|
+
});
|
|
58
|
+
it('returns MLS basic devices with empty identity', async () => {
|
|
59
|
+
const [service, { coreCrypto }] = buildE2EIService();
|
|
60
|
+
const user1 = { domain: 'elna.wire.link', id: '48a1c3b0-4b0e-4bcd-93ad-64c7344b1534' };
|
|
61
|
+
const user2 = { domain: 'elna.wire.link', id: 'b7d287e4-7bbd-40e0-a550-6b18dcaf5f31' };
|
|
62
|
+
const userIds = [user1, user2];
|
|
63
|
+
const user1Identities = [
|
|
64
|
+
generateCoreCryptoIdentity({ userId: user1.id }),
|
|
65
|
+
generateCoreCryptoIdentity({ userId: user1.id }),
|
|
66
|
+
];
|
|
67
|
+
const encoder = new TextEncoder();
|
|
68
|
+
coreCrypto.getUserIdentities.mockResolvedValue(new Map([[user1.id, user1Identities]]));
|
|
69
|
+
const allClients = [
|
|
70
|
+
...user1Identities.map(identity => identity.client_id),
|
|
71
|
+
`${user1.id}:74a50c1f4352b41f@elna.wire.link`,
|
|
72
|
+
`${user2.id}:452cb4c65f0369a8@elna.wire.link`,
|
|
73
|
+
];
|
|
74
|
+
coreCrypto.getClientIds.mockResolvedValue(allClients.map(clientId => encoder.encode(clientId)));
|
|
75
|
+
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
76
|
+
expect(userIdentities.get(user1.id)).toHaveLength(3);
|
|
77
|
+
expect(userIdentities.get(user2.id)).toHaveLength(1);
|
|
55
78
|
});
|
|
56
79
|
});
|
|
57
80
|
});
|
|
@@ -11,7 +11,7 @@ declare class E2EIServiceInternal {
|
|
|
11
11
|
private isInitialized;
|
|
12
12
|
private constructor();
|
|
13
13
|
static getInstance(params?: InitParams): Promise<E2EIServiceInternal>;
|
|
14
|
-
startCertificateProcess(
|
|
14
|
+
startCertificateProcess(): Promise<AcmeChallenge | undefined>;
|
|
15
15
|
continueCertificateProcess(oAuthIdToken: string): Promise<RotateBundle | undefined>;
|
|
16
16
|
private initIdentity;
|
|
17
17
|
private exitWithError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2EIServiceInternal.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,aAAa,EAKb,UAAU,EACV,YAAY,EACb,MAAM,qBAAqB,CAAC;AAW7B,cAAM,mBAAmB;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAC9E,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAa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C;IAgD9C;;;;;;;OAOG;YACW,sCAAsC;IA2EpD;;;OAGG;YACW,iBAAiB;IA0B/B;;;;;;OAMG;YACW,iBAAiB;IAmB/B;;;;;OAKG;IACU,0BAA0B,CAAC,YAAY,EAAE,MAAM;CAkB7D;AAED,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
|
|
@@ -63,12 +63,12 @@ class E2EIServiceInternal {
|
|
|
63
63
|
}
|
|
64
64
|
return E2EIServiceInternal.instance;
|
|
65
65
|
}
|
|
66
|
-
async startCertificateProcess(
|
|
66
|
+
async startCertificateProcess() {
|
|
67
67
|
// Step 0: Check if we have a handle in local storage
|
|
68
68
|
// If we don't have a handle, we need to start a new OAuth flow
|
|
69
69
|
try {
|
|
70
70
|
// Initialize the identity
|
|
71
|
-
await this.initIdentity(
|
|
71
|
+
await this.initIdentity();
|
|
72
72
|
return this.startNewOAuthFlow();
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
@@ -89,13 +89,19 @@ class E2EIServiceInternal {
|
|
|
89
89
|
return undefined;
|
|
90
90
|
}
|
|
91
91
|
// ############ Internal Functions ############
|
|
92
|
-
async initIdentity(
|
|
92
|
+
async initIdentity() {
|
|
93
93
|
const { clientId, user } = E2EIStorage_1.E2EIStorage.get.initialData();
|
|
94
94
|
const e2eiClientId = (0, Helper_1.getE2EIClientId)(clientId, user.id, user.domain).asString;
|
|
95
95
|
const expiryDays = 2;
|
|
96
96
|
const ciphersuite = E2EIService_types_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519;
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
if (this.e2eServiceExternal.hasActiveCertificate()) {
|
|
98
|
+
try {
|
|
99
|
+
this.identity = await this.coreCryptoClient.e2eiNewRotateEnrollment(e2eiClientId, expiryDays, ciphersuite, user.displayName, user.handle);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
this.logger.error('Error while trying to initIdentity e2eiNewRotateEnrollment', error);
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
99
105
|
}
|
|
100
106
|
else {
|
|
101
107
|
this.identity = await this.coreCryptoClient.e2eiNewActivationEnrollment(e2eiClientId, user.displayName, user.handle, expiryDays, ciphersuite);
|
|
@@ -260,7 +266,13 @@ class E2EIServiceInternal {
|
|
|
260
266
|
}
|
|
261
267
|
E2EIStorage_1.E2EIStorage.store.certificate(certificate);
|
|
262
268
|
// Step 10: Initialize MLS with the certificate
|
|
263
|
-
|
|
269
|
+
try {
|
|
270
|
+
return await this.coreCryptoClient.e2eiRotateAll(this.identity, certificate, this.keyPackagesAmount);
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
this.logger.error('Error while e2eiRotateAll', error);
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
264
276
|
}
|
|
265
277
|
/**
|
|
266
278
|
* This function starts a new ACME enrollment flow for either a new client
|
|
@@ -322,7 +334,7 @@ class E2EIServiceInternal {
|
|
|
322
334
|
return this.exitWithError('Error while trying to continue OAuth flow. AcmeService is not initialized');
|
|
323
335
|
}
|
|
324
336
|
// We need to initialize the identity
|
|
325
|
-
await this.initIdentity(
|
|
337
|
+
await this.initIdentity();
|
|
326
338
|
await this.getAndStoreInitialEnrollmentData();
|
|
327
339
|
return await this.getRotateBundleAndStoreCertificateData(oAuthIdToken);
|
|
328
340
|
}
|
|
@@ -30,11 +30,12 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
30
30
|
private readonly coreCryptoClient;
|
|
31
31
|
private readonly coreDatabase;
|
|
32
32
|
private readonly recurringTaskScheduler;
|
|
33
|
+
private readonly e2eServiceExternal;
|
|
33
34
|
logger: logdown.Logger;
|
|
34
35
|
config: LocalMLSServiceConfig;
|
|
35
36
|
private readonly textEncoder;
|
|
36
37
|
private readonly textDecoder;
|
|
37
|
-
constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, coreDatabase: CoreDatabase, recurringTaskScheduler: RecurringTaskScheduler, { keyingMaterialUpdateThreshold, nbKeyPackages, cipherSuite, }: Partial<MLSServiceConfig>);
|
|
38
|
+
constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, coreDatabase: CoreDatabase, recurringTaskScheduler: RecurringTaskScheduler, e2eServiceExternal: E2EIServiceExternal, { keyingMaterialUpdateThreshold, nbKeyPackages, cipherSuite, }: Partial<MLSServiceConfig>);
|
|
38
39
|
initClient(userId: QualifiedId, client: RegisteredClient, blockKeypackageUpload?: boolean): Promise<void>;
|
|
39
40
|
private getCredentialType;
|
|
40
41
|
private readonly uploadCommitBundle;
|
|
@@ -209,7 +210,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
|
|
|
209
210
|
* @param oAuthIdToken The OAuth id token if the user is already authenticated
|
|
210
211
|
* @returns AcmeChallenge if the user is not authenticated, true if the user is authenticated
|
|
211
212
|
*/
|
|
212
|
-
enrollE2EI(discoveryUrl: string, e2eiServiceExternal: E2EIServiceExternal, user: User, client: RegisteredClient, nbPrekeys: number,
|
|
213
|
+
enrollE2EI(discoveryUrl: string, e2eiServiceExternal: E2EIServiceExternal, user: User, client: RegisteredClient, nbPrekeys: number, oAuthIdToken?: string): Promise<AcmeChallenge | boolean>;
|
|
213
214
|
}
|
|
214
215
|
export {};
|
|
215
216
|
//# sourceMappingURL=MLSService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAqB,gBAAgB,EAAC,MAAM,gCAAgC,CAAC;AACzF,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;AAEzD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OA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C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;CA4DpC"}
|
|
@@ -58,12 +58,13 @@ const defaultConfig = {
|
|
|
58
58
|
cipherSuite: core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519,
|
|
59
59
|
};
|
|
60
60
|
class MLSService extends commons_1.TypedEventEmitter {
|
|
61
|
-
constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler, { keyingMaterialUpdateThreshold = defaultConfig.keyingMaterialUpdateThreshold, nbKeyPackages = defaultConfig.nbKeyPackages, cipherSuite = defaultConfig.cipherSuite, }) {
|
|
61
|
+
constructor(apiClient, coreCryptoClient, coreDatabase, recurringTaskScheduler, e2eServiceExternal, { keyingMaterialUpdateThreshold = defaultConfig.keyingMaterialUpdateThreshold, nbKeyPackages = defaultConfig.nbKeyPackages, cipherSuite = defaultConfig.cipherSuite, }) {
|
|
62
62
|
super();
|
|
63
63
|
this.apiClient = apiClient;
|
|
64
64
|
this.coreCryptoClient = coreCryptoClient;
|
|
65
65
|
this.coreDatabase = coreDatabase;
|
|
66
66
|
this.recurringTaskScheduler = recurringTaskScheduler;
|
|
67
|
+
this.e2eServiceExternal = e2eServiceExternal;
|
|
67
68
|
this.logger = (0, logdown_1.default)('@wireapp/core/MLSService');
|
|
68
69
|
this.textEncoder = new TextEncoder();
|
|
69
70
|
this.textDecoder = new TextDecoder();
|
|
@@ -613,7 +614,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
613
614
|
* @param oAuthIdToken The OAuth id token if the user is already authenticated
|
|
614
615
|
* @returns AcmeChallenge if the user is not authenticated, true if the user is authenticated
|
|
615
616
|
*/
|
|
616
|
-
async enrollE2EI(discoveryUrl, e2eiServiceExternal, user, client, nbPrekeys,
|
|
617
|
+
async enrollE2EI(discoveryUrl, e2eiServiceExternal, user, client, nbPrekeys, oAuthIdToken) {
|
|
617
618
|
try {
|
|
618
619
|
const instance = await E2EIServiceInternal_1.E2EIServiceInternal.getInstance({
|
|
619
620
|
apiClient: this.apiClient,
|
|
@@ -626,7 +627,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
626
627
|
});
|
|
627
628
|
// If we don't have an OAuth id token, we need to start the certificate process with Oauth
|
|
628
629
|
if (!oAuthIdToken) {
|
|
629
|
-
const challengeData = await instance.startCertificateProcess(
|
|
630
|
+
const challengeData = await instance.startCertificateProcess();
|
|
630
631
|
if (challengeData) {
|
|
631
632
|
return challengeData;
|
|
632
633
|
}
|
|
@@ -635,7 +636,7 @@ class MLSService extends commons_1.TypedEventEmitter {
|
|
|
635
636
|
else {
|
|
636
637
|
let rotateBundle;
|
|
637
638
|
// If we are not refreshing the active certificate, we need to continue the certificate process with Oauth
|
|
638
|
-
if (!
|
|
639
|
+
if (!this.e2eServiceExternal.hasActiveCertificate()) {
|
|
639
640
|
rotateBundle = await instance.continueCertificateProcess(oAuthIdToken);
|
|
640
641
|
// If we are refreshing the active certificate, can start the refresh process
|
|
641
642
|
}
|
|
@@ -28,12 +28,18 @@ const MLSService_1 = require("./MLSService");
|
|
|
28
28
|
const CoreDB_1 = require("../../../storage/CoreDB");
|
|
29
29
|
const RecurringTaskScheduler_1 = require("../../../util/RecurringTaskScheduler");
|
|
30
30
|
const TaskScheduler_1 = require("../../../util/TaskScheduler");
|
|
31
|
+
const E2EIdentityService_1 = require("../E2EIdentityService");
|
|
31
32
|
jest.createMockFromModule('@wireapp/api-client');
|
|
32
33
|
function createUserId() {
|
|
33
34
|
return { id: (0, crypto_1.randomUUID)(), domain: '' };
|
|
34
35
|
}
|
|
36
|
+
const coreCrypto = {
|
|
37
|
+
getUserIdentities: jest.fn(),
|
|
38
|
+
};
|
|
39
|
+
const clientService = {};
|
|
35
40
|
const createMLSService = async () => {
|
|
36
41
|
const apiClient = new api_client_1.APIClient();
|
|
42
|
+
const e2eServiceExternal = new E2EIdentityService_1.E2EIServiceExternal(coreCrypto, clientService);
|
|
37
43
|
const mockCoreCrypto = {
|
|
38
44
|
createConversation: jest.fn(),
|
|
39
45
|
conversationExists: jest.fn(),
|
|
@@ -57,7 +63,7 @@ const createMLSService = async () => {
|
|
|
57
63
|
await mockedDb.put('recurringTasks', { key, firingDate: timestamp });
|
|
58
64
|
},
|
|
59
65
|
});
|
|
60
|
-
const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler, {});
|
|
66
|
+
const mlsService = new MLSService_1.MLSService(apiClient, mockCoreCrypto, mockedDb, recurringTaskScheduler, e2eServiceExternal, {});
|
|
61
67
|
return [mlsService, { apiClient, coreCrypto: mockCoreCrypto, recurringTaskScheduler }];
|
|
62
68
|
};
|
|
63
69
|
describe('MLSService', () => {
|
|
@@ -3,12 +3,13 @@ type UserId = string;
|
|
|
3
3
|
type ClientId = string;
|
|
4
4
|
type Domain = string;
|
|
5
5
|
export type ClientIdStringType = `${UserId}:${ClientId}@${Domain}`;
|
|
6
|
-
export
|
|
7
|
-
export declare const parseFullQualifiedClientId: (qualifiedId: string) => {
|
|
6
|
+
export type ParsedFullyQualifiedId = {
|
|
8
7
|
user: UserId;
|
|
9
8
|
client: ClientId;
|
|
10
9
|
domain: Domain;
|
|
11
10
|
};
|
|
11
|
+
export declare const constructFullyQualifiedClientId: (userId: UserId, clientId: ClientId, domain: Domain) => ClientIdStringType;
|
|
12
|
+
export declare const parseFullQualifiedClientId: (qualifiedId: string) => ParsedFullyQualifiedId;
|
|
12
13
|
export declare const mapQualifiedUserClientIdsToFullyQualifiedClientIds: (qualifiedUserMap: QualifiedUserClientMap) => `${string}:${string}@${string}`[];
|
|
13
14
|
export {};
|
|
14
15
|
//# sourceMappingURL=fullyQualifiedClientIdUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fullyQualifiedClientIdUtils.d.ts","sourceRoot":"","sources":["../../src/util/fullyQualifiedClientIdUtils.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,QAAQ,GAAG,MAAM,CAAC;AACvB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,MAAM,MAAM,kBAAkB,GAAG,GAAG,MAAM,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"fullyQualifiedClientIdUtils.d.ts","sourceRoot":"","sources":["../../src/util/fullyQualifiedClientIdUtils.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,QAAQ,GAAG,MAAM,CAAC;AACvB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,MAAM,MAAM,kBAAkB,GAAG,GAAG,MAAM,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAC;AAEtF,eAAO,MAAM,+BAA+B,WAClC,MAAM,YACJ,QAAQ,UACV,MAAM,KACb,kBAAuD,CAAC;AAE3D,eAAO,MAAM,0BAA0B,gBAAiB,MAAM,KAAG,sBAOhE,CAAC;AAEF,eAAO,MAAM,kDAAkD,qBAAsB,sBAAsB,sCAO1G,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^26.7.
|
|
14
|
+
"@wireapp/api-client": "^26.7.2",
|
|
15
15
|
"@wireapp/commons": "^5.2.3",
|
|
16
16
|
"@wireapp/core-crypto": "1.0.0-rc.21",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/promise-queue": "^2.2.8",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.44.0",
|
|
20
|
-
"@wireapp/store-engine": "5.1.
|
|
21
|
-
"@wireapp/store-engine-dexie": "^2.1.
|
|
20
|
+
"@wireapp/store-engine": "5.1.5",
|
|
21
|
+
"@wireapp/store-engine-dexie": "^2.1.7",
|
|
22
22
|
"axios": "1.6.2",
|
|
23
|
-
"bazinga64": "^6.3.
|
|
23
|
+
"bazinga64": "^6.3.4",
|
|
24
24
|
"deepmerge-ts": "5.1.0",
|
|
25
25
|
"hash.js": "1.1.7",
|
|
26
26
|
"http-status-codes": "2.3.0",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"test:coverage": "jest --coverage",
|
|
62
62
|
"watch": "tsc --watch"
|
|
63
63
|
},
|
|
64
|
-
"version": "43.
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"version": "43.2.0",
|
|
65
|
+
"gitHead": "f0bbee291bcfee2d3a4ea43759a08f15cf5535b8"
|
|
66
66
|
}
|