@wireapp/core-crypto 0.6.0-rc.6 → 0.6.0-rc.7

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": "0.6.0-rc.6",
3
+ "version": "0.6.0-rc.7",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
@@ -1,124 +1,3 @@
1
- declare class FfiWireE2EIdentity {
2
- free(): void;
3
- /**
4
- * See [core_crypto::e2e_identity::WireE2eIdentity::directory_response]
5
- * @param {Uint8Array} directory
6
- * @returns {any}
7
- */
8
- directory_response(directory: Uint8Array): any;
9
- /**
10
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_account_request]
11
- * @param {any} directory
12
- * @param {string} previous_nonce
13
- * @returns {Uint8Array}
14
- */
15
- new_account_request(directory: any, previous_nonce: string): Uint8Array;
16
- /**
17
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_account_response]
18
- * @param {Uint8Array} account
19
- * @returns {Uint8Array}
20
- */
21
- new_account_response(account: Uint8Array): Uint8Array;
22
- /**
23
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_order_request]
24
- * @param {string} handle
25
- * @param {string} client_id
26
- * @param {number} expiry_days
27
- * @param {any} directory
28
- * @param {Uint8Array} account
29
- * @param {string} previous_nonce
30
- * @returns {Uint8Array}
31
- */
32
- new_order_request(handle: string, client_id: string, expiry_days: number, directory: any, account: Uint8Array, previous_nonce: string): Uint8Array;
33
- /**
34
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_order_response]
35
- * @param {Uint8Array} order
36
- * @returns {any}
37
- */
38
- new_order_response(order: Uint8Array): any;
39
- /**
40
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_authz_request]
41
- * @param {string} url
42
- * @param {Uint8Array} account
43
- * @param {string} previous_nonce
44
- * @returns {Uint8Array}
45
- */
46
- new_authz_request(url: string, account: Uint8Array, previous_nonce: string): Uint8Array;
47
- /**
48
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_authz_response]
49
- * @param {Uint8Array} authz
50
- * @returns {any}
51
- */
52
- new_authz_response(authz: Uint8Array): any;
53
- /**
54
- * See [core_crypto::e2e_identity::WireE2eIdentity::create_dpop_token]
55
- * @param {string} access_token_url
56
- * @param {string} user_id
57
- * @param {bigint} client_id
58
- * @param {string} domain
59
- * @param {any} client_id_challenge
60
- * @param {string} backend_nonce
61
- * @param {number} expiry_days
62
- * @returns {string}
63
- */
64
- create_dpop_token(access_token_url: string, user_id: string, client_id: bigint, domain: string, client_id_challenge: any, backend_nonce: string, expiry_days: number): string;
65
- /**
66
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_challenge_request]
67
- * @param {any} handle_challenge
68
- * @param {Uint8Array} account
69
- * @param {string} previous_nonce
70
- * @returns {Uint8Array}
71
- */
72
- new_challenge_request(handle_challenge: any, account: Uint8Array, previous_nonce: string): Uint8Array;
73
- /**
74
- * See [core_crypto::e2e_identity::WireE2eIdentity::new_challenge_response]
75
- * @param {Uint8Array} challenge
76
- */
77
- new_challenge_response(challenge: Uint8Array): void;
78
- /**
79
- * See [core_crypto::e2e_identity::WireE2eIdentity::check_order_request]
80
- * @param {string} order_url
81
- * @param {Uint8Array} account
82
- * @param {string} previous_nonce
83
- * @returns {Uint8Array}
84
- */
85
- check_order_request(order_url: string, account: Uint8Array, previous_nonce: string): Uint8Array;
86
- /**
87
- * See [core_crypto::e2e_identity::WireE2eIdentity::check_order_response]
88
- * @param {Uint8Array} order
89
- * @returns {Uint8Array}
90
- */
91
- check_order_response(order: Uint8Array): Uint8Array;
92
- /**
93
- * See [core_crypto::e2e_identity::WireE2eIdentity::finalize_request]
94
- * @param {(Uint8Array)[]} domains
95
- * @param {Uint8Array} order
96
- * @param {Uint8Array} account
97
- * @param {string} previous_nonce
98
- * @returns {Uint8Array}
99
- */
100
- finalize_request(domains: (Uint8Array)[], order: Uint8Array, account: Uint8Array, previous_nonce: string): Uint8Array;
101
- /**
102
- * See [core_crypto::e2e_identity::WireE2eIdentity::finalize_response]
103
- * @param {Uint8Array} finalize
104
- * @returns {any}
105
- */
106
- finalize_response(finalize: Uint8Array): any;
107
- /**
108
- * See [core_crypto::e2e_identity::WireE2eIdentity::certificate_request]
109
- * @param {any} finalize
110
- * @param {Uint8Array} account
111
- * @param {string} previous_nonce
112
- * @returns {Uint8Array}
113
- */
114
- certificate_request(finalize: any, account: Uint8Array, previous_nonce: string): Uint8Array;
115
- /**
116
- * See [core_crypto::e2e_identity::WireE2eIdentity::certificate_response]
117
- * @param {string} certificate_chain
118
- * @returns {(Uint8Array)[]}
119
- */
120
- certificate_response(certificate_chain: string): (Uint8Array)[];
121
- }
122
1
  /**
123
2
  * Error wrapper that takes care of extracting rich error details across the FFI (through JSON parsing)
124
3
  *
@@ -1016,7 +895,7 @@ type AcmeOrder = Uint8Array;
1016
895
  export declare class WireE2eIdentity {
1017
896
  #private;
1018
897
  /** @hidden */
