upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/37.md
diff options
context:
space:
mode:
Diffstat (limited to '37.md')
-rw-r--r--37.md39
1 files changed, 23 insertions, 16 deletions
diff --git a/37.md b/37.md
index 1ade59d..ca0fdfb 100644
--- a/37.md
+++ b/37.md
@@ -1,50 +1,57 @@
1NIP-37 1NIP-37
2====== 2======
3 3
4Draft Events 4Draft Wraps
5------------ 5-----------
6 6
7`draft` `optional` 7`draft` `optional`
8 8
9This NIP defines kind `31234` as a private wrap for drafts of any other event kind. 9This NIP defines kind `31234` as an encrypted storage for unsigned draft events of any other kind.
10 10
11The draft event is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content` of the event. 11The draft is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content`.
12 12
13An additional `k` tag identifies the kind of the draft event. 13`k` tags identify the kind of the draft.
14 14
15```js 15```js
16{ 16{
17 "kind": 31234, 17 "kind": 31234,
18 "tags": [ 18 "tags": [
19 ["d", "<identifier>"], 19 ["d", "<identifier>"],
20 ["k", "<kind of the draft event>"], 20 ["k", "<kind of the draft event>"], // required
21 ["e", "<anchor event event id>", "<relay-url>"], 21 ["expiration", "now + 90 days"] // recommended
22 ["a", "<anchor event address>", "<relay-url>"],
23 ], 22 ],
24 "content": nip44Encrypt(JSON.stringify(draft_event)), 23 "content": nip44Encrypt(JSON.stringify(draft_event)),
25 // other fields 24 // other fields
26} 25}
27``` 26```
28 27
29A blanked `.content` means this draft has been deleted by a client but relays still have the event. 28A blanked `.content` field signals that the draft has been deleted.
30 29
31Tags `e` and `a` identify one or more anchor events, such as parent events on replies. 30[NIP-40](40.md) `expiration` tags are recommended.
31
32Clients SHOULD publish kind `31234` events to relays listed on kind `10013` below.
32 33
33## Relay List for Private Content 34## Relay List for Private Content
34 35
35Kind `10013` indicates the user's preferred relays to store private events like Drafts. The event MUST include a list of `relay` URLs in private tags. Private tags are JSON Stringified, NIP-44-encrypted to the signer's keys and placed inside the .content of the event. 36Kind `10013` indicates the user's preferred relays to store private events like Draft Wraps.
37
38The event MUST include a list of `relay` URLs in private tags. Private tags are JSON Stringified, [NIP44-encrypted](44.md) to the signer's keys and placed inside the .content of the event.
36 39
37```js 40```js
38{ 41{
39 "kind": 10013, 42 "kind": 10013,
40 "tags": [], 43 "tags": [],
41 "content": nip44Encrypt(JSON.stringify([ 44 "content": nip44Encrypt(
42 ["relay", "wss://myrelay.mydomain.com"] 45 JSON.stringify(
43 ])) 46 [
47 ["relay", "wss://myrelay.mydomain.com"]
48 ]
49 )
50 )
44 //...other fields 51 //...other fields
45} 52}
46``` 53```
47 54
48Relays listed in this event SHOULD be authed and only allow downloads to events signed by the authed user. 55It's recommended that Private Storage relays SHOULD be [NIP-42](42.md)-authed and only allow downloads of events signed by the authed user.
49 56
50Clients SHOULD publish kind `10013` events to the author's [NIP-65](65.md) `write` relays. 57Clients MUST publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.