@crisp-e3/sdk 0.2.3-test → 0.3.0-test

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/LICENSE.md CHANGED
@@ -1,102 +1,83 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
1
+ GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007
3
2
 
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
3
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy
4
+ and distribute verbatim copies of this license document, but changing it is not allowed.
7
5
 
6
+ This version of the GNU Lesser General Public License incorporates the terms and conditions of
7
+ version 3 of the GNU General Public License, supplemented by the additional permissions listed
8
+ below.
8
9
 
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
10
+ 0. Additional Definitions.
12
11
 
13
- 0. Additional Definitions.
12
+ As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the
13
+ "GNU GPL" refers to version 3 of the GNU General Public License.
14
14
 
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
15
+ "The Library" refers to a covered work governed by this License, other than an Application or a
16
+ Combined Work as defined below.
18
17
 
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
18
+ An "Application" is any work that makes use of an interface provided by the Library, but which is
19
+ not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed
20
+ a mode of using an interface provided by the Library.
21
21
 
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
22
+ A "Combined Work" is a work produced by combining or linking an Application with the Library. The
23
+ particular version of the Library with which the Combined Work was made is also called the "Linked
30
24
  Version".
31
25
 
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
26
+ The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the
27
+ Combined Work, excluding any source code for portions of the Combined Work that, considered in
28
+ isolation, are based on the Application, and not on the Linked Version.
36
29
 
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
30
+ The "Corresponding Application Code" for a Combined Work means the object code and/or source code
31
+ for the Application, including any data and utility programs needed for reproducing the Combined
32
+ Work from the Application, but excluding the System Libraries of the Combined Work.
41
33
 
42
- 1. Exception to Section 3 of the GNU GPL.
34
+ 1. Exception to Section 3 of the GNU GPL.
43
35
 
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
36
+ You may convey a covered work under sections 3 and 4 of this License without being bound by section
37
+ 3 of the GNU GPL.
46
38
 
47
- 2. Conveying Modified Versions.
39
+ 2. Conveying Modified Versions.
48
40
 
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
41
+ If you modify a copy of the Library, and, in your modifications, a facility refers to a function or
42
+ data to be supplied by an Application that uses the facility (other than as an argument passed when
43
+ the facility is invoked), then you may convey a copy of the modified version:
54
44
 
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
45
+ a) under this License, provided that you make a good faith effort to ensure that, in the event an
46
+ Application does not supply the function or data, the facility still operates, and performs whatever
47
+ part of its purpose remains meaningful, or
59
48
 
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
49
+ b) under the GNU GPL, with none of the additional permissions of this License applicable to that
50
+ copy.
62
51
 
63
- 3. Object Code Incorporating Material from Library Header Files.
52
+ 3. Object Code Incorporating Material from Library Header Files.
64
53
 
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
54
+ The object code form of an Application may incorporate material from a header file that is part of
55
+ the Library. You may convey such object code under terms of your choice, provided that, if the
56
+ incorporated material is not limited to numerical parameters, data structure layouts and accessors,
57
+ or small macros, inline functions and templates (ten or fewer lines in length), you do both of the
58
+ following:
71
59
 
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
60
+ a) Give prominent notice with each copy of the object code that the Library is used in it and that
61
+ the Library and its use are covered by this License.
75
62
 
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
63
+ b) Accompany the object code with a copy of the GNU GPL and this license document.
78
64
 
79
- 4. Combined Works.
65
+ 4. Combined Works.
80
66
 
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
67
+ You may convey a Combined Work under terms of your choice that, taken together, effectively do not
68
+ restrict modification of the portions of the Library contained in the Combined Work and reverse
69
+ engineering for debugging such modifications, if you also do each of the following:
86
70
 
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
71
+ a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that
72
+ the Library and its use are covered by this License.
90
73
 
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
74
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
93
75
 
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
76
+ c) For a Combined Work that displays copyright notices during execution, include the copyright
77
+ notice for the Library among these notices, as well as a reference directing the user to the copies
78
+ of the GNU GPL and this license document.
98
79
 
99
- d) Do one of the following:
80
+ d) Do one of the following:
100
81
 
101
82
  0) Convey the Minimal Corresponding Source under the terms of this
102
83
  License, and the Corresponding Application Code in a form
@@ -113,53 +94,41 @@ the following:
113
94
  of the Library that is interface-compatible with the Linked
114
95
  Version.
