@wireapp/core-crypto 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.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
  *
@@ -34,14 +34,6 @@ const heap = new Array(128).fill(undefined);
34
34
  heap.push(undefined, null, true, false);
35
35
  function getObject(idx) { return heap[idx]; }
36
36
  let heap_next = heap.length;
37
- function addHeapObject(obj) {
38
- if (heap_next === heap.length)
39
- heap.push(heap.length + 1);
40
- const idx = heap_next;
41
- heap_next = heap[idx];
42
- heap[idx] = obj;
43
- return idx;
44
- }
45
37
  function dropObject(idx) {
46
38
  if (idx < 132)
47
39
  return;
@@ -53,6 +45,14 @@ function takeObject(idx) {
53
45
  dropObject(idx);
54
46
  return ret;
55
47
  }
48
+ function addHeapObject(obj) {
49
+ if (heap_next === heap.length)
50
+ heap.push(heap.length + 1);
51
+ const idx = heap_next;
52
+ heap_next = heap[idx];
53
+ heap[idx] = obj;
54
+ return idx;
55
+ }
56
56
  const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
57
57
  cachedTextDecoder.decode();
58
58
  let cachedUint8Memory0 = null;
@@ -231,7 +231,7 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
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__h86787f18fe84dc73(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) {
@@ -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];
@@ -2426,13 +2427,13 @@ async function load(module, imports) {
2426
2427
  function getImports() {
2427
2428
  const imports = {};
2428
2429
  imports.wbg = {};
2430
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2431
+ takeObject(arg0);
2432
+ };
2429
2433
  imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
2430
2434
  const ret = getObject(arg0);
2431
2435
  return addHeapObject(ret);
2432
2436
  };
2433
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2434
- takeObject(arg0);
2435
- };
2436
2437
  imports.wbg.__wbindgen_is_object = function (arg0) {
2437
2438
  const val = getObject(arg0);
2438
2439
  const ret = typeof (val) === 'object' && val !== null;
@@ -2478,8 +2479,8 @@ 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;
2482
+ imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2483
+ const ret = new Uint8Array(getObject(arg0));
2483
2484
  return addHeapObject(ret);
2484
2485
  };
2485
2486
  imports.wbg.__wbg_call_9495de66fdbe016b = function () {
@@ -2488,10 +2489,26 @@ function getImports() {
2488
2489
  return addHeapObject(ret);
2489
2490
  }, arguments);
2490
2491
  };
2492
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2493
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
2494
+ return addHeapObject(ret);
2495
+ };
2491
2496
  imports.wbg.__wbg_new_f9876326328f45ed = function () {
2492
2497
  const ret = new Object();
2493
2498
  return addHeapObject(ret);
2494
2499
  };
2500
+ imports.wbg.__wbg_new_f841cc6f2098f4b5 = function () {
2501
+ const ret = new Map();
2502
+ return addHeapObject(ret);
2503
+ };
2504
+ imports.wbg.__wbg_set_388c4c6422704173 = function (arg0, arg1, arg2) {
2505
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2506
+ return addHeapObject(ret);
2507
+ };
2508
+ imports.wbg.__wbindgen_number_new = function (arg0) {
2509
+ const ret = arg0;
2510
+ return addHeapObject(ret);
2511
+ };
2495
2512
  imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function (arg0, arg1) {
2496
2513
  try {
2497
2514
  var state0 = { a: arg0, b: arg1 };
@@ -2512,10 +2529,6 @@ function getImports() {
2512
2529
  state0.a = state0.b = 0;
2513
2530
  }
2514
2531
  };
2515
- imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2516
- const ret = new Uint8Array(getObject(arg0));
2517
- return addHeapObject(ret);
2518
- };
2519
2532
  imports.wbg.__wbg_new_b525de17f44a8943 = function () {
2520
2533
  const ret = new Array();
2521
2534
  return addHeapObject(ret);
@@ -2524,22 +2537,10 @@ 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
2540
  imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2536
2541
  const ret = BigInt.asUintN(64, arg0);
2537
2542
  return addHeapObject(ret);
2538
2543
  };
2539
- imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2540
- const ret = FfiWireE2EIdentity.__wrap(arg0);
2541
- return addHeapObject(ret);
2542
- };
2543
2544
  imports.wbg.__wbg_proteusautoprekeybundle_new = function (arg0) {
2544
2545
  const ret = ProteusAutoPrekeyBundle.__wrap(arg0);
2545
2546
  return addHeapObject(ret);
@@ -2925,6 +2926,12 @@ function getImports() {
2925
2926
  const ret = getObject(arg0).target;
2926
2927
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
2927
2928
  };
2929
+ imports.wbg.__wbg_error_f64b8d41ed4d2fdc = function () {
2930
+ return handleError(function (arg0) {
2931
+ const ret = getObject(arg0).error;
2932
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2933
+ }, arguments);
2934
+ };
2928
2935
  imports.wbg.__wbg_result_3a1fef332bc47038 = function () {
2929
2936
  return handleError(function (arg0) {
2930
2937
  const ret = getObject(arg0).result;
@@ -2965,12 +2972,6 @@ function getImports() {
2965
2972
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
2966
2973
  }, arguments);
2967
2974
  };
2968
- imports.wbg.__wbg_error_f64b8d41ed4d2fdc = function () {
2969
- return handleError(function (arg0) {
2970
- const ret = getObject(arg0).error;
2971
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2972
- }, arguments);
2973
- };
2974
2975
  imports.wbg.__wbindgen_is_falsy = function (arg0) {
2975
2976
  const ret = !getObject(arg0);
2976
2977
  return ret;
@@ -3135,11 +3136,11 @@ function getImports() {
3135
3136
  return addHeapObject(ret);
3136
3137
  }, arguments);
3137
3138
  };
3138
- imports.wbg.__wbindgen_closure_wrapper1541 = function (arg0, arg1, arg2) {
3139
+ imports.wbg.__wbindgen_closure_wrapper1537 = function (arg0, arg1, arg2) {
3139
3140
  const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_52);
3140
3141
  return addHeapObject(ret);
3141
3142
  };
3142
- imports.wbg.__wbindgen_closure_wrapper4565 = function (arg0, arg1, arg2) {
3143
+ imports.wbg.__wbindgen_closure_wrapper4550 = function (arg0, arg1, arg2) {
3143
3144
  const ret = makeMutClosure(arg0, arg1, 155, __wbg_adapter_55);
3144
3145
  return addHeapObject(ret);
3145
3146
  };
@@ -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-65dbc085.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);