use alloc::boxed::Box;
use alloc::string::String;
use core::any::Any;
use core::fmt::Debug;
use core::future::Future;
use core::pin::Pin;
use crate::key::PublicKey;
pub trait Nip04: Any + Debug + Send + Sync {
type Error: core::error::Error;
fn nip04_encrypt(&self, public_key: &PublicKey, content: &str) -> Result<String, Self::Error>;
fn nip04_decrypt(
&self,
public_key: &PublicKey,
encrypted_content: &str,
) -> Result<String, Self::Error>;
}
pub trait AsyncNip04: Any + Debug + Send + Sync {
type Error: core::error::Error;
fn nip04_encrypt_async<'a>(
&'a self,
public_key: &'a PublicKey,
content: &'a str,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'a>>;
fn nip04_decrypt_async<'a>(
&'a self,
public_key: &'a PublicKey,
encrypted_content: &'a str,
) -> Pin<Box<dyn Future<Output = Result<String, Self::Error>> + Send + 'a>>;
}