@wireapp/core 45.0.13 → 45.1.1
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/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +4 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +4 -4
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +11 -10
- package/lib/util/qualifiedIdUtil.d.ts +2 -1
- package/lib/util/qualifiedIdUtil.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -3,11 +3,13 @@ import { TypedEventEmitter } from '@wireapp/commons';
|
|
|
3
3
|
import { CoreCrypto, E2eiConversationState, WireIdentity, DeviceStatus } from '@wireapp/core-crypto';
|
|
4
4
|
import { ClientService } from '../../../client';
|
|
5
5
|
import { CoreDatabase } from '../../../storage/CoreDB';
|
|
6
|
+
import { StringifiedQualifiedId } from '../../../util/qualifiedIdUtil';
|
|
6
7
|
import { RecurringTaskScheduler } from '../../../util/RecurringTaskScheduler';
|
|
7
8
|
import { MLSService } from '../MLSService';
|
|
8
9
|
export type DeviceIdentity = Omit<WireIdentity, 'free' | 'status'> & {
|
|
9
10
|
status?: DeviceStatus;
|
|
10
11
|
deviceId: string;
|
|
12
|
+
qualifiedUserId: QualifiedId;
|
|
11
13
|
};
|
|
12
14
|
type Events = {
|
|
13
15
|
crlChanged: {
|
|
@@ -27,8 +29,8 @@ export declare class E2EIServiceExternal extends TypedEventEmitter<Events> {
|
|
|
27
29
|
clearAllProgress(): Promise<void>;
|
|
28
30
|
getConversationState(conversationId: Uint8Array): Promise<E2eiConversationState>;
|
|
29
31
|
isE2EIEnabled(): Promise<boolean>;
|
|
30
|
-
getAllGroupUsersIdentities(groupId: string): Promise<Map<
|
|
31
|
-
getUsersIdentities(groupId: string, userIds: QualifiedId[]): Promise<Map<
|
|
32
|
+
getAllGroupUsersIdentities(groupId: string): Promise<Map<StringifiedQualifiedId, DeviceIdentity[]> | undefined>;
|
|
33
|
+
getUsersIdentities(groupId: string, userIds: QualifiedId[]): Promise<Map<StringifiedQualifiedId, DeviceIdentity[]> | undefined>;
|
|
32
34
|
getDevicesIdentities(groupId: string, userClientsMap: Record<string, QualifiedId>): Promise<DeviceIdentity[]>;
|
|
33
35
|
isFreshMLSSelfClient(): Promise<boolean>;
|
|
34
36
|
private registerLocalCertificateRoot;
|
|
@@ -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,EAAC,MAAM,sBAAsB,CAAC;AAMnG,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,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,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAMnG,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAC,sBAAsB,EAAuB,MAAM,+BAA+B,CAAC;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E,GACrB,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,EAAE,CAAC,GAAG,SAAS,CAAC;IAwDxD,oBAAoB,CAC/B,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;IAgBf,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;YAQvC,4BAA4B;IAO1C;;;;;OAKG;IACU,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D,OAAO,KAAK,WAAW,GAKtB;YAEa,+BAA+B;IAK7C;;;;;;;;;;;;OAYG;YACW,0BAA0B;IA6BxC,OAAO,CAAC,4BAA4B;YAStB,+BAA+B;YAQ/B,uBAAuB;YAKvB,0BAA0B;YAI1B,4BAA4B;YAO5B,WAAW;YAkBX,8BAA8B;CAK7C"}
|
|
@@ -84,14 +84,14 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
84
84
|
.map(fullyQualifiedId => (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(fullyQualifiedId));
|
|
85
85
|
const mappedUserIdentities = new Map();
|
|
86
86
|
for (const userId of userIds) {
|
|
87
|
-
const identities = (userIdentities.get(userId.id) || []).map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client })));
|
|
87
|
+
const identities = (userIdentities.get(userId.id) || []).map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client, qualifiedUserId: userId })));
|
|
88
88
|
const basicMLSDevices = allUsersMLSDevices
|
|
89
89
|
.filter(({ user }) => user === userId.id)
|
|
90
90
|
// filtering devices that have a valid identity
|
|
91
91
|
.filter(({ client }) => !identities.map(identity => identity.deviceId).includes(client))
|
|
92
92
|
// map basic MLS devices to "fake" identity object
|
|
93
|
-
.map(id => (Object.assign(Object.assign({}, id), { deviceId: id.client, thumbprint: '', user: '', certificate: '', displayName: '', handle: '', notAfter: BigInt(0), notBefore: BigInt(0), serialNumber: '', clientId: id.client })));
|
|
94
|
-
mappedUserIdentities.set(userId
|
|
93
|
+
.map(id => (Object.assign(Object.assign({}, id), { deviceId: id.client, thumbprint: '', user: '', certificate: '', displayName: '', handle: '', notAfter: BigInt(0), notBefore: BigInt(0), serialNumber: '', clientId: id.client, qualifiedUserId: userId })));
|
|
94
|
+
mappedUserIdentities.set((0, qualifiedIdUtil_1.stringifyQualifiedId)(userId), [...identities, ...basicMLSDevices]);
|
|
95
95
|
}
|
|
96
96
|
return mappedUserIdentities;
|
|
97
97
|
}
|
|
@@ -99,7 +99,7 @@ class E2EIServiceExternal extends commons_1.TypedEventEmitter {
|
|
|
99
99
|
async getDevicesIdentities(groupId, userClientsMap) {
|
|
100
100
|
const clientIds = Object.entries(userClientsMap).map(([clientId, userId]) => (0, Helper_1.getE2EIClientId)(clientId, userId.id, userId.domain).asBytes);
|
|
101
101
|
const deviceIdentities = await this.coreCryptoClient.getDeviceIdentities(bazinga64_1.Decoder.fromBase64(groupId).asBytes, clientIds);
|
|
102
|
-
return deviceIdentities.map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client })));
|
|
102
|
+
return deviceIdentities.map(identity => (Object.assign(Object.assign({}, identity), { deviceId: (0, fullyQualifiedClientIdUtils_1.parseFullQualifiedClientId)(identity.clientId).client, qualifiedUserId: userClientsMap[identity.clientId] })));
|
|
103
103
|
}
|
|
104
104
|
async isFreshMLSSelfClient() {
|
|
105
105
|
const client = await this.clientService.loadClient();
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
const E2EIServiceExternal_1 = require("./E2EIServiceExternal");
|
|
22
22
|
const CoreDB_1 = require("../../../storage/CoreDB");
|
|
23
23
|
const PayloadHelper_1 = require("../../../test/PayloadHelper");
|
|
24
|
+
const qualifiedIdUtil_1 = require("../../../util/qualifiedIdUtil");
|
|
24
25
|
const RecurringTaskScheduler_1 = require("../../../util/RecurringTaskScheduler");
|
|
25
26
|
async function buildE2EIService() {
|
|
26
27
|
const coreCrypto = {
|
|
@@ -67,8 +68,8 @@ describe('E2EIServiceExternal', () => {
|
|
|
67
68
|
const userIds = [user1, user2];
|
|
68
69
|
jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(false);
|
|
69
70
|
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
70
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
71
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
71
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toEqual(undefined);
|
|
72
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toEqual(undefined);
|
|
72
73
|
});
|
|
73
74
|
it('returns the user identities', async () => {
|
|
74
75
|
const [service, { coreCrypto, mlsService }] = await buildE2EIService();
|
|
@@ -81,8 +82,8 @@ describe('E2EIServiceExternal', () => {
|
|
|
81
82
|
]));
|
|
82
83
|
jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(true);
|
|
83
84
|
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
84
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
85
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
85
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(2);
|
|
86
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
|
|
86
87
|
});
|
|
87
88
|
it('returns MLS basic devices with empty identity', async () => {
|
|
88
89
|
const [service, { coreCrypto, mlsService }] = await buildE2EIService();
|
|
@@ -103,8 +104,8 @@ describe('E2EIServiceExternal', () => {
|
|
|
103
104
|
coreCrypto.getClientIds.mockResolvedValue(allClients.map(clientId => encoder.encode(clientId)));
|
|
104
105
|
jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(true);
|
|
105
106
|
const userIdentities = await service.getUsersIdentities(groupId, userIds);
|
|
106
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
107
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(
|
|
107
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user1))).toHaveLength(3);
|
|
108
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)(user2))).toHaveLength(1);
|
|
108
109
|
});
|
|
109
110
|
});
|
|
110
111
|
describe('getAllGroupUsersIdentities', () => {
|
|
@@ -124,8 +125,8 @@ describe('E2EIServiceExternal', () => {
|
|
|
124
125
|
jest.spyOn(mlsService, 'getClientIds').mockResolvedValue(clientIds);
|
|
125
126
|
jest.spyOn(mlsService, 'conversationExists').mockResolvedValue(false);
|
|
126
127
|
const userIdentities = await service.getAllGroupUsersIdentities(groupId);
|
|
127
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user1.userId)).toEqual(undefined);
|
|
128
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user2.userId)).toEqual(undefined);
|
|
128
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user1.domain, id: user1.userId }))).toEqual(undefined);
|
|
129
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ domain: user2.domain, id: user2.userId }))).toEqual(undefined);
|
|
129
130
|
});
|
|
130
131
|
it('returns all the user identities of a mls group', async () => {
|
|
131
132
|
const [service, { coreCrypto, mlsService }] = await buildE2EIService();
|
|
@@ -150,8 +151,8 @@ describe('E2EIServiceExternal', () => {
|
|
|
150
151
|
[user2.userId, [generateCoreCryptoIdentity({ userId: user2.userId })]],
|
|
151
152
|
]));
|
|
152
153
|
const userIdentities = await service.getAllGroupUsersIdentities(groupId);
|
|
153
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user1.userId)).toHaveLength(2);
|
|
154
|
-
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user2.userId)).toHaveLength(1);
|
|
154
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user1.userId, domain: user1.domain }))).toHaveLength(2);
|
|
155
|
+
expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get((0, qualifiedIdUtil_1.stringifyQualifiedId)({ id: user2.userId, domain: user2.domain }))).toHaveLength(1);
|
|
155
156
|
});
|
|
156
157
|
});
|
|
157
158
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { QualifiedId } from '@wireapp/api-client/lib/user';
|
|
2
|
-
export
|
|
2
|
+
export type StringifiedQualifiedId = `${string}@${string}`;
|
|
3
|
+
export declare const stringifyQualifiedId: (qualifiedId: QualifiedId) => StringifiedQualifiedId;
|
|
3
4
|
export declare const parseQualifiedId: (qualifiedId: string) => QualifiedId;
|
|
4
5
|
//# sourceMappingURL=qualifiedIdUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qualifiedIdUtil.d.ts","sourceRoot":"","sources":["../../src/util/qualifiedIdUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"qualifiedIdUtil.d.ts","sourceRoot":"","sources":["../../src/util/qualifiedIdUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,sBAAsB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAC3D,eAAO,MAAM,oBAAoB,gBAAiB,WAAW,KAAG,sBACrB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,KAAG,WAMtD,CAAC"}
|
package/package.json
CHANGED