@wireapp/core-crypto 0.7.0 → 0.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.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
7
- "types": "platforms/web/corecrypto.d.js",
7
+ "types": "platforms/web/corecrypto.d.ts",
8
8
  "scripts": {
9
9
  "prepare": "npm run build",
10
10
  "build": "npm run clean && rollup -c crypto-ffi/bindings/js/rollup.config.js",
@@ -1056,9 +1056,10 @@ export declare class WireE2eIdentity {
1056
1056
  * {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token} on wire-server.
1057
1057
  *
1058
1058
  * @param accessTokenUrl backend endpoint where this token will be sent. Should be this one {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token}
1059
+ * @param expirySecs of the client Dpop JWT. This should be equal to the grace period set in Team Management
1059
1060
  * @param backendNonce you get by calling `GET /clients/token/nonce` on wire-server as defined here {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce}
1060
1061
  */
1061
- createDpopToken(accessTokenUrl: string, backendNonce: string): Uint8Array;
1062
+ createDpopToken(accessTokenUrl: string, expirySecs: number, backendNonce: string): Uint8Array;
1062
1063
  /**
1063
1064
  * Creates a new challenge request for Wire Dpop challenge.
1064
1065
  *
@@ -226,12 +226,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
226
226
  return real;
227
227
  }
228
228
  function __wbg_adapter_52(arg0, arg1, arg2) {
229
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4f5b84878d1a1cd6(arg0, arg1, addHeapObject(arg2));
229
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h56c36d723a01191f(arg0, arg1, addHeapObject(arg2));
230
230
  }
231
231
  function __wbg_adapter_55(arg0, arg1, arg2) {
232
232
  try {
233
233
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
234
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h035196cd566a20a2(retptr, arg0, arg1, addHeapObject(arg2));
234
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdcf886fad5e08d14(retptr, arg0, arg1, addHeapObject(arg2));
235
235
  var r0 = getInt32Memory0()[retptr / 4 + 0];
236
236
  var r1 = getInt32Memory0()[retptr / 4 + 1];
237
237
  if (r1) {
@@ -282,7 +282,7 @@ function handleError(f, args) {
282
282
  }
283
283
  }
284
284
  function __wbg_adapter_285(arg0, arg1, arg2, arg3) {
285
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h77a2ddbf015f399a(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
285
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h1ca1c588492035e5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
286
286
  }
287
287
  /**
288
288
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -581,6 +581,41 @@ let CoreCrypto$1 = class CoreCrypto {
581
581
  wasm$1.__wbg_corecrypto_free(ptr);
582
582
  }
583
583
  /**
584
+ * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
585
+ *
586
+ * see [core_crypto::mls::MlsCentral::new_acme_enrollment]
587
+ * @param {string} client_id
588
+ * @param {string} display_name
589
+ * @param {string} handle
590
+ * @param {number} expiry_days
591
+ * @param {number} ciphersuite
592
+ * @returns {Promise<any>}
593
+ */
594
+ new_acme_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
595
+ const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
596
+ const len0 = WASM_VECTOR_LEN;
597
+ const ptr1 = passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
598
+ const len1 = WASM_VECTOR_LEN;
599
+ const ptr2 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
600
+ const len2 = WASM_VECTOR_LEN;
601
+ const ret = wasm$1.corecrypto_new_acme_enrollment(this.ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
602
+ return takeObject(ret);
603
+ }
604
+ /**
605
+ * see [core_crypto::mls::MlsCentral::e2ei_mls_init]
606
+ * @param {FfiWireE2EIdentity} e2ei
607
+ * @param {string} certificate_chain
608
+ * @returns {Promise<any>}
609
+ */
610
+ e2ei_mls_init(e2ei, certificate_chain) {
611
+ _assertClass(e2ei, FfiWireE2EIdentity);
612
+ var ptr0 = e2ei.__destroy_into_raw();
613
+ const ptr1 = passStringToWasm0(certificate_chain, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
614
+ const len1 = WASM_VECTOR_LEN;
615
+ const ret = wasm$1.corecrypto_e2ei_mls_init(this.ptr, ptr0, ptr1, len1);
616
+ return takeObject(ret);
617
+ }
618
+ /**
584
619
  * Returns the current version of CoreCrypto
585
620
  * @returns {string}
586
621
  */
@@ -1410,41 +1445,6 @@ let CoreCrypto$1 = class CoreCrypto {
1410
1445
  const ret = wasm$1.corecrypto_get_client_ids(this.ptr, ptr0, len0);
1411
1446
  return takeObject(ret);
1412
1447
  }
1413
- /**
1414
- * Returns: [`WasmCryptoResult<WireE2eIdentity>`]
1415
- *
1416
- * see [core_crypto::mls::MlsCentral::new_acme_enrollment]
1417
- * @param {string} client_id
1418
- * @param {string} display_name
1419
- * @param {string} handle
1420
- * @param {number} expiry_days
1421
- * @param {number} ciphersuite
1422
- * @returns {Promise<any>}
1423
- */
1424
- new_acme_enrollment(client_id, display_name, handle, expiry_days, ciphersuite) {
1425
- const ptr0 = passStringToWasm0(client_id, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1426
- const len0 = WASM_VECTOR_LEN;
1427
- const ptr1 = passStringToWasm0(display_name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1428
- const len1 = WASM_VECTOR_LEN;
1429
- const ptr2 = passStringToWasm0(handle, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1430
- const len2 = WASM_VECTOR_LEN;
1431
- const ret = wasm$1.corecrypto_new_acme_enrollment(this.ptr, ptr0, len0, ptr1, len1, ptr2, len2, expiry_days, ciphersuite);
1432
- return takeObject(ret);
1433
- }
1434
- /**
1435
- * see [core_crypto::mls::MlsCentral::e2ei_mls_init]
1436
- * @param {FfiWireE2EIdentity} e2ei
1437
- * @param {string} certificate_chain
1438
- * @returns {Promise<any>}
1439
- */
1440
- e2ei_mls_init(e2ei, certificate_chain) {
1441
- _assertClass(e2ei, FfiWireE2EIdentity);
1442
- var ptr0 = e2ei.__destroy_into_raw();
1443
- const ptr1 = passStringToWasm0(certificate_chain, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1444
- const len1 = WASM_VECTOR_LEN;
1445
- const ret = wasm$1.corecrypto_e2ei_mls_init(this.ptr, ptr0, ptr1, len1);
1446
- return takeObject(ret);
1447
- }
1448
1448
  };
1449
1449
  /**
1450
1450
  * see [core_crypto::prelude::CoreCryptoCallbacks]
@@ -1751,17 +1751,18 @@ class FfiWireE2EIdentity {
1751
1751
  /**
1752
1752
  * See [core_crypto::e2e_identity::WireE2eIdentity::create_dpop_token]
1753
1753
  * @param {string} access_token_url
1754
+ * @param {number} expiry_secs
1754
1755
  * @param {string} backend_nonce
1755
1756
  * @returns {Uint8Array}
1756
1757
  */
1757
- create_dpop_token(access_token_url, backend_nonce) {
1758
+ create_dpop_token(access_token_url, expiry_secs, backend_nonce) {
1758
1759
  try {
1759
1760
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
1760
1761
  const ptr0 = passStringToWasm0(access_token_url, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1761
1762
  const len0 = WASM_VECTOR_LEN;
1762
1763
  const ptr1 = passStringToWasm0(backend_nonce, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
1763
1764
  const len1 = WASM_VECTOR_LEN;
1764
- wasm$1.ffiwiree2eidentity_create_dpop_token(retptr, this.ptr, ptr0, len0, ptr1, len1);
1765
+ wasm$1.ffiwiree2eidentity_create_dpop_token(retptr, this.ptr, ptr0, len0, expiry_secs, ptr1, len1);
1765
1766
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1766
1767
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1767
1768
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -2430,14 +2431,14 @@ function getImports() {
2430
2431
  const ret = getObject(arg0);
2431
2432
  return addHeapObject(ret);
2432
2433
  };
2433
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2434
- takeObject(arg0);
2435
- };
2436
2434
  imports.wbg.__wbindgen_is_object = function (arg0) {
2437
2435
  const val = getObject(arg0);
2438
2436
  const ret = typeof (val) === 'object' && val !== null;
2439
2437
  return ret;
2440
2438
  };
2439
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2440
+ takeObject(arg0);
2441
+ };
2441
2442
  imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function (arg0, arg1) {
2442
2443
  const ret = getObject(arg0)[getObject(arg1)];
2443
2444
  return addHeapObject(ret);
@@ -2478,18 +2479,26 @@ function getImports() {
2478
2479
  const ret = getObject(arg0).length;
2479
2480
  return ret;
2480
2481
  };
2481
- imports.wbg.__wbindgen_number_new = function (arg0) {
2482
- const ret = arg0;
2483
- return addHeapObject(ret);
2484
- };
2485
2482
  imports.wbg.__wbg_call_9495de66fdbe016b = function () {
2486
2483
  return handleError(function (arg0, arg1, arg2) {
2487
2484
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2488
2485
  return addHeapObject(ret);
2489
2486
  }, arguments);
2490
2487
  };
2491
- imports.wbg.__wbg_new_f9876326328f45ed = function () {
2492
- const ret = new Object();
2488
+ imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2489
+ const ret = new Uint8Array(getObject(arg0));
2490
+ return addHeapObject(ret);
2491
+ };
2492
+ imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2493
+ const ret = BigInt.asUintN(64, arg0);
2494
+ return addHeapObject(ret);
2495
+ };
2496
+ imports.wbg.__wbg_new_f841cc6f2098f4b5 = function () {
2497
+ const ret = new Map();
2498
+ return addHeapObject(ret);
2499
+ };
2500
+ imports.wbg.__wbg_set_388c4c6422704173 = function (arg0, arg1, arg2) {
2501
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2493
2502
  return addHeapObject(ret);
2494
2503
  };
2495
2504
  imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function (arg0, arg1) {
@@ -2512,8 +2521,12 @@ function getImports() {
2512
2521
  state0.a = state0.b = 0;
2513
2522
  }
2514
2523
  };
2515
- imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2516
- const ret = new Uint8Array(getObject(arg0));
2524
+ imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
2525
+ const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2526
+ return addHeapObject(ret);
2527
+ };
2528
+ imports.wbg.__wbindgen_number_new = function (arg0) {
2529
+ const ret = arg0;
2517
2530
  return addHeapObject(ret);
2518
2531
  };
2519
2532
  imports.wbg.__wbg_new_b525de17f44a8943 = function () {
@@ -2524,24 +2537,12 @@ function getImports() {
2524
2537
  const ret = getObject(arg0).push(getObject(arg1));
2525
2538
  return ret;
2526
2539
  };
2527
- imports.wbg.__wbg_new_f841cc6f2098f4b5 = function () {
2528
- const ret = new Map();
2529
- return addHeapObject(ret);
2530
- };
2531
- imports.wbg.__wbg_set_388c4c6422704173 = function (arg0, arg1, arg2) {
2532
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2533
- return addHeapObject(ret);
2534
- };
2535
- imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2536
- const ret = BigInt.asUintN(64, arg0);
2537
- return addHeapObject(ret);
2538
- };
2539
2540
  imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2540
2541
  const ret = FfiWireE2EIdentity.__wrap(arg0);
2541
2542
  return addHeapObject(ret);
2542
2543
  };
2543
- imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
2544
- const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2544
+ imports.wbg.__wbg_new_f9876326328f45ed = function () {
2545
+ const ret = new Object();
2545
2546
  return addHeapObject(ret);
2546
2547
  };
2547
2548
  imports.wbg.__wbg_setonsuccess_925a7718d3f62bc1 = function (arg0, arg1) {
@@ -3135,12 +3136,12 @@ function getImports() {
3135
3136
  return addHeapObject(ret);
3136
3137
  }, arguments);
3137
3138
  };
3138
- imports.wbg.__wbindgen_closure_wrapper1541 = function (arg0, arg1, arg2) {
3139
- const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_52);
3139
+ imports.wbg.__wbindgen_closure_wrapper1540 = function (arg0, arg1, arg2) {
3140
+ const ret = makeMutClosure(arg0, arg1, 158, __wbg_adapter_52);
3140
3141
  return addHeapObject(ret);
3141
3142
  };
3142
- imports.wbg.__wbindgen_closure_wrapper4565 = function (arg0, arg1, arg2) {
3143
- const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_55);
3143
+ imports.wbg.__wbindgen_closure_wrapper4618 = function (arg0, arg1, arg2) {
3144
+ const ret = makeMutClosure(arg0, arg1, 158, __wbg_adapter_55);
3144
3145
  return addHeapObject(ret);
3145
3146
  };
3146
3147
  return imports;
@@ -3201,7 +3202,7 @@ var exports = /*#__PURE__*/Object.freeze({
3201
3202
  var wasm = async (opt = {}) => {
3202
3203
  let {importHook, serverPath} = opt;
3203
3204
 
3204
- let path = "assets/core_crypto_ffi-a6e9489a.wasm";
3205
+ let path = "assets/core_crypto_ffi-db9a9765.wasm";
3205
3206
 
3206
3207
  if (serverPath != null) {
3207
3208
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -4339,11 +4340,12 @@ class WireE2eIdentity {
4339
4340
  * {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token} on wire-server.
4340
4341
  *
4341
4342
  * @param accessTokenUrl backend endpoint where this token will be sent. Should be this one {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/post_clients__cid__access_token}
4343
+ * @param expirySecs of the client Dpop JWT. This should be equal to the grace period set in Team Management
4342
4344
  * @param backendNonce you get by calling `GET /clients/token/nonce` on wire-server as defined here {@link https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce}
4343
4345
  */
4344
- createDpopToken(accessTokenUrl, backendNonce) {
4346
+ createDpopToken(accessTokenUrl, expirySecs, backendNonce) {
4345
4347
  try {
4346
- return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").create_dpop_token(accessTokenUrl, backendNonce);
4348
+ return __classPrivateFieldGet(this, _WireE2eIdentity_e2ei, "f").create_dpop_token(accessTokenUrl, expirySecs, backendNonce);
4347
4349
  }
4348
4350
  catch (e) {
4349
4351
  throw CoreCryptoError.fromStdError(e);