nips/09.md

79 lines
3.7 KiB
Markdown
Raw Normal View History

2022-05-01 06:48:57 -04:00
NIP-09
======
Event Deletion Request
----------------------
2022-05-01 06:48:57 -04:00
2023-11-15 19:42:51 -05:00
`draft` `optional`
2022-05-01 06:48:57 -04:00
A special event with kind `5`, meaning "deletion request" is defined as having a list of one or more `e` or `a` tags, each referencing an event the author is requesting to be deleted. Deletion requests SHOULD include a `k` tag for the kind of each event being requested for deletion.
2022-05-01 06:48:57 -04:00
The event's `content` field MAY contain a text note describing the reason for the deletion request.
2022-05-01 06:48:57 -04:00
For example:
2024-09-03 13:11:31 -04:00
```jsonc
2022-05-01 06:48:57 -04:00
{
"kind": 5,
"pubkey": <32-bytes hex-encoded public key of the event creator>,
"tags": [
["e", "dcd59..464a2"],
["e", "968c5..ad7a4"],
2024-07-29 10:38:29 -04:00
["a", "<kind>:<pubkey>:<d-identifier>"],
["k", "1"],
["k", "30023"]
2022-05-01 06:48:57 -04:00
],
"content": "these posts were published by accident",
2024-09-03 13:11:31 -04:00
// other fields...
2022-05-01 06:48:57 -04:00
}
```
Relays SHOULD delete or stop publishing any referenced events that have an identical `pubkey` as the deletion request. Clients SHOULD hide or otherwise indicate a deletion request status for referenced events.
Relays SHOULD continue to publish/share the deletion request events indefinitely, as clients may already have the event that's intended to be deleted. Additionally, clients SHOULD broadcast deletion request events to other relays which don't have it.
2022-05-01 06:48:57 -04:00
When an `a` tag is used, relays SHOULD delete all versions of the replaceable event up to the `created_at` timestamp of the deletion request event.
2024-06-07 13:37:29 -04:00
2024-09-21 04:55:34 -04:00
## Filter Deletation
A client MAY use `f` tag to provide a filter, relays and clients SHOULD consider deletation of all events matching to this specific filter from this client up to `kind 5` created at.
For example:
```jsonc
{
"kind": 5,
"pubkey": <32-bytes hex-encoded public key of the event creator>,
"tags": [
["f", "{\"kinds\":[1,7]}"]
],
"content": "no more text note and reactions.",
// other fields...
}
```
The above event requests the deletation of all text notes and reactions from a user.
2024-09-21 04:57:36 -04:00
A kind 5 MUST NOT contain a `f` tag beside other tags, or multiple `f` tags in one event.
2024-09-21 04:55:34 -04:00
### Usages
User can make complex bulk deletation requests with consuming small space and this bring possiblited to remove ***all posts***, ***direct messages*** or ***delete account***.
2022-05-01 06:48:57 -04:00
## Client Usage
Clients MAY choose to fully hide any events that are referenced by valid deletion request events. This includes text notes, direct messages, or other yet-to-be defined event kinds. Alternatively, they MAY show the event along with an icon or other indication that the author has "disowned" the event. The `content` field MAY also be used to replace the deleted events' own content, although a user interface should clearly indicate that this is a deletion request reason, not the original content.
2022-05-01 06:48:57 -04:00
A client MUST validate that each event `pubkey` referenced in the `e` tag of the deletion request is identical to the deletion request `pubkey`, before hiding or deleting any event. Relays can not, in general, perform this validation and should not be treated as authoritative.
2022-05-01 06:48:57 -04:00
Clients display the deletion request event itself in any way they choose, e.g., not at all, or with a prominent notice.
Clients MAY choose to inform the user that their request for deletion does not guarantee deletion because it is impossible to delete events from all relays and clients.
2022-05-01 06:48:57 -04:00
## Relay Usage
Relays MAY validate that a deletion request event only references events that have the same `pubkey` as the deletion request itself, however this is not required since relays may not have knowledge of all referenced events.
2022-05-01 06:48:57 -04:00
## Deletion Request of a Deletion Request
2022-05-01 06:48:57 -04:00
Publishing a deletion request event against a deletion request has no effect. Clients and relays are not obliged to support "unrequest deletion" functionality.