-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add validations and improve as_arkworks #663
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,6 +341,9 @@ impl ZkLoginInputs { | |
|
||
/// Initialize JWTDetails by parsing header_base64 and iss_base64_details. | ||
pub fn init(&mut self) -> Result<Self, FastCryptoError> { | ||
if BigUint::from_str(&self.address_seed).is_err() { | ||
return Err(FastCryptoError::InvalidInput); | ||
} | ||
self.jwt_details = JWTDetails::new(&self.header_base64, &self.iss_base64_details)?; | ||
Ok(self.to_owned()) | ||
} | ||
|
@@ -420,9 +423,9 @@ impl ZkLoginProof { | |
/// Convert the Circom G1/G2/GT to arkworks G1/G2/GT | ||
pub fn as_arkworks(&self) -> Result<Proof<Bn254>, FastCryptoError> { | ||
Ok(Proof { | ||
a: g1_affine_from_str_projective(self.a.clone())?, | ||
b: g2_affine_from_str_projective(self.b.clone())?, | ||
c: g1_affine_from_str_projective(self.c.clone())?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. possibly why this takes too much time in flamegraph 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean the clone? The flamegraph shows that it's the subgroup check called by the I don't think we can omit the subgroup check, but it's possible to batch subgroup checks by doing the check on a random linear combination of elements. |
||
a: g1_affine_from_str_projective(&self.a)?, | ||
b: g2_affine_from_str_projective(&self.b)?, | ||
c: g1_affine_from_str_projective(&self.c)?, | ||
}) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the proof points are validated somewhere else already