From 3eb2df2a21615c5005a1482926f66026e03abca5 Mon Sep 17 00:00:00 2001 From: Joy Wang <108701016+joyqvq@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:26:40 -0400 Subject: [PATCH] fix: use schemars for string --- fastcrypto-zkp/src/zk_login_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastcrypto-zkp/src/zk_login_utils.rs b/fastcrypto-zkp/src/zk_login_utils.rs index 75e0918e5b..6010b86421 100644 --- a/fastcrypto-zkp/src/zk_login_utils.rs +++ b/fastcrypto-zkp/src/zk_login_utils.rs @@ -19,7 +19,7 @@ pub type CircomG2 = Vec>; /// 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; @@ -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.