@unirep/circuits
Version:
Client library for circuit related functions which are used in UniRep protocol.
43 lines (42 loc) • 1.77 kB
TypeScript
import { Circuit } from '../src';
import * as snarkjs from 'snarkjs';
import { Groth16Proof } from 'snarkjs';
/**
* The default prover that uses the circuits in default built folder `zksnarkBuild/`
* @note
* :::caution
* The keys included are not safe for production use. A phase 2 trusted setup needs to be done before use.
* :::
* @example
* ```ts
* import { Circuit } from '@unirep/circuits'
* import prover from '@unirep/circuits/provers/defaultProver'
*
* await prover.genProofAndPublicSignals(Circuit.signup, {
* // circuit inputs
* })
* ```
*/
export declare const defaultProver: {
/**
* Generate proof and public signals with `snarkjs.groth16.fullProve`
* @param circuitName Name of the circuit, which can be chosen from `Circuit`
* @param inputs The user inputs of the circuit
* @returns snark proof and public signals
*/
genProofAndPublicSignals: (circuitName: string | Circuit, inputs: any) => Promise<any>;
/**
* Verify the snark proof and public signals with `snarkjs.groth16.verify`
* @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 | Circuit, publicSignals: snarkjs.PublicSignals, proof: Groth16Proof) => Promise<boolean>;
/**
* Get vkey from default built folder `zksnarkBuild/`
* @param name Name of the circuit, which can be chosen from `Circuit`
* @returns vkey of the circuit
*/
getVKey: (name: string | Circuit) => Promise<any>;
};