Skip to main content

Module send

Module send 

Source
Expand description

Sending and fetching Community channel messages over a Transport.

publish_message seals a message (envelope) and publishes the outer event to the Community’s relays. fetch_channel_messages queries the channel’s current epoch pseudonym, then decrypts + verifies each event, silently dropping any that fail (wrong key, splice, bad signature) — a non-member, or a spliced event, never surfaces. Both are transport-agnostic so they run identically against the live client and the in-memory test relay.

Functions§

delete_own_message
Delete a message the sender previously published, via its retained ephemeral key (NIP-09 — the deletion must be signed by the same key that signed the event, so only the original sender can delete their own message).
fetch_channel_events
Raw fetch of every append-plane event — messages (3300), reactions (3301), edits (3302) — for a channel’s CURRENT-epoch pseudonym. Backfill/cold-start primitive (“recent on open”): unlike fetch_channel_messages this returns the un-opened outer events of all sub-kinds so the caller can run them through inbound::process_channel_batch, which opens, verifies, dedups (inner id), and applies reactions/edits to their target messages.
fetch_channel_messages
Fetch + open all messages across the channel’s held epochs. Events that fail to open (wrong key, splice, forged signature) are dropped, not surfaced.
fetch_channel_page
Fetch one PAGE of a channel’s append-plane events (3300/3301/3302) for its current-epoch pseudonym, newest-first, capped at limit. until (seconds, inclusive) pages OLDER history — pass the oldest-known message’s created_at to step back a page; pass None for the latest page. The Discord-style sync primitive: latest-page on open/join/boot, older-page when local DB history is exhausted on scroll-up. Returns raw outer events for inbound::process_channel_batch.
publish_message
Seal content and publish it to the Community’s relays.
publish_signed_message
Publish a message whose inner authorship event was already signed externally (via the active NostrSigner — local keys OR a NIP-46 bunker). Mirrors publish_message but is signer-agnostic, so bunker accounts can post (parity with DMs). Returns the published outer event + its retained ephemeral key. durable: control/moderation events (a hide, a presence-join that must reliably land so the sender stays in the observed recipient set) broadcast durably (per-relay retry); ordinary chat messages pass false for the latency-sensitive single-attempt path.