@wireapp/core-crypto 1.0.0-rc.57 → 1.0.0-rc.59

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0-rc.57",
3
+ "version": "1.0.0-rc.59",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -351,10 +351,6 @@ export interface CoreCryptoDeferredParams {
351
351
  * This should be appropriately stored in a secure location (i.e. WebCrypto private key storage)
352
352
  */
353
353
  key: string;
354
- /**
355
- * All the ciphersuites this MLS client can support
356
- */
357
- ciphersuites: Ciphersuite[];
358
354
  /**
359
355
  * External PRNG entropy pool seed.
360
356
  * This **must** be exactly 32 bytes
@@ -364,10 +360,6 @@ export interface CoreCryptoDeferredParams {
364
360
  * .wasm file path, this will be useful in case your bundling system likes to relocate files (i.e. what webpack does)
365
361
  */
366
362
  wasmFilePath?: string;
367
- /**
368
- * Number of initial KeyPackage to create when initializing the client
369
- */
370
- nbKeyPackage?: number;
371
363
  }
372
364
  /**
373
365
  * Params for CoreCrypto initialization
@@ -379,6 +371,14 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
379
371
  * This should stay consistent as it will be verified against the stored signature & identity to validate the persisted credential
380
372
  */
381
373
  clientId: ClientId;
374
+ /**
375
+ * All the ciphersuites this MLS client can support
376
+ */
377
+ ciphersuites: Ciphersuite[];
378
+ /**
379
+ * Number of initial KeyPackage to create when initializing the client
380
+ */
381
+ nbKeyPackage?: number;
382
382
  }
