@provablehq/wasm 0.8.2 → 0.8.6
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 +1 -1
- package/dist/mainnet/aleo_wasm.d.ts +324 -16
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +2490 -944
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +2498 -943
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +324 -16
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +2490 -944
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +2498 -943
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,4 +58,4 @@ wasm-pack test --[firefox/chrome/safari]
|
|
|
58
58
|
Further documentation and tutorials as to how to use the modules built from this crate to build web apps will be built
|
|
59
59
|
in the future. However, in the meantime, the [provable.tools](https://provable.tools) website is a good
|
|
60
60
|
example of how to use these modules to build a web app. Its source code can be found in the
|
|
61
|
-
[
|
|
61
|
+
[Provable SDK](https://github.com/ProvableHQ/sdk) repo in the `website` folder.
|
|
@@ -62,6 +62,114 @@ export class Address {
|
|
|
62
62
|
*/
|
|
63
63
|
verify(message: Uint8Array, signature: Signature): boolean;
|
|
64
64
|
}
|
|
65
|
+
export class BHP1024 {
|
|
66
|
+
free(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Create a BHP hasher with an input size of 1024 bits.
|
|
69
|
+
*/
|
|
70
|
+
constructor();
|
|
71
|
+
/**
|
|
72
|
+
* Create a BHP hasher with an input size of 1024 bits with a custom domain separator.
|
|
73
|
+
*/
|
|
74
|
+
static setup(domain_separator: string): BHP1024;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the BHP hash with an input hasher of 1024 bits.
|
|
77
|
+
*/
|
|
78
|
+
hash(input: Array<any>): Field;
|
|
79
|
+
/**
|
|
80
|
+
* Returns a BHP hash with an input hasher of 1024 bits.
|
|
81
|
+
*/
|
|
82
|
+
hashToGroup(input: Array<any>): Group;
|
|
83
|
+
/**
|
|
84
|
+
* Returns a BHP commitment with an input hasher of 1024 bits and randomizer.
|
|
85
|
+
*/
|
|
86
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
87
|
+
/**
|
|
88
|
+
* Returns a BHP commitment with an input hasher of 1024 bits and randomizer.
|
|
89
|
+
*/
|
|
90
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
91
|
+
}
|
|
92
|
+
export class BHP256 {
|
|
93
|
+
free(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Create a BHP hasher with an input size of 256 bits.
|
|
96
|
+
*/
|
|
97
|
+
constructor();
|
|
98
|
+
/**
|
|
99
|
+
* Create a BHP hasher with an input size of 256 bits with a custom domain separator.
|
|
100
|
+
*/
|
|
101
|
+
static setup(domain_separator: string): BHP256;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the BHP hash with an input hasher of 256 bits.
|
|
104
|
+
*/
|
|
105
|
+
hash(input: Array<any>): Field;
|
|
106
|
+
/**
|
|
107
|
+
* Returns a BHP hash with an input hasher of 256 bits.
|
|
108
|
+
*/
|
|
109
|
+
hashToGroup(input: Array<any>): Group;
|
|
110
|
+
/**
|
|
111
|
+
* Returns a BHP commitment with an input hasher of 256 bits and randomizer.
|
|
112
|
+
*/
|
|
113
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
114
|
+
/**
|
|
115
|
+
* Returns a BHP commitment with an input hasher of 256 bits and randomizer.
|
|
116
|
+
*/
|
|
117
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
118
|
+
}
|
|
119
|
+
export class BHP512 {
|
|
120
|
+
free(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Create a BHP hasher with an input size of 512 bits.
|
|
123
|
+
*/
|
|
124
|
+
constructor();
|
|
125
|
+
/**
|
|
126
|
+
* Create a BHP hasher with an input size of 512 bits with a custom domain separator.
|
|
127
|
+
*/
|
|
128
|
+
static setup(domain_separator: string): BHP512;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the BHP hash with an input hasher of 512 bits.
|
|
131
|
+
*/
|
|
132
|
+
hash(input: Array<any>): Field;
|
|
133
|
+
/**
|
|
134
|
+
* Returns a BHP hash with an input hasher of 512 bits.
|
|
135
|
+
*/
|
|
136
|
+
hashToGroup(input: Array<any>): Group;
|
|
137
|
+
/**
|
|
138
|
+
* Returns a BHP commitment with an input hasher of 512 bits and randomizer.
|
|
139
|
+
*/
|
|
140
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
141
|
+
/**
|
|
142
|
+
* Returns a BHP commitment with an input hasher of 512 bits and randomizer.
|
|
143
|
+
*/
|
|
144
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
145
|
+
}
|
|
146
|
+
export class BHP768 {
|
|
147
|
+
free(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Create a BHP hasher with an input size of 768 bits.
|
|
150
|
+
*/
|
|
151
|
+
constructor();
|
|
152
|
+
/**
|
|
153
|
+
* Create a BHP hasher with an input size of 768 bits with a custom domain separator.
|
|
154
|
+
*/
|
|
155
|
+
static setup(domain_separator: string): BHP768;
|
|
156
|
+
/**
|
|
157
|
+
* Returns the BHP hash with an input hasher of 768 bits.
|
|
158
|
+
*/
|
|
159
|
+
hash(input: Array<any>): Field;
|
|
160
|
+
/**
|
|
161
|
+
* Returns a BHP hash with an input hasher of 768 bits.
|
|
162
|
+
*/
|
|
163
|
+
hashToGroup(input: Array<any>): Group;
|
|
164
|
+
/**
|
|
165
|
+
* Returns a BHP commitment with an input hasher of 768 bits and randomizer.
|
|
166
|
+
*/
|
|
167
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
168
|
+
/**
|
|
169
|
+
* Returns a BHP commitment with an input hasher of 768 bits and randomizer.
|
|
170
|
+
*/
|
|
171
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
172
|
+
}
|
|
65
173
|
/**
|
|
66
174
|
* SnarkVM Ciphertext object. A Ciphertext represents an symmetrically encrypted plaintext. This
|
|
67
175
|
* object provides decryption methods to recover the plaintext from the ciphertext (given the
|
|
@@ -82,7 +190,16 @@ export class Ciphertext {
|
|
|
82
190
|
*/
|
|
83
191
|
decrypt(view_key: ViewKey, nonce: Group): Plaintext;
|
|
84
192
|
/**
|
|
85
|
-
*
|
|
193
|
+
* Decrypt a ciphertext using the view key of the transition signer, transition public key, and
|
|
194
|
+
* (program, function, index) tuple.
|
|
195
|
+
*/
|
|
196
|
+
decrypt_with_transition_info(view_key: ViewKey, transition_public_key: Group, program: string, function_name: string, index: number): Plaintext;
|
|
197
|
+
/**
|
|
198
|
+
* Decrypt a ciphertext using the transition view key and a (program, function, index) tuple.
|
|
199
|
+
*/
|
|
200
|
+
decrypt_with_transition_view_key(transition_view_key: Field, program: string, function_name: string, index: number): Plaintext;
|
|
201
|
+
/**
|
|
202
|
+
* Decrypts a ciphertext into plaintext using the given ciphertext view key.
|
|
86
203
|
*
|
|
87
204
|
* @param {Field} transition_view_key The transition view key that was used to encrypt the ciphertext.
|
|
88
205
|
*
|
|
@@ -246,17 +363,37 @@ export class Field {
|
|
|
246
363
|
private constructor();
|
|
247
364
|
free(): void;
|
|
248
365
|
/**
|
|
249
|
-
* Creates a field object from a string representation of a field.
|
|
366
|
+
* Creates a field object from a string representation of a field element.
|
|
250
367
|
*/
|
|
251
368
|
static fromString(field: string): Field;
|
|
252
369
|
/**
|
|
253
|
-
*
|
|
370
|
+
* Returns the string representation of the field element.
|
|
371
|
+
*/
|
|
372
|
+
toString(): string;
|
|
373
|
+
/**
|
|
374
|
+
* Create a field element from a Uint8Array of left endian bytes.
|
|
375
|
+
*/
|
|
376
|
+
static fromBytesLe(bytes: Uint8Array): Field;
|
|
377
|
+
/**
|
|
378
|
+
* Encode the field element as a Uint8Array of left endian bytes.
|
|
379
|
+
*/
|
|
380
|
+
toBytesLe(): Uint8Array;
|
|
381
|
+
/**
|
|
382
|
+
* Reconstruct a field element from a boolean array representation.
|
|
383
|
+
*/
|
|
384
|
+
static fromBitsLe(bits: Array<any>): Field;
|
|
385
|
+
/**
|
|
386
|
+
* Get the left endian boolean array representation of the field element.
|
|
387
|
+
*/
|
|
388
|
+
toBitsLe(): Array<any>;
|
|
389
|
+
/**
|
|
390
|
+
* Create a plaintext from the field element.
|
|
254
391
|
*/
|
|
255
392
|
toPlaintext(): Plaintext;
|
|
256
393
|
/**
|
|
257
|
-
*
|
|
394
|
+
* Clone the field element.
|
|
258
395
|
*/
|
|
259
|
-
|
|
396
|
+
clone(): Field;
|
|
260
397
|
/**
|
|
261
398
|
* Generate a random field element.
|
|
262
399
|
*/
|
|
@@ -286,11 +423,11 @@ export class Field {
|
|
|
286
423
|
*/
|
|
287
424
|
inverse(): Field;
|
|
288
425
|
/**
|
|
289
|
-
* Get the
|
|
426
|
+
* Get the additive identity element of the field.
|
|
290
427
|
*/
|
|
291
428
|
static zero(): Field;
|
|
292
429
|
/**
|
|
293
|
-
* Get the
|
|
430
|
+
* Get the multiplicative identity of the field.
|
|
294
431
|
*/
|
|
295
432
|
static one(): Field;
|
|
296
433
|
/**
|
|
@@ -337,13 +474,29 @@ export class Group {
|
|
|
337
474
|
private constructor();
|
|
338
475
|
free(): void;
|
|
339
476
|
/**
|
|
340
|
-
* Creates a group object from a string representation of a group.
|
|
477
|
+
* Creates a group object from a string representation of a group element.
|
|
341
478
|
*/
|
|
342
479
|
static fromString(group: string): Group;
|
|
343
480
|
/**
|
|
344
|
-
* Returns the string representation of the group.
|
|
481
|
+
* Returns the string representation of the group element.
|
|
345
482
|
*/
|
|
346
483
|
toString(): string;
|
|
484
|
+
/**
|
|
485
|
+
* Create a group element from a Uint8Array of left endian bytes.
|
|
486
|
+
*/
|
|
487
|
+
static fromBytesLe(bytes: Uint8Array): Group;
|
|
488
|
+
/**
|
|
489
|
+
* Encode the group element as a Uint8Array of left endian bytes.
|
|
490
|
+
*/
|
|
491
|
+
toBytesLe(): Uint8Array;
|
|
492
|
+
/**
|
|
493
|
+
* Reconstruct a group element from a boolean array representation.
|
|
494
|
+
*/
|
|
495
|
+
static fromBitsLe(bits: Array<any>): Group;
|
|
496
|
+
/**
|
|
497
|
+
* Get the left endian boolean array representation of the group element.
|
|
498
|
+
*/
|
|
499
|
+
toBitsLe(): Array<any>;
|
|
347
500
|
/**
|
|
348
501
|
* Get the x-coordinate of the group element.
|
|
349
502
|
*/
|
|
@@ -352,6 +505,10 @@ export class Group {
|
|
|
352
505
|
* Create a plaintext element from a group element.
|
|
353
506
|
*/
|
|
354
507
|
toPlaintext(): Plaintext;
|
|
508
|
+
/**
|
|
509
|
+
* Clone the group element.
|
|
510
|
+
*/
|
|
511
|
+
clone(): Group;
|
|
355
512
|
/**
|
|
356
513
|
* Generate a random group element.
|
|
357
514
|
*/
|
|
@@ -471,6 +628,52 @@ export class OfflineQuery {
|
|
|
471
628
|
*/
|
|
472
629
|
static fromString(s: string): OfflineQuery;
|
|
473
630
|
}
|
|
631
|
+
export class Pedersen128 {
|
|
632
|
+
free(): void;
|
|
633
|
+
/**
|
|
634
|
+
* Create a Pedersen hasher for a given (up to) 128-bit input.
|
|
635
|
+
*/
|
|
636
|
+
constructor();
|
|
637
|
+
/**
|
|
638
|
+
* Create a Pedersen hasher for a given (up to) 128-bit input with a custom domain separator.
|
|
639
|
+
*/
|
|
640
|
+
static setup(domain_separator: string): Pedersen128;
|
|
641
|
+
/**
|
|
642
|
+
* Returns the Pedersen hash for a given (up to) 128-bit input.
|
|
643
|
+
*/
|
|
644
|
+
hash(input: Array<any>): Field;
|
|
645
|
+
/**
|
|
646
|
+
* Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
|
|
647
|
+
*/
|
|
648
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
649
|
+
/**
|
|
650
|
+
* Returns a Pedersen commitment for the given (up to) 128-bit input and randomizer.
|
|
651
|
+
*/
|
|
652
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
653
|
+
}
|
|
654
|
+
export class Pedersen64 {
|
|
655
|
+
free(): void;
|
|
656
|
+
/**
|
|
657
|
+
* Create a Pedersen hasher for a given (up to) 64-bit input.
|
|
658
|
+
*/
|
|
659
|
+
constructor();
|
|
660
|
+
/**
|
|
661
|
+
* Create a Pedersen64 hasher for a given (up to) 64-bit input with a custom domain separator.
|
|
662
|
+
*/
|
|
663
|
+
static setup(domain_separator: string): Pedersen64;
|
|
664
|
+
/**
|
|
665
|
+
* Returns the Pedersen hash for a given (up to) 64-bit input.
|
|
666
|
+
*/
|
|
667
|
+
hash(input: Array<any>): Field;
|
|
668
|
+
/**
|
|
669
|
+
* Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
|
|
670
|
+
*/
|
|
671
|
+
commit(input: Array<any>, randomizer: Scalar): Field;
|
|
672
|
+
/**
|
|
673
|
+
* Returns a Pedersen commitment for the given (up to) 64-bit input and randomizer.
|
|
674
|
+
*/
|
|
675
|
+
commitToGroup(input: Array<any>, randomizer: Scalar): Group;
|
|
676
|
+
}
|
|
474
677
|
/**
|
|
475
678
|
* SnarkVM Plaintext object. Plaintext is a fundamental monadic type used to represent Aleo
|
|
476
679
|
* primitive types (boolean, field, group, i8, i16, i32, i64, i128, u8, u16, u32, u64, u128,
|
|
@@ -552,6 +755,87 @@ export class Plaintext {
|
|
|
552
755
|
*/
|
|
553
756
|
toObject(): any;
|
|
554
757
|
}
|
|
758
|
+
export class Poseidon2 {
|
|
759
|
+
free(): void;
|
|
760
|
+
/**
|
|
761
|
+
* Create a Poseidon hasher with an input rate of 2.
|
|
762
|
+
*/
|
|
763
|
+
constructor();
|
|
764
|
+
/**
|
|
765
|
+
* Create a Poseidon hasher with an input rate of 2 and a custom domain separator.
|
|
766
|
+
*/
|
|
767
|
+
static setup(domain_separator: string): Poseidon2;
|
|
768
|
+
/**
|
|
769
|
+
* Returns the Poseidon hash with an input rate of 2.
|
|
770
|
+
*/
|
|
771
|
+
hash(input: Array<any>): Field;
|
|
772
|
+
/**
|
|
773
|
+
* Returns the extended Poseidon hash with an input rate of 2.
|
|
774
|
+
*/
|
|
775
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
776
|
+
/**
|
|
777
|
+
* Returns the Poseidon hash with an input rate of 2 on the scalar field.
|
|
778
|
+
*/
|
|
779
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
780
|
+
/**
|
|
781
|
+
* Returns the Poseidon hash with an input rate of 2 on the affine curve.
|
|
782
|
+
*/
|
|
783
|
+
hashToGroup(input: Array<any>): Group;
|
|
784
|
+
}
|
|
785
|
+
export class Poseidon4 {
|
|
786
|
+
free(): void;
|
|
787
|
+
/**
|
|
788
|
+
* Create a Poseidon hasher with an input rate of 4.
|
|
789
|
+
*/
|
|
790
|
+
constructor();
|
|
791
|
+
/**
|
|
792
|
+
* Create a Poseidon hasher with an input rate of 4 and a custom domain separator.
|
|
793
|
+
*/
|
|
794
|
+
static setup(domain_separator: string): Poseidon4;
|
|
795
|
+
/**
|
|
796
|
+
* Returns the Poseidon hash with an input rate of 4.
|
|
797
|
+
*/
|
|
798
|
+
hash(input: Array<any>): Field;
|
|
799
|
+
/**
|
|
800
|
+
* Returns the extended Poseidon hash with an input rate of 4.
|
|
801
|
+
*/
|
|
802
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
803
|
+
/**
|
|
804
|
+
* Returns the Poseidon hash with an input rate of 4 on the scalar field.
|
|
805
|
+
*/
|
|
806
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
807
|
+
/**
|
|
808
|
+
* Returns the Poseidon hash with an input rate of 4 on the affine curve.
|
|
809
|
+
*/
|
|
810
|
+
hashToGroup(input: Array<any>): Group;
|
|
811
|
+
}
|
|
812
|
+
export class Poseidon8 {
|
|
813
|
+
free(): void;
|
|
814
|
+
/**
|
|
815
|
+
* Create a Poseidon hasher with an input rate of 8.
|
|
816
|
+
*/
|
|
817
|
+
constructor();
|
|
818
|
+
/**
|
|
819
|
+
* Create a Poseidon hasher with an input rate of 8 and a custom domain separator.
|
|
820
|
+
*/
|
|
821
|
+
static setup(domain_separator: string): Poseidon8;
|
|
822
|
+
/**
|
|
823
|
+
* Returns the Poseidon hash with an input rate of 8.
|
|
824
|
+
*/
|
|
825
|
+
hash(input: Array<any>): Field;
|
|
826
|
+
/**
|
|
827
|
+
* Returns the extended Poseidon hash with an input rate of 8.
|
|
828
|
+
*/
|
|
829
|
+
hashMany(input: Array<any>, num_outputs: number): Array<any>;
|
|
830
|
+
/**
|
|
831
|
+
* Returns the Poseidon hash with an input rate of 8 on the scalar field.
|
|
832
|
+
*/
|
|
833
|
+
hashToScalar(input: Array<any>): Scalar;
|
|
834
|
+
/**
|
|
835
|
+
* Returns the Poseidon hash with an input rate of 8 on the affine curve.
|
|
836
|
+
*/
|
|
837
|
+
hashToGroup(input: Array<any>): Group;
|
|
838
|
+
}
|
|
555
839
|
/**
|
|
556
840
|
* Private key of an Aleo account
|
|
557
841
|
*/
|
|
@@ -1432,19 +1716,39 @@ export class Scalar {
|
|
|
1432
1716
|
private constructor();
|
|
1433
1717
|
free(): void;
|
|
1434
1718
|
/**
|
|
1435
|
-
*
|
|
1719
|
+
* Creates a scalar object from a string representation of a scalar element.
|
|
1720
|
+
*/
|
|
1721
|
+
static fromString(group: string): Scalar;
|
|
1722
|
+
/**
|
|
1723
|
+
* Returns the string representation of the scalar element.
|
|
1436
1724
|
*/
|
|
1437
1725
|
toString(): string;
|
|
1438
1726
|
/**
|
|
1439
|
-
* Create a
|
|
1727
|
+
* Create a scalar element from a Uint8Array of left endian bytes.
|
|
1728
|
+
*/
|
|
1729
|
+
static fromBytesLe(bytes: Uint8Array): Scalar;
|
|
1730
|
+
/**
|
|
1731
|
+
* Encode the scalar element as a Uint8Array of left endian bytes.
|
|
1732
|
+
*/
|
|
1733
|
+
toBytesLe(): Uint8Array;
|
|
1734
|
+
/**
|
|
1735
|
+
* Reconstruct a scalar element from a boolean array representation.
|
|
1736
|
+
*/
|
|
1737
|
+
static fromBitsLe(bits: Array<any>): Scalar;
|
|
1738
|
+
/**
|
|
1739
|
+
* Get the left endian boolean array representation of the scalar element.
|
|
1740
|
+
*/
|
|
1741
|
+
toBitsLe(): Array<any>;
|
|
1742
|
+
/**
|
|
1743
|
+
* Create a plaintext element from a scalar element.
|
|
1440
1744
|
*/
|
|
1441
1745
|
toPlaintext(): Plaintext;
|
|
1442
1746
|
/**
|
|
1443
|
-
*
|
|
1747
|
+
* Clone the scalar element.
|
|
1444
1748
|
*/
|
|
1445
|
-
|
|
1749
|
+
clone(): Scalar;
|
|
1446
1750
|
/**
|
|
1447
|
-
* Generate a random
|
|
1751
|
+
* Generate a random scalar element.
|
|
1448
1752
|
*/
|
|
1449
1753
|
static random(): Scalar;
|
|
1450
1754
|
/**
|
|
@@ -1476,11 +1780,11 @@ export class Scalar {
|
|
|
1476
1780
|
*/
|
|
1477
1781
|
inverse(): Scalar;
|
|
1478
1782
|
/**
|
|
1479
|
-
*
|
|
1783
|
+
* Get the multiplicative identity of the scalar field.
|
|
1480
1784
|
*/
|
|
1481
1785
|
static one(): Scalar;
|
|
1482
1786
|
/**
|
|
1483
|
-
*
|
|
1787
|
+
* Get the additive identity of the scalar field.
|
|
1484
1788
|
*/
|
|
1485
1789
|
static zero(): Scalar;
|
|
1486
1790
|
/**
|
|
@@ -1792,6 +2096,10 @@ export class Transition {
|
|
|
1792
2096
|
* Get the transition public key of the transition.
|
|
1793
2097
|
*/
|
|
1794
2098
|
tpk(): Group;
|
|
2099
|
+
/**
|
|
2100
|
+
* Get the transition view key of the transition.
|
|
2101
|
+
*/
|
|
2102
|
+
tvk(view_key: ViewKey): Field;
|
|
1795
2103
|
/**
|
|
1796
2104
|
* Get the transition commitment of the transition.
|
|
1797
2105
|
*/
|
|
Binary file
|