import type { Group, MerkleProof } from "@semaphore-protocol/group"; import type { Identity } from "@semaphore-protocol/identity"; import { type SnarkArtifacts } from "@zk-kit/artifacts"; import type { BigNumberish } from "ethers"; import type { SemaphoreProof } from "./types"; /** * It generates a Semaphore proof, i.e. a zero-knowledge proof that an identity that * is part of a group has shared an anonymous message. * The message may be any arbitrary user-defined value (e.g. a vote), or the hash of that value. * The scope is a value used like a topic on which users can generate a valid proof only once, * for example the id of an election in which voters can only vote once. * The hash of the identity's scope and secret scalar is called a nullifier and can be * used to verify whether that identity has already generated a valid proof in that scope. * The depth of the tree determines which zero-knowledge artifacts to use to generate the proof. * If it is not defined, it will be inferred from the group or Merkle proof passed as the second parameter. * Finally, the artifacts themselves can be passed manually with file paths, * or they will be automatically fetched. * Please keep in mind that groups with 1 member or 2 members cannot be considered anonymous. * @param identity The Semaphore identity. * @param groupOrMerkleProof The Semaphore group or its Merkle proof. * @param message The Semaphore message. * @param scope The Semaphore scope. * @param merkleTreeDepth The depth of the tree with which the circuit was compiled. * @param snarkArtifacts See {@link https://zkkit.pse.dev/interfaces/_zk_kit_utils.SnarkArtifacts.html | SnarkArtifacts}. * @returns The Semaphore proof ready to be verified. */ export default function generateProof(identity: Identity, groupOrMerkleProof: Group | MerkleProof, message: BigNumberish | Uint8Array | string, scope: BigNumberish | Uint8Array | string, merkleTreeDepth?: number, snarkArtifacts?: SnarkArtifacts): Promise;