MCPcopy Create free account
hub / github.com/docknetwork/crypto / verify

Method verify

syra/src/vrf.rs:55–82  ·  view source on GitHub ↗
(
        &self,
        message: E::ScalarField,
        output: &Output<E>,
        public_key: impl Into<&'a E::G2Affine>,
        params: impl Into<PreparedSetupParams<E>>,
    )

Source from the content-addressed store, hash-verified

53
54impl<E: Pairing> Proof<E> {
55 pub fn verify<'a>(
56 &self,
57 message: E::ScalarField,
58 output: &Output<E>,
59 public_key: impl Into<&'a E::G2Affine>,
60 params: impl Into<PreparedSetupParams<E>>,
61 ) -> Result<(), SyraError> {
62 let params = params.into();
63 let prep_0 = E::G1Prepared::from(self.0);
64 let prep_1 = E::G2Prepared::from(self.1);
65 if E::pairing(prep_0.clone(), (params.g_hat * message) + public_key.into())
66 != params.pairing
67 {
68 return Err(SyraError::InvalidProof);
69 }
70 if E::pairing(prep_0.clone(), params.g_hat) != output.0 {
71 return Err(SyraError::InvalidProof);
72 }
73 if !E::multi_pairing(
74 [E::G1Prepared::from(params.g), prep_0],
75 [prep_1, params.g_hat.into_group().neg().into().into()],
76 )
77 .is_zero()
78 {
79 return Err(SyraError::InvalidProof);
80 }
81 Ok(())
82 }
83}
84
85#[cfg(test)]

Callers 9

sig_setupFunction · 0.45
checkFunction · 0.45
verify_aggregate_proofFunction · 0.45
output_verifyFunction · 0.45
issue_with_known_user_idFunction · 0.45
new_verifiableMethod · 0.45

Calls 2

cloneMethod · 0.80
is_zeroMethod · 0.80

Tested by 5

sig_setupFunction · 0.36
checkFunction · 0.36
output_verifyFunction · 0.36
issue_with_known_user_idFunction · 0.36