use alloc::vec::Vec;
use secrecy::SecretSlice;
use crate::crypto::Result;
pub(crate) trait PublicKey: Sized + Clone {
fn new(alg: CurveAlgorithm, x: Vec<u8>) -> Result<Self>;
fn to_bytes(&self) -> Vec<u8>;
fn verify(&mut self, msg: &[u8], signature: &[u8]) -> Result<bool>;
}
pub(crate) trait PrivateKey: Sized + Clone {
type Signature: Into<Vec<u8>> + AsRef<[u8]>;
type PublicKey: PublicKey;
fn generate(alg: CurveAlgorithm) -> Result<Self>;
fn new(alg: CurveAlgorithm, x: Vec<u8>, d: SecretSlice<u8>) -> Result<Self>;
fn to_public_key(&self) -> Self::PublicKey;
fn to_bytes(&self) -> SecretSlice<u8>;
fn sign(&mut self, data: &[u8]) -> Result<Self::Signature>;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum CurveAlgorithm {
Ed25519,
Ed448,
}