115
96
 
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
97
+ e) Provide Installation Information, but only if you would otherwise be required to provide such
98
+ information under section 6 of the GNU GPL, and only to the extent that such information is
99
+ necessary to install and execute a modified version of the Combined Work produced by recombining or
100
+ relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the
101
+ Installation Information must accompany the Minimal Corresponding Source and Corresponding
102
+ Application Code. If you use option 4d1, you must provide the Installation Information in the manner
103
+ specified by section 6 of the GNU GPL for conveying Corresponding Source.)
104
+
105
+ 5. Combined Libraries.
106
+
107
+ You may place library facilities that are a work based on the Library side by side in a single
108
+ library together with other library facilities that are not Applications and are not covered by this
109
+ License, and convey such a combined library under terms of your choice, if you do both of the
110
+ following:
111
+
112
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with
113
+ any other library facilities, conveyed under the terms of this License.
114
+
115
+ b) Give prominent notice with the combined library that part of it is a work based on the Library,
116
+ and explaining where to find the accompanying uncombined form of the same work.
117
+
118
+ 6. Revised Versions of the GNU Lesser General Public License.
119
+
120
+ The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General
121
+ Public License from time to time. Such new versions will be similar in spirit to the present
122
+ version, but may differ in detail to address new problems or concerns.
123
+
124
+ Each version is given a distinguishing version number. If the Library as you received it specifies
125
+ that a certain numbered version of the GNU Lesser General Public License "or any later version"
126
+ applies to it, you have the option of following the terms and conditions either of that published
127
+ version or of any later version published by the Free Software Foundation. If the Library as you
128
+ received it does not specify a version number of the GNU Lesser General Public License, you may
129
+ choose any version of the GNU Lesser General Public License ever published by the Free Software
130
+ Foundation.
131
+
132
+ If the Library as you received it specifies that a proxy can decide whether future versions of the
133
+ GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any
134
+ version is permanent authorization for you to choose that version for the Library.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { LeanIMTMerkleProof, LeanIMT } from '@zk-kit/lean-imt';
2
2
  import { ProofData } from '@aztec/bb.js';
3
+ import { Hex } from 'viem';
3
4
 
4
5
  /**
5
6
  * Get the merkle tree data from the CRISP server
@@ -341,6 +342,13 @@ declare const getCircuitOutputValue: (crispInputs: CRISPCircuitInputs) => Promis
341
342
  returnValue: unknown;
342
343
  }>;
343
344
  declare const verifyProof: (proof: ProofData) => Promise<boolean>;
345
+ /**
346
+ * Encode the proof data into a format that can be used by the CRISP program in Solidity
347
+ * to validate the proof.
348
+ * @param proof The proof data.
349
+ * @returns The encoded proof data as a hex string.
350
+ */
351
+ declare const encodeSolidityProof: (proof: ProofData) => Hex;
344
352
 
345
353
  /**
346
354
  * Given a message and its signed version, extract the signature components
@@ -350,4 +358,4 @@ declare const verifyProof: (proof: ProofData) => Promise<boolean>;
350
358
  */
351
359
  declare const extractSignature: (message: string, signedMessage: `0x${string}`) => Promise<NoirSignatureInputs>;
352
360
 
353
- export { type CRISPCircuitInputs, CRISP_SERVER_STATE_LITE_ENDPOINT, CRISP_SERVER_TOKEN_TREE_ENDPOINT, HALF_LARGEST_MINIMUM_DEGREE, type IMerkleProof, type IRoundDetails, type IRoundDetailsResponse, type ITokenDetails, type IVote, MAXIMUM_VOTE_VALUE, MERKLE_TREE_MAX_DEPTH, MESSAGE, type NoirSignatureInputs, VotingMode, calculateValidIndicesForPlaintext, decodeTally, encodeVote, encryptVote, encryptVoteAndGenerateCRISPInputs, extractSignature, generateMaskVote, generateMerkleProof, generateMerkleTree, generateProof, generateProofWithReturnValue, generatePublicKey, getBalanceAt, getCircuitOutputValue, getRoundDetails, getRoundTokenDetails, getTotalSupplyAt, getTreeData, hashLeaf, toBinary, validateVote, verifyProof };
361
+ export { type CRISPCircuitInputs, CRISP_SERVER_STATE_LITE_ENDPOINT, CRISP_SERVER_TOKEN_TREE_ENDPOINT, HALF_LARGEST_MINIMUM_DEGREE, type IMerkleProof, type IRoundDetails, type IRoundDetailsResponse, type ITokenDetails, type IVote, MAXIMUM_VOTE_VALUE, MERKLE_TREE_MAX_DEPTH, MESSAGE, type NoirSignatureInputs, VotingMode, calculateValidIndicesForPlaintext, decodeTally, encodeSolidityProof, encodeVote, encryptVote, encryptVoteAndGenerateCRISPInputs, extractSignature, generateMaskVote, generateMerkleProof, generateMerkleTree, generateProof, generateProofWithReturnValue, generatePublicKey, getBalanceAt, getCircuitOutputValue, getRoundDetails, getRoundTokenDetails, getTotalSupplyAt, getTreeData, hashLeaf, toBinary, validateVote, verifyProof };