Skip to content

Commit

Permalink
fix: use schemars for string (#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqvq authored Mar 27, 2024
1 parent 8a3d154 commit 52d00a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastcrypto-zkp/src/zk_login_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub type CircomG2 = Vec<Vec<Bn254FqElement>>;

/// A struct that stores a Bn254 Fq field element as 32 bytes.
#[derive(Debug, Clone, JsonSchema, Eq, PartialEq)]
pub struct Bn254FqElement([u8; 32]);
pub struct Bn254FqElement(#[schemars(with = "String")] [u8; 32]);

impl std::str::FromStr for Bn254FqElement {
type Err = FastCryptoError;
Expand Down Expand Up @@ -64,7 +64,7 @@ impl<'de> Deserialize<'de> for Bn254FqElement {

/// A struct that stores a Bn254 Fr field element as 32 bytes.
#[derive(Debug, Clone, JsonSchema, Eq, PartialEq)]
pub struct Bn254FrElement([u8; 32]);
pub struct Bn254FrElement(#[schemars(with = "String")] [u8; 32]);

impl Bn254FrElement {
/// Returns the unpadded version of the field element. This returns with leading zeros removed.
Expand Down

0 comments on commit 52d00a5

Please sign in to comment.