1019
- constructor(e2ei: CoreCryptoFfiTypes.FfiWireE2EIdentity);
898
+ constructor(e2ei: unknown);
1020
899
  /**
1021
900
  * Parses the response from `GET /acme/{provisioner-name}/directory`.
1022
901
  * Use this {@link AcmeDirectory} in the next step to fetch the first nonce from the acme server. Use
@@ -1133,13 +1012,13 @@ export declare class WireE2eIdentity {
1133
1012
  /**
1134
1013
  * Final step before fetching the certificate.
1135
1014
  *
1136
- * @param domains you want to generate a certificate for e.g. `["wire.com"]`
1137
- * @param order you got from {@link checkOrderResponse}
1138
- * @param account you found after {@link newAccountResponse}
1139
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
1015
+ * @param domains - domains you want to generate a certificate for e.g. `["wire.com"]`
1016
+ * @param order - order you got from {@link checkOrderResponse}
1017
+ * @param account - account you found after {@link newAccountResponse}
1018
+ * @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
1140
1019
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
1141
1020
  */
1142
- finalizeRequest(domains: Uint8Array[], order: AcmeOrder, account: AcmeAccount, previousNonce: string): JsonRawData;
1021
+ finalizeRequest(domains: string[], order: AcmeOrder, account: AcmeAccount, previousNonce: string): JsonRawData;
1143
1022
  /**
1144
1023
  * Parses the response from `POST /acme/{provisioner-name}/order/{order-id}/finalize`.
1145
1024
  *
@@ -34,6 +34,14 @@ 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
+ }
37
45
  function dropObject(idx) {
38
46
  if (idx < 132)
39
47
  return;
@@ -45,14 +53,6 @@ function takeObject(idx) {
45
53
  dropObject(idx);
46
54
  return ret;
47
55
  }
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;
@@ -228,7 +228,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
228
228
  function __wbg_adapter_52(arg0, arg1, arg2) {
229
229
  try {
230
230
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
231
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h017e8b5914b4ce6e(retptr, arg0, arg1, addHeapObject(arg2));
231
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0b669391a1ca469a(retptr, arg0, arg1, addHeapObject(arg2));
232
232
  var r0 = getInt32Memory0()[retptr / 4 + 0];
233
233
  var r1 = getInt32Memory0()[retptr / 4 + 1];
234
234
  if (r1) {
@@ -240,7 +240,7 @@ function __wbg_adapter_52(arg0, arg1, arg2) {
240
240
  }
241
241
  }
242
242
  function __wbg_adapter_55(arg0, arg1, arg2) {
243
- wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2cd85c49913904d9(arg0, arg1, addHeapObject(arg2));
243
+ wasm$1._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha3d8e2730fb8635e(arg0, arg1, addHeapObject(arg2));
244
244
  }
245
245
  function _assertClass(instance, klass) {
246
246
  if (!(instance instanceof klass)) {
@@ -307,8 +307,8 @@ function handleError(f, args) {
307
307
  function getArrayU8FromWasm0(ptr, len) {
308
308
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
309
309
  }
310
- function __wbg_adapter_263(arg0, arg1, arg2, arg3) {
311
- wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h8cd39efe380c2d83(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
310
+ function __wbg_adapter_267(arg0, arg1, arg2, arg3) {
311
+ wasm$1.wasm_bindgen__convert__closures__invoke2_mut__h191981cd1d6b08cc(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
312
312
  }
313
313
  /**
314
314
  * see [core_crypto::prelude::MlsWirePolicy]
@@ -1838,7 +1838,7 @@ class FfiWireE2EIdentity {
1838
1838
  }
1839
1839
  /**
1840
1840
  * See [core_crypto::e2e_identity::WireE2eIdentity::finalize_request]
1841
- * @param {(Uint8Array)[]} domains
1841
+ * @param {(string)[]} domains
1842
1842
  * @param {Uint8Array} order
1843
1843
  * @param {Uint8Array} account
1844
1844
  * @param {string} previous_nonce
@@ -2244,9 +2244,6 @@ async function load(module, imports) {
2244
2244
  function getImports() {
2245
2245
  const imports = {};
2246
2246
  imports.wbg = {};
2247
- imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2248
- takeObject(arg0);
2249
- };
2250
2247
  imports.wbg.__wbindgen_object_clone_ref = function (arg0) {
2251
2248
  const ret = getObject(arg0);
2252
2249
  return addHeapObject(ret);
@@ -2256,6 +2253,9 @@ function getImports() {
2256
2253
  const ret = typeof (val) === 'object' && val !== null;
2257
2254
  return ret;
2258
2255
  };
2256
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
2257
+ takeObject(arg0);
2258
+ };
2259
2259
  imports.wbg.__wbg_getwithrefkey_15c62c2b8546208d = function (arg0, arg1) {
2260
2260
  const ret = getObject(arg0)[getObject(arg1)];
2261
2261
  return addHeapObject(ret);
@@ -2296,34 +2296,22 @@ function getImports() {
2296
2296
  const ret = getObject(arg0).length;
2297
2297
  return ret;
2298
2298
  };
2299
- imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2300
- const ret = new Uint8Array(getObject(arg0));
2301
- return addHeapObject(ret);
2302
- };
2303
2299
  imports.wbg.__wbg_call_9495de66fdbe016b = function () {
2304
2300
  return handleError(function (arg0, arg1, arg2) {
2305
2301
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
2306
2302
  return addHeapObject(ret);
2307
2303
  }, arguments);
2308
2304
  };
2309
- imports.wbg.__wbg_new_f9876326328f45ed = function () {
2310
- const ret = new Object();
2311
- return addHeapObject(ret);
2312
- };
2313
- imports.wbg.__wbg_new_f841cc6f2098f4b5 = function () {
2314
- const ret = new Map();
2315
- return addHeapObject(ret);
2316
- };
2317
- imports.wbg.__wbg_set_388c4c6422704173 = function (arg0, arg1, arg2) {
2318
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2305
+ imports.wbg.__wbg_new_537b7341ce90bb31 = function (arg0) {
2306
+ const ret = new Uint8Array(getObject(arg0));
2319
2307
  return addHeapObject(ret);
2320
2308
  };
2321
2309
  imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) {
2322
2310
  const ret = BigInt.asUintN(64, arg0);
2323
2311
  return addHeapObject(ret);
2324
2312
  };
2325
- imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2326
- const ret = FfiWireE2EIdentity.__wrap(arg0);
2313
+ imports.wbg.__wbg_new_f9876326328f45ed = function () {
2314
+ const ret = new Object();
2327
2315
  return addHeapObject(ret);
2328
2316
  };
2329
2317
  imports.wbg.__wbg_new_b525de17f44a8943 = function () {
@@ -2340,9 +2328,9 @@ function getImports() {
2340
2328
  const ret = arg0;
2341
2329
  return addHeapObject(ret);
2342
2330
  };
2343
- imports.wbg.__wbg_push_49c286f04dd3bf59 = function (arg0, arg1) {
2344
- const ret = getObject(arg0).push(getObject(arg1));
2345
- return ret;
2331
+ imports.wbg.__wbg_ffiwiree2eidentity_new = function (arg0) {
2332
+ const ret = FfiWireE2EIdentity.__wrap(arg0);
2333
+ return addHeapObject(ret);
2346
2334
  };
2347
2335
  imports.wbg.__wbg_new_9d3a9ce4282a18a8 = function (arg0, arg1) {
2348
2336
  try {
@@ -2351,7 +2339,7 @@ function getImports() {
2351
2339
  const a = state0.a;
2352
2340
  state0.a = 0;
2353
2341
  try {
2354
- return __wbg_adapter_263(a, state0.b, arg0, arg1);
2342
+ return __wbg_adapter_267(a, state0.b, arg0, arg1);
2355
2343
  }
2356
2344
  finally {
2357
2345
  state0.a = a;
@@ -2364,6 +2352,18 @@ function getImports() {
2364
2352
  state0.a = state0.b = 0;
2365
2353
  }
2366
2354
  };
2355
+ imports.wbg.__wbg_push_49c286f04dd3bf59 = function (arg0, arg1) {
2356
+ const ret = getObject(arg0).push(getObject(arg1));
2357
+ return ret;
2358
+ };
2359
+ imports.wbg.__wbg_new_f841cc6f2098f4b5 = function () {
2360
+ const ret = new Map();
2361
+ return addHeapObject(ret);
2362
+ };
2363
+ imports.wbg.__wbg_set_388c4c6422704173 = function (arg0, arg1, arg2) {
2364
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2365
+ return addHeapObject(ret);
2366
+ };
2367
2367
  imports.wbg.__wbg_setonsuccess_925a7718d3f62bc1 = function (arg0, arg1) {
2368
2368
  getObject(arg0).onsuccess = getObject(arg1);
2369
2369
  };
@@ -2448,6 +2448,10 @@ function getImports() {
2448
2448
  return addHeapObject(ret);
2449
2449
  }, arguments);
2450
2450
  };
2451
+ imports.wbg.__wbg_length_ea0846e494e3b16e = function (arg0) {
2452
+ const ret = getObject(arg0).length;
2453
+ return ret;
2454
+ };
2451
2455
  imports.wbg.__wbg_reject_57029f54148d79c3 = function (arg0) {
2452
2456
  const ret = Promise.reject(getObject(arg0));
2453
2457
  return addHeapObject(ret);
@@ -2638,6 +2642,10 @@ function getImports() {
2638
2642
  const ret = new Uint8Array(arg0 >>> 0);
2639
2643
  return addHeapObject(ret);
2640
2644
  };
2645
+ imports.wbg.__wbg_charCodeAt_d78a90aced59e02f = function (arg0, arg1) {
2646
+ const ret = getObject(arg0).charCodeAt(arg1 >>> 0);
2647
+ return ret;
2648
+ };
2641
2649
  imports.wbg.__wbg_next_88560ec06a094dea = function () {
2642
2650
  return handleError(function (arg0) {
2643
2651
  const ret = getObject(arg0).next();
@@ -2719,6 +2727,12 @@ function getImports() {
2719
2727
  const ret = getObject(arg0).target;
2720
2728
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
2721
2729
  };
2730
+ imports.wbg.__wbg_error_f64b8d41ed4d2fdc = function () {
2731
+ return handleError(function (arg0) {
2732
+ const ret = getObject(arg0).error;
2733
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
2734
+ }, arguments);
2735
+ };
2722
2736
  imports.wbg.__wbg_result_3a1fef332bc47038 = function () {
2723
2737
  return handleError(function (arg0) {
2724
2738
  const ret = getObject(arg0).result;
@@ -2759,12 +2773,6 @@ function getImports() {
2759
2773
  getObject(arg0).deleteObjectStore(getStringFromWasm0(arg1, arg2));
2760
2774
  }, arguments);
2761
2775
  };
2762
- imports.wbg.__wbg_error_f64b8d41ed4d2fdc = function () {
2763
- return handleError(function (arg0) {
2764
- const ret = getObject(arg0).error;
2765
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
2766
- }, arguments);
2767
- };
2768
2776
  imports.wbg.__wbindgen_is_falsy = function (arg0) {
2769
2777
  const ret = !getObject(arg0);
2770
2778
  return ret;
@@ -2944,12 +2952,12 @@ function getImports() {
2944
2952
  return addHeapObject(ret);
2945
2953
  }, arguments);
2946
2954
  };
2947
- imports.wbg.__wbindgen_closure_wrapper4326 = function (arg0, arg1, arg2) {
2948
- const ret = makeMutClosure(arg0, arg1, 146, __wbg_adapter_52);
2955
+ imports.wbg.__wbindgen_closure_wrapper4324 = function (arg0, arg1, arg2) {
2956
+ const ret = makeMutClosure(arg0, arg1, 145, __wbg_adapter_52);
2949
2957
  return addHeapObject(ret);
2950
2958
  };
2951
- imports.wbg.__wbindgen_closure_wrapper4766 = function (arg0, arg1, arg2) {
2952
- const ret = makeMutClosure(arg0, arg1, 146, __wbg_adapter_55);
2959
+ imports.wbg.__wbindgen_closure_wrapper4778 = function (arg0, arg1, arg2) {
2960
+ const ret = makeMutClosure(arg0, arg1, 145, __wbg_adapter_55);
2953
2961
  return addHeapObject(ret);
2954
2962
  };
2955
2963
  return imports;
@@ -3010,7 +3018,7 @@ var exports = /*#__PURE__*/Object.freeze({
3010
3018
  var wasm = async (opt = {}) => {
3011
3019
  let {importHook, serverPath} = opt;
3012
3020
 
3013
- let path = "assets/core_crypto_ffi-fb64c1f7.wasm";
3021
+ let path = "assets/core_crypto_ffi-734d7b2f.wasm";
3014
3022
 
3015
3023
  if (serverPath != null) {
3016
3024
  path = serverPath + /[^\/\\]*$/.exec(path)[0];
@@ -4152,10 +4160,10 @@ class WireE2eIdentity {
4152
4160
  /**
4153
4161
  * Final step before fetching the certificate.
4154
4162
  *
4155
- * @param domains you want to generate a certificate for e.g. `["wire.com"]`
4156
- * @param order you got from {@link checkOrderResponse}
4157
- * @param account you found after {@link newAccountResponse}
4158
- * @param previousNonce `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
4163
+ * @param domains - domains you want to generate a certificate for e.g. `["wire.com"]`
4164
+ * @param order - order you got from {@link checkOrderResponse}
4165
+ * @param account - account you found after {@link newAccountResponse}
4166
+ * @param previousNonce - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}`
4159
4167
  * @see https://www.rfc-editor.org/rfc/rfc8555.html#section-7.4
4160
4168
  */
4161
4169
  finalizeRequest(domains, order, account, previousNonce) {