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