@provablehq/wasm 0.9.8 → 0.9.9

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.
@@ -1817,6 +1817,13 @@ export class Poseidon8 {
1817
1817
  */
1818
1818
  export class PrivateKey {
1819
1819
  free(): void;
1820
+ /**
1821
+ * Sign an instance of a valid Aleo data type or record.
1822
+ *
1823
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
1824
+ * @returns {Signature} Signature of the message.
1825
+ */
1826
+ signValue(message: string): Signature;
1820
1827
  /**
1821
1828
  * Get the address corresponding to the private key
1822
1829
  *
@@ -2997,6 +3004,14 @@ export class Scalar {
2997
3004
  export class Signature {
2998
3005
  private constructor();
2999
3006
  free(): void;
3007
+ /**
3008
+ * Sign an instance of a valid Aleo data type or record.
3009
+ *
3010
+ * @param {PrivateKey} private_key The private key used to sign the message.
3011
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
3012
+ * @returns {Signature} Signature of the message.
3013
+ */
3014
+ static signValue(private_key: PrivateKey, message: string): Signature;
3000
3015
  /**
3001
3016
  * Get an address from a signature.
3002
3017
  *
@@ -3030,6 +3045,14 @@ export class Signature {
3030
3045
  * Get the plaintext representation of the signature.
3031
3046
  */
3032
3047
  toPlaintext(): Plaintext;
3048
+ /**
3049
+ * Verify a signature over an Aleo datatype or record by an address.
3050
+ *
3051
+ * @param {Address} address The address used to verify the signature.
3052
+ * @param {String} message The message to verify, which must be the string representation of a valid Aleo datatype or record.
3053
+ * @returns {boolean} True if the signature is valid, false otherwise.
3054
+ */
3055
+ verifyValue(address: Address, message: string): boolean;
3033
3056
  /**
3034
3057
  * Get a signature from a series of bytes.
3035
3058
  *
Binary file
@@ -287,7 +287,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
287
287
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
288
288
  }
289
289
 
290
- function __wbg_adapter_856(arg0, arg1, arg2, arg3) {
290
+ function __wbg_adapter_859(arg0, arg1, arg2, arg3) {
291
291
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
292
292
  }
293
293
 
@@ -6636,6 +6636,31 @@ class PrivateKey {
6636
6636
  const ptr = this.__destroy_into_raw();
6637
6637
  wasm.__wbg_privatekey_free(ptr, 0);
6638
6638
  }
6639
+ /**
6640
+ * Sign an instance of a valid Aleo data type or record.
6641
+ *
6642
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
6643
+ * @returns {Signature} Signature of the message.
6644
+ * @param {string} message
6645
+ * @returns {Signature}
6646
+ */
6647
+ signValue(message) {
6648
+ try {
6649
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6650
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
6651
+ const len0 = WASM_VECTOR_LEN;
6652
+ wasm.privatekey_signValue(retptr, this.__wbg_ptr, ptr0, len0);
6653
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6654
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6655
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6656
+ if (r2) {
6657
+ throw takeObject(r1);
6658
+ }
6659
+ return Signature.__wrap(r0);
6660
+ } finally {
6661
+ wasm.__wbindgen_add_to_stack_pointer(16);
6662
+ }
6663
+ }
6639
6664
  /**
6640
6665
  * Get the address corresponding to the private key
6641
6666
  *
@@ -9639,6 +9664,34 @@ class Signature {
9639
9664
  const ptr = this.__destroy_into_raw();
9640
9665
  wasm.__wbg_signature_free(ptr, 0);
9641
9666
  }
9667
+ /**
9668
+ * Sign an instance of a valid Aleo data type or record.
9669
+ *
9670
+ * @param {PrivateKey} private_key The private key used to sign the message.
9671
+ * @param {String} message The string representation of the Aleo datatype or record to sign.
9672
+ * @returns {Signature} Signature of the message.
9673
+ * @param {PrivateKey} private_key
9674
+ * @param {string} message
9675
+ * @returns {Signature}
9676
+ */
9677
+ static signValue(private_key, message) {
9678
+ try {
9679
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9680
+ _assertClass(private_key, PrivateKey);
9681
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
9682
+ const len0 = WASM_VECTOR_LEN;
9683
+ wasm.signature_signValue(retptr, private_key.__wbg_ptr, ptr0, len0);
9684
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9685
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9686
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
9687
+ if (r2) {
9688
+ throw takeObject(r1);
9689
+ }
9690
+ return Signature.__wrap(r0);
9691
+ } finally {
9692
+ wasm.__wbindgen_add_to_stack_pointer(16);
9693
+ }
9694
+ }
9642
9695
  /**
9643
9696
  * Get an address from a signature.
9644
9697
  *
@@ -9722,6 +9775,34 @@ class Signature {
9722
9775
  const ret = wasm.signature_toPlaintext(this.__wbg_ptr);
9723
9776
  return Plaintext.__wrap(ret);
9724
9777
  }
9778
+ /**
9779
+ * Verify a signature over an Aleo datatype or record by an address.
9780
+ *
9781
+ * @param {Address} address The address used to verify the signature.
9782
+ * @param {String} message The message to verify, which must be the string representation of a valid Aleo datatype or record.
9783
+ * @returns {boolean} True if the signature is valid, false otherwise.
9784
+ * @param {Address} address
9785
+ * @param {string} message
9786
+ * @returns {boolean}
9787
+ */
9788
+ verifyValue(address, message) {
9789
+ try {
9790
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9791
+ _assertClass(address, Address);
9792
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
9793
+ const len0 = WASM_VECTOR_LEN;
9794
+ wasm.signature_verifyValue(retptr, this.__wbg_ptr, address.__wbg_ptr, ptr0, len0);
9795
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9796
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9797
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
9798
+ if (r2) {
9799
+ throw takeObject(r1);
9800
+ }
9801
+ return r0 !== 0;
9802
+ } finally {
9803
+ wasm.__wbindgen_add_to_stack_pointer(16);
9804
+ }
9805
+ }
9725
9806
  /**
9726
9807
  * Get a signature from a series of bytes.
9727
9808
  *
@@ -12941,7 +13022,7 @@ function __wbg_get_imports() {
12941
13022
  const ret = getObject(arg0).length;
12942
13023
  return ret;
12943
13024
  };
12944
- imports.wbg.__wbg_log_941d3627df3e4a6f = function(arg0, arg1) {
13025
+ imports.wbg.__wbg_log_95e0b7e090d013b6 = function(arg0, arg1) {
12945
13026
  console.log(getStringFromWasm0(arg0, arg1));
12946
13027
  };
12947
13028
  imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
@@ -12959,7 +13040,7 @@ function __wbg_get_imports() {
12959
13040
  const a = state0.a;
12960
13041
  state0.a = 0;
12961
13042
  try {
12962
- return __wbg_adapter_856(a, state0.b, arg0, arg1);
13043
+ return __wbg_adapter_859(a, state0.b, arg0, arg1);
12963
13044
  } finally {
12964
13045
  state0.a = a;
12965
13046
  }
@@ -13146,7 +13227,7 @@ function __wbg_get_imports() {
13146
13227
  const ret = Signature.__wrap(arg0);
13147
13228
  return addHeapObject(ret);
13148
13229
  };
13149
- imports.wbg.__wbg_spawnWorker_ffdd33a3c185ce11 = function(arg0, arg1, arg2, arg3) {
13230
+ imports.wbg.__wbg_spawnWorker_45047dc45447b7dc = function(arg0, arg1, arg2, arg3) {
13150
13231
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
13151
13232
  return addHeapObject(ret);
13152
13233
  };
@@ -13266,11 +13347,11 @@ function __wbg_get_imports() {
13266
13347
  const ret = false;
13267
13348
  return ret;
13268
13349
  };
13269
- imports.wbg.__wbindgen_closure_wrapper6729 = function(arg0, arg1, arg2) {
13350
+ imports.wbg.__wbindgen_closure_wrapper6736 = function(arg0, arg1, arg2) {
13270
13351
  const ret = makeMutClosure(arg0, arg1, 492, __wbg_adapter_40);
13271
13352
  return addHeapObject(ret);
13272
13353
  };
13273
- imports.wbg.__wbindgen_closure_wrapper6734 = function(arg0, arg1, arg2) {
13354
+ imports.wbg.__wbindgen_closure_wrapper6741 = function(arg0, arg1, arg2) {
13274
13355
  const ret = makeMutClosure(arg0, arg1, 492, __wbg_adapter_40);
13275
13356
  return addHeapObject(ret);
13276
13357
  };