pub struct Verifier { /* private fields */ }Expand description
Groth16 proof verifier
Create once with a verification key, then verify multiple proofs.
§Example
ⓘ
use signedby_sdk::{Verifier, VerificationKey};
let vk = VerificationKey::from_json(vk_json)?;
let verifier = Verifier::new(vk);
let result = verifier.verify(&proof, &public_inputs)?;
assert!(result.valid);Implementations§
Source§impl Verifier
impl Verifier
Sourcepub fn new(vk: VerificationKey) -> Self
pub fn new(vk: VerificationKey) -> Self
Create a new verifier with the given verification key
Sourcepub fn verify(
&self,
proof: &Groth16Proof,
public_inputs: &PublicInputs,
) -> Result<VerificationResult, SdkError>
pub fn verify( &self, proof: &Groth16Proof, public_inputs: &PublicInputs, ) -> Result<VerificationResult, SdkError>
Verify a Groth16 proof
Returns a VerificationResult with:
valid: whether the proof is cryptographically validnpub: the user’s pseudonymous identifier (NOSTR public key)merkle_root: the group membership tree they proved membership insession_binding: prevents proof replay across sessions
Sourcepub fn verify_json(
&self,
proof_json: &str,
public_inputs_json: &str,
) -> Result<VerificationResult, SdkError>
pub fn verify_json( &self, proof_json: &str, public_inputs_json: &str, ) -> Result<VerificationResult, SdkError>
Verify proof from JSON strings (convenience method)
Auto Trait Implementations§
impl Freeze for Verifier
impl RefUnwindSafe for Verifier
impl Send for Verifier
impl Sync for Verifier
impl Unpin for Verifier
impl UnsafeUnpin for Verifier
impl UnwindSafe for Verifier
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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