@wireapp/core 45.0.13 → 45.1.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.
@@ -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: {
@@ -28,7 +30,7 @@ export declare class E2EIServiceExternal extends TypedEventEmitter<Events> {
28
30
  getConversationState(conversationId: Uint8Array): Promise<E2eiConversationState>;
29
31
  isE2EIEnabled(): Promise<boolean>;
30
32
  getAllGroupUsersIdentities(groupId: string): Promise<Map<string, DeviceIdentity[]> | undefined>;
31
- getUsersIdentities(groupId: string, userIds: QualifiedId[]): Promise<Map<string, 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,E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,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.id, [...identities, ...basicMLSDevices]);
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(user1.id)).toEqual(undefined);
71
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user2.id)).toEqual(undefined);
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(user1.id)).toHaveLength(2);
85
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user2.id)).toHaveLength(1);
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(user1.id)).toHaveLength(3);
107
- expect(userIdentities === null || userIdentities === void 0 ? void 0 : userIdentities.get(user2.id)).toHaveLength(1);
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', () => {
@@ -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 declare const stringifyQualifiedId: (qualifiedId: QualifiedId) => `${string}@${string}`;
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,eAAO,MAAM,oBAAoB,gBAAiB,WAAW,KAAG,GAAG,MAAM,IAAI,MAAM,EACxC,CAAC;AAE5C,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,KAAG,WAMtD,CAAC"}
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
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "45.0.13",
65
- "gitHead": "8f1f305c6a2d6993b40a498933ba7258466cd572"
64
+ "version": "45.1.0",
65
+ "gitHead": "2d99401cd7f59fba88425d88f4cde8db12a72d7b"
66
66
  }