upleb.uk

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

summaryrefslogtreecommitdiff
path: root/37.md
blob: 9ef728b01b26f9344325e09f1d338f69f162d7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
NIP-37
======

Draft Events 
------------

`draft` `optional`

This NIP defines kind `31234` as a private wrap for drafts of any other event kind. 

The draft event is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content` of the event.

An additional `k` tag identifies the kind of the draft event. 

```js
{
  "kind": 31234,
  "tags": [
    ["d", "<identifier>"],
    ["k", "<kind of the draft event>"],
    ["e", "<anchor event event id>", "<relay-url>"],
    ["a", "<anchor event address>", "<relay-url>"],
  ],
  "content": nip44Encrypt(JSON.stringify(draft_event)),
  // other fields
}
```

A blanked `.content` means this draft has been deleted by a client but relays still have the event. 

Tags `e` and `a` identify one or more anchor events, such as parent events on replies.   

## Checkpoints
`kind:1234` defines checkpoints that belong to a parent `kind:31234` event. These can serve to provide a revision history of a parent event.

```js
{
  "kind": 1234,
  "tags": [
    ["a", "31234:<pubkey>:<identifier>"]
  ],
  "content": nip44Encrypt(JSON.stringify(draft_event)),
}
```

## Relay List for Private Content

Kind `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.

```js
{
  "kind": 10013,
  "tags": [],
  "content": nip44Encrypt(JSON.stringify([
    ["relay", "wss://myrelay.mydomain.com"]
  ]))
  //...other fields
}
```

Relays listed in this event SHOULD be authed and only allow downloads to events signed by the authed user.

Clients SHOULD publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.