use crate::nips::nip17::{self, Message}; use anyhow::Result; use nostr_sdk::prelude::*; /// Sends a private message. /// The SDK will automatically handle the NIP-17 (modern) or NIP-04 (legacy) logic. pub async fn send_private_message( client: &Client, receiver_pubkey: &str, message: &str, ) -> Result { let receiver = PublicKey::parse(receiver_pubkey)?; nip17::send_dm(client, receiver, message).await } /// Fetches all private messages between the user and a specific contact. pub async fn get_private_messages(client: &Client, contact_npub: &str) -> Result> { nip17::get_dm_messages(client, contact_npub).await }