Skip to main content

Module sending

Module sending 

Source
Expand description

Message sending — NIP-17 gift-wrapped DMs (text and file attachments).

This is the core send pipeline used by all Vector interfaces (GUI, CLI, SDK). Clients provide a SendCallback for status notifications (pending/sent/failed/progress) and a SendConfig for retry/cancel behavior.

Structs§

NoOpSendCallback
No-op callback for headless/CLI/test use.
SendConfig
Configuration for a send operation.
SendResult
Result of sending a message.
TempFile
Removes a file when dropped: the ciphertext of an upload that ended either way.

Enums§

FileSource
Where an outgoing file’s bytes come from.
Sealed
An outgoing attachment, ready for the upload.

Constants§

NIP59_RANDOM_TIMESTAMP_TWEAK
NIP-59’s gift-wrap backdating window (0 to 2 days).

Traits§

SendCallback
Callbacks invoked during the DM send pipeline.

Functions§

abandon_failed_send
Give up on a failed send for good. Its uploads leave the media servers only once nothing signed can still be read with them: no message was ever built, or its take-back is on a relay. A message that failed here may have landed, or may land yet, and would point at them.
discard_retry_copy
Forget what a failed send of att kept to go again: its sealed copies and its bubble’s source.
failure_line
The first line of a failure, as a row can show it: a list of per-server reasons is summed up by its heading.
keep_for_retry
A failed upload’s ciphertext, kept for its retry: written out when it was sealed in memory.
keep_sent
Mark a pending file message failed (in state, in the UI, on disk) and hand back err. Keep a sent blob in the store: the file moves in, bytes in hand are written there.
note_relay_ok
Feed a relay OK for an outbound event back into the send pipeline.
resend_failed_dm
Manually retry a failed DM by republishing the EXACT retained recipient wrap. Same outer event id → relays no-op the duplicate, so a first send that silently landed can never double-post, regardless of the recipient’s client.
retry_source
What a failed send of att can go again from, best first: the sender’s own file, the bytes this account still holds, or the ciphertext its failed upload kept.
seal_or_reuse
Reuse a live blob of the plaintext hash, or seal plain under key/nonce, reporting each stage against pending_id. A file seals file to file, costing no memory.
send_dm
send_file_dm
Send a NIP-17 gift-wrapped file attachment DM.
send_file_dm_from
send_file_dm_with_meta from either source.
send_file_dm_with_meta
send_file_dm for a caller that already holds the image’s preview metadata, sparing a second full decode before the bubble can appear. None derives it.
send_rumor_dm
Send a pre-built rumor via NIP-17 gift-wrap.
sweep_outgoing
Ciphertext of uploads that never went again, once it’s two weeks old, and plaintext working copies a send left behind, once they’re a day old.
tweaked_timestamp
crate::clock::timestamp() backdated by a random offset inside the NIP-59 window.