@provablehq/wasm 0.9.8 → 0.9.10-testnet-rc
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/dist/mainnet/aleo_wasm.d.ts +80 -10
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +223 -20
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +223 -19
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +80 -10
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +223 -20
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +223 -19
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +3 -3
|
@@ -16,6 +16,18 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
16
16
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
17
17
|
*/
|
|
18
18
|
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Set test consensus version heights for testing.
|
|
21
|
+
*
|
|
22
|
+
* @params {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { getOrInitConsensusVersionHeights } from @provablehq/sdk;
|
|
26
|
+
*
|
|
27
|
+
* Set the consensus version heights.
|
|
28
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9");
|
|
29
|
+
*/
|
|
30
|
+
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
19
31
|
/**
|
|
20
32
|
* Public address of an Aleo account
|
|
21
33
|
*/
|
|
@@ -809,6 +821,10 @@ export class Field {
|
|
|
809
821
|
* Create a field element from a Uint8Array of left endian bytes.
|
|
810
822
|
*/
|
|
811
823
|
static fromBytesLe(bytes: Uint8Array): Field;
|
|
824
|
+
/**
|
|
825
|
+
* Initializes a new field as a domain separator.
|
|
826
|
+
*/
|
|
827
|
+
static newDomainSeparator(domain: string): Field;
|
|
812
828
|
/**
|
|
813
829
|
* Add two field elements.
|
|
814
830
|
*/
|
|
@@ -1636,9 +1652,9 @@ export class Plaintext {
|
|
|
1636
1652
|
private constructor();
|
|
1637
1653
|
free(): void;
|
|
1638
1654
|
/**
|
|
1639
|
-
* Get the
|
|
1655
|
+
* Get the little endian boolean array representation of the bits of the plaintext.
|
|
1640
1656
|
*
|
|
1641
|
-
* @returns {Array} The
|
|
1657
|
+
* @returns {Array} The little endian boolean array representation of the bits of the plaintext.
|
|
1642
1658
|
*/
|
|
1643
1659
|
toBitsLe(): Array<any>;
|
|
1644
1660
|
/**
|
|
@@ -1658,15 +1674,15 @@ export class Plaintext {
|
|
|
1658
1674
|
*/
|
|
1659
1675
|
static fromString(plaintext: string): Plaintext;
|
|
1660
1676
|
/**
|
|
1661
|
-
* Get the
|
|
1677
|
+
* Get the little endian byte array representation of the plaintext.
|
|
1662
1678
|
*
|
|
1663
|
-
* @returns {Uint8Array} The
|
|
1679
|
+
* @returns {Uint8Array} The little endian byte array representation of the plaintext.
|
|
1664
1680
|
*/
|
|
1665
1681
|
toBytesLe(): Uint8Array;
|
|
1666
1682
|
/**
|
|
1667
1683
|
* Get a plaintext object from a series of bits represented as a boolean array.
|
|
1668
1684
|
*
|
|
1669
|
-
* @param {Array} bits A
|
|
1685
|
+
* @param {Array} bits A little endian boolean array representing the bits plaintext.
|
|
1670
1686
|
*
|
|
1671
1687
|
* @returns {Plaintext} The plaintext object.
|
|
1672
1688
|
*/
|
|
@@ -1674,17 +1690,47 @@ export class Plaintext {
|
|
|
1674
1690
|
/**
|
|
1675
1691
|
* Get a plaintext object from a series of bytes.
|
|
1676
1692
|
*
|
|
1677
|
-
* @param {Uint8Array} bytes A
|
|
1693
|
+
* @param {Uint8Array} bytes A little endian byte array representing the plaintext.
|
|
1678
1694
|
*
|
|
1679
1695
|
* @returns {Plaintext} The plaintext object.
|
|
1680
1696
|
*/
|
|
1681
1697
|
static fromBytesLe(bytes: Uint8Array): Plaintext;
|
|
1698
|
+
/**
|
|
1699
|
+
* Get the raw field array representation of the plaintext.
|
|
1700
|
+
*
|
|
1701
|
+
* @returns {Array} The raw field array representation of the plaintext.
|
|
1702
|
+
*/
|
|
1703
|
+
toFieldsRaw(): Array<any>;
|
|
1682
1704
|
/**
|
|
1683
1705
|
* Gives the type of the plaintext.
|
|
1684
1706
|
*
|
|
1685
1707
|
* @returns {string} The type of the plaintext.
|
|
1686
1708
|
*/
|
|
1687
1709
|
plaintextType(): string;
|
|
1710
|
+
/**
|
|
1711
|
+
* Get the raw big endian boolean array representation of the bits of the plaintext.
|
|
1712
|
+
*
|
|
1713
|
+
* @returns {Array} The raw big endian boolean array representation of the bits of the plaintext.
|
|
1714
|
+
*/
|
|
1715
|
+
toBitsRawBe(): Array<any>;
|
|
1716
|
+
/**
|
|
1717
|
+
* Get the raw little endian boolean array representation of the bits of the plaintext.
|
|
1718
|
+
*
|
|
1719
|
+
* @returns {Array} The raw little endian boolean array representation of the bits of the plaintext.
|
|
1720
|
+
*/
|
|
1721
|
+
toBitsRawLe(): Array<any>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Get the raw big endian byte array representation of the plaintext.
|
|
1724
|
+
*
|
|
1725
|
+
* @returns {Uint8Array} The raw big endian byte array representation of the plaintext.
|
|
1726
|
+
*/
|
|
1727
|
+
toBytesRawBe(): Uint8Array;
|
|
1728
|
+
/**
|
|
1729
|
+
* Get the raw little endian byte array representation of the plaintext.
|
|
1730
|
+
*
|
|
1731
|
+
* @returns {Uint8Array} The raw little endian byte array representation of the plaintext.
|
|
1732
|
+
*/
|
|
1733
|
+
toBytesRawLe(): Uint8Array;
|
|
1688
1734
|
/**
|
|
1689
1735
|
* Encrypt a plaintext with a transition view key.
|
|
1690
1736
|
*
|
|
@@ -1817,6 +1863,13 @@ export class Poseidon8 {
|
|
|
1817
1863
|
*/
|
|
1818
1864
|
export class PrivateKey {
|
|
1819
1865
|
free(): void;
|
|
1866
|
+
/**
|
|
1867
|
+
* Sign an instance of a valid Aleo data type or record.
|
|
1868
|
+
*
|
|
1869
|
+
* @param {String} message The string representation of the Aleo datatype or record to sign.
|
|
1870
|
+
* @returns {Signature} Signature of the message.
|
|
1871
|
+
*/
|
|
1872
|
+
signValue(message: string): Signature;
|
|
1820
1873
|
/**
|
|
1821
1874
|
* Get the address corresponding to the private key
|
|
1822
1875
|
*
|
|
@@ -2168,12 +2221,13 @@ export class ProgramManager {
|
|
|
2168
2221
|
/**
|
|
2169
2222
|
* Synthesize proving and verifying keys for a program
|
|
2170
2223
|
*
|
|
2171
|
-
* @param
|
|
2172
|
-
* @param
|
|
2173
|
-
* @param
|
|
2174
|
-
* @param
|
|
2224
|
+
* @param {string} program The program source code of the program to synthesize keys for
|
|
2225
|
+
* @param {string} function_id The function to synthesize keys for
|
|
2226
|
+
* @param {Array} inputs The inputs to the function
|
|
2227
|
+
* @param {Object | undefined} imports The imports for the program
|
|
2175
2228
|
*/
|
|
2176
2229
|
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<KeyPair>;
|
|
2230
|
+
static loadInclusionProver(proving_key: ProvingKey): void;
|
|
2177
2231
|
/**
|
|
2178
2232
|
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
2179
2233
|
* function and associated fee function. This object can be sent directly to a remote prover
|
|
@@ -2997,6 +3051,14 @@ export class Scalar {
|
|
|
2997
3051
|
export class Signature {
|
|
2998
3052
|
private constructor();
|
|
2999
3053
|
free(): void;
|
|
3054
|
+
/**
|
|
3055
|
+
* Sign an instance of a valid Aleo data type or record.
|
|
3056
|
+
*
|
|
3057
|
+
* @param {PrivateKey} private_key The private key used to sign the message.
|
|
3058
|
+
* @param {String} message The string representation of the Aleo datatype or record to sign.
|
|
3059
|
+
* @returns {Signature} Signature of the message.
|
|
3060
|
+
*/
|
|
3061
|
+
static signValue(private_key: PrivateKey, message: string): Signature;
|
|
3000
3062
|
/**
|
|
3001
3063
|
* Get an address from a signature.
|
|
3002
3064
|
*
|
|
@@ -3030,6 +3092,14 @@ export class Signature {
|
|
|
3030
3092
|
* Get the plaintext representation of the signature.
|
|
3031
3093
|
*/
|
|
3032
3094
|
toPlaintext(): Plaintext;
|
|
3095
|
+
/**
|
|
3096
|
+
* Verify a signature over an Aleo datatype or record by an address.
|
|
3097
|
+
*
|
|
3098
|
+
* @param {Address} address The address used to verify the signature.
|
|
3099
|
+
* @param {String} message The message to verify, which must be the string representation of a valid Aleo datatype or record.
|
|
3100
|
+
* @returns {boolean} True if the signature is valid, false otherwise.
|
|
3101
|
+
*/
|
|
3102
|
+
verifyValue(address: Address, message: string): boolean;
|
|
3033
3103
|
/**
|
|
3034
3104
|
* Get a signature from a series of bytes.
|
|
3035
3105
|
*
|
|
Binary file
|
package/dist/mainnet/index.js
CHANGED
|
@@ -264,6 +264,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Set test consensus version heights for testing.
|
|
269
|
+
*
|
|
270
|
+
* @params {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* import { getOrInitConsensusVersionHeights } from @provablehq/sdk;
|
|
274
|
+
*
|
|
275
|
+
* Set the consensus version heights.
|
|
276
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9");
|
|
277
|
+
* @param {string | null} [heights]
|
|
278
|
+
* @returns {Array<any>}
|
|
279
|
+
*/
|
|
280
|
+
function getOrInitConsensusVersionTestHeights(heights) {
|
|
281
|
+
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
282
|
+
var len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ret = wasm.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
284
|
+
return takeObject(ret);
|
|
285
|
+
}
|
|
286
|
+
|
|
267
287
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
268
288
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
269
289
|
const mem = getDataViewMemory0();
|
|
@@ -287,7 +307,7 @@ function __wbg_adapter_40(arg0, arg1, arg2) {
|
|
|
287
307
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
288
308
|
}
|
|
289
309
|
|
|
290
|
-
function
|
|
310
|
+
function __wbg_adapter_867(arg0, arg1, arg2, arg3) {
|
|
291
311
|
wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
292
312
|
}
|
|
293
313
|
|
|
@@ -2996,6 +3016,17 @@ class Field {
|
|
|
2996
3016
|
heap[stack_pointer++] = undefined;
|
|
2997
3017
|
}
|
|
2998
3018
|
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Initializes a new field as a domain separator.
|
|
3021
|
+
* @param {string} domain
|
|
3022
|
+
* @returns {Field}
|
|
3023
|
+
*/
|
|
3024
|
+
static newDomainSeparator(domain) {
|
|
3025
|
+
const ptr0 = passStringToWasm0(domain, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
3026
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3027
|
+
const ret = wasm.field_newDomainSeparator(ptr0, len0);
|
|
3028
|
+
return Field.__wrap(ret);
|
|
3029
|
+
}
|
|
2999
3030
|
/**
|
|
3000
3031
|
* Add two field elements.
|
|
3001
3032
|
* @param {Field} other
|
|
@@ -5895,9 +5926,9 @@ class Plaintext {
|
|
|
5895
5926
|
wasm.__wbg_plaintext_free(ptr, 0);
|
|
5896
5927
|
}
|
|
5897
5928
|
/**
|
|
5898
|
-
* Get the
|
|
5929
|
+
* Get the little endian boolean array representation of the bits of the plaintext.
|
|
5899
5930
|
*
|
|
5900
|
-
* @returns {Array} The
|
|
5931
|
+
* @returns {Array} The little endian boolean array representation of the bits of the plaintext.
|
|
5901
5932
|
* @returns {Array<any>}
|
|
5902
5933
|
*/
|
|
5903
5934
|
toBitsLe() {
|
|
@@ -5955,9 +5986,9 @@ class Plaintext {
|
|
|
5955
5986
|
}
|
|
5956
5987
|
}
|
|
5957
5988
|
/**
|
|
5958
|
-
* Get the
|
|
5989
|
+
* Get the little endian byte array representation of the plaintext.
|
|
5959
5990
|
*
|
|
5960
|
-
* @returns {Uint8Array} The
|
|
5991
|
+
* @returns {Uint8Array} The little endian byte array representation of the plaintext.
|
|
5961
5992
|
* @returns {Uint8Array}
|
|
5962
5993
|
*/
|
|
5963
5994
|
toBytesLe() {
|
|
@@ -5978,7 +6009,7 @@ class Plaintext {
|
|
|
5978
6009
|
/**
|
|
5979
6010
|
* Get a plaintext object from a series of bits represented as a boolean array.
|
|
5980
6011
|
*
|
|
5981
|
-
* @param {Array} bits A
|
|
6012
|
+
* @param {Array} bits A little endian boolean array representing the bits plaintext.
|
|
5982
6013
|
*
|
|
5983
6014
|
* @returns {Plaintext} The plaintext object.
|
|
5984
6015
|
* @param {Array<any>} bits
|
|
@@ -6002,7 +6033,7 @@ class Plaintext {
|
|
|
6002
6033
|
/**
|
|
6003
6034
|
* Get a plaintext object from a series of bytes.
|
|
6004
6035
|
*
|
|
6005
|
-
* @param {Uint8Array} bytes A
|
|
6036
|
+
* @param {Uint8Array} bytes A little endian byte array representing the plaintext.
|
|
6006
6037
|
*
|
|
6007
6038
|
* @returns {Plaintext} The plaintext object.
|
|
6008
6039
|
* @param {Uint8Array} bytes
|
|
@@ -6023,6 +6054,27 @@ class Plaintext {
|
|
|
6023
6054
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6024
6055
|
}
|
|
6025
6056
|
}
|
|
6057
|
+
/**
|
|
6058
|
+
* Get the raw field array representation of the plaintext.
|
|
6059
|
+
*
|
|
6060
|
+
* @returns {Array} The raw field array representation of the plaintext.
|
|
6061
|
+
* @returns {Array<any>}
|
|
6062
|
+
*/
|
|
6063
|
+
toFieldsRaw() {
|
|
6064
|
+
try {
|
|
6065
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6066
|
+
wasm.plaintext_toFieldsRaw(retptr, this.__wbg_ptr);
|
|
6067
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6068
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6069
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6070
|
+
if (r2) {
|
|
6071
|
+
throw takeObject(r1);
|
|
6072
|
+
}
|
|
6073
|
+
return takeObject(r0);
|
|
6074
|
+
} finally {
|
|
6075
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6076
|
+
}
|
|
6077
|
+
}
|
|
6026
6078
|
/**
|
|
6027
6079
|
* Gives the type of the plaintext.
|
|
6028
6080
|
*
|
|
@@ -6045,6 +6097,68 @@ class Plaintext {
|
|
|
6045
6097
|
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
6046
6098
|
}
|
|
6047
6099
|
}
|
|
6100
|
+
/**
|
|
6101
|
+
* Get the raw big endian boolean array representation of the bits of the plaintext.
|
|
6102
|
+
*
|
|
6103
|
+
* @returns {Array} The raw big endian boolean array representation of the bits of the plaintext.
|
|
6104
|
+
* @returns {Array<any>}
|
|
6105
|
+
*/
|
|
6106
|
+
toBitsRawBe() {
|
|
6107
|
+
const ret = wasm.plaintext_toBitsRawBe(this.__wbg_ptr);
|
|
6108
|
+
return takeObject(ret);
|
|
6109
|
+
}
|
|
6110
|
+
/**
|
|
6111
|
+
* Get the raw little endian boolean array representation of the bits of the plaintext.
|
|
6112
|
+
*
|
|
6113
|
+
* @returns {Array} The raw little endian boolean array representation of the bits of the plaintext.
|
|
6114
|
+
* @returns {Array<any>}
|
|
6115
|
+
*/
|
|
6116
|
+
toBitsRawLe() {
|
|
6117
|
+
const ret = wasm.plaintext_toBitsRawLe(this.__wbg_ptr);
|
|
6118
|
+
return takeObject(ret);
|
|
6119
|
+
}
|
|
6120
|
+
/**
|
|
6121
|
+
* Get the raw big endian byte array representation of the plaintext.
|
|
6122
|
+
*
|
|
6123
|
+
* @returns {Uint8Array} The raw big endian byte array representation of the plaintext.
|
|
6124
|
+
* @returns {Uint8Array}
|
|
6125
|
+
*/
|
|
6126
|
+
toBytesRawBe() {
|
|
6127
|
+
try {
|
|
6128
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6129
|
+
wasm.plaintext_toBytesRawBe(retptr, this.__wbg_ptr);
|
|
6130
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6131
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6132
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6133
|
+
if (r2) {
|
|
6134
|
+
throw takeObject(r1);
|
|
6135
|
+
}
|
|
6136
|
+
return takeObject(r0);
|
|
6137
|
+
} finally {
|
|
6138
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
/**
|
|
6142
|
+
* Get the raw little endian byte array representation of the plaintext.
|
|
6143
|
+
*
|
|
6144
|
+
* @returns {Uint8Array} The raw little endian byte array representation of the plaintext.
|
|
6145
|
+
* @returns {Uint8Array}
|
|
6146
|
+
*/
|
|
6147
|
+
toBytesRawLe() {
|
|
6148
|
+
try {
|
|
6149
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6150
|
+
wasm.plaintext_toBytesRawLe(retptr, this.__wbg_ptr);
|
|
6151
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6152
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6153
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6154
|
+
if (r2) {
|
|
6155
|
+
throw takeObject(r1);
|
|
6156
|
+
}
|
|
6157
|
+
return takeObject(r0);
|
|
6158
|
+
} finally {
|
|
6159
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6160
|
+
}
|
|
6161
|
+
}
|
|
6048
6162
|
/**
|
|
6049
6163
|
* Encrypt a plaintext with a transition view key.
|
|
6050
6164
|
*
|
|
@@ -6636,6 +6750,31 @@ class PrivateKey {
|
|
|
6636
6750
|
const ptr = this.__destroy_into_raw();
|
|
6637
6751
|
wasm.__wbg_privatekey_free(ptr, 0);
|
|
6638
6752
|
}
|
|
6753
|
+
/**
|
|
6754
|
+
* Sign an instance of a valid Aleo data type or record.
|
|
6755
|
+
*
|
|
6756
|
+
* @param {String} message The string representation of the Aleo datatype or record to sign.
|
|
6757
|
+
* @returns {Signature} Signature of the message.
|
|
6758
|
+
* @param {string} message
|
|
6759
|
+
* @returns {Signature}
|
|
6760
|
+
*/
|
|
6761
|
+
signValue(message) {
|
|
6762
|
+
try {
|
|
6763
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
6764
|
+
const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
6765
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6766
|
+
wasm.privatekey_signValue(retptr, this.__wbg_ptr, ptr0, len0);
|
|
6767
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
6768
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
6769
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
6770
|
+
if (r2) {
|
|
6771
|
+
throw takeObject(r1);
|
|
6772
|
+
}
|
|
6773
|
+
return Signature.__wrap(r0);
|
|
6774
|
+
} finally {
|
|
6775
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6639
6778
|
/**
|
|
6640
6779
|
* Get the address corresponding to the private key
|
|
6641
6780
|
*
|
|
@@ -7394,10 +7533,10 @@ class ProgramManager {
|
|
|
7394
7533
|
/**
|
|
7395
7534
|
* Synthesize proving and verifying keys for a program
|
|
7396
7535
|
*
|
|
7397
|
-
* @param
|
|
7398
|
-
* @param
|
|
7399
|
-
* @param
|
|
7400
|
-
* @param
|
|
7536
|
+
* @param {string} program The program source code of the program to synthesize keys for
|
|
7537
|
+
* @param {string} function_id The function to synthesize keys for
|
|
7538
|
+
* @param {Array} inputs The inputs to the function
|
|
7539
|
+
* @param {Object | undefined} imports The imports for the program
|
|
7401
7540
|
* @param {PrivateKey} private_key
|
|
7402
7541
|
* @param {string} program
|
|
7403
7542
|
* @param {string} function_id
|
|
@@ -7415,6 +7554,14 @@ class ProgramManager {
|
|
|
7415
7554
|
const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
|
|
7416
7555
|
return takeObject(ret);
|
|
7417
7556
|
}
|
|
7557
|
+
/**
|
|
7558
|
+
* @param {ProvingKey} proving_key
|
|
7559
|
+
*/
|
|
7560
|
+
static loadInclusionProver(proving_key) {
|
|
7561
|
+
_assertClass(proving_key, ProvingKey);
|
|
7562
|
+
var ptr0 = proving_key.__destroy_into_raw();
|
|
7563
|
+
wasm.programmanager_loadInclusionProver(ptr0);
|
|
7564
|
+
}
|
|
7418
7565
|
/**
|
|
7419
7566
|
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
7420
7567
|
* function and associated fee function. This object can be sent directly to a remote prover
|
|
@@ -9639,6 +9786,34 @@ class Signature {
|
|
|
9639
9786
|
const ptr = this.__destroy_into_raw();
|
|
9640
9787
|
wasm.__wbg_signature_free(ptr, 0);
|
|
9641
9788
|
}
|
|
9789
|
+
/**
|
|
9790
|
+
* Sign an instance of a valid Aleo data type or record.
|
|
9791
|
+
*
|
|
9792
|
+
* @param {PrivateKey} private_key The private key used to sign the message.
|
|
9793
|
+
* @param {String} message The string representation of the Aleo datatype or record to sign.
|
|
9794
|
+
* @returns {Signature} Signature of the message.
|
|
9795
|
+
* @param {PrivateKey} private_key
|
|
9796
|
+
* @param {string} message
|
|
9797
|
+
* @returns {Signature}
|
|
9798
|
+
*/
|
|
9799
|
+
static signValue(private_key, message) {
|
|
9800
|
+
try {
|
|
9801
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
9802
|
+
_assertClass(private_key, PrivateKey);
|
|
9803
|
+
const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
9804
|
+
const len0 = WASM_VECTOR_LEN;
|
|
9805
|
+
wasm.signature_signValue(retptr, private_key.__wbg_ptr, ptr0, len0);
|
|
9806
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
9807
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
9808
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
9809
|
+
if (r2) {
|
|
9810
|
+
throw takeObject(r1);
|
|
9811
|
+
}
|
|
9812
|
+
return Signature.__wrap(r0);
|
|
9813
|
+
} finally {
|
|
9814
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
9815
|
+
}
|
|
9816
|
+
}
|
|
9642
9817
|
/**
|
|
9643
9818
|
* Get an address from a signature.
|
|
9644
9819
|
*
|
|
@@ -9722,6 +9897,34 @@ class Signature {
|
|
|
9722
9897
|
const ret = wasm.signature_toPlaintext(this.__wbg_ptr);
|
|
9723
9898
|
return Plaintext.__wrap(ret);
|
|
9724
9899
|
}
|
|
9900
|
+
/**
|
|
9901
|
+
* Verify a signature over an Aleo datatype or record by an address.
|
|
9902
|
+
*
|
|
9903
|
+
* @param {Address} address The address used to verify the signature.
|
|
9904
|
+
* @param {String} message The message to verify, which must be the string representation of a valid Aleo datatype or record.
|
|
9905
|
+
* @returns {boolean} True if the signature is valid, false otherwise.
|
|
9906
|
+
* @param {Address} address
|
|
9907
|
+
* @param {string} message
|
|
9908
|
+
* @returns {boolean}
|
|
9909
|
+
*/
|
|
9910
|
+
verifyValue(address, message) {
|
|
9911
|
+
try {
|
|
9912
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
9913
|
+
_assertClass(address, Address);
|
|
9914
|
+
const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
|
|
9915
|
+
const len0 = WASM_VECTOR_LEN;
|
|
9916
|
+
wasm.signature_verifyValue(retptr, this.__wbg_ptr, address.__wbg_ptr, ptr0, len0);
|
|
9917
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
9918
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
9919
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
9920
|
+
if (r2) {
|
|
9921
|
+
throw takeObject(r1);
|
|
9922
|
+
}
|
|
9923
|
+
return r0 !== 0;
|
|
9924
|
+
} finally {
|
|
9925
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
9926
|
+
}
|
|
9927
|
+
}
|
|
9725
9928
|
/**
|
|
9726
9929
|
* Get a signature from a series of bytes.
|
|
9727
9930
|
*
|
|
@@ -12941,7 +13144,7 @@ function __wbg_get_imports() {
|
|
|
12941
13144
|
const ret = getObject(arg0).length;
|
|
12942
13145
|
return ret;
|
|
12943
13146
|
};
|
|
12944
|
-
imports.wbg.
|
|
13147
|
+
imports.wbg.__wbg_log_bac25b70f2db29a3 = function(arg0, arg1) {
|
|
12945
13148
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
12946
13149
|
};
|
|
12947
13150
|
imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
|
|
@@ -12959,7 +13162,7 @@ function __wbg_get_imports() {
|
|
|
12959
13162
|
const a = state0.a;
|
|
12960
13163
|
state0.a = 0;
|
|
12961
13164
|
try {
|
|
12962
|
-
return
|
|
13165
|
+
return __wbg_adapter_867(a, state0.b, arg0, arg1);
|
|
12963
13166
|
} finally {
|
|
12964
13167
|
state0.a = a;
|
|
12965
13168
|
}
|
|
@@ -13146,7 +13349,7 @@ function __wbg_get_imports() {
|
|
|
13146
13349
|
const ret = Signature.__wrap(arg0);
|
|
13147
13350
|
return addHeapObject(ret);
|
|
13148
13351
|
};
|
|
13149
|
-
imports.wbg.
|
|
13352
|
+
imports.wbg.__wbg_spawnWorker_231c975bbb3598af = function(arg0, arg1, arg2, arg3) {
|
|
13150
13353
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
13151
13354
|
return addHeapObject(ret);
|
|
13152
13355
|
};
|
|
@@ -13266,12 +13469,12 @@ function __wbg_get_imports() {
|
|
|
13266
13469
|
const ret = false;
|
|
13267
13470
|
return ret;
|
|
13268
13471
|
};
|
|
13269
|
-
imports.wbg.
|
|
13270
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
13472
|
+
imports.wbg.__wbindgen_closure_wrapper7347 = function(arg0, arg1, arg2) {
|
|
13473
|
+
const ret = makeMutClosure(arg0, arg1, 548, __wbg_adapter_40);
|
|
13271
13474
|
return addHeapObject(ret);
|
|
13272
13475
|
};
|
|
13273
|
-
imports.wbg.
|
|
13274
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
13476
|
+
imports.wbg.__wbindgen_closure_wrapper7352 = function(arg0, arg1, arg2) {
|
|
13477
|
+
const ret = makeMutClosure(arg0, arg1, 548, __wbg_adapter_40);
|
|
13275
13478
|
return addHeapObject(ret);
|
|
13276
13479
|
};
|
|
13277
13480
|
imports.wbg.__wbindgen_is_function = function(arg0) {
|
|
@@ -13347,7 +13550,7 @@ function __wbg_get_imports() {
|
|
|
13347
13550
|
}
|
|
13348
13551
|
|
|
13349
13552
|
function __wbg_init_memory(imports, memory) {
|
|
13350
|
-
imports.wbg.memory = memory || new WebAssembly.Memory({initial:
|
|
13553
|
+
imports.wbg.memory = memory || new WebAssembly.Memory({initial:167,maximum:65536,shared:true});
|
|
13351
13554
|
}
|
|
13352
13555
|
|
|
13353
13556
|
function __wbg_finalize_init(instance, module, thread_stack_size) {
|
|
@@ -13426,5 +13629,5 @@ async function initThreadPool(threads) {
|
|
|
13426
13629
|
await initThreadPool$1(new URL("worker.js", import.meta.url), threads);
|
|
13427
13630
|
}
|
|
13428
13631
|
|
|
13429
|
-
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
13632
|
+
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, Execution, ExecutionRequest, ExecutionResponse, Field, GraphKey, Group, I128, I16, I32, I64, I8, KeyPair, Metadata, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initSync, initThreadPool, runRayonThread, verifyFunctionExecution };
|
|
13430
13633
|
//# sourceMappingURL=index.js.map
|