mirror of
https://github.com/privacy-scaling-explorations/zk-kit.git
synced 2026-04-22 03:00:15 -04:00
refactor: update parameter to pack solidity proofs
Former-commit-id: a383873684598f560b82d4b7356300fae1c8d337 [formerly 91eb676c28acdabc7e02b448faa2af70300f5cf7] [formerly 6e451c34d114199daaad8986695fd27a8a3b1974 [formerly 106914a4ef05cdb8c8da54040ab95e01e68a72c5]] [formerly db418a85da9b07c55fbcceb83e5cf07b2a8d172a [formerly 4ac53a6f910d3b8e4017476b7e009e4db3d94122] [formerly 702a7417bb77daaf0bcb69f7d2dda3fae97cfc8a [formerly fde16215b4]]]
Former-commit-id: 5cd2992b24e222e8e9d0a9860e795aafe1f2ab0c [formerly 95cf35ed96c2ff1c04202203f1e0b8316ce08412] [formerly bedaba8f63221c2cab2f7ea530ae7b5483975f3a [formerly 87c40a7dbbeff754b29babdcbe90c9ff7670e083]]
Former-commit-id: 9d49f693570e79fc71deec92f3ad0d16ab0aa26f [formerly 0f8b5807db9588d54f6a9588ce6758309015eb70]
Former-commit-id: 8883c10ff83d7ea3a97cfad081a477bbbff10424
This commit is contained in:
@@ -82,6 +82,6 @@ const signal = "Hello world"
|
||||
const externalNullifier = BigInt(1)
|
||||
const witness = Semaphore.genWitness(identity, merkleProof, externalNullifier, signal)
|
||||
|
||||
const fullProof = await Semaphore.genProof(witness, "./semaphore.wasm", "./semaphore.zkey")
|
||||
const solidityProof = Semaphore.packToSolidityProof(fullProof)
|
||||
const { proof, publicSignals } = await Semaphore.genProof(witness, "./semaphore.wasm", "./semaphore.zkey")
|
||||
const solidityProof = Semaphore.packToSolidityProof(proof)
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MerkleProof } from "@zk-kit/incremental-merkle-tree"
|
||||
import { poseidon } from "circomlibjs"
|
||||
import { groth16 } from "snarkjs"
|
||||
import { SemaphoreFullProof, SemaphoreSolidityProof, SemaphoreWitness, StrBigInt } from "./types"
|
||||
import { Proof, SemaphoreFullProof, SemaphoreSolidityProof, SemaphoreWitness, StrBigInt } from "./types"
|
||||
import { genSignalHash } from "./utils"
|
||||
|
||||
export default class Semaphore {
|
||||
@@ -91,9 +91,7 @@ export default class Semaphore {
|
||||
* @returns The Solidity compatible proof.
|
||||
*/
|
||||
/* istanbul ignore next */
|
||||
public static packToSolidityProof(fullProof: SemaphoreFullProof): SemaphoreSolidityProof {
|
||||
const { proof } = fullProof
|
||||
|
||||
public static packToSolidityProof(proof: Proof): SemaphoreSolidityProof {
|
||||
return [
|
||||
proof.pi_a[0],
|
||||
proof.pi_a[1],
|
||||
|
||||
Reference in New Issue
Block a user