#[macro_export]
macro_rules! with_ciphersuite {
    ($curve:expr, |$alias:ident| $body:block) => {
        match $curve {
            NetworkCurve::Secp256k1 => {
                use k256::elliptic_curve::sec1::ToEncodedPoint;
                use frost_secp256k1 as $alias;

                #[allow(unused_imports)]
                use frost_secp256k1::Secp256K1Sha256 as Ciphersuite;

                #[allow(dead_code)]
                fn decomporess_key(
                    verifying_key: $alias::VerifyingKey,
                ) -> Result<Vec<u8>, ExodusError> {
                    let element = verifying_key.to_element();

                    if element == k256::ProjectivePoint::IDENTITY {
                        return Err(ExodusError::InvalidIdentityElement);
                    }

                    let mut fixed_serialized = [0; 65];
                    let serialized_point = element.to_affine().to_encoded_point(false);
                    let serialized = serialized_point.as_bytes();
                    fixed_serialized.copy_from_slice(serialized);

                    Ok(fixed_serialized.to_vec())
                }

                $body
            },
            NetworkCurve::Ed25519 => {
                use frost_ed25519 as $alias;

                #[allow(unused_imports)]
                use frost_ed25519::Ed25519Sha512 as Ciphersuite;

                #[allow(dead_code)]
                fn decomporess_key(
                    verifying_key: $alias::VerifyingKey,
                ) -> Result<Vec<u8>, ExodusError> {
                    verifying_key.serialize().map_err(|err| match err {
                        f::Error::SerializationError => ExodusError::SerializationError,
                        _ => ExodusError::Unknown,
                    })
                }

                $body
            },
        }
    }
}

#[macro_use]
mod converter;

#[macro_use]
mod merkle;

#[macro_use]
mod dkg;

#[macro_use]
mod ecdh;

#[macro_use]
mod frost;
