@crisp-e3/sdk 0.2.2-test → 0.2.3-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/dist/index.d.ts +5 -19
- package/dist/index.js +17 -21
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
- package/dist/index.cjs +0 -1325
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -367
package/dist/index.d.ts
CHANGED
|
@@ -174,14 +174,6 @@ interface CRISPCircuitInputs {
|
|
|
174
174
|
balance: string;
|
|
175
175
|
is_first_vote: boolean;
|
|
176
176
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Interface representing the BFV parameters
|
|
179
|
-
*/
|
|
180
|
-
interface BFVParams {
|
|
181
|
-
degree: number;
|
|
182
|
-
plaintextModulus: bigint;
|
|
183
|
-
moduli: BigInt64Array;
|
|
184
|
-
}
|
|
185
177
|
/**
|
|
186
178
|
* Interface representing the inputs for Noir signature verification
|
|
187
179
|
*/
|
|
@@ -214,7 +206,6 @@ interface EncryptVoteAndGenerateCRISPInputsParams {
|
|
|
214
206
|
message: string;
|
|
215
207
|
merkleData: IMerkleProof;
|
|
216
208
|
balance: bigint;
|
|
217
|
-
bfvParams?: BFVParams;
|
|
218
209
|
slotAddress: string;
|
|
219
210
|
isFirstVote: boolean;
|
|
220
211
|
}
|
|
@@ -244,11 +235,6 @@ declare const HALF_LARGEST_MINIMUM_DEGREE = 28;
|
|
|
244
235
|
* The minimum degree that BFV should use is 56 (to accommodate both Yes and No votes)
|
|
245
236
|
*/
|
|
246
237
|
declare const MAXIMUM_VOTE_VALUE: bigint;
|
|
247
|
-
/**
|
|
248
|
-
* Default BFV parameters for the CRISP ZK inputs generator.
|
|
249
|
-
* These are the parameters used for the default testing purposes only.
|
|
250
|
-
*/
|
|
251
|
-
declare const DEFAULT_BFV_PARAMS: BFVParams;
|
|
252
238
|
/**
|
|
253
239
|
* Mock message for masking signature
|
|
254
240
|
*/
|
|
@@ -303,7 +289,7 @@ declare const calculateValidIndicesForPlaintext: (totalVotingPower: bigint, degr
|
|
|
303
289
|
* @param bfvParams The BFV parameters to use for encoding
|
|
304
290
|
* @returns The encoded vote as a string
|
|
305
291
|
*/
|
|
306
|
-
declare const encodeVote: (vote: IVote, votingMode: VotingMode, votingPower: bigint
|
|
292
|
+
declare const encodeVote: (vote: IVote, votingMode: VotingMode, votingPower: bigint) => string[];
|
|
307
293
|
/**
|
|
308
294
|
* Given an encoded tally, decode it into its decimal representation
|
|
309
295
|
* @param tally The encoded tally to decode
|
|
@@ -318,6 +304,7 @@ declare const decodeTally: (tally: string[], votingMode: VotingMode) => IVote;
|
|
|
318
304
|
*/
|
|
319
305
|
declare const validateVote: (votingMode: VotingMode, vote: IVote, votingPower: bigint) => void;
|
|
320
306
|
declare const encryptVote: (encodedVote: string[], publicKey: Uint8Array) => Promise<Uint8Array>;
|
|
307
|
+
declare const generatePublicKey: () => Promise<Uint8Array>;
|
|
321
308
|
/**
|
|
322
309
|
* This is a wrapper around enclave-e3/sdk encryption functions as CRISP circuit will require some more
|
|
323
310
|
* input values which generic Greco do not need.
|
|
@@ -333,19 +320,18 @@ declare const encryptVote: (encodedVote: string[], publicKey: Uint8Array) => Pro
|
|
|
333
320
|
* @param isFirstVote Whether this is the first vote for this slot
|
|
334
321
|
* @returns The CRISP circuit inputs
|
|
335
322
|
*/
|
|
336
|
-
declare const encryptVoteAndGenerateCRISPInputs: ({ encodedVote, publicKey, previousCiphertext,
|
|
323
|
+
declare const encryptVoteAndGenerateCRISPInputs: ({ encodedVote, publicKey, previousCiphertext, merkleData, message, signature, balance, slotAddress, isFirstVote, }: EncryptVoteAndGenerateCRISPInputsParams) => Promise<CRISPCircuitInputs>;
|
|
337
324
|
/**
|
|
338
325
|
* A function to generate the data required to mask a vote
|
|
339
326
|
* @param voter The voter's address
|
|
340
327
|
* @param publicKey The voter's public key
|
|
341
328
|
* @param previousCiphertext The previous ciphertext
|
|
342
|
-
* @param bfvParams The BFV parameters
|
|
343
329
|
* @param merkleRoot The merkle root of the census tree
|
|
344
330
|
* @param slotAddress The voter's slot address
|
|
345
331
|
* @param isFirstVote Whether this is the first vote for this slot
|
|
346
332
|
* @returns The CRISP circuit inputs for a mask vote
|
|
347
333
|
*/
|
|
348
|
-
declare const generateMaskVote: (publicKey: Uint8Array, previousCiphertext: Uint8Array,
|
|
334
|
+
declare const generateMaskVote: (publicKey: Uint8Array, previousCiphertext: Uint8Array, merkleRoot: bigint, slotAddress: string, isFirstVote: boolean) => Promise<CRISPCircuitInputs>;
|
|
349
335
|
declare const generateProof: (crispInputs: CRISPCircuitInputs) => Promise<ProofData>;
|
|
350
336
|
declare const generateProofWithReturnValue: (crispInputs: CRISPCircuitInputs) => Promise<{
|
|
351
337
|
returnValue: unknown;
|
|
@@ -364,4 +350,4 @@ declare const verifyProof: (proof: ProofData) => Promise<boolean>;
|
|
|
364
350
|
*/
|
|
365
351
|
declare const extractSignature: (message: string, signedMessage: `0x${string}`) => Promise<NoirSignatureInputs>;
|
|
366
352
|
|
|
367
|
-
export { type CRISPCircuitInputs, CRISP_SERVER_STATE_LITE_ENDPOINT, CRISP_SERVER_TOKEN_TREE_ENDPOINT,
|
|
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 };
|