use crate::error::IntoErrorSource;
pub trait Curve {
const HMAC_KEY: &'static [u8];
type PublicKey: CurvePublicKey;
type PrivateKey: CurvePrivateKey<PublicKey = Self::PublicKey>;
}
pub trait CurvePublicKey: Clone {
type Error: IntoErrorSource + Send + Sync + 'static;
type Bytes: AsRef<[u8]> + Clone;
fn from_bytes(bytes: &Self::Bytes) -> Result<Self, Self::Error>;
fn to_bytes(&self) -> Self::Bytes;
}
pub trait CurvePrivateKey: Clone {
type Error: IntoErrorSource + Send + Sync + 'static;
type PublicKey: CurvePublicKey<Error = Self::Error>;
type Bytes: AsRef<[u8]> + Clone;
fn from_bytes(bytes: &Self::Bytes) -> Result<Self, Self::Error>;
fn to_bytes(&self) -> Self::Bytes;
fn to_public(&self) -> Self::PublicKey;
fn zeroize(&mut self) {}
}
pub trait TweakableKey: Sized {
type Error: IntoErrorSource + Send + Sync + 'static;
fn add_tweak(&self, tweak: &[u8; 32]) -> Result<Self, Self::Error>;
}
pub trait Bip32Curve: Curve {}
mod error;
#[cfg(feature = "slip10")]
mod slip10;
pub use self::error::CurveError;
#[cfg(feature = "slip10")]
pub use self::slip10::*;
#[cfg(feature = "slip10")]
pub mod ed25519;
#[cfg(feature = "slip10")]
pub mod nist256p1;
pub mod secp256k1;