Expand description
Message deletion: Vector’s “delete from network” for DMs.
A NIP-17 DM travels as kind-1059 gift wraps, each signed by a single-use key and p-tagged
to the one person who can open it. A relay honours a deletion of a wrap only from that
p-tagged owner (NIP-59; CORD-01 §Deletions). A Concord plane shares one wrap key among all
its members, so a deletion signed by a wrap’s author would let any of them wipe the plane:
Vector’s relay refuses those, as every relay serving Concord should. A relay also refuses a
vanish request (NIP-62) from a key that has written wraps, for the same reason.
So each side deletes the copies addressed to itself:
- The sender deletes its own self-copies with its own key, at once.
- Either side deletes a message it received the same way: its copy by its own key, and a hide request to itself for its other devices.
- A hide request (a kind-5 rumor gift-wrapped to the recipient and to self, its wrap expiring after 30 days) asks every other device to drop the message and delete the copy it was sent the same way. A client that ignores it keeps the message.
- A device that later meets any other wrap of a deleted message deletes that one too, and one whose hide request came before the message holds it until the message arrives.
Every wrap whose single-use key we kept (db::nip17_keys) also gets an author-signed
deletion, best-effort: a relay still honouring those drops the recipient’s copy even when
their client never will, and our own on a relay that ignores the owner. On a relay that
follows the spec it changes nothing.
Structs§
- Delete
Outcome - Outcome of a delete-own-* operation.
Functions§
- delete_
cached_ attachment_ files_ pub - Best-effort delete of every cached attachment file for a message.
Only unlinks files that canonicalize to a path under Vector’s
managed download directory — files the user has moved or copied
elsewhere are never touched. Symlink and
..escape attempts are rejected by the canonicalize check. - delete_
own_ dm - Delete an outbound DM from the network: our own copies of it with our key, the hide request for the recipient’s, its attachments from Blossom. Every relay round trip runs in the background; the call returns once the local state is gone.
- delete_
own_ reaction - Revoke one of OUR OWN DM reactions, as
delete_own_dmdeletes a message: our copies with our key, a hide request (k=7) so the counterpart’s clients drop the chip and delete theirs.recipientis the DM counterpart, for when no recipient-role wrap key is retained. - delete_
received_ dm - Delete a DM someone sent us. Its gift wrap is addressed to us, so our key deletes our copy from relays (NIP-59), and a hide request to ourselves takes it off our other devices. The sender’s copies are theirs to delete.
- filter_
unreferenced_ attachments - Filter
attachmentsdown to those NOT referenced by any OTHER undeleted message in STATE. - scrub_
safe_ urls - Of these attachments’ remote urls, the ones no OTHER event still references — the only ones a delete may scrub from Blossom. One blob backs many messages under smart-forward, and the shared copy must outlive every send but the last. A ledger read failure scrubs nothing, same reasoning as above.
- take_
back_ failed_ dm - Take back a DM whose send was given up on: a wrap that no relay confirmed may still have landed. Its copies leave the relays by the keys kept for them and the recipient is asked to hide it. Returns whether that request went out, which is what lets its files go.