@crisp-e3/sdk 0.4.1 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # CRISP SDK
2
2
 
3
- TypeScript SDK for interacting with CRISP (Cryptographically Secure and Private voting protocol) and
4
- the CRISP server.
3
+ TypeScript SDK for interacting with CRISP (Coercion-Resistant Impartial Selection Protocol) and the
4
+ CRISP server.
5
5
 
6
6
  ## Installation
7
7
 
package/dist/index.d.ts CHANGED
@@ -106,6 +106,8 @@ type VoteProofInputs = {
106
106
  balance: bigint;
107
107
  vote: Vote;
108
108
  signature: `0x${string}`;
109
+ previousCiphertext?: Uint8Array;
110
+ messageHash: `0x${string}`;
109
111
  };
110
112
 
111
113
  /**
@@ -122,15 +124,17 @@ declare const getRoundTokenDetails: (serverUrl: string, e3Id: number) => Promise
122
124
 
123
125
  declare const MERKLE_TREE_MAX_DEPTH = 20;
124
126
  /**
125
- * This is the maximum value for a vote (Yes or No). This is 2^28 - 1
126
- * The minimum degree that BFV should use is 56 (to accommodate both Yes and No votes)
127
+ * This is the maximum value for a vote (Yes or No). This is 2^50 - 1
128
+ * The minimum degree that BFV should use is 100 (to accommodate both Yes and No votes)
127
129
  */
128
130
  declare const MAXIMUM_VOTE_VALUE: bigint;
129
131
  /**
130
132
  * Message used by users to prove ownership of their Ethereum account
131
133
  * This message is signed by the user's private key to authenticate their identity
134
+ * @notice Apps ideally want to use a different message to avoid signature reuse across different applications
132
135
  */
133
136
  declare const SIGNATURE_MESSAGE = "CRISP: Sign this message to prove ownership of your Ethereum account";
137
+ declare const SIGNATURE_MESSAGE_HASH: `0x${string}`;
134
138
 
135
139
  /**
136
140
  * Hash a leaf node for the Merkle tree
@@ -152,7 +156,7 @@ declare const generateMerkleTree: (leaves: bigint[]) => LeanIMT;
152
156
  * @param leaves The leaves of the Merkle tree
153
157
  */
154
158
  declare const generateMerkleProof: (balance: bigint, address: string, leaves: bigint[] | string[]) => MerkleProof;
155
- declare const getAddressFromSignature: (signature: `0x${string}`) => Promise<string>;
159
+ declare const getAddressFromSignature: (signature: `0x${string}`, messageHash: `0x${string}`) => Promise<string>;
156
160
 
157
161
  /**
158
162
  * Decode an encoded tally into its decimal representation.
@@ -173,4 +177,4 @@ declare const verifyProof: (proof: ProofData) => Promise<boolean>;
173
177
  */
174
178
  declare const encodeSolidityProof: (proof: ProofData) => Hex;
175
179
 
176
- export { MAXIMUM_VOTE_VALUE, MERKLE_TREE_MAX_DEPTH, type MaskVoteProofInputs, type RoundDetails, type RoundDetailsResponse, SIGNATURE_MESSAGE, type TokenDetails, type Vote, type VoteProofInputs, decodeTally, encodeSolidityProof, encryptVote, generateMaskVoteProof, generateMerkleProof, generateMerkleTree, generatePublicKey, generateVoteProof, getAddressFromSignature, getBalanceAt, getRoundDetails, getRoundTokenDetails, getTotalSupplyAt, getTreeData, hashLeaf, verifyProof };
180
+ export { MAXIMUM_VOTE_VALUE, MERKLE_TREE_MAX_DEPTH, type MaskVoteProofInputs, type RoundDetails, type RoundDetailsResponse, SIGNATURE_MESSAGE, SIGNATURE_MESSAGE_HASH, type TokenDetails, type Vote, type VoteProofInputs, decodeTally, encodeSolidityProof, encryptVote, generateMaskVoteProof, generateMerkleProof, generateMerkleTree, generatePublicKey, generateVoteProof, getAddressFromSignature, getBalanceAt, getRoundDetails, getRoundTokenDetails, getTotalSupplyAt, getTreeData, hashLeaf, verifyProof };