import { SnarkProof, SnarkPublicSignals } from '@unirep/utils'; /** * The circuits package includes a browser compatible prover. This prover loads the proving keys from a remote URL. * By default this url is https://keys.unirep.io/${version}/. * * The server is expected to serve the `zkey`, `wasm`, and `vkey` files at their respective names in the provided subpath. * e.g. for the above url the signup zkey is at https://keys.unirep.io/${version}/signup.zkey`. * @param serverUrl The server url to the `zkey`, `wasm`, and `vkey` files. * Default: `https://keys.unirep.io/${version}/` * * @note * :::caution * The keys included are not safe for production use. A phase 2 trusted setup needs to be done before use. * ::: * * @example * **Default key server** * ```ts * import { Circuit } from '@unirep/circuits' * import prover from '@unirep/circuits/provers/web' * * await prover.genProofAndPublicSignals(Circuit.signup, { * // circuit inputs * }) * ``` * * **Custom key server** * ```ts * import { Circuit } from '@unirep/circuits' * import { WebProver } from '@unirep/circuits/provers/web' * * // For a local key server * const prover = new WebProver('http://localhost:8000/keys/') * await prover.genProofAndPublicSignals(Circuit.signup, { * // circuit inputs * }) * ``` * */ export declare class WebProver { cache: { [key: string]: any; }; url: string; constructor(serverUrl?: string); /** * Get key object from the server. * @param circuitUrl The url to the a `vkey`, a `zkey`s or a `wasm`. * @returns The `vkey`, the `zkey`s or the `wasm` object. */ getKey(circuitUrl: string): Promise; /** * Load proving keys for a circuit into memory. Future proofs using these keys will not need to wait for download. * :::tip * Use this function without `await` to start the download in the background. * ::: * @param circuitName Name of the circuit, which can be chosen from `Circuit` * @example * ```ts * await webProver.warmKeys(circuitName: string) * ``` */ warmKeys(circuitName: string): Promise; /** * The function returns true if the proof of the circuit is valid, false otherwise. * @param circuitName Name of the circuit, which can be chosen from `Circuit` * @param publicSignals The snark public signals that are generated from `genProofAndPublicSignals` * @param proof The snark proof that is generated from `genProofAndPublicSignals` * @returns True if the proof is valid, false otherwise */ verifyProof(circuitName: string, publicSignals: SnarkPublicSignals, proof: SnarkProof): Promise; /** * Generate proof and public signals with `snarkjs.groth16.fullProve` * @param circuitName * @param inputs Name of the circuit, which can be chosen from `Circuit` * @returns Snark proof and public signals */ genProofAndPublicSignals(circuitName: string, inputs: any): Promise<{ proof: any; publicSignals: any; }>; /** * Get vkey from a remote URL. * @param circuitName Name of the circuit, which can be chosen from `Circuit` * @returns vkey of the circuit */ getVKey(circuitName: string): Promise; } declare const _default: WebProver; export default _default;