383
383
  export interface ConversationInitBundle {
384
384
  /**
@@ -799,7 +799,7 @@ export declare class CoreCrypto {
799
799
  * Use this clientId to initialize MLS with {@link CoreCrypto.mlsInit}.
800
800
  * @param params - {@link CoreCryptoDeferredParams}
801
801
  */
802
- static deferredInit({ databaseName, key, ciphersuites, entropySeed, wasmFilePath, nbKeyPackage, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
802
+ static deferredInit({ databaseName, key, entropySeed, wasmFilePath, }: CoreCryptoDeferredParams): Promise<CoreCrypto>;
803
803
  /**
804
804
  * Use this after {@link CoreCrypto.deferredInit} when you have a clientId. It initializes MLS.
805
805
  *
@@ -265,57 +265,53 @@ async function __wbg_load(module, imports) {
265
265
  var __wbg_get_imports = function() {
266
266
  const imports = {};
267
267
  imports.wbg = {};
268
- imports.wbg.__wbg_acmedirectory_new = function(arg0) {
269
- const ret = AcmeDirectory.__wrap(arg0);
268
+ imports.wbg.__wbindgen_number_new = function(arg0) {
269
+ const ret = arg0;
270
270
  return addHeapObject(ret);
271
271
  };
272
- imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
273
- const ret = BufferedDecryptedMessage.__wrap(arg0);
272
+ imports.wbg.__wbg_commitbundle_new = function(arg0) {
273
+ const ret = CommitBundle.__wrap(arg0);
274
+ return addHeapObject(ret);
275
+ };
276
+ imports.wbg.__wbg_newacmeorder_new = function(arg0) {
277
+ const ret = NewAcmeOrder.__wrap(arg0);
274
278
  return addHeapObject(ret);
275
279
  };
276
280
  imports.wbg.__wbg_proteusautoprekeybundle_new = function(arg0) {
277
281
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
278
282
  return addHeapObject(ret);
279
283
  };
280
- imports.wbg.__wbindgen_number_new = function(arg0) {
281
- const ret = arg0;
284
+ imports.wbg.__wbg_corecrypto_new = function(arg0) {
285
+ const ret = CoreCrypto.__wrap(arg0);
282
286
  return addHeapObject(ret);
283
287
  };
284
288
  imports.wbg.__wbg_newacmeauthz_new = function(arg0) {
285
289
  const ret = NewAcmeAuthz.__wrap(arg0);
286
290
  return addHeapObject(ret);
287
291
  };
288
- imports.wbg.__wbg_newacmeorder_new = function(arg0) {
289
- const ret = NewAcmeOrder.__wrap(arg0);
292
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
293
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
290
294
  return addHeapObject(ret);
291
295
  };
292
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
293
- takeObject(arg0);
294
- };
295
- imports.wbg.__wbg_proposalbundle_new = function(arg0) {
296
- const ret = ProposalBundle.__wrap(arg0);
296
+ imports.wbg.__wbg_acmedirectory_new = function(arg0) {
297
+ const ret = AcmeDirectory.__wrap(arg0);
297
298
  return addHeapObject(ret);
298
299
  };
299
- imports.wbg.__wbg_commitbundle_new = function(arg0) {
300
- const ret = CommitBundle.__wrap(arg0);
301
- return addHeapObject(ret);
300
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
301
+ takeObject(arg0);
302
302
  };
303
- imports.wbg.__wbg_corecrypto_new = function(arg0) {
304
- const ret = CoreCrypto.__wrap(arg0);
303
+ imports.wbg.__wbg_buffereddecryptedmessage_new = function(arg0) {
304
+ const ret = BufferedDecryptedMessage.__wrap(arg0);
305
305
  return addHeapObject(ret);
306
306
  };
307
- imports.wbg.__wbg_ffiwiree2eidentity_new = function(arg0) {
308
- const ret = FfiWireE2EIdentity.__wrap(arg0);
307
+ imports.wbg.__wbg_proposalbundle_new = function(arg0) {
308
+ const ret = ProposalBundle.__wrap(arg0);
309
309
  return addHeapObject(ret);
310
310
  };
311
311
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
312
312
  const ret = getObject(arg0);
313
313
  return addHeapObject(ret);
314
314
  };
315
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
316
- const ret = BigInt.asUintN(64, arg0);
317
- return addHeapObject(ret);
318
- };
319
315
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
320
316
  const ret = getStringFromWasm0(arg0, arg1);
321
317
  return addHeapObject(ret);
@@ -328,6 +324,10 @@ var __wbg_get_imports = function() {
328
324
  const ret = getObject(arg0) === null;
329
325
  return ret;
330
326
  };
327
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
328
+ const ret = BigInt.asUintN(64, arg0);
329
+ return addHeapObject(ret);
330
+ };
331
331
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
332
332
  const obj = getObject(arg1);
333
333
  const ret = typeof obj === "string" ? obj : undefined;
@@ -983,8 +983,8 @@ var __wbg_get_imports = function() {
983
983
  const ret = makeMutClosure(arg0, arg1, 667, __wbg_adapter_54);
984
984
  return addHeapObject(ret);
985
985
  };
986
- imports.wbg.__wbindgen_closure_wrapper13244 = function(arg0, arg1, arg2) {
987
- const ret = makeMutClosure(arg0, arg1, 2142, __wbg_adapter_57);
986
+ imports.wbg.__wbindgen_closure_wrapper13251 = function(arg0, arg1, arg2) {
987
+ const ret = makeMutClosure(arg0, arg1, 2143, __wbg_adapter_57);
988
988
  return addHeapObject(ret);
989
989
  };
990
990
  return imports;
@@ -1051,14 +1051,6 @@ var CLOSURE_DTORS = typeof FinalizationRegistry === "undefined" ? { register: ()
1051
1051
  });
1052
1052
  var cachedUint32Memory0 = null;
1053
1053
  var cachedUint16Memory0 = null;
1054
- var DeviceStatus = Object.freeze({
1055
- Valid: 1,
1056
- "1": "Valid",
1057
- Expired: 2,
1058
- "2": "Expired",
1059
- Revoked: 3,
1060
- "3": "Revoked"
1061
- });
1062
1054
  var WirePolicy = Object.freeze({
1063
1055
  Plaintext: 1,
1064
1056
  "1": "Plaintext",
@@ -1071,6 +1063,14 @@ var CredentialType = Object.freeze({
1071
1063
  X509: 2,
1072
1064
  "2": "X509"
1073
1065
  });
1066
+ var DeviceStatus = Object.freeze({
1067
+ Valid: 1,
1068
+ "1": "Valid",
1069
+ Expired: 2,
1070
+ "2": "Expired",
1071
+ Revoked: 3,
1072
+ "3": "Revoked"
1073
+ });
1074
1074
  var Ciphersuite = Object.freeze({
1075
1075
  MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519: 1,
1076
1076
  "1": "MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519",
@@ -1550,16 +1550,14 @@ class CoreCrypto {
1550
1550
  const ret = wasm.corecrypto__internal_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(nb_key_package), isLikeNone(nb_key_package) ? 0 : nb_key_package);
1551
1551
  return takeObject(ret);
1552
1552
  }
1553
- static deferred_init(path, key, ciphersuites, entropy_seed, nb_key_package) {
1553
+ static deferred_init(path, key, entropy_seed) {
1554
1554
  const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1555
1555
  const len0 = WASM_VECTOR_LEN;
1556
1556
  const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1557
1557
  const len1 = WASM_VECTOR_LEN;
1558
- const ptr2 = passArray16ToWasm0(ciphersuites, wasm.__wbindgen_malloc);
1559
- const len2 = WASM_VECTOR_LEN;
1560
- var ptr3 = isLikeNone(entropy_seed) ? 0 : passArray8ToWasm0(entropy_seed, wasm.__wbindgen_malloc);
1561
- var len3 = WASM_VECTOR_LEN;
1562
- const ret = wasm.corecrypto_deferred_init(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, !isLikeNone(nb_key_package), isLikeNone(nb_key_package) ? 0 : nb_key_package);
1558
+ var ptr2 = isLikeNone(entropy_seed) ? 0 : passArray8ToWasm0(entropy_seed, wasm.__wbindgen_malloc);
1559
+ var len2 = WASM_VECTOR_LEN;
1560
+ const ret = wasm.corecrypto_deferred_init(ptr0, len0, ptr1, len1, ptr2, len2);
1563
1561
  return takeObject(ret);
1564
1562
  }
1565
1563
  mls_init(client_id, ciphersuites, nb_key_package) {
@@ -2749,14 +2747,11 @@ class CoreCrypto2 {
2749
2747
  static async deferredInit({
2750
2748
  databaseName,
2751
2749
  key,
2752
- ciphersuites,
2753
2750
  entropySeed,
2754
- wasmFilePath,
2755
- nbKeyPackage
2751
+ wasmFilePath
2756
2752
  }) {
2757
2753
  await this.#loadModule(wasmFilePath);
2758
- let cs = ciphersuites.map((cs2) => cs2.valueOf());
2759
- const cc = await CoreCryptoError.asyncMapErr(CoreCrypto.deferred_init(databaseName, key, Uint16Array.of(...cs), entropySeed, nbKeyPackage));
2754
+ const cc = await CoreCryptoError.asyncMapErr(CoreCrypto.deferred_init(databaseName, key, entropySeed));
2760
2755
  return new this(cc);
2761
2756
  }
2762
2757
  async mlsInit(clientId, ciphersuites, nbKeyPackage) {