#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::{string::String, vec::Vec};
#[cfg(feature = "std")]
use std::{string::String, vec::Vec};
pub trait Signature: AsRef<[u8]> {}
impl Signature for Vec<u8> {}
impl Signature for &[u8] {}
impl Signature for String {}
impl Signature for &str {}
pub trait Signer {
type Signature: Signature;
type Error;
fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>;
}
impl<T> Signer for &T
where
T: Signer,
{
type Signature = T::Signature;
type Error = T::Error;
fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error> {
T::sign(self, bytes)
}
}
#[cfg(feature = "p256")]
#[cfg_attr(docsrs, doc(cfg(feature = "p256")))]
pub mod p256;
#[cfg(feature = "ring")]
#[cfg_attr(docsrs, doc(cfg(feature = "ring")))]
pub mod ring;
#[cfg(feature = "rsa")]
#[cfg_attr(docsrs, doc(cfg(feature = "rsa")))]
pub mod rsa;