pub struct ZeroKnowledgeProof { /* private fields */ }Expand description
Encoded World ID Proof.
Internally, the first 4 elements are a compressed Groth16 proof
[a (G1), b (G2), b (G2), c (G1)]. Proofs also require the root hash of the Merkle tree
in the WorldIDRegistry as a public input. To simplify transmission, that root is encoded as the last element
with the proof.
The WorldIDVerifier.sol contract handles the decoding and verification.
Implementations§
Source§impl ZeroKnowledgeProof
impl ZeroKnowledgeProof
Sourcepub fn from_groth16_proof(
groth16_proof: &Proof<Bn254>,
merkle_root: FieldElement,
) -> Self
pub fn from_groth16_proof( groth16_proof: &Proof<Bn254>, merkle_root: FieldElement, ) -> Self
Initialize a new proof from a Groth16 proof and Merkle root.
Sourcepub const fn as_ethereum_representation(&self) -> [U256; 5]
pub const fn as_ethereum_representation(&self) -> [U256; 5]
Outputs the proof as a Solidity-friendly representation.
Sourcepub const fn from_ethereum_representation(value: [U256; 5]) -> Self
pub const fn from_ethereum_representation(value: [U256; 5]) -> Self
Initializes a proof from an encoded Solidity-friendly representation.
Sourcepub fn to_compressed_bytes(&self) -> Vec<u8> ⓘ
pub fn to_compressed_bytes(&self) -> Vec<u8> ⓘ
Converts the proof to compressed bytes (160 bytes total: 5 × 32 bytes).
Trait Implementations§
Source§impl Clone for ZeroKnowledgeProof
impl Clone for ZeroKnowledgeProof
Source§fn clone(&self) -> ZeroKnowledgeProof
fn clone(&self) -> ZeroKnowledgeProof
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ZeroKnowledgeProof
impl Debug for ZeroKnowledgeProof
Source§impl Default for ZeroKnowledgeProof
impl Default for ZeroKnowledgeProof
Source§fn default() -> ZeroKnowledgeProof
fn default() -> ZeroKnowledgeProof
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ZeroKnowledgeProof
impl<'de> Deserialize<'de> for ZeroKnowledgeProof
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ZeroKnowledgeProof> for [U256; 5]
impl From<ZeroKnowledgeProof> for [U256; 5]
Source§fn from(value: ZeroKnowledgeProof) -> Self
fn from(value: ZeroKnowledgeProof) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ZeroKnowledgeProof
impl PartialEq for ZeroKnowledgeProof
Source§impl Serialize for ZeroKnowledgeProof
impl Serialize for ZeroKnowledgeProof
impl Eq for ZeroKnowledgeProof
impl StructuralPartialEq for ZeroKnowledgeProof
Auto Trait Implementations§
impl Freeze for ZeroKnowledgeProof
impl RefUnwindSafe for ZeroKnowledgeProof
impl Send for ZeroKnowledgeProof
impl Sync for ZeroKnowledgeProof
impl Unpin for ZeroKnowledgeProof
impl UnsafeUnpin for ZeroKnowledgeProof
impl UnwindSafe for ZeroKnowledgeProof
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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