@wireapp/core 40.7.1 → 40.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM,oCAAoC,CAAC;AAIvD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAI9C,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAE5G,OAAO,EAAC,YAAY,EAAuB,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAuB,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAkC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AACjG,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACzB,MAAM,sEAAsE,CAAC;AAG9E,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAN/B,SAAgB,YAAY,EAAE,YAAY,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAGpD,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,CAAC,wB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AE,MAAM,GAAG,IAAiB,GAC3C,OAAO,CAAC,IAAI,CAAC;IAaT,yBAAyB,CAC9B,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,2BAA2B,GAAG,MAAM,GACrD,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IAEH;;;OAGG;IACU,qBAAqB,CAChC,gBAAgB,EAAE,eAAe,EACjC,UAAU,EAAE,WAAW,EACvB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,CAAC;YAqCX,cAAc;IAiC5B;;;;;;OAMG;IACU,yBAAyB,CAAC,EACrC,cAAc,EACd,OAAO,EACP,cAAc,GACf,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAmBvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAmBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,mBAAmB;CA2BjC"}
1
+ {"version":3,"file":"ConversationService.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationService/ConversationService.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EACZ,2BAA2B,EAC3B,WAAW,EACX,eAAe,EACf,oBAAoB,EAEpB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAC,4BAA4B,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,GAAG,EAAC,MAAM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AAC;IAkBvC,8BAA8B,CAAC,EAC1C,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBhC,oBAAoB,CAAC,cAAc,EAAE,WAAW;IAI7D;;;;;OAKG;IACU,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAmBvD,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAI5C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,YAAY;IAYb,mBAAmB;CA2BjC"}
@@ -218,9 +218,8 @@ class ConversationService {
218
218
  * @param conversationId Id of the conversation to which we want to add users
219
219
  */
220
220
  async addUsersToMLSConversation({ qualifiedUsers, groupId, conversationId, }) {
221
- const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
222
221
  const { coreCryptoKeyPackagesPayload, failedToFetchKeyPackages } = await this.mlsService.getKeyPackagesPayload(qualifiedUsers);
223
- const response = await this.mlsService.addUsersToExistingConversation(groupIdBytes, coreCryptoKeyPackagesPayload);
222
+ const response = await this.mlsService.addUsersToExistingConversation(groupId, coreCryptoKeyPackagesPayload);
224
223
  const conversation = await this.getConversation(conversationId);
225
224
  conversation.failed_to_add = failedToFetchKeyPackages;
226
225
  //We store the info when user was added (and key material was created), so we will know when to renew it
@@ -31,6 +31,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
31
31
  private readonly textEncoder;
32
32
  private readonly textDecoder;
33
33
  private readonly defaultCiphersuite;
34
+ private readonly defaultCredentialType;
34
35
  constructor(apiClient: APIClient, coreCryptoClient: CoreCrypto, { keyingMaterialUpdateThreshold, nbKeyPackages, }: Partial<MLSServiceConfig>);
35
36
  initClient(userId: QualifiedId, clientId: string): Promise<void>;
36
37
  createClient(userId: QualifiedId, clientId: string): Promise<void>;
@@ -42,7 +43,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
42
43
  * @param groupId - the group id of the MLS group
43
44
  * @param invitee - the list of keys of clients to add to the MLS group
44
45
  */
45
- addUsersToExistingConversation(groupId: Uint8Array, invitee: Invitee[]): Promise<PostMlsMessageResponse>;
46
+ addUsersToExistingConversation(groupId: string, invitee: Invitee[]): Promise<PostMlsMessageResponse>;
46
47
  configureMLSCallbacks({ groupIdFromConversationId, ...coreCryptoCallbacks }: MLSCallbacks): void;
47
48
  getKeyPackagesPayload(qualifiedUsers: KeyPackageClaimUser[]): Promise<{
48
49
  coreCryptoKeyPackagesPayload: Invitee[];
@@ -86,9 +87,14 @@ export declare class MLSService extends TypedEventEmitter<Events> {
86
87
  * @param generateCommit The function that will generate a coreCrypto CommitBundle
87
88
  */
88
89
  private processCommitAction;
89
- updateKeyingMaterial(conversationId: ConversationId): Promise<PostMlsMessageResponse>;
90
+ private updateKeyingMaterial;
90
91
  /**
91
- * Will create a conversation inside of coreCrypto.
92
+ * Will create an empty conversation inside of coreCrypto.
93
+ * @param groupId the id of the group to create inside of coreCrypto
94
+ */
95
+ registerEmptyConversation(groupId: string): Promise<void>;
96
+ /**
97
+ * Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
92
98
  * @param groupId the id of the group to create inside of coreCrypto
93
99
  * @param users the list of users that will be members of the conversation (including the self user)
94
100
  * @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
@@ -108,7 +114,7 @@ export declare class MLSService extends TypedEventEmitter<Events> {
108
114
  clientValidKeypackagesCount(): Promise<number>;
109
115
  clientKeypackages(amountRequested: number): Promise<Uint8Array[]>;
110
116
  /**
111
- * Renew key material for a given groupId
117
+ * Will send an empty commit into a group (renew key material)
112
118
  *
113
119
  * @param groupId groupId of the conversation
114
120
  */
@@ -1 +1 @@
1
- {"version":3,"file":"MLSService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/MLSService/MLSService.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM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G;IACI,8BAA8B;YAQvB,eAAe;IAmB7B;;;;;OAKG;YACW,mBAAmB;YAMnB,oBAAoB;IAOrB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhD,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,kBAAkB;IAW5F;;;;;OAKG;IACU,4BAA4B,CACvC,uBAAuB,EAAE,WAAW,EACpC,iBAAiB,CAAC,EAAE,kBAAkB,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQ9B;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,4BAA4B;IAoBjG;;;;;OAKG;IACU,sBAAsB,CAAC,EAAC,OAAO,EAAE,UAAkB,EAAC,EAAE,4BAA4B;IAa/F;;;;OAIG;IACU,6BAA6B;IAiB1C;;;;OAIG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CAW1G"}
@@ -67,6 +67,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
67
67
  this.textEncoder = new TextEncoder();
68
68
  this.textDecoder = new TextDecoder();
69
69
  this.defaultCiphersuite = core_crypto_1.Ciphersuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519;
70
+ this.defaultCredentialType = core_crypto_1.CredentialType.Basic;
70
71
  this.config = {
71
72
  keyingMaterialUpdateThreshold,
72
73
  nbKeyPackages,
@@ -80,7 +81,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
80
81
  await this.initClient(userId, clientId);
81
82
  // If the device is new, we need to upload keypackages and public key to the backend
82
83
  const publicKey = await this.coreCryptoClient.clientPublicKey(this.defaultCiphersuite);
83
- const keyPackages = await this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, this.config.nbKeyPackages);
84
+ const keyPackages = await this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, this.defaultCredentialType, this.config.nbKeyPackages);
84
85
  await this.uploadMLSPublicKeys(publicKey, clientId);
85
86
  await this.uploadMLSKeyPackages(keyPackages, clientId);
86
87
  }
@@ -127,10 +128,11 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
127
128
  * @param invitee - the list of keys of clients to add to the MLS group
128
129
  */
129
130
  addUsersToExistingConversation(groupId, invitee) {
131
+ const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
130
132
  if (invitee.length < 1) {
131
133
  throw new Error('Empty list of keys provided to addUsersToExistingConversation');
132
134
  }
133
- return this.processCommitAction(groupId, () => this.coreCryptoClient.addClientsToConversation(groupId, invitee));
135
+ return this.processCommitAction(groupIdBytes, () => this.coreCryptoClient.addClientsToConversation(groupIdBytes, invitee));
134
136
  }
135
137
  configureMLSCallbacks(_a) {
136
138
  var { groupIdFromConversationId } = _a, coreCryptoCallbacks = __rest(_a, ["groupIdFromConversationId"]);
@@ -186,7 +188,7 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
186
188
  async joinByExternalCommit(getGroupInfo) {
187
189
  const generateCommit = async () => {
188
190
  const groupInfo = await getGroupInfo();
189
- const _a = await this.coreCryptoClient.joinByExternalCommit(groupInfo, core_crypto_1.CredentialType.Basic), { conversationId } = _a, commitBundle = __rest(_a, ["conversationId"]);
191
+ const _a = await this.coreCryptoClient.joinByExternalCommit(groupInfo, this.defaultCredentialType), { conversationId } = _a, commitBundle = __rest(_a, ["conversationId"]);
190
192
  return { groupId: conversationId, commitBundle };
191
193
  };
192
194
  const { commitBundle, groupId } = await generateCommit();
@@ -303,16 +305,15 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
303
305
  return this.uploadCommitBundle(groupId, commitBundle, { regenerateCommitBundle: generateCommit });
304
306
  });
305
307
  }
306
- updateKeyingMaterial(conversationId) {
307
- return this.processCommitAction(conversationId, () => this.coreCryptoClient.updateKeyingMaterial(conversationId));
308
+ updateKeyingMaterial(groupId) {
309
+ const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
310
+ return this.processCommitAction(groupIdBytes, () => this.coreCryptoClient.updateKeyingMaterial(groupIdBytes));
308
311
  }
309
312
  /**
310
- * Will create a conversation inside of coreCrypto.
313
+ * Will create an empty conversation inside of coreCrypto.
311
314
  * @param groupId the id of the group to create inside of coreCrypto
312
- * @param users the list of users that will be members of the conversation (including the self user)
313
- * @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
314
315
  */
315
- async registerConversation(groupId, users, creator) {
316
+ async registerEmptyConversation(groupId) {
316
317
  const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
317
318
  const mlsKeys = (await this.apiClient.api.client.getPublicKeys()).removal;
318
319
  const mlsKeyBytes = Object.values(mlsKeys).map((key) => bazinga64_1.Decoder.fromBase64(key).asBytes);
@@ -320,7 +321,16 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
320
321
  externalSenders: mlsKeyBytes,
321
322
  ciphersuite: this.defaultCiphersuite,
322
323
  };
323
- await this.coreCryptoClient.createConversation(groupIdBytes, core_crypto_1.CredentialType.Basic, configuration);
324
+ return void this.coreCryptoClient.createConversation(groupIdBytes, this.defaultCredentialType, configuration);
325
+ }
326
+ /**
327
+ * Will create a conversation inside of coreCrypto, add users to it or update the keying material if empty key packages list is provided.
328
+ * @param groupId the id of the group to create inside of coreCrypto
329
+ * @param users the list of users that will be members of the conversation (including the self user)
330
+ * @param creator the creator of the list. Most of the time will be the self user (or empty if the conversation was created by backend first)
331
+ */
332
+ async registerConversation(groupId, users, creator) {
333
+ await this.registerEmptyConversation(groupId);
324
334
  const { coreCryptoKeyPackagesPayload: keyPackages, failedToFetchKeyPackages } = await this.getKeyPackagesPayload(users.map(user => {
325
335
  if (user.id === (creator === null || creator === void 0 ? void 0 : creator.user.id)) {
326
336
  /**
@@ -332,9 +342,9 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
332
342
  return user;
333
343
  }));
334
344
  const response = keyPackages.length > 0
335
- ? await this.addUsersToExistingConversation(groupIdBytes, keyPackages)
345
+ ? await this.addUsersToExistingConversation(groupId, keyPackages)
336
346
  : // If there are no clients to add, just update the keying material
337
- await this.processCommitAction(groupIdBytes, () => this.coreCryptoClient.updateKeyingMaterial(groupIdBytes));
347
+ await this.updateKeyingMaterial(groupId);
338
348
  // We schedule a periodic key material renewal
339
349
  this.scheduleKeyMaterialRenewal(groupId);
340
350
  /**
@@ -362,13 +372,13 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
362
372
  return this.coreCryptoClient.conversationExists(groupIdBytes);
363
373
  }
364
374
  async clientValidKeypackagesCount() {
365
- return this.coreCryptoClient.clientValidKeypackagesCount(this.defaultCiphersuite);
375
+ return this.coreCryptoClient.clientValidKeypackagesCount(this.defaultCiphersuite, this.defaultCredentialType);
366
376
  }
367
377
  async clientKeypackages(amountRequested) {
368
- return this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, amountRequested);
378
+ return this.coreCryptoClient.clientKeypackages(this.defaultCiphersuite, this.defaultCredentialType, amountRequested);
369
379
  }
370
380
  /**
371
- * Renew key material for a given groupId
381
+ * Will send an empty commit into a group (renew key material)
372
382
  *
373
383
  * @param groupId groupId of the conversation
374
384
  */
@@ -376,11 +386,9 @@ class MLSService extends TypedEventEmitter_1.TypedEventEmitter {
376
386
  try {
377
387
  const groupConversationExists = await this.conversationExists(groupId);
378
388
  if (!groupConversationExists) {
379
- this.cancelKeyMaterialRenewal(groupId);
380
- return;
389
+ return this.cancelKeyMaterialRenewal(groupId);
381
390
  }
382
- const groupIdDecodedFromBase64 = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
383
- await this.updateKeyingMaterial(groupIdDecodedFromBase64);
391
+ await this.updateKeyingMaterial(groupId);
384
392
  }
385
393
  catch (error) {
386
394
  this.logger.error(`Error while renewing key material for groupId ${groupId}`, error);
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@wireapp/api-client": "^24.20.0",
15
15
  "@wireapp/commons": "^5.1.0",
16
- "@wireapp/core-crypto": "1.0.0-pre.5",
16
+ "@wireapp/core-crypto": "^1.0.0-rc.1",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
18
  "@wireapp/promise-queue": "^2.2.0",
19
19
  "@wireapp/protocol-messaging": "1.44.0",
@@ -60,6 +60,6 @@
60
60
  "test:coverage": "jest --coverage",
61
61
  "watch": "tsc --watch"
62
62
  },
63
- "version": "40.7.1",
64
- "gitHead": "e53d5a0ed50c7dd0fb42dc18b7d551816d97ceec"
63
+ "version": "40.8.1",
64
+ "gitHead": "8554612ccf2bb59a5b95235c9751cd62fca17140"
65
65
  }