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,
public_hash: &[u8],
) -> Result<bool, Error>
pub fn verify_secret_value( &self, proof: &ZkpProof, public_hash: &[u8], ) -> Result<bool, Error>
Verify a zero-knowledge proof of secret value knowledge
This verifies a proof generated by ZkpProver::prove_secret_value. The
expected hash is the Poseidon commitment (same encoding as used in proving).
For NIST proofs use verify_secret_value_nist.
§Arguments
proof- The proof to verifypublic_hash- The expected Poseidon hash output (bytes encoding used by the prover)
§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