#[macro_export]
macro_rules! delegate_secp256k1_ctors {
() => {
pub fn from_bytes(bytes: &[u8; 32]) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Secp256k1Signer::from_bytes(bytes)?))
}
pub fn from_hex(hex_str: &str) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Secp256k1Signer::from_hex(hex_str)?))
}
#[cfg(feature = "getrandom")]
pub fn try_random() -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Secp256k1Signer::try_random()?))
}
#[cfg(feature = "getrandom")]
#[must_use]
pub fn random() -> Self {
Self($crate::Secp256k1Signer::random())
}
};
}
#[macro_export]
macro_rules! delegate_ed25519_ctors {
() => {
pub fn from_bytes(bytes: &[u8; 32]) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Ed25519Signer::from_bytes(bytes)?))
}
pub fn from_hex(hex_str: &str) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Ed25519Signer::from_hex(hex_str)?))
}
#[cfg(feature = "getrandom")]
pub fn try_random() -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::Ed25519Signer::try_random()?))
}
#[cfg(feature = "getrandom")]
#[must_use]
pub fn random() -> Self {
Self($crate::Ed25519Signer::random())
}
};
}
#[macro_export]
macro_rules! delegate_schnorr_ctors {
() => {
pub fn from_bytes(bytes: &[u8; 32]) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::SchnorrSigner::from_bytes(bytes)?))
}
pub fn from_hex(hex_str: &str) -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::SchnorrSigner::from_hex(hex_str)?))
}
#[cfg(feature = "getrandom")]
pub fn try_random() -> ::core::result::Result<Self, $crate::SignError> {
Ok(Self($crate::SchnorrSigner::try_random()?))
}
#[cfg(feature = "getrandom")]
#[must_use]
pub fn random() -> Self {
Self($crate::SchnorrSigner::random())
}
};
}