arnaucube
arnaucube/ark-ec-blind-signaturesPublic Self-hosted repository
ark-ec-blind-signatures/src/lib.rs
src/lib.rsRaw
 1use ark_std::rand::Rng;
 2
 3pub mod mala_nezhadansari;
 4pub mod schnorr_blind;
 5
 6use ark_ff::PrimeField;
 7use arkworks_native_gadgets::poseidon;
 8
 9pub trait BlindSignatureScheme {
10    type Parameters;
11    type Fq;
12    type Fr;
13    type ConstraintF: PrimeField;
14    type PointAffine;
15    type SecretKey;
16    type PublicKey;
17    type BlindedSignature;
18    type Signature;
19    type UserSecretData;
20
21    fn setup(hash: &poseidon::Poseidon<Self::ConstraintF>) -> Self::Parameters;
22
23    fn keygen<R: Rng>(
24        parameters: &Self::Parameters,
25        rng: &mut R,
26    ) -> (Self::PublicKey, Self::SecretKey);
27
28    fn new_request_params<R: Rng>(
29        parameters: &Self::Parameters,
30        rng: &mut R,
31    ) -> (Self::Fr, Self::PointAffine);
32
33    fn blind_sign(sk: Self::SecretKey, r: Self::Fr, m_blinded: Self::Fr) -> Self::BlindedSignature;
34
35    fn unblind(s_blinded: Self::Fr, u: &Self::UserSecretData) -> Self::Signature;
36
37    fn non_blind_sign<R: Rng>(
38        parameters: &Self::Parameters,
39        rng: &mut R,
40        sk: Self::SecretKey,
41        m: &[Self::ConstraintF],
42    ) -> Result<Self::Signature, ark_crypto_primitives::Error>;
43
44    fn blind<R: Rng>(
45        parameters: &Self::Parameters,
46        rng: &mut R,
47        m: &[Self::ConstraintF],
48        signer_pk: Self::PublicKey,
49        signer_r: Self::PointAffine,
50    ) -> Result<(Self::Fr, Self::UserSecretData), ark_crypto_primitives::Error>;
51
52    fn verify(
53        parameters: &Self::Parameters,
54        m: &[Self::ConstraintF],
55        s: Self::Signature,
56        q: Self::PublicKey,
57    ) -> bool;
58}