1pub mod prover;
2pub mod witness;
3
4use anyhow::Result;
5use prover::{CircomProof, ProofLib};
6use std::collections::HashMap;
7
8#[cfg(feature = "rustwitness")]
9pub use rust_witness::*;
10use witness::WitnessFn;
11#[cfg(feature = "witnesscalc")]
12pub use witnesscalc_adapter;
13
14#[derive(Debug, Clone)]
15pub struct CircomProver {}
16
17impl CircomProver {
18 pub fn prove(
19 proof_lib: ProofLib,
20 wit_fn: WitnessFn,
21 inputs: HashMap<String, Vec<String>>,
22 zkey_path: String,
23 ) -> Result<CircomProof> {
24 let wit_thread = witness::generate_witness(wit_fn, inputs);
25 prover::prove(proof_lib, zkey_path.clone(), wit_thread)
26 }
27
28 pub fn verify(
29 proof_lib: ProofLib,
30 proof: Vec<u8>,
31 public_inputs: Vec<u8>,
32 zkey_path: String,
33 ) -> Result<bool> {
34 prover::verify(proof_lib, zkey_path, proof, public_inputs)
35 }
36}