@provablehq/wasm 0.6.13 → 0.7.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/README.md +6 -6
- package/dist/{crates → mainnet}/aleo_wasm.d.ts +33 -33
- package/dist/mainnet/aleo_wasm.js +4570 -0
- package/dist/mainnet/aleo_wasm.js.map +1 -0
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/{index.d.ts → mainnet/index.d.ts} +1 -1
- package/dist/{index.js → mainnet/index.js} +54 -54
- package/dist/mainnet/index.js.map +1 -0
- package/dist/{worker.js → mainnet/worker.js} +53 -53
- package/dist/mainnet/worker.js.map +1 -0
- package/dist/testnet/aleo_wasm.d.ts +1686 -0
- package/dist/testnet/aleo_wasm.js +4570 -0
- package/dist/testnet/aleo_wasm.js.map +1 -0
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/aleo_wasm_init.d.ts +17 -0
- package/dist/testnet/index.d.ts +27 -0
- package/dist/testnet/index.js +4607 -0
- package/dist/testnet/index.js.map +1 -0
- package/dist/testnet/worker.d.ts +1 -0
- package/dist/testnet/worker.js +4603 -0
- package/dist/testnet/worker.js.map +1 -0
- package/package.json +12 -9
- package/dist/assets/aleo_wasm.wasm +0 -0
- package/dist/index.js.map +0 -1
- package/dist/worker.js.map +0 -1
- /package/dist/{crates → mainnet}/aleo_wasm_init.d.ts +0 -0
- /package/dist/{worker.d.ts → mainnet/worker.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://crates.io/crates/aleo-wasm)
|
|
2
|
-
[](https://
|
|
2
|
+
[](https://provable.com)
|
|
3
3
|
[](./LICENSE.md)
|
|
4
4
|
|
|
5
5
|
[![github]](https://github.com/ProvableHQ/sdk) [![crates-io]](https://crates.io/crates/aleo-wasm) [![docs-rs]](https://docs.rs/aleo-wasm/latest/aleo-wasm/)
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
Aleo JavaScript and WebAssembly bindings for building zero-knowledge web applications.
|
|
14
14
|
|
|
15
|
-
`Rust` compiles easily to `WebAssembly`, but creating the glue code necessary to use compiled WebAssembly binaries
|
|
16
|
-
from other languages such as JavaScript is a challenging task. `wasm-bindgen` is a tool that simplifies this process by
|
|
17
|
-
auto-generating JavaScript bindings to Rust code that has been compiled into WebAssembly.
|
|
15
|
+
`Rust` compiles easily to `WebAssembly`, but creating the glue code necessary to use compiled WebAssembly binaries
|
|
16
|
+
from other languages such as JavaScript is a challenging task. `wasm-bindgen` is a tool that simplifies this process by
|
|
17
|
+
auto-generating JavaScript bindings to Rust code that has been compiled into WebAssembly.
|
|
18
18
|
|
|
19
19
|
This crate uses `wasm-bindgen` to create JavaScript bindings to Aleo source code so that it can be used to create zero-knowledge proofs directly within web browsers and `Node.js`.
|
|
20
20
|
|
|
@@ -56,7 +56,7 @@ wasm-pack test --[firefox/chrome/safari]
|
|
|
56
56
|
|
|
57
57
|
## Building Web Apps
|
|
58
58
|
|
|
59
|
-
Further documentation and tutorials as to how to use the modules built from this crate to build web apps will be built
|
|
59
|
+
Further documentation and tutorials as to how to use the modules built from this crate to build web apps will be built
|
|
60
60
|
in the future. However, in the meantime, the [provable.tools](https://provable.tools) website is a good
|
|
61
|
-
example of how to use these modules to build a web app. Its source code can be found in the
|
|
61
|
+
example of how to use these modules to build a web app. Its source code can be found in the
|
|
62
62
|
[Aleo SDK](https://github.com/ProvableHQ/sdk) repo in the `website` folder.
|
|
@@ -181,14 +181,14 @@ export class KeyPair {
|
|
|
181
181
|
/**
|
|
182
182
|
* Get the proving key. This method will remove the proving key from the key pair
|
|
183
183
|
*
|
|
184
|
-
* @returns {ProvingKey
|
|
184
|
+
* @returns {ProvingKey}
|
|
185
185
|
* @returns {ProvingKey}
|
|
186
186
|
*/
|
|
187
187
|
provingKey(): ProvingKey;
|
|
188
188
|
/**
|
|
189
189
|
* Get the verifying key. This method will remove the verifying key from the key pair
|
|
190
190
|
*
|
|
191
|
-
* @returns {VerifyingKey
|
|
191
|
+
* @returns {VerifyingKey}
|
|
192
192
|
* @returns {VerifyingKey}
|
|
193
193
|
*/
|
|
194
194
|
verifyingKey(): VerifyingKey;
|
|
@@ -374,7 +374,7 @@ export class PrivateKey {
|
|
|
374
374
|
* and will be needed to decrypt the private key later, so it should be stored securely
|
|
375
375
|
*
|
|
376
376
|
* @param {string} secret Secret used to encrypt the private key
|
|
377
|
-
* @returns {PrivateKeyCiphertext
|
|
377
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
378
378
|
* @param {string} secret
|
|
379
379
|
* @returns {PrivateKeyCiphertext}
|
|
380
380
|
*/
|
|
@@ -384,7 +384,7 @@ export class PrivateKey {
|
|
|
384
384
|
* decrypt the private key later, so it should be stored securely
|
|
385
385
|
*
|
|
386
386
|
* @param {string} secret Secret used to encrypt the private key
|
|
387
|
-
* @returns {PrivateKeyCiphertext
|
|
387
|
+
* @returns {PrivateKeyCiphertext} Ciphertext representation of the private key
|
|
388
388
|
* @param {string} secret
|
|
389
389
|
* @returns {PrivateKeyCiphertext}
|
|
390
390
|
*/
|
|
@@ -394,7 +394,7 @@ export class PrivateKey {
|
|
|
394
394
|
*
|
|
395
395
|
* @param {PrivateKeyCiphertext} ciphertext Ciphertext representation of the private key
|
|
396
396
|
* @param {string} secret Secret originally used to encrypt the private key
|
|
397
|
-
* @returns {PrivateKey
|
|
397
|
+
* @returns {PrivateKey} Private key
|
|
398
398
|
* @param {PrivateKeyCiphertext} ciphertext
|
|
399
399
|
* @param {string} secret
|
|
400
400
|
* @returns {PrivateKey}
|
|
@@ -412,7 +412,7 @@ export class PrivateKeyCiphertext {
|
|
|
412
412
|
*
|
|
413
413
|
* @param {PrivateKey} private_key Private key to encrypt
|
|
414
414
|
* @param {string} secret Secret to encrypt the private key with
|
|
415
|
-
* @returns {PrivateKeyCiphertext
|
|
415
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
416
416
|
* @param {PrivateKey} private_key
|
|
417
417
|
* @param {string} secret
|
|
418
418
|
* @returns {PrivateKeyCiphertext}
|
|
@@ -423,7 +423,7 @@ export class PrivateKeyCiphertext {
|
|
|
423
423
|
* encrypt the private key
|
|
424
424
|
*
|
|
425
425
|
* @param {string} secret Secret used to encrypt the private key
|
|
426
|
-
* @returns {PrivateKey
|
|
426
|
+
* @returns {PrivateKey} Private key
|
|
427
427
|
* @param {string} secret
|
|
428
428
|
* @returns {PrivateKey}
|
|
429
429
|
*/
|
|
@@ -439,7 +439,7 @@ export class PrivateKeyCiphertext {
|
|
|
439
439
|
* Creates a PrivateKeyCiphertext from a string
|
|
440
440
|
*
|
|
441
441
|
* @param {string} ciphertext Ciphertext string
|
|
442
|
-
* @returns {PrivateKeyCiphertext
|
|
442
|
+
* @returns {PrivateKeyCiphertext} Private key ciphertext
|
|
443
443
|
* @param {string} ciphertext
|
|
444
444
|
* @returns {PrivateKeyCiphertext}
|
|
445
445
|
*/
|
|
@@ -454,7 +454,7 @@ export class Program {
|
|
|
454
454
|
* Create a program from a program string
|
|
455
455
|
*
|
|
456
456
|
* @param {string} program Aleo program source code
|
|
457
|
-
* @returns {Program
|
|
457
|
+
* @returns {Program} Program object
|
|
458
458
|
* @param {string} program
|
|
459
459
|
* @returns {Program}
|
|
460
460
|
*/
|
|
@@ -503,7 +503,7 @@ export class Program {
|
|
|
503
503
|
* to generate a web form to capture user inputs for an execution of a function.
|
|
504
504
|
*
|
|
505
505
|
* @param {string} function_name Name of the function to get inputs for
|
|
506
|
-
* @returns {Array
|
|
506
|
+
* @returns {Array} Array of function inputs
|
|
507
507
|
*
|
|
508
508
|
* @example
|
|
509
509
|
* const expected_inputs = [
|
|
@@ -542,7 +542,7 @@ export class Program {
|
|
|
542
542
|
/**
|
|
543
543
|
* Get a the list of a program's mappings and the names/types of their keys and values.
|
|
544
544
|
*
|
|
545
|
-
* @returns {Array
|
|
545
|
+
* @returns {Array} - An array of objects representing the mappings in the program
|
|
546
546
|
* @example
|
|
547
547
|
* const expected_mappings = [
|
|
548
548
|
* {
|
|
@@ -564,7 +564,7 @@ export class Program {
|
|
|
564
564
|
* Get a javascript object representation of a program record and its types
|
|
565
565
|
*
|
|
566
566
|
* @param {string} record_name Name of the record to get members for
|
|
567
|
-
* @returns {Object
|
|
567
|
+
* @returns {Object} Object containing the record name, type, and members
|
|
568
568
|
*
|
|
569
569
|
* @example
|
|
570
570
|
*
|
|
@@ -596,7 +596,7 @@ export class Program {
|
|
|
596
596
|
* Get a javascript object representation of a program struct and its types
|
|
597
597
|
*
|
|
598
598
|
* @param {string} struct_name Name of the struct to get members for
|
|
599
|
-
* @returns {Array
|
|
599
|
+
* @returns {Array} Array containing the struct members
|
|
600
600
|
*
|
|
601
601
|
* @example
|
|
602
602
|
*
|
|
@@ -721,7 +721,7 @@ export class ProgramManager {
|
|
|
721
721
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
722
722
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
723
723
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
724
|
-
* @returns {Transaction
|
|
724
|
+
* @returns {Transaction}
|
|
725
725
|
* @param {PrivateKey} private_key
|
|
726
726
|
* @param {string} program
|
|
727
727
|
* @param {number} fee_credits
|
|
@@ -743,7 +743,7 @@ export class ProgramManager {
|
|
|
743
743
|
* @param imports (optional) Provide a list of imports to use for the deployment fee estimation
|
|
744
744
|
* in the form of a javascript object where the keys are a string of the program name and the values
|
|
745
745
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
746
|
-
* @returns {u64
|
|
746
|
+
* @returns {u64}
|
|
747
747
|
* @param {string} program
|
|
748
748
|
* @param {object | undefined} [imports]
|
|
749
749
|
* @returns {Promise<bigint>}
|
|
@@ -757,7 +757,7 @@ export class ProgramManager {
|
|
|
757
757
|
* Disclaimer: Fee estimation is experimental and may not represent a correct estimate on any current or future network
|
|
758
758
|
*
|
|
759
759
|
* @param name The name of the program to be deployed
|
|
760
|
-
* @returns {u64
|
|
760
|
+
* @returns {u64}
|
|
761
761
|
* @param {string} name
|
|
762
762
|
* @returns {bigint}
|
|
763
763
|
*/
|
|
@@ -816,7 +816,7 @@ export class ProgramManager {
|
|
|
816
816
|
* @param verifying_key (optional) Provide a verifying key to use for the function execution
|
|
817
817
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
818
818
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
819
|
-
* @returns {Transaction
|
|
819
|
+
* @returns {Transaction}
|
|
820
820
|
* @param {PrivateKey} private_key
|
|
821
821
|
* @param {string} program
|
|
822
822
|
* @param {string} _function
|
|
@@ -850,7 +850,7 @@ export class ProgramManager {
|
|
|
850
850
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
851
851
|
* @param proving_key (optional) Provide a verifying key to use for the fee estimation
|
|
852
852
|
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
853
|
-
* @returns {u64
|
|
853
|
+
* @returns {u64} Fee in microcredits
|
|
854
854
|
* @param {PrivateKey} private_key
|
|
855
855
|
* @param {string} program
|
|
856
856
|
* @param {string} _function
|
|
@@ -872,7 +872,7 @@ export class ProgramManager {
|
|
|
872
872
|
*
|
|
873
873
|
* @param program The program containing the function to estimate the finalize fee for
|
|
874
874
|
* @param function The function to estimate the finalize fee for
|
|
875
|
-
* @returns {u64
|
|
875
|
+
* @returns {u64} Fee in microcredits
|
|
876
876
|
* @param {string} program
|
|
877
877
|
* @param {string} _function
|
|
878
878
|
* @returns {bigint}
|
|
@@ -892,7 +892,7 @@ export class ProgramManager {
|
|
|
892
892
|
* @param join_verifying_key (optional) Provide a verifying key to use for the join function
|
|
893
893
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
894
894
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
895
|
-
* @returns {Transaction
|
|
895
|
+
* @returns {Transaction} Transaction object
|
|
896
896
|
* @param {PrivateKey} private_key
|
|
897
897
|
* @param {RecordPlaintext} record_1
|
|
898
898
|
* @param {RecordPlaintext} record_2
|
|
@@ -917,7 +917,7 @@ export class ProgramManager {
|
|
|
917
917
|
* @param url The url of the Aleo network node to send the transaction to
|
|
918
918
|
* @param split_proving_key (optional) Provide a proving key to use for the split function
|
|
919
919
|
* @param split_verifying_key (optional) Provide a verifying key to use for the split function
|
|
920
|
-
* @returns {Transaction
|
|
920
|
+
* @returns {Transaction} Transaction object
|
|
921
921
|
* @param {PrivateKey} private_key
|
|
922
922
|
* @param {number} split_amount
|
|
923
923
|
* @param {RecordPlaintext} amount_record
|
|
@@ -943,7 +943,7 @@ export class ProgramManager {
|
|
|
943
943
|
* function
|
|
944
944
|
* @param fee_proving_key (optional) Provide a proving key to use for the fee execution
|
|
945
945
|
* @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
|
|
946
|
-
* @returns {Transaction
|
|
946
|
+
* @returns {Transaction}
|
|
947
947
|
* @param {PrivateKey} private_key
|
|
948
948
|
* @param {number} amount_credits
|
|
949
949
|
* @param {string} recipient
|
|
@@ -1164,7 +1164,7 @@ export class ProvingKey {
|
|
|
1164
1164
|
* Construct a new proving key from a byte array
|
|
1165
1165
|
*
|
|
1166
1166
|
* @param {Uint8Array} bytes Byte array representation of a proving key
|
|
1167
|
-
* @returns {ProvingKey
|
|
1167
|
+
* @returns {ProvingKey}
|
|
1168
1168
|
* @param {Uint8Array} bytes
|
|
1169
1169
|
* @returns {ProvingKey}
|
|
1170
1170
|
*/
|
|
@@ -1172,7 +1172,7 @@ export class ProvingKey {
|
|
|
1172
1172
|
/**
|
|
1173
1173
|
* Create a proving key from string
|
|
1174
1174
|
*
|
|
1175
|
-
* @param {string
|
|
1175
|
+
* @param {string} String representation of the proving key
|
|
1176
1176
|
* @param {string} string
|
|
1177
1177
|
* @returns {ProvingKey}
|
|
1178
1178
|
*/
|
|
@@ -1180,7 +1180,7 @@ export class ProvingKey {
|
|
|
1180
1180
|
/**
|
|
1181
1181
|
* Return the byte representation of a proving key
|
|
1182
1182
|
*
|
|
1183
|
-
* @returns {Uint8Array
|
|
1183
|
+
* @returns {Uint8Array} Byte array representation of a proving key
|
|
1184
1184
|
* @returns {Uint8Array}
|
|
1185
1185
|
*/
|
|
1186
1186
|
toBytes(): Uint8Array;
|
|
@@ -1201,7 +1201,7 @@ export class RecordCiphertext {
|
|
|
1201
1201
|
* Create a record ciphertext from a string
|
|
1202
1202
|
*
|
|
1203
1203
|
* @param {string} record String representation of a record ciphertext
|
|
1204
|
-
* @returns {RecordCiphertext
|
|
1204
|
+
* @returns {RecordCiphertext} Record ciphertext
|
|
1205
1205
|
* @param {string} record
|
|
1206
1206
|
* @returns {RecordCiphertext}
|
|
1207
1207
|
*/
|
|
@@ -1218,7 +1218,7 @@ export class RecordCiphertext {
|
|
|
1218
1218
|
* decrypt if the record was encrypted by the account corresponding to the view key
|
|
1219
1219
|
*
|
|
1220
1220
|
* @param {ViewKey} view_key View key used to decrypt the ciphertext
|
|
1221
|
-
* @returns {RecordPlaintext
|
|
1221
|
+
* @returns {RecordPlaintext} Record plaintext object
|
|
1222
1222
|
* @param {ViewKey} view_key
|
|
1223
1223
|
* @returns {RecordPlaintext}
|
|
1224
1224
|
*/
|
|
@@ -1248,7 +1248,7 @@ export class RecordPlaintext {
|
|
|
1248
1248
|
* Return a record plaintext from a string.
|
|
1249
1249
|
*
|
|
1250
1250
|
* @param {string} record String representation of a plaintext representation of an Aleo record
|
|
1251
|
-
* @returns {RecordPlaintext
|
|
1251
|
+
* @returns {RecordPlaintext} Record plaintext
|
|
1252
1252
|
* @param {string} record
|
|
1253
1253
|
* @returns {RecordPlaintext}
|
|
1254
1254
|
*/
|
|
@@ -1280,7 +1280,7 @@ export class RecordPlaintext {
|
|
|
1280
1280
|
* @param {PrivateKey} private_key Private key of the account that owns the record
|
|
1281
1281
|
* @param {string} program_id Program ID of the program that the record is associated with
|
|
1282
1282
|
* @param {string} record_name Name of the record
|
|
1283
|
-
* @returns {string
|
|
1283
|
+
* @returns {string} Serial number of the record
|
|
1284
1284
|
* @param {PrivateKey} private_key
|
|
1285
1285
|
* @param {string} program_id
|
|
1286
1286
|
* @param {string} record_name
|
|
@@ -1344,7 +1344,7 @@ export class Transaction {
|
|
|
1344
1344
|
* Create a transaction from a string
|
|
1345
1345
|
*
|
|
1346
1346
|
* @param {string} transaction String representation of a transaction
|
|
1347
|
-
* @returns {Transaction
|
|
1347
|
+
* @returns {Transaction}
|
|
1348
1348
|
* @param {string} transaction
|
|
1349
1349
|
* @returns {Transaction}
|
|
1350
1350
|
*/
|
|
@@ -1609,7 +1609,7 @@ export class VerifyingKey {
|
|
|
1609
1609
|
* Construct a new verifying key from a byte array
|
|
1610
1610
|
*
|
|
1611
1611
|
* @param {Uint8Array} bytes Byte representation of a verifying key
|
|
1612
|
-
* @returns {VerifyingKey
|
|
1612
|
+
* @returns {VerifyingKey}
|
|
1613
1613
|
* @param {Uint8Array} bytes
|
|
1614
1614
|
* @returns {VerifyingKey}
|
|
1615
1615
|
*/
|
|
@@ -1618,7 +1618,7 @@ export class VerifyingKey {
|
|
|
1618
1618
|
* Create a verifying key from string
|
|
1619
1619
|
*
|
|
1620
1620
|
* @param {String} string String representation of a verifying key
|
|
1621
|
-
* @returns {VerifyingKey
|
|
1621
|
+
* @returns {VerifyingKey}
|
|
1622
1622
|
* @param {string} string
|
|
1623
1623
|
* @returns {VerifyingKey}
|
|
1624
1624
|
*/
|
|
@@ -1626,7 +1626,7 @@ export class VerifyingKey {
|
|
|
1626
1626
|
/**
|
|
1627
1627
|
* Create a byte array from a verifying key
|
|
1628
1628
|
*
|
|
1629
|
-
* @returns {Uint8Array
|
|
1629
|
+
* @returns {Uint8Array} Byte representation of a verifying key
|
|
1630
1630
|
* @returns {Uint8Array}
|
|
1631
1631
|
*/
|
|
1632
1632
|
toBytes(): Uint8Array;
|