use crate::keys::traits::{PrivateKey, PublicKey};
use digest::HashMarker;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::marker::PhantomData;
#[cfg(feature = "bbsplus")]
use crate::bbsplus::{
ciphersuites::{BbsCiphersuite, Bls12381Sha256, Bls12381Shake256},
keys::{BBSplusPublicKey, BBSplusSecretKey},
};
#[cfg(feature = "cl03")]
use crate::cl03::{
ciphersuites::{CL1024Sha256, CL2048Sha256, CL3072Sha256, CLCiphersuite},
keys::{CL03PublicKey, CL03SecretKey},
};
#[cfg(feature = "bbsplus")]
pub type BbsBls12381Shake256 = BBSplus<Bls12381Shake256>;
#[cfg(feature = "bbsplus")]
pub type BbsBls12381Sha256 = BBSplus<Bls12381Sha256>;
#[cfg(feature = "cl03")]
pub type CL03_CL1024_SHA256 = CL03<CL1024Sha256>;
#[cfg(feature = "cl03")]
pub type CL03_CL2048_SHA256 = CL03<CL2048Sha256>;
#[cfg(feature = "cl03")]
pub type CL03_CL3072_SHA256 = CL03<CL3072Sha256>;
#[cfg(feature = "bbsplus")]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub struct BBSplus<CS: BbsCiphersuite>(PhantomData<CS>);
#[cfg(feature = "cl03")]
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
pub struct CL03<CS: CLCiphersuite>(PhantomData<CS>);
pub trait Ciphersuite: 'static + Eq {
type HashAlg: HashMarker;
}
#[cfg(feature = "bbsplus")]
impl Ciphersuite for Bls12381Sha256 {
type HashAlg = sha2::Sha256;
}
#[cfg(feature = "bbsplus")]
impl Ciphersuite for Bls12381Shake256 {
type HashAlg = sha3::Shake256;
}
pub trait Scheme: Eq + 'static + Sized + Serialize + DeserializeOwned {
type Ciphersuite: Ciphersuite;
type PrivKey: PrivateKey;
type PubKey: PublicKey;
}
#[cfg(feature = "bbsplus")]
impl<CS: BbsCiphersuite> Scheme for BBSplus<CS> {
type Ciphersuite = CS;
type PrivKey = BBSplusSecretKey;
type PubKey = BBSplusPublicKey;
}
#[cfg(feature = "cl03")]
impl<CS: CLCiphersuite> Scheme for CL03<CS> {
type Ciphersuite = CS;
type PrivKey = CL03SecretKey;
type PubKey = CL03PublicKey;
}