use core::{
fmt::Debug,
ops::{Add, Div, Mul, Sub},
};
use zeroize::{Zeroize, ZeroizeOnDrop};
use crate::{reexport::rand_core::CryptoRngCore, KeyTrait};
pub mod curve25519;
pub trait DhKeyPair<const PUBLIC_KEY_LENGTH: usize, const PRIVATE_KEY_LENGTH: usize>:
Debug + PartialEq + Eq + Send + Sync + Sized + Clone + Zeroize + ZeroizeOnDrop
where
Self::PublicKey: From<Self::PrivateKey>,
for<'a, 'b> &'a Self::PublicKey: Add<&'b Self::PublicKey, Output = Self::PublicKey>
+ Mul<&'b Self::PrivateKey, Output = Self::PublicKey>,
for<'a, 'b> &'a Self::PrivateKey: Add<&'b Self::PrivateKey, Output = Self::PrivateKey>
+ Sub<&'b Self::PrivateKey, Output = Self::PrivateKey>
+ Mul<&'b Self::PrivateKey, Output = Self::PrivateKey>
+ Div<&'b Self::PrivateKey, Output = Self::PrivateKey>,
{
const PUBLIC_KEY_LENGTH: usize = PUBLIC_KEY_LENGTH;
const PRIVATE_KEY_LENGTH: usize = PRIVATE_KEY_LENGTH;
type PublicKey: KeyTrait<PUBLIC_KEY_LENGTH>;
type PrivateKey: KeyTrait<PRIVATE_KEY_LENGTH>;
#[must_use]
fn new<R: CryptoRngCore>(rng: &mut R) -> Self;
fn public_key(&self) -> &Self::PublicKey;
fn private_key(&self) -> &Self::PrivateKey;
}