pub struct ZkpVerifier {}Expand description
Verifier for verifying zero-knowledge proofs
Implementations§
Source§impl ZkpVerifier
impl ZkpVerifier
Sourcepub fn new() -> ZkpVerifier
pub fn new() -> ZkpVerifier
Create a new ZKP verifier
Sourcepub fn verify_secret_value(
&self,
proof: &ZkpProof,
preimage: &[u8],
) -> Result<bool, Error>
pub fn verify_secret_value( &self, proof: &ZkpProof, preimage: &[u8], ) -> Result<bool, Error>
Verify a zero-knowledge proof of secret value (preimage) knowledge
This verifies a proof generated by ZkpProver::prove_secret_value. The verifier
recomputes the public Poseidon commitment from the preimage, so the caller passes
the same secret preimage that was given to the prover (NOT the hash output). The proof
then attests that the prover knew a preimage hashing to that commitment.
For NIST proofs use verify_secret_value_nist.
§Arguments
proof- The proof to verifypreimage- The secret preimage (same bytes passed toprove_secret_value); the verifier hashes it with Poseidon-128 to reconstruct the public commitment
§Returns
Ok(true) if the proof is valid, Ok(false) or Err otherwise
Sourcepub fn verify_secret_value_nist(
&self,
proof: &ZkpProof,
expected_hash: &[u8],
) -> Result<bool, Error>
pub fn verify_secret_value_nist( &self, proof: &ZkpProof, expected_hash: &[u8], ) -> Result<bool, Error>
Verify a NIST (cSHAKE256) secret value proof
Verifies a proof from prove_secret_value_nist.
expected_hash is the raw 32-byte cSHAKE256 output (same as used in proving).
Sourcepub fn verify_computation(
&self,
proof: &ZkpProof,
circuit: &ArithmeticCircuit<BinomialExtensionField<Mersenne31, 2>>,
public: &[BinomialExtensionField<Mersenne31, 2>],
) -> Result<bool, Error>
pub fn verify_computation( &self, proof: &ZkpProof, circuit: &ArithmeticCircuit<BinomialExtensionField<Mersenne31, 2>>, public: &[BinomialExtensionField<Mersenne31, 2>], ) -> Result<bool, Error>
Sourcepub fn verify(
&self,
proof: ZkpProof,
public_statement: &[u8],
) -> Result<bool, Error>
pub fn verify( &self, proof: ZkpProof, public_statement: &[u8], ) -> Result<bool, Error>
Verify a zero-knowledge proof.
Performs full cryptographic (STARK) verification for proof types whose public inputs are fully described by a byte slice:
ProofMetadata::HashPreimage:public_statementis the expected hash output (same semantics asverify_secret_value).ProofMetadata::HashPreimageNist:public_statementis the expected cSHAKE256 hash output (same semantics asverify_secret_value_nist).ProofMetadata::MerkleInclusion:public_statementis the expected Merkle root hash (same semantics asapi::verify_membership).
Returns Ok(false) for Circuit, Credential, Identity, and None
metadata variants. Those proof types require a type-specific verifier that accepts
the additional inputs needed to reconstruct verification state.
batch_verify delegates to this method, so the same rules apply in bulk.
Trait Implementations§
Source§impl Default for ZkpVerifier
impl Default for ZkpVerifier
Source§fn default() -> ZkpVerifier
fn default() -> ZkpVerifier
Auto Trait Implementations§
impl Freeze for ZkpVerifier
impl RefUnwindSafe for ZkpVerifier
impl Send for ZkpVerifier
impl Sync for ZkpVerifier
impl Unpin for ZkpVerifier
impl UnsafeUnpin for ZkpVerifier
impl UnwindSafe for ZkpVerifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more