@provablehq/wasm 0.9.17 → 0.9.18

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.
@@ -104,6 +104,12 @@ export class Address {
104
104
  * Get the plaintext representation of the address.
105
105
  */
106
106
  toPlaintext(): Plaintext;
107
+ /**
108
+ * Get a string representation of an Aleo address object
109
+ *
110
+ * @returns {string} String representation of the address
111
+ */
112
+ toString(): string;
107
113
  /**
108
114
  * Get a string representation of an Aleo address object
109
115
  *
@@ -924,6 +930,12 @@ export class GraphKey {
924
930
  * Get the sk_tag of the graph key. Used to determine ownership of records.
925
931
  */
926
932
  sk_tag(): Field;
933
+ /**
934
+ * Get a string representation of a graph key
935
+ *
936
+ * @returns {string} String representation of a graph key
937
+ */
938
+ toString(): string;
927
939
  /**
928
940
  * Get a string representation of a graph key
929
941
  *
@@ -1920,6 +1932,13 @@ export class Poseidon8 {
1920
1932
  export class PrivateKey {
1921
1933
  free(): void;
1922
1934
  [Symbol.dispose](): void;
1935
+ /**
1936
+ * Get a private key from a byte representation
1937
+ *
1938
+ * @param {Uint8Array} bytes Byte representation of a private key
1939
+ * @returns {PrivateKey} Private key
1940
+ */
1941
+ static fromBytesLe(bytes: Uint8Array): PrivateKey;
1923
1942
  /**
1924
1943
  * Get private key from a private key ciphertext and secret originally used to encrypt it
1925
1944
  *
@@ -1970,6 +1989,12 @@ export class PrivateKey {
1970
1989
  * @returns {Signature} Signature of the message.
1971
1990
  */
1972
1991
  signValue(message: string): Signature;
1992
+ /**
1993
+ * Get the byte representation of a private key
1994
+ *
1995
+ * @returns {Uint8Array} Byte representation of a private key
1996
+ */
1997
+ toBytesLe(): Uint8Array;
1973
1998
  /**
1974
1999
  * Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
1975
2000
  * decrypt the private key later, so it should be stored securely
@@ -1978,6 +2003,13 @@ export class PrivateKey {
1978
2003
  * @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
1979
2004
  */
1980
2005
  toCiphertext(secret: string): PrivateKeyCiphertext;
2006
+ /**
2007
+ * Get a string representation of the private key. This function should be used very carefully
2008
+ * as it exposes the private key plaintext
2009
+ *
2010
+ * @returns {string} String representation of a private key
2011
+ */
2012
+ toString(): string;
1981
2013
  /**
1982
2014
  * Get the address corresponding to the private key
1983
2015
  *
@@ -3295,6 +3327,12 @@ export class Signature {
3295
3327
  * Get the plaintext representation of the signature.
3296
3328
  */
3297
3329
  toPlaintext(): Plaintext;
3330
+ /**
3331
+ * Get a string representation of a signature
3332
+ *
3333
+ * @returns {string} String representation of a signature
3334
+ */
3335
+ toString(): string;
3298
3336
  /**
3299
3337
  * Get an address from a signature.
3300
3338
  *
@@ -4399,6 +4437,12 @@ export class ViewKey {
4399
4437
  * Cast the view key to a field.
4400
4438
  */
4401
4439
  toField(): Field;
4440
+ /**
4441
+ * Get a string representation of a view key
4442
+ *
4443
+ * @returns {string} String representation of a view key
4444
+ */
4445
+ toString(): string;
4402
4446
  /**
4403
4447
  * Get the address corresponding to a view key
4404
4448
  *
Binary file
@@ -293,6 +293,28 @@ class Address {
293
293
  const ret = wasm.address_toPlaintext(this.__wbg_ptr);
294
294
  return Plaintext.__wrap(ret);
295
295
  }
296
+ /**
297
+ * Get a string representation of an Aleo address object
298
+ *
299
+ * @returns {string} String representation of the address
300
+ * @returns {string}
301
+ */
302
+ toString() {
303
+ let deferred1_0;
304
+ let deferred1_1;
305
+ try {
306
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
307
+ wasm.address_toString(retptr, this.__wbg_ptr);
308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
+ deferred1_0 = r0;
311
+ deferred1_1 = r1;
312
+ return getStringFromWasm0(r0, r1);
313
+ } finally {
314
+ wasm.__wbindgen_add_to_stack_pointer(16);
315
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
316
+ }
317
+ }
296
318
  /**
297
319
  * Get a string representation of an Aleo address object
298
320
  *
@@ -2920,6 +2942,28 @@ class GraphKey {
2920
2942
  const ret = wasm.graphkey_sk_tag(this.__wbg_ptr);
2921
2943
  return Field.__wrap(ret);
2922
2944
  }
2945
+ /**
2946
+ * Get a string representation of a graph key
2947
+ *
2948
+ * @returns {string} String representation of a graph key
2949
+ * @returns {string}
2950
+ */
2951
+ toString() {
2952
+ let deferred1_0;
2953
+ let deferred1_1;
2954
+ try {
2955
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2956
+ wasm.graphkey_toString(retptr, this.__wbg_ptr);
2957
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2958
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2959
+ deferred1_0 = r0;
2960
+ deferred1_1 = r1;
2961
+ return getStringFromWasm0(r0, r1);
2962
+ } finally {
2963
+ wasm.__wbindgen_add_to_stack_pointer(16);
2964
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
2965
+ }
2966
+ }
2923
2967
  /**
2924
2968
  * Get a string representation of a graph key
2925
2969
  *
@@ -6362,6 +6406,31 @@ class PrivateKey {
6362
6406
  const ptr = this.__destroy_into_raw();
6363
6407
  wasm.__wbg_privatekey_free(ptr, 0);
6364
6408
  }
6409
+ /**
6410
+ * Get a private key from a byte representation
6411
+ *
6412
+ * @param {Uint8Array} bytes Byte representation of a private key
6413
+ * @returns {PrivateKey} Private key
6414
+ * @param {Uint8Array} bytes
6415
+ * @returns {PrivateKey}
6416
+ */
6417
+ static fromBytesLe(bytes) {
6418
+ try {
6419
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6420
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
6421
+ const len0 = WASM_VECTOR_LEN;
6422
+ wasm.privatekey_fromBytesLe(retptr, ptr0, len0);
6423
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6424
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6425
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6426
+ if (r2) {
6427
+ throw takeObject(r1);
6428
+ }
6429
+ return PrivateKey.__wrap(r0);
6430
+ } finally {
6431
+ wasm.__wbindgen_add_to_stack_pointer(16);
6432
+ }
6433
+ }
6365
6434
  /**
6366
6435
  * Get private key from a private key ciphertext and secret originally used to encrypt it
6367
6436
  *
@@ -6505,6 +6574,30 @@ class PrivateKey {
6505
6574
  wasm.__wbindgen_add_to_stack_pointer(16);
6506
6575
  }
6507
6576
  }
6577
+ /**
6578
+ * Get the byte representation of a private key
6579
+ *
6580
+ * @returns {Uint8Array} Byte representation of a private key
6581
+ * @returns {Uint8Array}
6582
+ */
6583
+ toBytesLe() {
6584
+ try {
6585
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6586
+ wasm.privatekey_toBytesLe(retptr, this.__wbg_ptr);
6587
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6588
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6589
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6590
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6591
+ if (r3) {
6592
+ throw takeObject(r2);
6593
+ }
6594
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
6595
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6596
+ return v1;
6597
+ } finally {
6598
+ wasm.__wbindgen_add_to_stack_pointer(16);
6599
+ }
6600
+ }
6508
6601
  /**
6509
6602
  * Encrypt an existing private key with a secret. The secret is sensitive and will be needed to
6510
6603
  * decrypt the private key later, so it should be stored securely
@@ -6531,6 +6624,29 @@ class PrivateKey {
6531
6624
  wasm.__wbindgen_add_to_stack_pointer(16);
6532
6625
  }
6533
6626
  }
6627
+ /**
6628
+ * Get a string representation of the private key. This function should be used very carefully
6629
+ * as it exposes the private key plaintext
6630
+ *
6631
+ * @returns {string} String representation of a private key
6632
+ * @returns {string}
6633
+ */
6634
+ toString() {
6635
+ let deferred1_0;
6636
+ let deferred1_1;
6637
+ try {
6638
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6639
+ wasm.privatekey_toString(retptr, this.__wbg_ptr);
6640
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6641
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6642
+ deferred1_0 = r0;
6643
+ deferred1_1 = r1;
6644
+ return getStringFromWasm0(r0, r1);
6645
+ } finally {
6646
+ wasm.__wbindgen_add_to_stack_pointer(16);
6647
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
6648
+ }
6649
+ }
6534
6650
  /**
6535
6651
  * Get the address corresponding to the private key
6536
6652
  *
@@ -9798,6 +9914,28 @@ class Signature {
9798
9914
  const ret = wasm.signature_toPlaintext(this.__wbg_ptr);
9799
9915
  return Plaintext.__wrap(ret);
9800
9916
  }
9917
+ /**
9918
+ * Get a string representation of a signature
9919
+ *
9920
+ * @returns {string} String representation of a signature
9921
+ * @returns {string}
9922
+ */
9923
+ toString() {
9924
+ let deferred1_0;
9925
+ let deferred1_1;
9926
+ try {
9927
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9928
+ wasm.signature_toString(retptr, this.__wbg_ptr);
9929
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9930
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9931
+ deferred1_0 = r0;
9932
+ deferred1_1 = r1;
9933
+ return getStringFromWasm0(r0, r1);
9934
+ } finally {
9935
+ wasm.__wbindgen_add_to_stack_pointer(16);
9936
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
9937
+ }
9938
+ }
9801
9939
  /**
9802
9940
  * Get an address from a signature.
9803
9941
  *
@@ -12767,6 +12905,28 @@ class ViewKey {
12767
12905
  wasm.__wbindgen_add_to_stack_pointer(16);
12768
12906
  }
12769
12907
  }
12908
+ /**
12909
+ * Get a string representation of a view key
12910
+ *
12911
+ * @returns {string} String representation of a view key
12912
+ * @returns {string}
12913
+ */
12914
+ toString() {
12915
+ let deferred1_0;
12916
+ let deferred1_1;
12917
+ try {
12918
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12919
+ wasm.viewkey_toString(retptr, this.__wbg_ptr);
12920
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12921
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12922
+ deferred1_0 = r0;
12923
+ deferred1_1 = r1;
12924
+ return getStringFromWasm0(r0, r1);
12925
+ } finally {
12926
+ wasm.__wbindgen_add_to_stack_pointer(16);
12927
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
12928
+ }
12929
+ }
12770
12930
  /**
12771
12931
  * Get the address corresponding to a view key
12772
12932
  *
@@ -13102,7 +13262,7 @@ function __wbg_get_imports(memory) {
13102
13262
  const ret = getObject(arg0).length;
13103
13263
  return ret;
13104
13264
  },
13105
- __wbg_log_97dc7bb11f79001e: function(arg0, arg1) {
13265
+ __wbg_log_aa601feca8d69ed7: function(arg0, arg1) {
13106
13266
  console.log(getStringFromWasm0(arg0, arg1));
13107
13267
  },
13108
13268
  __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
@@ -13152,7 +13312,7 @@ function __wbg_get_imports(memory) {
13152
13312
  const a = state0.a;
13153
13313
  state0.a = 0;
13154
13314
  try {
13155
- return __wasm_bindgen_func_elem_6924(a, state0.b, arg0, arg1);
13315
+ return __wasm_bindgen_func_elem_6936(a, state0.b, arg0, arg1);
13156
13316
  } finally {
13157
13317
  state0.a = a;
13158
13318
  }
@@ -13174,7 +13334,7 @@ function __wbg_get_imports(memory) {
13174
13334
  const a = state0.a;
13175
13335
  state0.a = 0;
13176
13336
  try {
13177
- return __wasm_bindgen_func_elem_6924(a, state0.b, arg0, arg1);
13337
+ return __wasm_bindgen_func_elem_6936(a, state0.b, arg0, arg1);
13178
13338
  } finally {
13179
13339
  state0.a = a;
13180
13340
  }
@@ -13336,7 +13496,7 @@ function __wbg_get_imports(memory) {
13336
13496
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
13337
13497
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
13338
13498
  },
13339
- __wbg_spawnWorker_8f51d1d6d7d23039: function(arg0, arg1, arg2, arg3) {
13499
+ __wbg_spawnWorker_f36316fbdd1713a5: function(arg0, arg1, arg2, arg3) {
13340
13500
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
13341
13501
  return addHeapObject(ret);
13342
13502
  },
@@ -13432,22 +13592,22 @@ function __wbg_get_imports(memory) {
13432
13592
  },
13433
13593
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
13434
13594
  // Cast intrinsic for `Closure(Closure { dtor_idx: 314, function: Function { arguments: [Externref], shim_idx: 315, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
13435
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1524, __wasm_bindgen_func_elem_6930);
13595
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1522, __wasm_bindgen_func_elem_6942);
13436
13596
  return addHeapObject(ret);
13437
13597
  },
13438
13598
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
13439
13599
  // Cast intrinsic for `Closure(Closure { dtor_idx: 314, function: Function { arguments: [Externref], shim_idx: 325, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13440
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1524, __wasm_bindgen_func_elem_1525);
13600
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1522, __wasm_bindgen_func_elem_1523);
13441
13601
  return addHeapObject(ret);
13442
13602
  },
13443
13603
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
13444
13604
  // Cast intrinsic for `Closure(Closure { dtor_idx: 314, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 325, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13445
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1524, __wasm_bindgen_func_elem_1525_2);
13605
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1522, __wasm_bindgen_func_elem_1523_2);
13446
13606
  return addHeapObject(ret);
13447
13607
  },
13448
13608
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
13449
13609
  // Cast intrinsic for `Closure(Closure { dtor_idx: 314, function: Function { arguments: [], shim_idx: 445, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
13450
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1524, __wasm_bindgen_func_elem_6579);
13610
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1522, __wasm_bindgen_func_elem_6590);
13451
13611
  return addHeapObject(ret);
13452
13612
  },
13453
13613
  __wbindgen_cast_0000000000000005: function(arg0) {
@@ -13514,22 +13674,22 @@ function __wbg_get_imports(memory) {
13514
13674
  };
13515
13675
  }
13516
13676
 
13517
- function __wasm_bindgen_func_elem_6579(arg0, arg1) {
13518
- wasm.__wasm_bindgen_func_elem_6579(arg0, arg1);
13677
+ function __wasm_bindgen_func_elem_6590(arg0, arg1) {
13678
+ wasm.__wasm_bindgen_func_elem_6590(arg0, arg1);
13519
13679
  }
13520
13680
 
13521
- function __wasm_bindgen_func_elem_1525(arg0, arg1, arg2) {
13522
- wasm.__wasm_bindgen_func_elem_1525(arg0, arg1, addHeapObject(arg2));
13681
+ function __wasm_bindgen_func_elem_1523(arg0, arg1, arg2) {
13682
+ wasm.__wasm_bindgen_func_elem_1523(arg0, arg1, addHeapObject(arg2));
13523
13683
  }
13524
13684
 
13525
- function __wasm_bindgen_func_elem_1525_2(arg0, arg1, arg2) {
13526
- wasm.__wasm_bindgen_func_elem_1525_2(arg0, arg1, addHeapObject(arg2));
13685
+ function __wasm_bindgen_func_elem_1523_2(arg0, arg1, arg2) {
13686
+ wasm.__wasm_bindgen_func_elem_1523_2(arg0, arg1, addHeapObject(arg2));
13527
13687
  }
13528
13688
 
13529
- function __wasm_bindgen_func_elem_6930(arg0, arg1, arg2) {
13689
+ function __wasm_bindgen_func_elem_6942(arg0, arg1, arg2) {
13530
13690
  try {
13531
13691
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
13532
- wasm.__wasm_bindgen_func_elem_6930(retptr, arg0, arg1, addHeapObject(arg2));
13692
+ wasm.__wasm_bindgen_func_elem_6942(retptr, arg0, arg1, addHeapObject(arg2));
13533
13693
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
13534
13694
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13535
13695
  if (r1) {
@@ -13540,8 +13700,8 @@ function __wasm_bindgen_func_elem_6930(arg0, arg1, arg2) {
13540
13700
  }
13541
13701
  }
13542
13702
 
13543
- function __wasm_bindgen_func_elem_6924(arg0, arg1, arg2, arg3) {
13544
- wasm.__wasm_bindgen_func_elem_6924(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
13703
+ function __wasm_bindgen_func_elem_6936(arg0, arg1, arg2, arg3) {
13704
+ wasm.__wasm_bindgen_func_elem_6936(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
13545
13705
  }
13546
13706
 
13547
13707