@crisp-e3/sdk 0.27.0-insecure.0 → 0.27.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 +23 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +38 -4
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/presets/insecure-64.js +2 -2
- package/dist/presets/secure-8192.d.ts +7 -0
- package/dist/presets/secure-8192.js +20 -6
- package/dist/workers/generateCircuitInputs.worker.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -133,6 +133,28 @@ const maskProof = await generateMaskVoteProof({
|
|
|
133
133
|
})
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
+
#### Report Proving Progress
|
|
137
|
+
|
|
138
|
+
A ballot proof is five proofs in sequence, listed in `PROOF_STAGES`. `finishBallotProof`,
|
|
139
|
+
`finishMaskProof` and `CrispSDK.finishBallot` take an optional `onProgress`, called as each stage
|
|
140
|
+
starts:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { finishBallotProof } from '@crisp-e3/sdk'
|
|
144
|
+
|
|
145
|
+
const proof = await finishBallotProof(prepared, digest, signature, {
|
|
146
|
+
onProgress: ({ stage, index, total }) => console.log(`${index + 1}/${total}: ${stage}`),
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
| Stage | Circuit | What it proves |
|
|
151
|
+
| ---------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
152
|
+
| `encryption_ct0` | `user_data_encryption_ct0` | The ciphertext half that carries the ballot is a well-formed encryption of it |
|
|
153
|
+
| `encryption_ct1` | `user_data_encryption_ct1` | The other ciphertext half is well formed |
|
|
154
|
+
| `ballot` | `crisp` / `crisp_onchain` | A vote is signed by the slot owner and within voting power, or a mask is zero; the new slot ciphertext is the ballot plus the addend |
|
|
155
|
+
| `encryption` | `user_data_encryption` | Both halves verify and share the same encryption randomness |
|
|
156
|
+
| `fold` | `fold` / `fold_onchain` | Encryption and ballot proofs cover the same ciphertext; outputs the key commitment the contract checks against the committee key |
|
|
157
|
+
|
|
136
158
|
#### Verify Proof
|
|
137
159
|
|
|
138
160
|
```typescript
|
|
@@ -294,6 +316,7 @@ const { stage, retryOffered } = getSubmissionStage({
|
|
|
294
316
|
- `MAX_VOTE_OPTIONS` - Maximum number of options in a round
|
|
295
317
|
- `MAX_MSG_NON_ZERO_COEFFS` - Number of plaintext coefficients published as the tally
|
|
296
318
|
- `SIGNATURE_MESSAGE_HASH` - Hash of the signature message
|
|
319
|
+
- `PROOF_STAGES` - The ballot proof stages in the order they run
|
|
297
320
|
|
|
298
321
|
### Types
|
|
299
322
|
|