Add BlindSigVerifyGadget R1CS constraints trait

This commit is contained in:
2023-01-04 10:47:48 +01:00
parent 7a5ba6f56a
commit cf682c2d95
2 changed files with 26 additions and 0 deletions

22
src/constraints.rs Normal file
View File

@@ -0,0 +1,22 @@
use ark_r1cs_std::prelude::*;
use ark_relations::r1cs::SynthesisError;
use crate::BlindSignatureScheme;
use ark_ff::PrimeField;
use arkworks_r1cs_gadgets::poseidon::PoseidonGadget;
pub trait BlindSigVerifyGadget<S: BlindSignatureScheme, ConstraintF: PrimeField> {
type ParametersVar: AllocVar<S::Parameters, ConstraintF> + Clone;
type PublicKeyVar: AllocVar<S::PublicKey, ConstraintF> + Clone;
type SignatureVar: AllocVar<S::Signature, ConstraintF> + Clone;
type Msg;
type MsgVar: AllocVar<Self::Msg, ConstraintF> + Clone;
fn verify(
parameters: &Self::ParametersVar,
poseidon_hash: &PoseidonGadget<ConstraintF>,
m: &Self::MsgVar,
s: &Self::SignatureVar,
q: &Self::PublicKeyVar,
) -> Result<Boolean<ConstraintF>, SynthesisError>;
}

View File

@@ -1,5 +1,8 @@
use ark_std::rand::Rng; use ark_std::rand::Rng;
// #[cfg(feature="r1cs")]
pub mod constraints;
pub mod mala_nezhadansari; pub mod mala_nezhadansari;
pub mod schnorr_blind; pub mod schnorr_blind;
@@ -14,6 +17,7 @@ pub trait BlindSignatureScheme {
type PointAffine; type PointAffine;
type SecretKey; type SecretKey;
type PublicKey; type PublicKey;
// type Msg;
type BlindedSignature; type BlindedSignature;
type Signature; type Signature;
type UserSecretData; type UserSecretData;