verity_dp_zk_host/ic.rs
1use std::error::Error;
2
3use verity_verify_remote::{config::Config, ic::VerificationResponse, ic::Verifier};
4
5/// Asynchronously verifies a proof using the Internet Computer (IC).
6///
7/// # Arguments
8///
9/// * `json_string_proofs` - A vector of JSON strings representing the proofs.
10/// * `notary_pub_key` - The public key of the notary.
11/// * `config` - Configuration details for the IC environment and verifier canister.
12///
13/// # Returns
14///
15/// * `Result<verity_verify_remote::ic::VerificationResponse, Box<dyn Error>>` -
16/// A result containing the verification response or an error.
17pub async fn verify_proof(
18 json_string_proofs: Vec<String>,
19 notary_pub_key: String,
20 config: Config,
21) -> Result<VerificationResponse, Box<dyn Error>> {
22 // Initialize the verifier using the provided configuration
23 let verifier = Verifier::from_config(&config).await.unwrap();
24
25 // Perform the proof verification and obtain the response
26 let response = verifier
27 .verify_proof(json_string_proofs, notary_pub_key)
28 .await;
29
30 // Return the verification response
31 response
32}