@wireapp/core 28.6.3 → 28.7.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [28.7.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.6.3...@wireapp/core@28.7.0) (2022-07-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **core:** update core-crypto and pass entropy to crypto-core ([#4336](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4336)) ([0cc685f](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/0cc685f90ee7100b4930f9a59de4aece4ed62ba7))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [28.6.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.6.2...@wireapp/core@28.6.3) (2022-07-19)
7
18
 
8
19
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  },
5
5
  "dependencies": {
6
6
  "@open-wc/webpack-import-meta-loader": "0.4.7",
7
- "@otak/core-crypto": "0.3.0-beta-1",
7
+ "@otak/core-crypto": "0.3.0-beta-2",
8
8
  "@types/long": "4.0.1",
9
9
  "@types/node": "~14",
10
10
  "@wireapp/api-client": "19.16.1",
@@ -77,6 +77,6 @@
77
77
  "test:node": "nyc jasmine --config=jasmine.json",
78
78
  "watch": "tsc ---watch"
79
79
  },
80
- "version": "28.6.3",
81
- "gitHead": "7a2ac313eed98f7a1ab988bfb3ac31bbb8793ea9"
80
+ "version": "28.7.0",
81
+ "gitHead": "81ee05d7db9fafc791e28648cc6a859faa5398e3"
82
82
  }
@@ -162,7 +162,7 @@ export declare class Account<T = any> extends EventEmitter {
162
162
  localClient: RegisteredClient;
163
163
  }>;
164
164
  initServices(context: Context): Promise<void>;
165
- loadAndValidateLocalClient(): Promise<RegisteredClient>;
165
+ loadAndValidateLocalClient(entropyData?: Uint8Array): Promise<RegisteredClient>;
166
166
  private createMLSClient;
167
167
  private registerClient;
168
168
  private resetContext;
@@ -178,7 +178,7 @@ class Account extends events_1.EventEmitter {
178
178
  throw new Error('Services are not set.');
179
179
  }
180
180
  try {
181
- const localClient = await this.loadAndValidateLocalClient();
181
+ const localClient = await this.loadAndValidateLocalClient(entropyData);
182
182
  return { isNewClient: false, localClient };
183
183
  }
184
184
  catch (error) {
@@ -254,17 +254,17 @@ class Account extends events_1.EventEmitter {
254
254
  user: userService,
255
255
  };
256
256
  }
257
- async loadAndValidateLocalClient() {
257
+ async loadAndValidateLocalClient(entropyData) {
258
258
  await this.service.cryptography.initCryptobox();
259
259
  const loadedClient = await this.service.client.getLocalClient();
260
260
  await this.apiClient.api.client.getClient(loadedClient.id);
261
261
  this.apiClient.context.clientId = loadedClient.id;
262
262
  if (this.mlsConfig) {
263
- this.coreCryptoClient = await this.createMLSClient(loadedClient, this.apiClient.context, this.mlsConfig);
263
+ this.coreCryptoClient = await this.createMLSClient(loadedClient, this.apiClient.context, this.mlsConfig, entropyData);
264
264
  }
265
265
  return loadedClient;
266
266
  }
267
- async createMLSClient(client, context, mlsConfig) {
267
+ async createMLSClient(client, context, mlsConfig, entropyData) {
268
268
  const coreCryptoKeyId = 'corecrypto-key';
269
269
  const { CoreCrypto } = await Promise.resolve().then(() => __importStar(require('@otak/core-crypto')));
270
270
  const dbName = `secrets-${this.generateDbName(context)}`;
@@ -282,6 +282,7 @@ class Account extends events_1.EventEmitter {
282
282
  key: bazinga64_1.Encoder.toBase64(key).asString,
283
283
  clientId: `${userId}:${client.id}@${domain}`,
284
284
  wasmFilePath: mlsConfig.coreCrypoWasmFilePath,
285
+ entropySeed: entropyData,
285
286
  });
286
287
  }
287
288
  async registerClient(loginData, clientInfo = coreDefaultClient, entropyData) {
@@ -291,8 +292,8 @@ class Account extends events_1.EventEmitter {
291
292
  this.logger.info(`Creating new client {mls: ${!!this.mlsConfig}}`);
292
293
  const registeredClient = await this.service.client.register(loginData, clientInfo, entropyData);
293
294
  if (this.mlsConfig) {
294
- this.coreCryptoClient = await this.createMLSClient(registeredClient, this.apiClient.context, this.mlsConfig);
295
- await this.service.client.uploadMLSPublicKeys(this.coreCryptoClient.clientPublicKey(), registeredClient.id);
295
+ this.coreCryptoClient = await this.createMLSClient(registeredClient, this.apiClient.context, this.mlsConfig, entropyData);
296
+ await this.service.client.uploadMLSPublicKeys(await this.coreCryptoClient.clientPublicKey(), registeredClient.id);
296
297
  await this.service.client.uploadMLSKeyPackages(await this.coreCryptoClient.clientKeypackages(this.nbPrekeys), registeredClient.id);
297
298
  }
298
299
  this.apiClient.context.clientId = registeredClient.id;