Skip to main content

wrap_chat_message

Function wrap_chat_message 

Source
pub async fn wrap_chat_message(
    sender_trade_keys: &Keys,
    shared_pubkey: &PublicKey,
    message: &str,
) -> Result<Event, MostroError>
Expand description

Wrap a plain-text chat message into a Mostro P2P gift wrap (kind 1059).

  • sender_trade_keys — the sender’s per-trade keys; sign the inner kind 1 so the receiver can verify authorship.
  • shared_pubkey — public key of the SharedKey shared by the two chat parties; used as the NIP-44 recipient and as the value of the outer p tag.
  • message — the chat content to deliver.

The outer created_at is randomized within nip59::RANGE_RANDOM_TIMESTAMP_TWEAK to defeat timing correlation.