upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--01.md6
-rw-r--r--02.md4
-rw-r--r--04.md2
-rw-r--r--05.md4
-rw-r--r--10.md4
-rw-r--r--11.md2
-rw-r--r--13.md2
-rw-r--r--17.md164
-rw-r--r--24.md3
-rw-r--r--25.md19
-rw-r--r--28.md14
-rw-r--r--32.md8
-rw-r--r--34.md62
-rw-r--r--35.md70
-rw-r--r--38.md4
-rw-r--r--46.md41
-rw-r--r--47.md6
-rw-r--r--50.md2
-rw-r--r--51.md26
-rw-r--r--53.md2
-rw-r--r--54.md117
-rw-r--r--55.md538
-rw-r--r--56.md10
-rw-r--r--58.md6
-rw-r--r--59.md2
-rw-r--r--71.md118
-rw-r--r--72.md2
-rw-r--r--90.md8
-rw-r--r--96.md126
-rw-r--r--BREAKING.md3
-rw-r--r--README.md127
31 files changed, 1323 insertions, 179 deletions
diff --git a/01.md b/01.md
index 905e45f..b51fdf0 100644
--- a/01.md
+++ b/01.md
@@ -56,7 +56,7 @@ To prevent implementation differences from creating a different event ID for the
56 56
57### Tags 57### Tags
58 58
59Each tag is an array of strings of arbitrary size, with some conventions around them. Take a look at the example below: 59Each tag is an array of one or more strings, with some conventions around them. Take a look at the example below:
60 60
61```jsonc 61```jsonc
62{ 62{
@@ -81,13 +81,13 @@ This NIP defines 3 standard tags that can be used across all event kinds with th
81 - for a parameterized replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>, <recommended relay URL, optional>]` 81 - for a parameterized replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>, <recommended relay URL, optional>]`
82 - for a non-parameterized replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:, <recommended relay URL, optional>]` 82 - for a non-parameterized replaceable event: `["a", <kind integer>:<32-bytes lowercase hex of a pubkey>:, <recommended relay URL, optional>]`
83 83
84As a convention, all single-letter (only english alphabet letters: a-z, A-Z) key tags are expected to be indexed by relays, such that it is possible, for example, to query or subscribe to events that reference the event `"5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"` by using the `{"#e": "5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"}` filter. 84As a convention, all single-letter (only english alphabet letters: a-z, A-Z) key tags are expected to be indexed by relays, such that it is possible, for example, to query or subscribe to events that reference the event `"5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"` by using the `{"#e": ["5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36"]}` filter.
85 85
86### Kinds 86### Kinds
87 87
88Kinds specify how clients should interpret the meaning of each event and the other fields of each event (e.g. an `"r"` tag may have a meaning in an event of kind 1 and an entirely different meaning in an event of kind 10002). Each NIP may define the meaning of a set of kinds that weren't defined elsewhere. This NIP defines two basic kinds: 88Kinds specify how clients should interpret the meaning of each event and the other fields of each event (e.g. an `"r"` tag may have a meaning in an event of kind 1 and an entirely different meaning in an event of kind 10002). Each NIP may define the meaning of a set of kinds that weren't defined elsewhere. This NIP defines two basic kinds:
89 89
90- `0`: **metadata**: the `content` is set to a stringified JSON object `{name: <username>, about: <string>, picture: <url, string>}` describing the user who created the event. A relay may delete older events once it gets a new one for the same pubkey. 90- `0`: **metadata**: the `content` is set to a stringified JSON object `{name: <username>, about: <string>, picture: <url, string>}` describing the user who created the event. [Extra metadata fields](24.md#kind-0) may be set. A relay may delete older events once it gets a new one for the same pubkey.
91- `1`: **text note**: the `content` is set to the **plaintext** content of a note (anything the user wants to say). Content that must be parsed, such as Markdown and HTML, should not be used. Clients should also not parse content as those. 91- `1`: **text note**: the `content` is set to the **plaintext** content of a note (anything the user wants to say). Content that must be parsed, such as Markdown and HTML, should not be used. Clients should also not parse content as those.
92 92
93And also a convention for kind ranges that allow for easier experimentation and flexibility of relay implementation: 93And also a convention for kind ranges that allow for easier experimentation and flexibility of relay implementation:
diff --git a/02.md b/02.md
index 8b0aee1..4029b22 100644
--- a/02.md
+++ b/02.md
@@ -8,7 +8,9 @@ Follow List
8 8
9A special event with kind `3`, meaning "follow list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following. 9A special event with kind `3`, meaning "follow list" is defined as having a list of `p` tags, one for each of the followed/known profiles one is following.
10 10
11Each tag entry should contain the key for the profile, a relay URL where events from that key can be found (can be set to an empty string if not needed), and a local name (or "petname") for that profile (can also be set to an empty string or not provided), i.e., `["p", <32-bytes hex key>, <main relay URL>, <petname>]`. The `content` can be anything and should be ignored. 11Each tag entry should contain the key for the profile, a relay URL where events from that key can be found (can be set to an empty string if not needed), and a local name (or "petname") for that profile (can also be set to an empty string or not provided), i.e., `["p", <32-bytes hex key>, <main relay URL>, <petname>]`.
12
13The `.content` is not used.
12 14
13For example: 15For example:
14 16
diff --git a/04.md b/04.md
index dc232b4..a561a2f 100644
--- a/04.md
+++ b/04.md
@@ -1,4 +1,4 @@
1> __Warning__ `unrecommended`: deprecated in favor of [NIP-44](44.md) 1> __Warning__ `unrecommended`: deprecated in favor of [NIP-17](17.md)
2 2
3NIP-04 3NIP-04
4====== 4======
diff --git a/05.md b/05.md
index 6437550..405078a 100644
--- a/05.md
+++ b/05.md
@@ -35,7 +35,7 @@ It will make a GET request to `https://example.com/.well-known/nostr.json?name=b
35} 35}
36```` 36````
37 37
38or with the **optional** `"relays"` attribute: 38or with the **recommended** `"relays"` attribute:
39 39
40```json 40```json
41{ 41{
@@ -50,7 +50,7 @@ or with the **optional** `"relays"` attribute:
50 50
51If the pubkey matches the one given in `"names"` (as in the example above) that means the association is right and the `"nip05"` identifier is valid and can be displayed. 51If the pubkey matches the one given in `"names"` (as in the example above) that means the association is right and the `"nip05"` identifier is valid and can be displayed.
52 52
53The optional `"relays"` attribute may contain an object with public keys as properties and arrays of relay URLs as values. When present, that can be used to help clients learn in which relays the specific user may be found. Web servers which serve `/.well-known/nostr.json` files dynamically based on the query string SHOULD also serve the relays data for any name they serve in the same reply when that is available. 53The recommended `"relays"` attribute may contain an object with public keys as properties and arrays of relay URLs as values. When present, that can be used to help clients learn in which relays the specific user may be found. Web servers which serve `/.well-known/nostr.json` files dynamically based on the query string SHOULD also serve the relays data for any name they serve in the same reply when that is available.
54 54
55## Finding users from their NIP-05 identifier 55## Finding users from their NIP-05 identifier
56 56
diff --git a/10.md b/10.md
index a434ea0..dfd4cb9 100644
--- a/10.md
+++ b/10.md
@@ -38,13 +38,14 @@ They are citing from this event. `root-id` and `reply-id` are as above.
38>This scheme is deprecated because it creates ambiguities that are difficult, or impossible to resolve when an event references another but is not a reply. 38>This scheme is deprecated because it creates ambiguities that are difficult, or impossible to resolve when an event references another but is not a reply.
39 39
40## Marked "e" tags (PREFERRED) 40## Marked "e" tags (PREFERRED)
41`["e", <event-id>, <relay-url>, <marker>]` 41`["e", <event-id>, <relay-url>, <marker>, <pubkey>]`
42 42
43Where: 43Where:
44 44
45 * `<event-id>` is the id of the event being referenced. 45 * `<event-id>` is the id of the event being referenced.
46 * `<relay-url>` is the URL of a recommended relay associated with the reference. Clients SHOULD add a valid `<relay-URL>` field, but may instead leave it as `""`. 46 * `<relay-url>` is the URL of a recommended relay associated with the reference. Clients SHOULD add a valid `<relay-URL>` field, but may instead leave it as `""`.
47 * `<marker>` is optional and if present is one of `"reply"`, `"root"`, or `"mention"`. 47 * `<marker>` is optional and if present is one of `"reply"`, `"root"`, or `"mention"`.
48 * `<pubkey>` is optional, SHOULD be the pubkey of the author of the referenced event
48 49
49Those marked with `"reply"` denote the id of the reply event being responded to. Those marked with `"root"` denote the root id of the reply thread being responded to. For top level replies (those replying directly to the root event), only the `"root"` marker should be used. Those marked with `"mention"` denote a quoted or reposted event id. 50Those marked with `"reply"` denote the id of the reply event being responded to. Those marked with `"root"` denote the root id of the reply thread being responded to. For top level replies (those replying directly to the root event), only the `"root"` marker should be used. Those marked with `"mention"` denote a quoted or reposted event id.
50 51
@@ -52,6 +53,7 @@ A direct reply to the root of a thread should have a single marked "e" tag of ty
52 53
53>This scheme is preferred because it allows events to mention others without confusing them with `<reply-id>` or `<root-id>`. 54>This scheme is preferred because it allows events to mention others without confusing them with `<reply-id>` or `<root-id>`.
54 55
56`<pubkey>` SHOULD be the pubkey of the author of the `e` tagged event, this is used in the outbox model to search for that event from the authors write relays where relay hints did not resolve the event.
55 57
56## The "p" tag 58## The "p" tag
57Used in a text event contains a list of pubkeys used to record who is involved in a reply thread. 59Used in a text event contains a list of pubkeys used to record who is involved in a reply thread.
diff --git a/11.md b/11.md
index 45102d7..a50038a 100644
--- a/11.md
+++ b/11.md
@@ -37,7 +37,7 @@ Detailed plain-text information about the relay may be contained in the `descrip
37 37
38### Pubkey 38### Pubkey
39 39
40An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See `NIP-04`) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance. 40An administrative contact may be listed with a `pubkey`, in the same format as Nostr events (32-byte hex for a `secp256k1` public key). If a contact is listed, this provides clients with a recommended address to send encrypted direct messages (See [NIP-17](17.md)) to a system administrator. Expected uses of this address are to report abuse or illegal content, file bug reports, or request other technical assistance.
41 41
42Relay operators have no obligation to respond to direct messages. 42Relay operators have no obligation to respond to direct messages.
43 43
diff --git a/13.md b/13.md
index 53c4d1b..99289c2 100644
--- a/13.md
+++ b/13.md
@@ -35,7 +35,7 @@ Example mined note
35 "created_at": 1651794653, 35 "created_at": 1651794653,
36 "kind": 1, 36 "kind": 1,
37 "tags": [ 37 "tags": [
38 ["nonce", "776797", "21"] 38 ["nonce", "776797", "20"]
39 ], 39 ],
40 "content": "It's just me mining my own business", 40 "content": "It's just me mining my own business",
41 "sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977" 41 "sig": "284622fc0a3f4f1303455d5175f7ba962a3300d136085b9566801bc2e0699de0c7e31e44c81fb40ad9049173742e904713c3594a1da0fc5d2382a25c11aba977"
diff --git a/17.md b/17.md
new file mode 100644
index 0000000..0f51367
--- /dev/null
+++ b/17.md
@@ -0,0 +1,164 @@
1NIP-17
2======
3
4Private Direct Messages
5-----------------------
6
7`draft` `optional`
8
9This NIP defines an encrypted direct messaging scheme using [NIP-44](44.md) encryption and [NIP-59](59.md) seals and gift wraps.
10
11## Direct Message Kind
12
13Kind `14` is a chat message. `p` tags identify one or more receivers of the message.
14
15```js
16{
17 "id": "<usual hash>",
18  "pubkey": "<sender-pubkey>",
19 "created_at": now(),
20  "kind": 14,
21  "tags": [
22    ["p", "<receiver-1-pubkey>", "<relay-url>"],
23    ["p", "<receiver-2-pubkey>", "<relay-url>"],
24    ["e", "<kind-14-id>", "<relay-url>", "reply"] // if this is a reply
25 ["subject", "<conversation-title>"],
26    ...
27  ],
28  "content": "<message-in-plain-text>",
29}
30```
31
32`.content` MUST be plain text. Fields `id` and `created_at` are required.
33
34Tags that mention, quote and assemble threading structures MUST follow [NIP-10](10.md).
35
36Kind `14`s MUST never be signed. If it is signed, the message might leak to relays and become **fully public**.
37
38## Chat Rooms
39
40The set of `pubkey` + `p` tags defines a chat room. If a new `p` tag is added or a current one is removed, a new room is created with clean message history.
41
42Clients SHOULD render messages of the same room in a continuous thread.
43
44An optional `subject` tag defines the current name/topic of the conversation. Any member can change the topic by simply submitting a new `subject` to an existing `pubkey` + `p`-tags room. There is no need to send `subject` in every message. The newest `subject` in the thread is the subject of the conversation.
45
46## Encrypting
47
48Following [NIP-59](59.md), the **unsigned** `kind:14` chat message must be sealed (`kind:13`) and then gift-wrapped (`kind:1059`) to each receiver and the sender individually.
49
50```js
51{
52 "id": "<usual hash>",
53  "pubkey": randomPublicKey,
54  "created_at": randomTimeUpTo2DaysInThePast(),
55 "kind": 1059, // gift wrap
56  "tags": [
57    ["p", receiverPublicKey, "<relay-url>"] // receiver
58  ],
59  "content": nip44Encrypt(
60    {
61 "id": "<usual hash>",
62      "pubkey": senderPublicKey,
63      "created_at": randomTimeUpTo2DaysInThePast(),
64      "kind": 13, // seal
65      "tags": [], // no tags
66      "content": nip44Encrypt(unsignedKind14, senderPrivateKey, receiverPublicKey),
67      "sig": "<signed by senderPrivateKey>"
68    },
69    randomPrivateKey, receiverPublicKey
70  ),
71  "sig": "<signed by randomPrivateKey>"
72}
73```
74
75The encryption algorithm MUST use the latest version of [NIP-44](44.md).
76
77Clients MUST verify if pubkey of the `kind:13` is the same pubkey on the `kind:14`, otherwise any sender can impersonate others by simply changing the pubkey on `kind:14`.
78
79Clients SHOULD randomize `created_at` in up to two days in the past in both the seal and the gift wrap to make sure grouping by `created_at` doesn't reveal any metadata.
80
81The gift wrap's `p`-tag can be the receiver's main pubkey or an alias key created to receive DMs without exposing the receiver's identity.
82
83Clients CAN offer disappearing messages by setting an `expiration` tag in the gift wrap of each receiver or by not generating a gift wrap to the sender's public key
84
85## Publishing
86
87Kind `10050` indicates the user's preferred relays to receive DMs. The event MUST include a list of `relay` tags with relay URIs.
88
89```js
90{
91 "kind": 10050,
92 "tags": [
93 ["relay", "wss://inbox.nostr.wine"],
94 ["relay", "wss://myrelay.nostr1.com"],
95 ],
96 "content": "",
97 //...other fields
98}
99```
100
101Clients SHOULD publish kind `14` events to the `10050`-listed relays. If that is not found that indicates the user is not ready to receive messages under this NIP and clients shouldn't try.
102
103## Relays
104
105It's advisable that relays do not serve `kind:14` to clients other than the ones tagged in them.
106
107It's advisable that users choose relays that conform to these practices.
108
109Clients SHOULD guide users to keep `kind:10050` lists small (1-3 relays) and SHOULD spread it to as many relays as viable.
110
111## Benefits & Limitations
112
113This NIP offers the following privacy and security features:
114
1151. **No Metadata Leak**: Participant identities, each message's real date and time, event kinds, and other event tags are all hidden from the public. Senders and receivers cannot be linked with public information alone.
1162. **No Public Group Identifiers**: There is no public central queue, channel or otherwise converging identifier to correlate or count all messages in the same group.
1173. **No Moderation**: There are no group admins: no invitations or bans.
1184. **No Shared Secrets**: No secret must be known to all members that can leak or be mistakenly shared
1195. **Fully Recoverable**: Messages can be fully recoverable by any client with the user's private key
1206. **Optional Forward Secrecy**: Users and clients can opt-in for "disappearing messages".
1217. **Uses Public Relays**: Messages can flow through public relays without loss of privacy. Private relays can increase privacy further, but they are not required.
1228. **Cold Storage**: Users can unilaterally opt-in to sharing their messages with a separate key that is exclusive for DM backup and recovery.
123
124The main limitation of this approach is having to send a separate encrypted event to each receiver. Group chats with more than 100 participants should find a more suitable messaging scheme.
125
126## Implementation
127
128Clients implementing this NIP should by default only connect to the set of relays found in their `kind:10050` list. From that they should be able to load all messages both sent and received as well as get new live updates, making it for a very simple and lightweight implementation that should be fast.
129
130When sending a message to anyone, clients must then connect to the relays in the receiver's `kind:10050` and send the events there, but can disconnect right after unless more messages are expected to be sent (e.g. the chat tab is still selected). Clients should also send a copy of their outgoing messages to their own `kind:10050` relay set.
131
132## Examples
133
134This example sends the message `Hola, que tal?` from `nsec1w8udu59ydjvedgs3yv5qccshcj8k05fh3l60k9x57asjrqdpa00qkmr89m` to `nsec12ywtkplvyq5t6twdqwwygavp5lm4fhuang89c943nf2z92eez43szvn4dt`.
135
136The two final GiftWraps, one to the receiver and the other to the sender, are:
137
138```json
139{
140 "id":"2886780f7349afc1344047524540ee716f7bdc1b64191699855662330bf235d8",
141 "pubkey":"8f8a7ec43b77d25799281207e1a47f7a654755055788f7482653f9c9661c6d51",
142 "created_at":1703128320,
143 "kind":1059,
144 "tags":[
145 [ "p", "918e2da906df4ccd12c8ac672d8335add131a4cf9d27ce42b3bb3625755f0788"]
146 ],
147 "content":"AsqzdlMsG304G8h08bE67dhAR1gFTzTckUUyuvndZ8LrGCvwI4pgC3d6hyAK0Wo9gtkLqSr2rT2RyHlE5wRqbCOlQ8WvJEKwqwIJwT5PO3l2RxvGCHDbd1b1o40ZgIVwwLCfOWJ86I5upXe8K5AgpxYTOM1BD+SbgI5jOMA8tgpRoitJedVSvBZsmwAxXM7o7sbOON4MXHzOqOZpALpS2zgBDXSAaYAsTdEM4qqFeik+zTk3+L6NYuftGidqVluicwSGS2viYWr5OiJ1zrj1ERhYSGLpQnPKrqDaDi7R1KrHGFGyLgkJveY/45y0rv9aVIw9IWF11u53cf2CP7akACel2WvZdl1htEwFu/v9cFXD06fNVZjfx3OssKM/uHPE9XvZttQboAvP5UoK6lv9o3d+0GM4/3zP+yO3C0NExz1ZgFmbGFz703YJzM+zpKCOXaZyzPjADXp8qBBeVc5lmJqiCL4solZpxA1865yPigPAZcc9acSUlg23J1dptFK4n3Tl5HfSHP+oZ/QS/SHWbVFCtq7ZMQSRxLgEitfglTNz9P1CnpMwmW/Y4Gm5zdkv0JrdUVrn2UO9ARdHlPsW5ARgDmzaxnJypkfoHXNfxGGXWRk0sKLbz/ipnaQP/eFJv/ibNuSfqL6E4BnN/tHJSHYEaTQ/PdrA2i9laG3vJti3kAl5Ih87ct0w/tzYfp4SRPhEF1zzue9G/16eJEMzwmhQ5Ec7jJVcVGa4RltqnuF8unUu3iSRTQ+/MNNUkK6Mk+YuaJJs6Fjw6tRHuWi57SdKKv7GGkr0zlBUU2Dyo1MwpAqzsCcCTeQSv+8qt4wLf4uhU9Br7F/L0ZY9bFgh6iLDCdB+4iABXyZwT7Ufn762195hrSHcU4Okt0Zns9EeiBOFxnmpXEslYkYBpXw70GmymQfJlFOfoEp93QKCMS2DAEVeI51dJV1e+6t3pCSsQN69Vg6jUCsm1TMxSs2VX4BRbq562+VffchvW2BB4gMjsvHVUSRl8i5/ZSDlfzSPXcSGALLHBRzy+gn0oXXJ/447VHYZJDL3Ig8+QW5oFMgnWYhuwI5QSLEyflUrfSz+Pdwn/5eyjybXKJftePBD9Q+8NQ8zulU5sqvsMeIx/bBUx0fmOXsS3vjqCXW5IjkmSUV7q54GewZqTQBlcx+90xh/LSUxXex7UwZwRnifvyCbZ+zwNTHNb12chYeNjMV7kAIr3cGQv8vlOMM8ajyaZ5KVy7HpSXQjz4PGT2/nXbL5jKt8Lx0erGXsSsazkdoYDG3U",
148 "sig":"a3c6ce632b145c0869423c1afaff4a6d764a9b64dedaf15f170b944ead67227518a72e455567ca1c2a0d187832cecbde7ed478395ec4c95dd3e71749ed66c480"
149}
150```
151
152```json
153{
154 "id":"162b0611a1911cfcb30f8a5502792b346e535a45658b3a31ae5c178465509721",
155 "pubkey":"626be2af274b29ea4816ad672ee452b7cf96bbb4836815a55699ae402183f512",
156 "created_at":1702711587,
157 "kind":1059,
158 "tags":[
159 [ "p", "44900586091b284416a0c001f677f9c49f7639a55c3f1e2ec130a8e1a7998e1b"]
160 ],
161 "content":"AsTClTzr0gzXXji7uye5UB6LYrx3HDjWGdkNaBS6BAX9CpHa+Vvtt5oI2xJrmWLen+Fo2NBOFazvl285Gb3HSM82gVycrzx1HUAaQDUG6HI7XBEGqBhQMUNwNMiN2dnilBMFC3Yc8ehCJT/gkbiNKOpwd2rFibMFRMDKai2mq2lBtPJF18oszKOjA+XlOJV8JRbmcAanTbEK5nA/GnG3eGUiUzhiYBoHomj3vztYYxc0QYHOx0WxiHY8dsC6jPsXC7f6k4P+Hv5ZiyTfzvjkSJOckel1lZuE5SfeZ0nduqTlxREGeBJ8amOykgEIKdH2VZBZB+qtOMc7ez9dz4wffGwBDA7912NFS2dPBr6txHNxBUkDZKFbuD5wijvonZDvfWq43tZspO4NutSokZB99uEiRH8NAUdGTiNb25m9JcDhVfdmABqTg5fIwwTwlem5aXIy8b66lmqqz2LBzJtnJDu36bDwkILph3kmvaKPD8qJXmPQ4yGpxIbYSTCohgt2/I0TKJNmqNvSN+IVoUuC7ZOfUV9lOV8Ri0AMfSr2YsdZ9ofV5o82ClZWlWiSWZwy6ypa7CuT1PEGHzywB4CZ5ucpO60Z7hnBQxHLiAQIO/QhiBp1rmrdQZFN6PUEjFDloykoeHe345Yqy9Ke95HIKUCS9yJurD+nZjjgOxZjoFCsB1hQAwINTIS3FbYOibZnQwv8PXvcSOqVZxC9U0+WuagK7IwxzhGZY3vLRrX01oujiRrevB4xbW7Oxi/Agp7CQGlJXCgmRE8Rhm+Vj2s+wc/4VLNZRHDcwtfejogjrjdi8p6nfUyqoQRRPARzRGUnnCbh+LqhigT6gQf3sVilnydMRScEc0/YYNLWnaw9nbyBa7wFBAiGbJwO40k39wj+xT6HTSbSUgFZzopxroO3f/o4+ubx2+IL3fkev22mEN38+dFmYF3zE+hpE7jVxrJpC3EP9PLoFgFPKCuctMnjXmeHoiGs756N5r1Mm1ffZu4H19MSuALJlxQR7VXE/LzxRXDuaB2u9days/6muP6gbGX1ASxbJd/ou8+viHmSC/ioHzNjItVCPaJjDyc6bv+gs1NPCt0qZ69G+JmgHW/PsMMeL4n5bh74g0fJSHqiI9ewEmOG/8bedSREv2XXtKV39STxPweceIOh0k23s3N6+wvuSUAJE7u1LkDo14cobtZ/MCw/QhimYPd1u5HnEJvRhPxz0nVPz0QqL/YQeOkAYk7uzgeb2yPzJ6DBtnTnGDkglekhVzQBFRJdk740LEj6swkJ",
162 "sig":"c94e74533b482aa8eeeb54ae72a5303e0b21f62909ca43c8ef06b0357412d6f8a92f96e1a205102753777fd25321a58fba3fb384eee114bd53ce6c06a1c22bab"
163}
164```
diff --git a/24.md b/24.md
index d444a4b..b21f48e 100644
--- a/24.md
+++ b/24.md
@@ -16,6 +16,7 @@ These are extra fields not specified in NIP-01 that may be present in the string
16 - `display_name`: an alternative, bigger name with richer characters than `name`. `name` should always be set regardless of the presence of `display_name` in the metadata. 16 - `display_name`: an alternative, bigger name with richer characters than `name`. `name` should always be set regardless of the presence of `display_name` in the metadata.
17 - `website`: a web URL related in any way to the event author. 17 - `website`: a web URL related in any way to the event author.
18 - `banner`: an URL to a wide (~1024x768) picture to be optionally displayed in the background of a profile screen. 18 - `banner`: an URL to a wide (~1024x768) picture to be optionally displayed in the background of a profile screen.
19 - `bot`: a boolean to clarify that the content is entirely or partially the result of automation, such as with chatbots or newsfeeds.
19 20
20### Deprecated fields 21### Deprecated fields
21 22
@@ -39,4 +40,4 @@ tags
39These tags may be present in multiple event kinds. Whenever a different meaning is not specified by some more specific NIP, they have the following meanings: 40These tags may be present in multiple event kinds. Whenever a different meaning is not specified by some more specific NIP, they have the following meanings:
40 41
41 - `r`: a web URL the event is referring to in some way 42 - `r`: a web URL the event is referring to in some way
42 - `title`: title of the event 43 - `title`: name of [NIP-51](51.md) sets, [NIP-52](52.md) calendar event, [NIP-53](53.md) live event or [NIP-99](99.md) listing
diff --git a/25.md b/25.md
index 3b4aa59..17c203e 100644
--- a/25.md
+++ b/25.md
@@ -25,24 +25,22 @@ consider it a "+".
25Tags 25Tags
26---- 26----
27 27
28The reaction event SHOULD include `e` and `p` tags from the note the user is 28The reaction event SHOULD include `e` and `p` tags from the note the user is reacting to (and optionally `a` tags if the target is a replaceable event). This allows users to be notified of reactions to posts they were mentioned in. Including the `e` tags enables clients to pull all the reactions associated with individual posts or all the posts in a thread. `a` tags enables clients to seek reactions for all versions of a replaceable event.
29reacting to. This allows users to be notified of reactions to posts they were
30mentioned in. Including the `e` tags enables clients to pull all the reactions
31associated with individual posts or all the posts in a thread.
32 29
33The last `e` tag MUST be the `id` of the note that is being reacted to. 30The last `e` tag MUST be the `id` of the note that is being reacted to.
34 31
35The last `p` tag MUST be the `pubkey` of the event being reacted to. 32The last `p` tag MUST be the `pubkey` of the event being reacted to.
36 33
37The reaction event MAY include a `k` tag with the stringified kind number 34The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to.
38of the reacted event as its value. 35
36The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value.
39 37
40Example code 38Example code
41 39
42```swift 40```swift
43func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent { 41func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent {
44 var tags: [[String]] = liked.tags.filter { 42 var tags: [[String]] = liked.tags.filter {
45 tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p") 43 tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p")
46 } 44 }
47 tags.append(["e", liked.id]) 45 tags.append(["e", liked.id])
48 tags.append(["p", liked.pubkey]) 46 tags.append(["p", liked.pubkey])
@@ -68,8 +66,7 @@ content as an emoji if shortcode is specified.
68 "tags": [ 66 "tags": [
69 ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"] 67 ["emoji", "soapbox", "https://gleasonator.com/emoji/Gleasonator/soapbox.png"]
70 ], 68 ],
71 "pubkey": "79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6", 69 ...other fields
72 "created_at": 1682790000
73} 70}
74``` 71```
75 72
diff --git a/28.md b/28.md
index 2dcf800..65ebb3f 100644
--- a/28.md
+++ b/28.md
@@ -23,11 +23,11 @@ Client-centric moderation gives client developers discretion over what types of
23 23
24Create a public chat channel. 24Create a public chat channel.
25 25
26In the channel creation `content` field, Client SHOULD include basic channel metadata (`name`, `about`, `picture` as specified in kind 41). 26In the channel creation `content` field, Client SHOULD include basic channel metadata (`name`, `about`, `picture` and `relays` as specified in kind 41).
27 27
28```json 28```json
29{ 29{
30 "content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}", 30 "content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\", \"relays\": [\"wss://nos.lol\", \"wss://nostr.mom\"]}",
31 ... 31 ...
32} 32}
33``` 33```
@@ -46,6 +46,7 @@ Clients SHOULD support basic metadata fields:
46- `name` - string - Channel name 46- `name` - string - Channel name
47- `about` - string - Channel description 47- `about` - string - Channel description
48- `picture` - string - URL of channel picture 48- `picture` - string - URL of channel picture
49- `relays` - array - List of relays to download and broadcast events to
49 50
50Clients MAY add additional metadata fields. 51Clients MAY add additional metadata fields.
51 52
@@ -53,7 +54,7 @@ Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay.
53 54
54```json 55```json
55{ 56{
56 "content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}", 57 "content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\", \"relays\": [\"wss://nos.lol\", \"wss://nostr.mom\"]}",
57 "tags": [["e", <channel_create_event_id>, <relay-url>]], 58 "tags": [["e", <channel_create_event_id>, <relay-url>]],
58 ... 59 ...
59} 60}
@@ -132,12 +133,11 @@ Clients MAY hide event 42s for users other than the user who sent the event 44.
132} 133}
133``` 134```
134 135
135## NIP-10 relay recommendations 136## Relay recommendations
136 137
137For [NIP-10](10.md) relay recommendations, clients generally SHOULD use the relay URL of the original (oldest) kind 40 event. 138Clients SHOULD use the relay URLs of the metadata events.
138
139Clients MAY recommend any relay URL. For example, if a relay hosting the original kind 40 event for a channel goes offline, clients could instead fetch channel data from a backup relay, or a relay that clients trust more than the original relay.
140 139
140Clients MAY use any relay URL. For example, if a relay hosting the original kind 40 event for a channel goes offline, clients could instead fetch channel data from a backup relay, or a relay that clients trust more than the original relay.
141 141
142Motivation 142Motivation
143---------- 143----------
diff --git a/32.md b/32.md
index 6e6bf70..79f5937 100644
--- a/32.md
+++ b/32.md
@@ -153,3 +153,11 @@ A good heuristic for whether a use case fits this NIP is whether labels would ev
153For example, many events might be labeled with a particular place, topic, or pubkey, but labels 153For example, many events might be labeled with a particular place, topic, or pubkey, but labels
154with specific values like "John Doe" or "3.18743" are not labels, they are values, and should 154with specific values like "John Doe" or "3.18743" are not labels, they are values, and should
155be handled in some other way. 155be handled in some other way.
156
157
158Appendix: Known Ontologies
159-------------------------
160
161Below is a non-exhaustive list of ontologies currently in widespread use.
162
163- [social.ontolo.categories](https://ontolo.social/)
diff --git a/34.md b/34.md
index 651407d..fcc2cec 100644
--- a/34.md
+++ b/34.md
@@ -17,17 +17,21 @@ Git repositories are hosted in Git-enabled servers, but their existence can be a
17 "kind": 30617, 17 "kind": 30617,
18 "content": "", 18 "content": "",
19 "tags": [ 19 "tags": [
20 ["d", "<repo-id>"], 20 ["d", "<repo-id>"], // usually kebab-case short name
21 ["name", "<human-readable project name>"], 21 ["name", "<human-readable project name>"],
22 ["description", "brief human-readable project description>"], 22 ["description", "brief human-readable project description>"],
23 ["web", "<url for browsing>", ...], // a webpage url, if the git server being used provides such a thing 23 ["web", "<url for browsing>", ...], // a webpage url, if the git server being used provides such a thing
24 ["clone", "<url for git-cloning>", ...], // a url to be given to `git clone` so anyone can clone it 24 ["clone", "<url for git-cloning>", ...], // a url to be given to `git clone` so anyone can clone it
25 ["relays", "<relay-url>", ...] // relays that this repository will monitor for patches and issues 25 ["relays", "<relay-url>", ...] // relays that this repository will monitor for patches and issues
26 ["r", "<earliest-unique-commit-id>", "euc"]
27 ["maintainers", "<other-recognized-maintainer>", ...]
26 ] 28 ]
27} 29}
28``` 30```
29 31
30The tags `web`, `clone`, `relays` can have multiple values. 32The tags `web`, `clone`, `relays`, `maintainers` can have multiple values.
33
34The `r` tag annotated with the `"euc"` marker should be the commit ID of the earliest unique commit of this repo, made to identify it among forks and group it with other repositories hosted elsewhere that may represent essentially the same project. In most cases it will be the root commit of a repository. In case of a permanent fork between two projects, then the first commit after the fork should be used.
31 35
32Except `d`, all tags are optional. 36Except `d`, all tags are optional.
33 37
@@ -35,23 +39,30 @@ Except `d`, all tags are optional.
35 39
36Patches can be sent by anyone to any repository. Patches to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch events SHOULD include an `a` tag pointing to that repository's announcement address. 40Patches can be sent by anyone to any repository. Patches to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch events SHOULD include an `a` tag pointing to that repository's announcement address.
37 41
42Patches in a patch set SHOULD include a NIP-10 `e` `reply` tag pointing to the previous patch.
43
44The first patch revision in a patch revision SHOULD include a NIP-10 `e` `reply` to the original root patch.
45
38```jsonc 46```jsonc
39{ 47{
40 "kind": 1617, 48 "kind": 1617,
41 "content": "<patch>", // contents of <git format-patch> 49 "content": "<patch>", // contents of <git format-patch>
42 "tags": [ 50 "tags": [
43 ["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>"], 51 ["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>"],
52 ["r", "<earliest-unique-commit-id-of-repo>"] // so clients can subscribe to all patches sent to a local git repo
44 ["p", "<repository-owner>"], 53 ["p", "<repository-owner>"],
45 ["p", "<other-user>"], // optionally send the patch to another user to bring it to their attention 54 ["p", "<other-user>"], // optionally send the patch to another user to bring it to their attention
46 55
47 // for the first patch in a thread or series 56 ["t", "root"], // ommited for additional patches in a series
48 ["t", "root"], 57 // for the first patch in a revision
58 ["t", "root-revision"],
49 59
50 // optional tags for when it is desirable that the merged patch has a stable commit id 60 // optional tags for when it is desirable that the merged patch has a stable commit id
51 // these fields are necessary for ensuring that the commit resulting from applying a patch 61 // these fields are necessary for ensuring that the commit resulting from applying a patch
52 // has the same id as it had in the proposer's machine -- all these tags can be omitted 62 // has the same id as it had in the proposer's machine -- all these tags can be omitted
53 // if the maintainer doesn't care about these things 63 // if the maintainer doesn't care about these things
54 ["commit", "<current-commit-id>"], 64 ["commit", "<current-commit-id>"],
65 ["r", "<current-commit-id>"] // so clients can find existing patches for a specific commit
55 ["parent-commit", "<parent-commit-id>"], 66 ["parent-commit", "<parent-commit-id>"],
56 ["commit-pgp-sig", "-----BEGIN PGP SIGNATURE-----..."], // empty string for unsigned commit 67 ["commit-pgp-sig", "-----BEGIN PGP SIGNATURE-----..."], // empty string for unsigned commit
57 ["committer", "<name>", "<email>", "<timestamp>", "<timezone offset in minutes>"], 68 ["committer", "<name>", "<email>", "<timestamp>", "<timezone offset in minutes>"],
@@ -59,6 +70,8 @@ Patches can be sent by anyone to any repository. Patches to a specific repositor
59} 70}
60``` 71```
61 72
73The first patch in a series MAY be a cover letter in the format produced by `git format-patch`.
74
62## Issues 75## Issues
63 76
64Issues are Markdown text that is just human-readable conversational threads related to the repository: bug reports, feature requests, questions or comments of any kind. Like patches, these SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. 77Issues are Markdown text that is just human-readable conversational threads related to the repository: bug reports, feature requests, questions or comments of any kind. Like patches, these SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag.
@@ -94,9 +107,46 @@ Replies are also Markdown text. The difference is that they MUST be issued as re
94} 107}
95``` 108```
96 109
110## Status
111
112Root Patches and Issues have a Status that defaults to 'Open' and can be set by issuing Status events.
113
114```jsonc
115{
116 "kind": 1630, // Open
117 "kind": 1631, // Applied / Merged for Patches; Resolved for Issues
118 "kind": 1632, // Closed
119 "kind": 1633, // Draft
120 "content": "<markdown text>",
121 "tags": [
122 ["e", "<issue-or-original-root-patch-id-hex>", "", "root"],
123 ["e", "<accepted-revision-root-id-hex>", "", "reply"], // for when revisions applied
124 ["p", "<repository-owner>"],
125 ["p", "<root-event-author>"],
126 ["p", "<revision-author>"],
127
128 // optional for improved subscription filter efficiency
129 ["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>", "<relay-url>"],
130 ["r", "<earliest-unique-commit-id-of-repo>"]
131
132 // optional for `1631` status
133 ["e", "<applied-or-merged-patch-event-id>", "", "mention"], // for each
134 // when merged
135 ["merge-commit", "<merge-commit-id>"]
136 ["r", "<merge-commit-id>"]
137 // when applied
138 ["applied-as-commits", "<commit-id-in-master-branch>", ...]
139 ["r", "<applied-commit-id>"] // for each
140 ]
141}
142```
143
144The Status event with the largest created_at date is valid.
145
146The Status of a patch-revision defaults to either that of the root-patch, or `1632` (Closed) if the root-patch's Status is `1631` and the patch-revision isn't tagged in the `1631` event.
147
148
97## Possible things to be added later 149## Possible things to be added later
98 150
99- "status" kind (for letting people know a patch was merged or an issue was fixed or won't be fixed)
100- "branch merge" kind (specifying a URL from where to fetch the branch to be merged) 151- "branch merge" kind (specifying a URL from where to fetch the branch to be merged)
101- "cover letter" kind (to which multiple patches can refer and serve as a unifying layer to them)
102- inline file comments kind (we probably need one for patches and a different one for merged files) 152- inline file comments kind (we probably need one for patches and a different one for merged files)
diff --git a/35.md b/35.md
new file mode 100644
index 0000000..04cfb46
--- /dev/null
+++ b/35.md
@@ -0,0 +1,70 @@
1NIP-35
2======
3
4Torrents
5-----------
6
7`draft` `optional`
8
9This NIP defined a new `kind 2003` which is a Torrent.
10
11`kind 2003` is a simple torrent index where there is enough information to search for content and construct the magnet link. No torrent files exist on nostr.
12
13## Tags
14- `x`: V1 BitTorrent Info Hash, as seen in the [magnet link](https://www.bittorrent.org/beps/bep_0053.html) `magnet:?xt=urn:btih:HASH`
15- `file`: A file entry inside the torrent, including the full path ie. `info/example.txt`
16- `tracker`: (Optional) A tracker to use for this torrent
17
18In order to make torrents searchable by general category, you SHOULD include a few tags like `movie`, `tv`, `HD`, `UHD` etc.
19
20## Tag prefixes
21
22Tag prefixes are used to label the content with references, ie. `["i", "imdb:1234"]`
23
24- `tcat`: A comma separated text category path, ie. `["i", "tcat:video,movie,4k"]`, this should also match the `newznab` category in a best effort approach.
25- `newznab`: The category ID from [newznab](https://github.com/Prowlarr/Prowlarr/blob/develop/src/NzbDrone.Core/Indexers/NewznabStandardCategory.cs)
26- `tmdb`: [The movie database](https://www.themoviedb.org/) id.
27- `ttvdb`: [TV database](https://thetvdb.com/) id.
28- `imdb`: [IMDB](https://www.imdb.com/) id.
29- `mal`: [MyAnimeList](https://myanimelist.net/) id.
30- `anilist`: [AniList](https://anilist.co/) id.
31
32A second level prefix should be included where the database supports multiple media types.
33- `tmdb:movie:693134` maps to `themoviedb.org/movie/693134`
34- `ttvdb:movie:290272` maps to `thetvdb.com/movies/dune-part-two`
35- `mal:anime:9253` maps to `myanimelist.net/anime/9253`
36- `mal:manga:17517` maps to `myanimelist.net/manga/17517`
37
38In some cases the url mapping isnt direct, mapping the url in general is out of scope for this NIP, the section above is only a guide so that implementers have enough information to succsesfully map the url if they wish.
39
40```jsonc
41{
42 "kind": 2003,
43 "content": "<long-description-pre-formatted>",
44 "tags": [
45 ["title", "<torrent-title>"],
46 ["x", "<bittorrent-info-hash>"],
47 ["file", "<file-name>", "<file-size-in-bytes>"],
48 ["file", "<file-name>", "<file-size-in-bytes>"],
49 ["tracker", "udp://mytacker.com:1337"],
50 ["tracker", "http://1337-tracker.net/announce"],
51 ["i", "tcat:video,movie,4k"],
52 ["i", "newznab:2045"],
53 ["i", "imdb:tt15239678"],
54 ["i", "tmdb:movie:693134"],
55 ["i", "ttvdb:movie:290272"],
56 ["t", "movie"],
57 ["t", "4k"],
58 ]
59}
60```
61
62## Torrent Comments
63
64A torrent comment is a `kind 2004` event which is used to reply to a torrent event.
65
66This event works exactly like a `kind 1` and should follow `NIP-10` for tagging.
67
68## Implementations
691. [dtan.xyz](https://git.v0l.io/Kieran/dtan)
702. [nostrudel.ninja](https://github.com/hzrd149/nostrudel/tree/next/src/views/torrents) \ No newline at end of file
diff --git a/38.md b/38.md
index 911d5b1..4f2c06d 100644
--- a/38.md
+++ b/38.md
@@ -46,6 +46,8 @@ Any other status types can be used but they are not defined by this NIP.
46 46
47The status MAY include an `r`, `p`, `e` or `a` tag linking to a URL, profile, note, or parameterized replaceable event. 47The status MAY include an `r`, `p`, `e` or `a` tag linking to a URL, profile, note, or parameterized replaceable event.
48 48
49The `content` MAY include emoji(s), or [NIP-30](30.md) custom emoji(s). If the `content` is an empty string then the client should clear the status.
50
49# Client behavior 51# Client behavior
50 52
51Clients MAY display this next to the username on posts or profiles to provide live user status information. 53Clients MAY display this next to the username on posts or profiles to provide live user status information.
@@ -57,5 +59,3 @@ Clients MAY display this next to the username on posts or profiles to provide li
57* Nostr music streaming services that update your music status when you're listening 59* Nostr music streaming services that update your music status when you're listening
58* Podcasting apps that update your music status when you're listening to a podcast, with a link for others to listen as well 60* Podcasting apps that update your music status when you're listening to a podcast, with a link for others to listen as well
59* Clients can use the system media player to update playing music status 61* Clients can use the system media player to update playing music status
60
61The `content` MAY include emoji(s), or [NIP-30](30.md) custom emoji(s). If the `content` is an empty string then the client should clear the status.
diff --git a/46.md b/46.md
index eb96494..1528116 100644
--- a/46.md
+++ b/46.md
@@ -25,7 +25,7 @@ This is most common in a situation where you have your own nsecbunker or other t
25The remote signer would provide a connection token in the form: 25The remote signer would provide a connection token in the form:
26 26
27``` 27```
28bunker://<remote-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value> 28bunker://<remote-user-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value>
29``` 29```
30 30
31This token is pasted into the client by the user and the client then uses the details to connect to the remote signer via the specified relay(s). 31This token is pasted into the client by the user and the client then uses the details to connect to the remote signer via the specified relay(s).
@@ -61,8 +61,9 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
61 "method": "sign_event", 61 "method": "sign_event",
62 "params": [json_stringified(<{ 62 "params": [json_stringified(<{
63 content: "Hello, I'm signing remotely", 63 content: "Hello, I'm signing remotely",
64 pubkey: "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", 64 kind: 1,
65 // ...the rest of the event data 65 tags: [],
66 created_at: 1714078911
66 }>)] 67 }>)]
67 }), 68 }),
68 "tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote user pubkey 69 "tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote user pubkey
@@ -118,17 +119,21 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c
118 119
119Each of the following are methods that the client sends to the remote signer. 120Each of the following are methods that the client sends to the remote signer.
120 121
121| Command | Params | Result | 122| Command | Params | Result |
122| ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- | 123| ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- |
123| `connect` | `[<remote_user_pubkey>, <optional_secret>]` | "ack" | 124| `connect` | `[<remote_user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" |
124| `sign_event` | `[<json_stringified_event_to_sign>]` | `json_stringified(<signed_event>)` | 125| `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` |
125| `ping` | `[]` | "pong" | 126| `ping` | `[]` | "pong" |
126| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` | 127| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` |
127| `get_public_key` | `[]` | `<hex-pubkey>` | 128| `get_public_key` | `[]` | `<hex-pubkey>` |
128| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` | 129| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` |
129| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` | 130| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` |
130| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` | 131| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` |
131| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` | 132| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` |
133
134### Requested permissions
135
136The `connect` method may be provided with `optional_requested_permissions` for user convenience. The permissions are a comma-separated list of `method[:params]`, i.e. `nip04_encrypt,sign_event:4` meaning permissions to call `nip04_encrypt` and to call `sign_event` with `kind:4`. Optional parameter for `sign_event` is the kind number, parameters for other methods are to be defined later.
132 137
133## Response Events `kind:24133` 138## Response Events `kind:24133`
134 139
@@ -149,13 +154,13 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c
149{ 154{
150 "id": <request_id>, 155 "id": <request_id>,
151 "result": <results_string>, 156 "result": <results_string>,
152 "error": <error_string> 157 "error": <optional_error_string>
153} 158}
154``` 159```
155 160
156- `id` is the request ID that this response is for. 161- `id` is the request ID that this response is for.
157- `results` is a string of the result of the call (this can be either a string or a JSON stringified object) 162- `results` is a string of the result of the call (this can be either a string or a JSON stringified object)
158- `error` is an error in string form. 163- `error`, _optionally_, it is an error in string form, if any. Its presence indicates an error with the request.
159 164
160### Auth Challenges 165### Auth Challenges
161 166
@@ -185,7 +190,7 @@ Each of the following are methods that the client sends to the remote signer.
185 190
186| Command | Params | Result | 191| Command | Params | Result |
187| ---------------- | ------------------------------------------ | ------------------------------------ | 192| ---------------- | ------------------------------------------ | ------------------------------------ |
188| `create_account` | `[<username>, <domain>, <optional_email>]` | `<newly_created_remote_user_pubkey>` | 193| `create_account` | `[<username>, <domain>, <optional_email>, <optional_requested_permissions>]` | `<newly_created_remote_user_pubkey>` |
189 194
190## Appendix 195## Appendix
191 196
@@ -203,7 +208,7 @@ When the user types a NIP-05 the client:
203 208
204#### Remote signer discovery via NIP-89 209#### Remote signer discovery via NIP-89
205 210
206In this last case, most often used to fascilitate an OAuth-like signin flow, the client first looks for remote signers that have announced themselves via NIP-89 application handler events. 211In this last case, most often used to facilitate an OAuth-like signin flow, the client first looks for remote signers that have announced themselves via NIP-89 application handler events.
207 212
208First the client will query for `kind: 31990` events that have a `k` tag of `24133`. 213First the client will query for `kind: 31990` events that have a `k` tag of `24133`.
209 214
diff --git a/47.md b/47.md
index 9033847..983d2c9 100644
--- a/47.md
+++ b/47.md
@@ -81,7 +81,7 @@ If the command was successful, the `error` field must be null.
81## Nostr Wallet Connect URI 81## Nostr Wallet Connect URI
82**client** discovers **wallet service** by scanning a QR code, handling a deeplink or pasting in a URI. 82**client** discovers **wallet service** by scanning a QR code, handling a deeplink or pasting in a URI.
83 83
84The **wallet service** generates this connection URI with protocol `nostr+walletconnect:` and base path it's hex-encoded `pubkey` with the following query string parameters: 84The **wallet service** generates this connection URI with protocol `nostr+walletconnect://` and base path it's hex-encoded `pubkey` with the following query string parameters:
85 85
86- `relay` Required. URL of the relay where the **wallet service** is connected and will be listening for events. May be more than one. 86- `relay` Required. URL of the relay where the **wallet service** is connected and will be listening for events. May be more than one.
87- `secret` Required. 32-byte randomly generated hex encoded string. The **client** MUST use this to sign events and encrypt payloads when communicating with the **wallet service**. 87- `secret` Required. 32-byte randomly generated hex encoded string. The **client** MUST use this to sign events and encrypt payloads when communicating with the **wallet service**.
@@ -95,7 +95,7 @@ The **client** should then store this connection and use it when the user wants
95 95
96### Example connection string 96### Example connection string
97```sh 97```sh
98nostr+walletconnect:b889ff5b1513b641e2a139f661a661364979c5beee91842f8f0ef42ab558e9d4?relay=wss%3A%2F%2Frelay.damus.io&secret=71a8c14c1407c113601079c4302dab36460f0ccd0ad506f1f2dc73b5100e4f3c 98nostr+walletconnect://b889ff5b1513b641e2a139f661a661364979c5beee91842f8f0ef42ab558e9d4?relay=wss%3A%2F%2Frelay.damus.io&secret=71a8c14c1407c113601079c4302dab36460f0ccd0ad506f1f2dc73b5100e4f3c
99``` 99```
100 100
101## Commands 101## Commands
@@ -402,7 +402,7 @@ Response:
402 402
403## Example pay invoice flow 403## Example pay invoice flow
404 404
4050. The user scans the QR code generated by the **wallet service** with their **client** application, they follow a `nostr+walletconnect:` deeplink or configure the connection details manually. 4050. The user scans the QR code generated by the **wallet service** with their **client** application, they follow a `nostr+walletconnect://` deeplink or configure the connection details manually.
4061. **client** sends an event to the **wallet service** with kind `23194`. The content is a `pay_invoice` request. The private key is the secret from the connection string above. 4061. **client** sends an event to the **wallet service** with kind `23194`. The content is a `pay_invoice` request. The private key is the secret from the connection string above.
4072. **wallet service** verifies that the author's key is authorized to perform the payment, decrypts the payload and sends the payment. 4072. **wallet service** verifies that the author's key is authorized to perform the payment, decrypts the payload and sends the payment.
4083. **wallet service** responds to the event by sending an event with kind `23195` and content being a response either containing an error message or a preimage. 4083. **wallet service** responds to the event by sending an event with kind `23195` and content being a response either containing an error message or a preimage.
diff --git a/50.md b/50.md
index a6e02be..2a31cb1 100644
--- a/50.md
+++ b/50.md
@@ -26,6 +26,8 @@ Relays SHOULD interpret the query to the best of their ability and return events
26Relays SHOULD perform matching against `content` event field, and MAY perform 26Relays SHOULD perform matching against `content` event field, and MAY perform
27matching against other fields if that makes sense in the context of a specific kind. 27matching against other fields if that makes sense in the context of a specific kind.
28 28
29Results SHOULD be returned in descending order by quality of search result (as defined by the implementation),
30not by the usual `.created_at`. The `limit` filter SHOULD be applied after sorting by matching score.
29A query string may contain `key:value` pairs (two words separated by colon), these are extensions, relays SHOULD ignore 31A query string may contain `key:value` pairs (two words separated by colon), these are extensions, relays SHOULD ignore
30extensions they don't support. 32extensions they don't support.
31 33
diff --git a/51.md b/51.md
index 95acbc8..fb40b26 100644
--- a/51.md
+++ b/51.md
@@ -20,18 +20,20 @@ Standard lists use non-parameterized replaceable events, meaning users may only
20 20
21For example, _mute list_ can contain the public keys of spammers and bad actors users don't want to see in their feeds or receive annoying notifications from. 21For example, _mute list_ can contain the public keys of spammers and bad actors users don't want to see in their feeds or receive annoying notifications from.
22 22
23| name | kind | description | expected tag items | 23| name | kind | description | expected tag items |
24| --- | --- | --- | --- | 24| --- | --- | --- | --- |
25| Mute list | 10000 | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags), `"word"` (lowercase string), `"e"` (threads) | 25| Mute list | 10000 | things the user doesn't want to see in their feeds | `"p"` (pubkeys), `"t"` (hashtags), `"word"` (lowercase string), `"e"` (threads) |
26| Pinned notes | 10001 | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) | 26| Pinned notes | 10001 | events the user intends to showcase in their profile page | `"e"` (kind:1 notes) |
27| Bookmarks | 10003 | uncategorized, "global" list of things a user wants to save | `"e"` (kind:1 notes), `"a"` (kind:30023 articles), `"t"` (hashtags), `"r"` (URLs) | 27| Bookmarks | 10003 | uncategorized, "global" list of things a user wants to save | `"e"` (kind:1 notes), `"a"` (kind:30023 articles), `"t"` (hashtags), `"r"` (URLs) |
28| Communities | 10004 | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) | 28| Communities | 10004 | [NIP-72](72.md) communities the user belongs to | `"a"` (kind:34550 community definitions) |
29| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) | 29| Public chats | 10005 | [NIP-28](28.md) chat channels the user is in | `"e"` (kind:40 channel definitions) |
30| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) | 30| Blocked relays | 10006 | relays clients should never connect to | `"relay"` (relay URLs) |
31| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) | 31| Search relays | 10007 | relays clients should use when performing search queries | `"relay"` (relay URLs) |
32| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group ids + mandatory relay URL) | 32| Simple groups | 10009 | [NIP-29](29.md) groups the user is in | `"group"` ([NIP-29](29.md) group ids + mandatory relay URL) |
33| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a"` (kind:30015 interest set) | 33| Interests | 10015 | topics a user may be interested in and pointers | `"t"` (hashtags) and `"a"` (kind:30015 interest set) |
34| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) | 34| Emojis | 10030 | user preferred emojis and pointers to emoji sets | `"emoji"` (see [NIP-30](30.md)) and `"a"` (kind:30030 emoji set) |
35| Good wiki authors | 10101 | [NIP-54](54.md) user recommended wiki authors | `"p"` (pubkeys) |
36| Good wiki relays | 10102 | [NIP-54](54.md) relays deemed to only host useful articles | `"relay"` (relay URLs) |
35 37
36## Sets 38## Sets
37 39
diff --git a/53.md b/53.md
index fad2622..0b1cb81 100644
--- a/53.md
+++ b/53.md
@@ -77,7 +77,7 @@ Event `kind:1311` is live chat's channel message. Clients MUST include the `a` t
77 77
78## Use Cases 78## Use Cases
79 79
80Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [live.snort.social](https://live.snort.social) and [nostrnests.com](https://nostrnests.com). 80Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [zap.stream](https://zap.stream).
81 81
82## Example 82## Example
83 83
diff --git a/54.md b/54.md
new file mode 100644
index 0000000..fe46918
--- /dev/null
+++ b/54.md
@@ -0,0 +1,117 @@
1NIP-54
2======
3
4Wiki
5----
6
7`draft` `optional`
8
9This NIP defines `kind:30818` (a _parameterized replaceable event_) for long-form text content similar to [NIP-23](23.md), but with one important difference: articles are meant to be descriptions, or encyclopedia entries, of particular subjects, and it's expected that multiple people will write articles about the exact same subjects, with either small variations or completely independent content.
10
11Articles are identified by lowercase, normalized ascii `d` tags.
12
13### Articles
14```jsonc
15{
16 "content": "A wiki is a hypertext publication collaboratively edited and managed by its own audience.",
17 "tags": [
18 ["d", "wiki"],
19 ["title", "Wiki"],
20 ]
21}
22```
23
24### `d` tag normalization rules
25
26- Any non-letter character MUST be converted to a `-`.
27- All letters MUST be converted to lowercase.
28
29### Content rules
30
31The content should be Markdown, following the same rules as of [NIP-23](23.md), although it takes some extra (optional) metadata tags:
32
33 - `title`: for when the display title should be different from the `d` tag.
34 - `summary`: for display in lists.
35 - `a` and `e`: for referencing the original event a wiki article was forked from.
36
37One extra functionality is added: **wikilinks**. Unlike normal Markdown links `[]()` that link to webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink.
38
39Wikilinks can take these two forms:
40
41 1. `[[Target Page]]` -- in this case it will link to the page `target-page` (according to `d` tag normalization rules above) and be displayed as `Target Page`;
42 2. `[[target page|see this]]` -- in this case it will link to the page `target-page`, but will be displayed as `see this`.
43
44### Merge Requests
45
46Event `kind:818` represents a request to merge from a forked article into the source. It is directed to a pubkey and references the original article and the modified event.
47
48[INSERT EVENT EXAMPLE]
49
50### Redirects
51
52Event `kind:30819` is also defined to stand for "wiki redirects", i.e. if one thinks `Shell structure` should redirect to `Thin-shell structure` they can issue one of these events instead of replicating the content. These events can be used for automatically redirecting between articles on a client, but also for generating crowdsourced "disambiguation" pages ([common in Wikipedia](https://en.wikipedia.org/wiki/Help:Disambiguation)).
53
54[INSERT EVENT EXAMPLE]
55
56How to decide what article to display
57-------------------------------------
58
59As there could be many articles for each given name, some kind of prioritization must be done by clients. Criteria for this should vary between users and clients, but some means that can be used are described below:
60
61### Reactions
62
63[NIP-25](25.md) reactions are very simple and can be used to create a simple web-of-trust between wiki article writers and their content. While just counting a raw number of "likes" is unproductive, reacting to any wiki article event with a `+` can be interpreted as a recommendation for that article specifically and a partial recommendation of the author of that article. When 2 or 3-level deep recommendations are followed, suddenly a big part of all the articles may have some form of tagging.
64
65### Relays
66
67[NIP-51](51.md) lists of relays can be created with the kind 10102 and then used by wiki clients in order to determine where to query articles first and to rank these differently in relation to other events fetched from other relays.
68
69### Contact lists
70
71[NIP-02](02.md) contact lists can form the basis of a recommendation system that is then expanded with relay lists and reaction lists through nested queries. These lists form a good starting point only because they are so widespread.
72
73### Wiki-related contact lists
74
75[NIP-51](51.md) lists can also be used to create a list of users that are trusted only in the context of wiki authorship or wiki curationship.
76
77Forks
78---------
79Wiki-events can tag other wiki-events with a `fork` marker to specify that this event came from a different version. Both `a` and `e` tags SHOULD be used and have the `fork` marker applied, to identify the exact version it was forked from.
80
81Deference
82---------
83Wiki-events can tag other wiki-events with a `defer` marker to indicate that it considers someone else's entry as a "better" version of itself. If using a `defer` marker both `a` and `e` tags SHOULD be used.
84
85This is a stronger signal of trust than a `+` reaction.
86
87This marker is useful when a user edits someone else's entry; if the original author includes the editor's changes and the editor doesn't want to keep/maintain an independent version, the `link` tag could effectively be a considered a "deletion" of the editor's version and putting that pubkey's WoT weight behind the original author's version.
88
89Why Markdown?
90-------------
91
92If the idea is to make a wiki then the most obvious text format to use is probably the mediawiki/wikitext format used by Wikipedia since it's widely deployed in all mediawiki installations and used for decades with great success. However, it turns out that format is very bloated and convoluted, has way too many features and probably because of that it doesn't have many alternative implementations out there, and the ones that exist are not complete and don't look very trustworthy. Also it is very much a centralized format that can probably be changed at the whims of the Wikipedia owners.
93
94On the other hand, Markdown has proven to work well for small scale wikis and one of the biggest wikis in the planet (which is not very often thought of as a wiki), [StackOverflow](https://stackoverflow.com) and its child sites, and also one of the biggest "personal wiki" software, [Obsidian](https://obsidian.md/). Markdown can probably deliver 95% of the functionality of wikitext. When augmented with tables, diagram generators and MathJax (which are common extensions that exist in the wild and can be included in this NIP) that rate probably goes to 99%, and its simplicity is a huge benefit that can't be overlooked. Wikitext format can also be transpíled into Markdown using Pandoc. Given all that, I think it's a reasonable suspicion that mediawiki is not inherently better than Markdown, the success of Wikipedia probably cannot be predicated on the syntax language choice.
95
96# Appendix 1: Merge requests
97Users can request other users to get their entries merged into someone else's entry by creating a `kind:818` event.
98
99```jsonc
100{
101 "content": "I added information about how to make hot ice-creams",
102 "kind": 818,
103 "tags": [
104 [ "a", "30818:<destination-pubkey>:hot-ice-creams", "<relay-url>" ],
105 [ "e", "<version-against-which-the-modification-was-made>", "<relay-url>' ],
106 [ "p", "<destination-pubkey>" ],
107 [ "e", "<version-to-be-merged>", "<relay-url>", "source" ]
108 ]
109}
110```
111
112`.content`: an optional explanation detailing why this merge is being requested.
113`a` tag: tag of the article which should be modified (i.e. the target of this merge request).
114`e` tag: optional version of the article in which this modifications is based
115`e` tag with `source` marker: the ID of the event that should be merged. This event id MUST be of a `kind:30818` as defined in this NIP.
116
117The destination-pubkey (the pubkey being requested to merge something into their article can create [[NIP-25]] reactions that tag the `kind:818` event with `+` or `-`
diff --git a/55.md b/55.md
new file mode 100644
index 0000000..4565e8c
--- /dev/null
+++ b/55.md
@@ -0,0 +1,538 @@
1# NIP-55
2
3## Android Signer Application
4
5`draft` `optional`
6
7This NIP describes a method for 2-way communication between an Android signer and any Nostr client on Android. The Android signer is an Android Application and the client can be a web client or an Android application.
8
9# Usage for Android applications
10
11The Android signer uses Intents and Content Resolvers to communicate between applications.
12
13To be able to use the Android signer in your application you should add this to your AndroidManifest.xml:
14
15```xml
16<queries>
17 <intent>
18 <action android:name="android.intent.action.VIEW" />
19 <category android:name="android.intent.category.BROWSABLE" />
20 <data android:scheme="nostrsigner" />
21 </intent>
22</queries>
23```
24
25Then you can use this function to check if there's a signer application installed:
26
27```kotlin
28fun isExternalSignerInstalled(context: Context): Boolean {
29 val intent =
30 Intent().apply {
31 action = Intent.ACTION_VIEW
32 data = Uri.parse("nostrsigner:")
33 }
34 val infos = context.packageManager.queryIntentActivities(intent, 0)
35 return infos.size > 0
36}
37```
38
39## Using Intents
40
41To get the result back from the Signer Application you should use `registerForActivityResult` or `rememberLauncherForActivityResult` in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result.
42
43```kotlin
44val launcher = rememberLauncherForActivityResult(
45 contract = ActivityResultContracts.StartActivityForResult(),
46 onResult = { result ->
47 if (result.resultCode != Activity.RESULT_OK) {
48 Toast.makeText(
49 context,
50 "Sign request rejected",
51 Toast.LENGTH_SHORT
52 ).show()
53 } else {
54 val signature = activityResult.data?.getStringExtra("signature")
55 // Do something with signature ...
56 }
57 }
58)
59```
60
61Create the Intent using the **nostrsigner** scheme:
62
63```kotlin
64val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$content"))
65```
66
67Set the Signer package name:
68
69```kotlin
70intent.`package` = "com.example.signer"
71```
72
73Send the Intent:
74
75```kotlin
76launcher.launch(intent)
77```
78
79### Methods
80
81- **get_public_key**
82 - params:
83
84 ```kotlin
85 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:"))
86 intent.`package` = "com.example.signer"
87 intent.putExtra("type", "get_public_key")
88 // You can send some default permissions for the user to authorize for ever
89 val permissions = listOf(
90 Permission(
91 type = "sign_event",
92 kind = 22242
93 ),
94 Permission(
95 type = "nip44_decrypt"
96 )
97 )
98 intent.putExtra("permissions", permissions.toJson())
99 context.startActivity(intent)
100 ```
101 - result:
102 - If the user approved intent it will return the **npub** in the signature field
103
104 ```kotlin
105 val npub = intent.data?.getStringExtra("signature")
106 // The package name of the signer application
107 val packageName = intent.data?.getStringExtra("package")
108 ```
109
110- **sign_event**
111 - params:
112
113 ```kotlin
114 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$eventJson"))
115 intent.`package` = "com.example.signer"
116 intent.putExtra("type", "sign_event")
117 // To handle results when not waiting between intents
118 intent.putExtra("id", event.id)
119 // Send the current logged in user npub
120 intent.putExtra("current_user", npub)
121
122 context.startActivity(intent)
123 ```
124 - result:
125 - If the user approved intent it will return the **signature**, **id** and **event** fields
126
127 ```kotlin
128 val signature = intent.data?.getStringExtra("signature")
129 // The id you sent
130 val id = intent.data?.getStringExtra("id")
131 val signedEventJson = intent.data?.getStringExtra("event")
132 ```
133
134- **nip04_encrypt**
135 - params:
136
137 ```kotlin
138 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$plaintext"))
139 intent.`package` = "com.example.signer"
140 intent.putExtra("type", "nip04_encrypt")
141 // to control the result in your application in case you are not waiting the result before sending another intent
142 intent.putExtra("id", "some_id")
143 // Send the current logged in user npub
144 intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
145 // Send the hex pubKey that will be used for encrypting the data
146 intent.putExtra("pubKey", pubKey)
147
148 context.startActivity(intent)
149 ```
150 - result:
151 - If the user approved intent it will return the **signature** and **id** fields
152
153 ```kotlin
154 val encryptedText = intent.data?.getStringExtra("signature")
155 // the id you sent
156 val id = intent.data?.getStringExtra("id")
157 ```
158
159- **nip44_encrypt**
160 - params:
161
162 ```kotlin
163 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$plaintext"))
164 intent.`package` = "com.example.signer"
165 intent.putExtra("type", "nip44_encrypt")
166 // to control the result in your application in case you are not waiting the result before sending another intent
167 intent.putExtra("id", "some_id")
168 // Send the current logged in user npub
169 intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
170 // Send the hex pubKey that will be used for encrypting the data
171 intent.putExtra("pubKey", pubKey)
172
173 context.startActivity(intent)
174 ```
175 - result:
176 - If the user approved intent it will return the **signature** and **id** fields
177
178 ```kotlin
179 val encryptedText = intent.data?.getStringExtra("signature")
180 // the id you sent
181 val id = intent.data?.getStringExtra("id")
182 ```
183
184- **nip04_decrypt**
185 - params:
186
187 ```kotlin
188 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$encryptedText"))
189 intent.`package` = "com.example.signer"
190 intent.putExtra("type", "nip04_decrypt")
191 // to control the result in your application in case you are not waiting the result before sending another intent
192 intent.putExtra("id", "some_id")
193 // Send the current logged in user npub
194 intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
195 // Send the hex pubKey that will be used for decrypting the data
196 intent.putExtra("pubKey", pubKey)
197
198 context.startActivity(intent)
199 ```
200 - result:
201 - If the user approved intent it will return the **signature** and **id** fields
202
203 ```kotlin
204 val plainText = intent.data?.getStringExtra("signature")
205 // the id you sent
206 val id = intent.data?.getStringExtra("id")
207 ```
208
209- **nip44_decrypt**
210 - params:
211
212 ```kotlin
213 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$encryptedText"))
214 intent.`package` = "com.example.signer"
215 intent.putExtra("type", "nip04_decrypt")
216 // to control the result in your application in case you are not waiting the result before sending another intent
217 intent.putExtra("id", "some_id")
218 // Send the current logged in user npub
219 intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
220 // Send the hex pubKey that will be used for decrypting the data
221 intent.putExtra("pubKey", pubKey)
222
223 context.startActivity(intent)
224 ```
225 - result:
226 - If the user approved intent it will return the **signature** and **id** fields
227
228 ```kotlin
229 val plainText = intent.data?.getStringExtra("signature")
230 // the id you sent
231 val id = intent.data?.getStringExtra("id")
232 ```
233
234- **decrypt_zap_event**
235 - params:
236
237 ```kotlin
238 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("nostrsigner:$eventJson"))
239 intent.`package` = "com.example.signer"
240 intent.putExtra("type", "decrypt_zap_event")
241 // to control the result in your application in case you are not waiting the result before sending another intent
242 intent.putExtra("id", "some_id")
243 // Send the current logged in user npub
244 intent.putExtra("current_user", account.keyPair.pubKey.toNpub())
245 context.startActivity(intent)
246 ```
247 - result:
248 - If the user approved intent it will return the **signature** and **id** fields
249
250 ```kotlin
251 val eventJson = intent.data?.getStringExtra("signature")
252 // the id you sent
253 val id = intent.data?.getStringExtra("id")
254 ```
255
256## Using Content Resolver
257
258To get the result back from Signer Application you should use contentResolver.query in Kotlin. If you are using another framework check the documentation of your framework or a third party library to get the result.
259
260If the user did not check the "remember my choice" option, the npub is not in Signer Application or the signer type is not recognized the `contentResolver` will return null
261
262For the SIGN_EVENT type Signer Application returns two columns "signature" and "event". The column event is the signed event json
263
264For the other types Signer Application returns the column "signature"
265
266If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application
267
268### Methods
269
270- **get_public_key**
271 - params:
272
273 ```kotlin
274 val result = context.contentResolver.query(
275 Uri.parse("content://com.example.signer.GET_PUBLIC_KEY"),
276 listOf("login"),
277 null,
278 null,
279 null
280 )
281 ```
282 - result:
283 - Will return the **npub** in the signature column
284
285 ```kotlin
286 if (result == null) return
287
288 if (result.moveToFirst()) {
289 val index = it.getColumnIndex("signature")
290 if (index < 0) return
291 val npub = it.getString(index)
292 }
293 ```
294
295- **sign_event**
296 - params:
297
298 ```kotlin
299 val result = context.contentResolver.query(
300 Uri.parse("content://com.example.signer.SIGN_EVENT"),
301 listOf("$eventJson", "", "${logged_in_user_npub}"),
302 null,
303 null,
304 null
305 )
306 ```
307 - result:
308 - Will return the **signature** and the **event** columns
309
310 ```kotlin
311 if (result == null) return
312
313 if (result.moveToFirst()) {
314 val index = it.getColumnIndex("signature")
315 val indexJson = it.getColumnIndex("event")
316 val signature = it.getString(index)
317 val eventJson = it.getString(indexJson)
318 }
319 ```
320
321- **nip04_encrypt**
322 - params:
323
324 ```kotlin
325 val result = context.contentResolver.query(
326 Uri.parse("content://com.example.signer.NIP04_ENCRYPT"),
327 listOf("$plainText", "${hex_pub_key}", "${logged_in_user_npub}"),
328 null,
329 null,
330 null
331 )
332 ```
333 - result:
334 - Will return the **signature** column
335
336 ```kotlin
337 if (result == null) return
338
339 if (result.moveToFirst()) {
340 val index = it.getColumnIndex("signature")
341 val encryptedText = it.getString(index)
342 }
343 ```
344
345- **nip44_encrypt**
346 - params:
347
348 ```kotlin
349 val result = context.contentResolver.query(
350 Uri.parse("content://com.example.signer.NIP44_ENCRYPT"),
351 listOf("$plainText", "${hex_pub_key}", "${logged_in_user_npub}"),
352 null,
353 null,
354 null
355 )
356 ```
357 - result:
358 - Will return the **signature** column
359
360 ```kotlin
361 if (result == null) return
362
363 if (result.moveToFirst()) {
364 val index = it.getColumnIndex("signature")
365 val encryptedText = it.getString(index)
366 }
367 ```
368
369- **nip04_decrypt**
370 - params:
371
372 ```kotlin
373 val result = context.contentResolver.query(
374 Uri.parse("content://com.example.signer.NIP04_DECRYPT"),
375 listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_npub}"),
376 null,
377 null,
378 null
379 )
380 ```
381 - result:
382 - Will return the **signature** column
383
384 ```kotlin
385 if (result == null) return
386
387 if (result.moveToFirst()) {
388 val index = it.getColumnIndex("signature")
389 val encryptedText = it.getString(index)
390 }
391 ```
392
393- **nip44_decrypt**
394 - params:
395
396 ```kotlin
397 val result = context.contentResolver.query(
398 Uri.parse("content://com.example.signer.NIP44_DECRYPT"),
399 listOf("$encryptedText", "${hex_pub_key}", "${logged_in_user_npub}"),
400 null,
401 null,
402 null
403 )
404 ```
405 - result:
406 - Will return the **signature** column
407
408 ```kotlin
409 if (result == null) return
410
411 if (result.moveToFirst()) {
412 val index = it.getColumnIndex("signature")
413 val encryptedText = it.getString(index)
414 }
415 ```
416
417- **decrypt_zap_event**
418 - params:
419
420 ```kotlin
421 val result = context.contentResolver.query(
422 Uri.parse("content://com.example.signer.DECRYPT_ZAP_EVENT"),
423 listOf("$eventJson", "", "${logged_in_user_npub}"),
424 null,
425 null,
426 null
427 )
428 ```
429 - result:
430 - Will return the **signature** column
431
432 ```kotlin
433 if (result == null) return
434
435 if (result.moveToFirst()) {
436 val index = it.getColumnIndex("signature")
437 val eventJson = it.getString(index)
438 }
439 ```
440
441# Usage for Web Applications
442
443Since web applications can't receive a result from the intent, you should add a modal to paste the signature or the event json or create a callback url.
444
445If you send the callback url parameter, Signer Application will send the result to the url.
446
447If you don't send a callback url, Signer Application will copy the result to the clipboard.
448
449You can configure the `returnType` to be **signature** or **event**.
450
451Android intents and browser urls have limitations, so if you are using the `returnType` of **event** consider using the parameter **compressionType=gzip** that will return "Signer1" + Base64 gzip encoded event json
452
453## Methods
454
455- **get_public_key**
456 - params:
457
458 ```js
459 window.href = `nostrsigner:?compressionType=none&returnType=signature&type=get_public_key&callbackUrl=https://example.com/?event=`;
460 ```
461
462- **sign_event**
463 - params:
464
465 ```js
466 window.href = `nostrsigner:${eventJson}?compressionType=none&returnType=signature&type=sign_event&callbackUrl=https://example.com/?event=`;
467 ```
468
469- **nip04_encrypt**
470 - params:
471
472 ```js
473 window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_encrypt&callbackUrl=https://example.com/?event=`;
474 ```
475
476- **nip44_encrypt**
477 - params:
478
479 ```js
480 window.href = `nostrsigner:${plainText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_encrypt&callbackUrl=https://example.com/?event=`;
481 ```
482
483- **nip04_decrypt**
484 - params:
485
486 ```js
487 window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip04_decrypt&callbackUrl=https://example.com/?event=`;
488 ```
489
490- **nip44_decrypt**
491 - params:
492
493 ```js
494 window.href = `nostrsigner:${encryptedText}?pubKey=${hex_pub_key}&compressionType=none&returnType=signature&type=nip44_decrypt&callbackUrl=https://example.com/?event=`;
495 ```
496
497- **decrypt_zap_event**
498 - params:
499
500 ```js
501 window.href = `nostrsigner:${eventJson}?compressionType=none&returnType=signature&type=decrypt_zap_event&callbackUrl=https://example.com/?event=`;
502 ```
503
504## Example
505
506```js
507<!DOCTYPE html>
508<html lang="en">
509<head>
510 <meta charset="UTF-8">
511 <meta name="viewport" content="width=device-width, initial-scale=1.0">
512 <title>Document</title>
513</head>
514<body>
515 <h1>Test</h1>
516
517 <script>
518 window.onload = function() {
519 var url = new URL(window.location.href);
520 var params = url.searchParams;
521 if (params) {
522 var param1 = params.get("event");
523 if (param1) alert(param1)
524 }
525 let json = {
526 kind: 1,
527 content: "test"
528 }
529 let encodedJson = encodeURIComponent(JSON.stringify(json))
530 var newAnchor = document.createElement("a");
531 newAnchor.href = `nostrsigner:${encodedJson}?compressionType=none&returnType=signature&type=sign_event&callbackUrl=https://example.com/?event=`;
532 newAnchor.textContent = "Open External Signer";
533 document.body.appendChild(newAnchor)
534 }
535 </script>
536</body>
537</html>
538```
diff --git a/56.md b/56.md
index a2861e3..fc8d898 100644
--- a/56.md
+++ b/56.md
@@ -4,10 +4,12 @@ NIP-56
4Reporting 4Reporting
5--------- 5---------
6 6
7`draft` `optional` 7`optional`
8 8
9A report is a `kind 1984` note that is used to report other notes for spam, 9A report is a `kind 1984` event that signals to users and relays that
10illegal and explicit content. 10some referenced content is objectionable. The definition of objectionable is
11obviously subjective and all agents on the network (users, apps, relays, etc.)
12may consume and take action on them as they see fit.
11 13
12The `content` MAY contain additional information submitted by the entity 14The `content` MAY contain additional information submitted by the entity
13reporting the content. 15reporting the content.
@@ -24,10 +26,12 @@ A `report type` string MUST be included as the 3rd entry to the `e` or `p` tag
24being reported, which consists of the following report types: 26being reported, which consists of the following report types:
25 27
26- `nudity` - depictions of nudity, porn, etc. 28- `nudity` - depictions of nudity, porn, etc.
29- `malware` - virus, trojan horse, worm, robot, spyware, adware, back door, ransomware, rootkit, kidnapper, etc.
27- `profanity` - profanity, hateful speech, etc. 30- `profanity` - profanity, hateful speech, etc.
28- `illegal` - something which may be illegal in some jurisdiction 31- `illegal` - something which may be illegal in some jurisdiction
29- `spam` - spam 32- `spam` - spam
30- `impersonation` - someone pretending to be someone else 33- `impersonation` - someone pretending to be someone else
34- `other` - for reports that don't fit in the above categories
31 35
32Some report tags only make sense for profile reports, such as `impersonation` 36Some report tags only make sense for profile reports, such as `impersonation`
33 37
diff --git a/58.md b/58.md
index 0ecef25..4a9ed4c 100644
--- a/58.md
+++ b/58.md
@@ -83,7 +83,7 @@ Clients SHOULD attempt to render the most appropriate badge thumbnail according
83 ["name", "Medal of Bravery"], 83 ["name", "Medal of Bravery"],
84 ["description", "Awarded to users demonstrating bravery"], 84 ["description", "Awarded to users demonstrating bravery"],
85 ["image", "https://nostr.academy/awards/bravery.png", "1024x1024"], 85 ["image", "https://nostr.academy/awards/bravery.png", "1024x1024"],
86 ["thumb", "https://nostr.academy/awards/bravery_256x256.png", "256x256"], 86 ["thumb", "https://nostr.academy/awards/bravery_256x256.png", "256x256"]
87 ], 87 ],
88 ... 88 ...
89} 89}
@@ -99,7 +99,7 @@ Clients SHOULD attempt to render the most appropriate badge thumbnail according
99 "tags": [ 99 "tags": [
100 ["a", "30009:alice:bravery"], 100 ["a", "30009:alice:bravery"],
101 ["p", "bob", "wss://relay"], 101 ["p", "bob", "wss://relay"],
102 ["p", "charlie", "wss://relay"], 102 ["p", "charlie", "wss://relay"]
103 ], 103 ],
104 ... 104 ...
105} 105}
@@ -117,7 +117,7 @@ Honorable Bob The Brave:
117 ["a", "30009:alice:bravery"], 117 ["a", "30009:alice:bravery"],
118 ["e", "<bravery badge award event id>", "wss://nostr.academy"], 118 ["e", "<bravery badge award event id>", "wss://nostr.academy"],
119 ["a", "30009:alice:honor"], 119 ["a", "30009:alice:honor"],
120 ["e", "<honor badge award event id>", "wss://nostr.academy"], 120 ["e", "<honor badge award event id>", "wss://nostr.academy"]
121 ], 121 ],
122 ... 122 ...
123} 123}
diff --git a/59.md b/59.md
index 7eff2b8..4dc857f 100644
--- a/59.md
+++ b/59.md
@@ -155,7 +155,7 @@ Sign the `gift wrap` using the random key generated in the previous step.
155 "created_at": 1703021488, 155 "created_at": 1703021488,
156 "pubkey": "18b1a75918f1f2c90c23da616bce317d36e348bcf5f7ba55e75949319210c87c", 156 "pubkey": "18b1a75918f1f2c90c23da616bce317d36e348bcf5f7ba55e75949319210c87c",
157 "id": "5c005f3ccf01950aa8d131203248544fb1e41a0d698e846bd419cec3890903ac", 157 "id": "5c005f3ccf01950aa8d131203248544fb1e41a0d698e846bd419cec3890903ac",
158 "sig": "35fabdae4634eb630880a1896a886e40fd6ea8a60958e30b89b33a93e6235df750097b04f9e13053764251b8bc5dd7e8e0794a3426a90b6bcc7e5ff660f54259" 158 "sig": "35fabdae4634eb630880a1896a886e40fd6ea8a60958e30b89b33a93e6235df750097b04f9e13053764251b8bc5dd7e8e0794a3426a90b6bcc7e5ff660f54259",
159 "tags": [["p", "166bf3765ebd1fc55decfe395beff2ea3b2a4e0a8946e7eb578512b555737c99"]], 159 "tags": [["p", "166bf3765ebd1fc55decfe395beff2ea3b2a4e0a8946e7eb578512b555737c99"]],
160} 160}
161``` 161```
diff --git a/71.md b/71.md
new file mode 100644
index 0000000..a811434
--- /dev/null
+++ b/71.md
@@ -0,0 +1,118 @@
1NIP-71
2======
3
4Video Events
5---------------
6
7`draft` `optional`
8
9This specification defines video events representing a dedicated post of externally hosted content. These video events are _parameterized replaceable_ and deletable per [NIP-09](09.md).
10
11Unlike a `kind 1` event with a video attached, Video Events are meant to contain all additional metadata concerning the subject media and to be surfaced in video-specific clients rather than general micro-blogging clients. The thought is for events of this kind to be referenced in a Netflix, YouTube, or TikTok like nostr client where the video itself is at the center of the experience.
12
13## Video Events
14
15There are two types of video events represented by different kinds: horizontal and vertical video events. This is meant to allow clients to cater to each as the viewing experience for horizontal (landscape) videos is often different than that of vertical (portrait) videos (Stories, Reels, Shorts, etc).
16
17#### Format
18
19The format uses a parameterized replaceable event kind `34235` for horizontal videos and `34236` for vertical videos.
20
21The `.content` of these events is a summary or description on the video content.
22
23The list of tags are as follows:
24* `d` (required) universally unique identifier (UUID). Generated by the client creating the video event.
25* `url` (required) the url to the video file
26* `m` a string indicating the data type of the file. The [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) format must be used, and they should be lowercase.
27* `title` (required) title of the video
28* `"published_at"`, for the timestamp in unix seconds (stringified) of the first time the video was published
29* `x` containing the SHA-256 hexencoded string of the file.
30* `size` (optional) size of file in bytes
31* `dim` (optional) size of file in pixels in the form `<width>x<height>`
32* `duration` (optional) video duration in seconds
33* `magnet` (optional) URI to magnet file
34* `i` (optional) torrent infohash
35* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
36* `thumb` (optional) url of thumbnail with same aspect ratio
37* `image` (optional) url of preview image with same dimensions
38* `content-warning` (optional) warning about content of NSFW video
39* `alt` (optional) description for accessibility
40* `segment` (optional, repeated) start timestamp in format `HH:MM:SS.sss`, end timestamp in format `HH:MM:SS.sss`, chapter/segment title, chapter thumbnail-url
41* `t` (optional, repeated) hashtag to categorize video
42* `p` (optional, repeated) 32-bytes hex pubkey of a participant in the video, optional recommended relay URL
43* `r` (optional, repeated) references / links to web pages
44
45```json
46{
47 "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
48 "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
49 "created_at": <Unix timestamp in seconds>,
50 "kind": 34235 | 34236,
51 "content": "<summary / description of video>",
52 "tags": [
53 ["d", "<UUID>"],
54
55 ["title", "<title of video>"],
56 ["thumb", "<thumbnail image for video>"],
57 ["published_at", "<unix timestamp>"],
58 ["alt", <description>],
59
60 // Video Data
61 ["url",<string with URI of file>],
62 ["m", <MIME type>],
63 ["x",<Hash SHA-256>],
64 ["size", <size of file in bytes>],
65 ["duration", <duration of video in seconds>],
66 ["dim", <size of file in pixels>],
67 ["magnet",<magnet URI> ],
68 ["i",<torrent infohash>],
69 ["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
70 ["content-warning", "<reason>"],
71 ["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
72
73 // Participants
74 ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>"],
75 ["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>"],
76
77 // Hashtags
78 ["t", "<tag>"],
79 ["t", "<tag>"],
80
81 // Reference links
82 ["r", "<url>"],
83 ["r", "<url>"]
84 ]
85}
86```
87
88## Video View
89
90A video event view is a response to a video event to track a user's view or progress viewing the video.
91
92### Format
93
94The format uses a parameterized replaceable event kind `34237`.
95
96The `.content` of these events is optional and could be a free-form note that acts like a bookmark for the user.
97
98The list of tags are as follows:
99* `a` (required) reference tag to kind `34235` or `34236` video event being viewed
100* `d` (required) same as `a` reference tag value
101* `viewed` (optional, repeated) timestamp of the user's start time in seconds, timestamp of the user's end time in seconds
102
103
104```json
105{
106 "id": <32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>,
107 "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
108 "created_at": <Unix timestamp in seconds>,
109 "kind": 34237,
110 "content": "<note>",
111 "tags": [
112 ["a", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>", "<optional relay url>"],
113 ["e", "<event-id", "<relay-url>"]
114 ["d", "<34235 | 34236>:<video event author pubkey>:<d-identifier of video event>"],
115 ["viewed", <start>, <end>],
116 ]
117}
118```
diff --git a/72.md b/72.md
index 4bafce0..5a8be0a 100644
--- a/72.md
+++ b/72.md
@@ -76,7 +76,7 @@ The post-approval event MUST include `a` tags of the communities the moderator i
76 76
77It's recommended that multiple moderators approve posts to avoid deleting them from the community when a moderator is removed from the owner's list. In case the full list of moderators must be rotated, the new moderator set must sign new approvals for posts in the past or the community will restart. The owner can also periodically copy and re-sign of each moderator's approval events to make sure posts don't disappear with moderators. 77It's recommended that multiple moderators approve posts to avoid deleting them from the community when a moderator is removed from the owner's list. In case the full list of moderators must be rotated, the new moderator set must sign new approvals for posts in the past or the community will restart. The owner can also periodically copy and re-sign of each moderator's approval events to make sure posts don't disappear with moderators.
78 78
79Post Approvals of replaceable events can be created in three ways: (i) by tagging the replaceable event as an `e` tag if moderators want to approve each individual change to the repleceable event; (ii) by tagging the replaceable event as an `a` tag if the moderator authorizes the replaceable event author to make changes without additional approvals and (iii) by tagging the replaceable event with both its `e` and `a` tag which empowers clients to display the original and updated versions of the event, with appropriate remarks in the UI. Since relays are instructed to delete old versions of a replaceable event, the `.content` of an `e`-approval MUST have the specific version of the event or Clients might not be able to find that version of the content anywhere. 79Post Approvals of replaceable events can be created in three ways: (i) by tagging the replaceable event as an `e` tag if moderators want to approve each individual change to the replaceable event; (ii) by tagging the replaceable event as an `a` tag if the moderator authorizes the replaceable event author to make changes without additional approvals and (iii) by tagging the replaceable event with both its `e` and `a` tag which empowers clients to display the original and updated versions of the event, with appropriate remarks in the UI. Since relays are instructed to delete old versions of a replaceable event, the `.content` of an `e`-approval MUST have the specific version of the event or Clients might not be able to find that version of the content anywhere.
80 80
81Clients SHOULD evaluate any non-`34550:*` `a` tag as posts to be included in all `34550:*` `a` tags. 81Clients SHOULD evaluate any non-`34550:*` `a` tag as posts to be included in all `34550:*` `a` tags.
82 82
diff --git a/90.md b/90.md
index 241eb38..5a15ebb 100644
--- a/90.md
+++ b/90.md
@@ -162,8 +162,8 @@ Service providers can give feedback about a job back to the customer.
162``` 162```
163 163
164* `content`: Either empty or a job-result (e.g. for partial-result samples) 164* `content`: Either empty or a job-result (e.g. for partial-result samples)
165* `amount` tag: as defined in the [Job Result](#job-result) section. 165* `amount` tag: as defined in the [Job Result](#job-result-kind6000-6999) section.
166* `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument. 166* `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Job Feedback Status](#job-feedback-status) defines status. Extra human-readable information can be added as an extra argument.
167 167
168* NOTE: If the input params requires input to be encrypted, then `content` field will have encrypted payload with `p` tag as key. 168* NOTE: If the input params requires input to be encrypted, then `content` field will have encrypted payload with `p` tag as key.
169 169
@@ -177,7 +177,7 @@ Service providers can give feedback about a job back to the customer.
177| `success` | Service Provider successfully processed the job. | 177| `success` | Service Provider successfully processed the job. |
178| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. | 178| `partial` | Service Provider partially processed the job. The `.content` might include a sample of the partial results. |
179 179
180Any job feedback event MIGHT include results in the `.content` field, as described in the [Job Result](#job-result) section. This is useful for service providers to provide a sample of the results that have been processed so far. 180Any job feedback event MIGHT include results in the `.content` field, as described in the [Job Result](#job-result-kind6000-6999) section. This is useful for service providers to provide a sample of the results that have been processed so far.
181 181
182 182
183# Protocol Flow 183# Protocol Flow
@@ -199,7 +199,7 @@ Some service providers might choose to submit a `payment-required` as the first
199It's not up to this NIP to define how individual vending machines should choose to run their business. 199It's not up to this NIP to define how individual vending machines should choose to run their business.
200 200
201# Cancellation 201# Cancellation
202A job request might be cancelled by publishing a `kind:5` delete request event tagging the job request event. 202A job request might be canceled by publishing a `kind:5` delete request event tagging the job request event.
203 203
204# Appendix 1: Job chaining 204# Appendix 1: Job chaining
205A Customer MAY request multiple jobs to be processed as a chain, where the output of a job is the input of another job. (e.g. podcast transcription -> summarization of the transcription). This is done by specifying as input an event id of a different job with the `job` type. 205A Customer MAY request multiple jobs to be processed as a chain, where the output of a job is the input of another job. (e.g. podcast transcription -> summarization of the transcription). This is done by specifying as input an event id of a different job with the `job` type.
diff --git a/96.md b/96.md
index f7d901f..2f25351 100644
--- a/96.md
+++ b/96.md
@@ -1,8 +1,6 @@
1NIP-96 1# NIP-96
2======
3 2
4HTTP File Storage Integration 3## HTTP File Storage Integration
5-----------------------------
6 4
7`draft` `optional` 5`draft` `optional`
8 6
@@ -84,46 +82,46 @@ it must use the "api_url" field instead.
84 82
85See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers. 83See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers.
86 84
85## Auth
86
87When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (**optionally** with the encoded `payload` tag set to the base64-encoded 256-bit SHA-256 hash of the file - not the hash of the whole request body).
88
87## Upload 89## Upload
88 90
89A file can be uploaded one at a time to `https://your-file-server.example/custom-api-path` (route from `https://your-file-server.example/.well-known/nostr/nip96.json` "api_url" field) as `multipart/form-data` content type using `POST` method with the file object set to the `file` form data field. 91`POST $api_url` as `multipart/form-data`.
90 92
91`Clients` must add an [NIP-98](98.md) `Authorization` header (**optionally** with the encoded `payload` tag set to the base64-encoded 256-bit SHA-256 hash of the file - not the hash of the whole request body). 93**AUTH required**
92If using an html form, use an `Authorization` form data field instead.
93 94
94These following **optional** form data fields MAY be used by `servers` and SHOULD be sent by `clients`: 95List of form fields:
95- `expiration`: string of the UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this;
96- `size`: string of the file byte size. This is just a value the server can use to reject early if the file size exceeds the server limits;
97- `alt`: (recommended) strict description text for visibility-impaired users;
98- `caption`: loose description;
99- `media_type`: "avatar" or "banner". Informs the server if the file will be used as an avatar or banner. If absent, the server will interpret it as a normal upload, without special treatment;
100- `content_type`: mime type such as "image/jpeg". This is just a value the server can use to reject early if the mime type isn't supported.
101 96
97- `file`: **REQUIRED** the file to upload
98- `caption`: **RECOMMENDED** loose description;
99- `expiration`: UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this.
100- `size`: File byte size. This is just a value the server can use to reject early if the file size exceeds the server limits.
101- `alt`: **RECOMMENDED** strict description text for visibility-impaired users.
102- `media_type`: "avatar" or "banner". Informs the server if the file will be used as an avatar or banner. If absent, the server will interpret it as a normal upload, without special treatment.
103- `content_type`: mime type such as "image/jpeg". This is just a value the server can use to reject early if the mime type isn't supported.
104- `no_transform`: "true" asks server not to transform the file and serve the uploaded file as is, may be rejected.
102 105
103Others custom form data fields may be used depending on specific `server` support. 106Others custom form data fields may be used depending on specific `server` support.
104The `server` isn't required to store any metadata sent by `clients`. 107The `server` isn't required to store any metadata sent by `clients`.
105 108
106Note for `clients`: if using an HTML form, it is important for the `file` form field to be the **last** one, or be re-ordered right before sending or be appended as the last field of XHR2's FormData object.
107
108The `filename` embedded in the file may not be honored by the `server`, which could internally store just the SHA-256 hash value as the file name, ignoring extra metadata. 109The `filename` embedded in the file may not be honored by the `server`, which could internally store just the SHA-256 hash value as the file name, ignoring extra metadata.
109The hash is enough to uniquely identify a file, that's why it will be used on the "download" and "delete" routes. 110The hash is enough to uniquely identify a file, that's why it will be used on the `download` and `delete` routes.
110
111The `server` MUST link the user's `pubkey` string (which is embedded in the decoded header value) as the owner of the file so to later allow them to delete the file.
112Note that if a file with the same hash of a previously received file (so the same file) is uploaded by another user, the server doesn't need to store the new file.
113It should just add the new user's `pubkey` to the list of the owners of the already stored file with said hash (if it wants to save space by keeping just one copy of the same file, because multiple uploads of the same file results in the same file hash).
114
115The `server` MAY also store the `Authorization` header/field value (decoded or not) for accountability purpose as this proves that the user with the unique pubkey did ask for the upload of the file with a specific hash. However, storing the pubkey is sufficient to establish ownership.
116 111
117The `server` MUST reject with 413 Payload Too Large if file size exceeds limits. 112The `server` MUST link the user's `pubkey` string as the owner of the file so to later allow them to delete the file.
118 113
119The `server` MUST reject with 400 Bad Request status if some fields are invalid. 114`no_transform` can be used to replicate a file to multiple servers for redundancy, clients can use the [server list](#selecting-a-server) to find alternative servers which might contain the same file. When uploading a file and requesting `no_transform` clients should check that the hash matches in the response in order to detect if the file was modified.
120 115
121The `server` MUST reply to the upload with 200 OK status if the `payload` tag value contains an already used SHA-256 hash (if file is already owned by the same pubkey) or reject the upload with 403 Forbidden status if it isn't the same of the received file. 116### Response codes
122 117
123The `server` MAY reject the upload with 402 Payment Required status if the user has a pending payment (Payment flow is not strictly required. Server owners decide if the storage is free or not. Monetization schemes may be added later to correlated NIPs.). 118- `200 OK`: File upload exists, but is successful (Existing hash)
124 119- `201 Created`: File upload successful (New hash)
125On successful uploads the `server` MUST reply with **201 Created** HTTP status code or **202 Accepted** if a `processing_url` field is added 120- `202 Accepted`: File upload is awaiting processing, see [Delayed Processing](#delayed-processing) section
126to the response so that the `client` can follow the processing status (see [Delayed Processing](#delayed-processing) section). 121- `413 Payload Too Large`: File size exceeds limit
122- `400 Bad Request`: Form data is invalid or not supported.
123- `403 Forbidden`: User is not allowed to upload or the uploaded file hash didnt match the hash included in the `Authorization` header `payload` tag.
124- `402 Payment Required`: Payment is required by the server, **this flow is undefined**.
127 125
128The upload response is a json object as follows: 126The upload response is a json object as follows:
129 127
@@ -179,11 +177,13 @@ The upload response is a json object as follows:
179 177
180Note that if the server didn't apply any transformation to the received file, both `nip94_event.tags.*.ox` and `nip94_event.tags.*.x` fields will have the same value. The server MUST link the saved file to the SHA-256 hash of the **original** file before any server transformations (the `nip94_event.tags.*.ox` tag value). The **original** file's SHA-256 hash will be used to identify the saved file when downloading or deleting it. 178Note that if the server didn't apply any transformation to the received file, both `nip94_event.tags.*.ox` and `nip94_event.tags.*.x` fields will have the same value. The server MUST link the saved file to the SHA-256 hash of the **original** file before any server transformations (the `nip94_event.tags.*.ox` tag value). The **original** file's SHA-256 hash will be used to identify the saved file when downloading or deleting it.
181 179
182`Clients` may upload the same file to one or many `servers`. 180`clients` may upload the same file to one or many `servers`.
183After successful upload, the `client` may optionally generate and send to any set of nostr `relays` a [NIP-94](94.md) event by including the missing fields. 181After successful upload, the `client` may optionally generate and send to any set of nostr `relays` a [NIP-94](94.md) event by including the missing fields.
184 182
185Alternatively, instead of using NIP-94, the `client` can share or embed on a nostr note just the above url. 183Alternatively, instead of using NIP-94, the `client` can share or embed on a nostr note just the above url.
186 184
185`clients` may also use the tags from the `nip94_event` to construct an `imeta` tag
186
187### Delayed Processing 187### Delayed Processing
188 188
189Sometimes the server may want to place the uploaded file in a processing queue for deferred file processing. 189Sometimes the server may want to place the uploaded file in a processing queue for deferred file processing.
@@ -219,7 +219,7 @@ However, for all file actions, such as download and deletion, the **original** f
219 219
220## Download 220## Download
221 221
222`Servers` must make available the route `https://your-file-server.example/custom-api-path/<sha256-file-hash>(.ext)` (route taken from `https://your-file-server.example/.well-known/nostr/nip96.json` "api_url" or "download_url" field) with `GET` method for file download. 222`GET $api_url/<sha256-hash>(.ext)`
223 223
224The primary file download url informed at the upload's response field `nip94_event.tags.*.url` 224The primary file download url informed at the upload's response field `nip94_event.tags.*.url`
225can be that or not (it can be any non-standard url the server wants). 225can be that or not (it can be any non-standard url the server wants).
@@ -227,17 +227,17 @@ If not, the server still MUST also respond to downloads at the standard url
227mentioned on the previous paragraph, to make it possible for a client 227mentioned on the previous paragraph, to make it possible for a client
228to try downloading a file on any NIP-96 compatible server by knowing just the SHA-256 file hash. 228to try downloading a file on any NIP-96 compatible server by knowing just the SHA-256 file hash.
229 229
230Note that the "\<sha256-file-hash\>" part is from the **original** file, **not** from the **transformed** file if the uploaded file went through any server transformation. 230Note that the "\<sha256-hash\>" part is from the **original** file, **not** from the **transformed** file if the uploaded file went through any server transformation.
231 231
232Supporting ".ext", meaning "file extension", is required for `servers`. It is optional, although recommended, for `clients` to append it to the path. 232Supporting ".ext", meaning "file extension", is required for `servers`. It is optional, although recommended, for `clients` to append it to the path.
233When present it may be used by `servers` to know which `Content-Type` header to send (e.g.: "Content-Type": "image/png" for ".png" extension). 233When present it may be used by `servers` to know which `Content-Type` header to send (e.g.: "Content-Type": "image/png" for ".png" extension).
234The file extension may be absent because the hash is the only needed string to uniquely identify a file. 234The file extension may be absent because the hash is the only needed string to uniquely identify a file.
235 235
236Example: `https://your-file-server.example/custom-api-path/719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b.png` 236Example: `$api_url/719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b.png`
237 237
238### Media Transformations 238### Media Transformations
239 239
240`Servers` may respond to some media transformation query parameters and ignore those they don't support by serving 240`servers` may respond to some media transformation query parameters and ignore those they don't support by serving
241the original media file without transformations. 241the original media file without transformations.
242 242
243#### Image Transformations 243#### Image Transformations
@@ -245,23 +245,23 @@ the original media file without transformations.
245##### Resizing 245##### Resizing
246 246
247Upon upload, `servers` may create resized image variants, such as thumbnails, respecting the original aspect ratio. 247Upon upload, `servers` may create resized image variants, such as thumbnails, respecting the original aspect ratio.
248`Clients` may use the `w` query parameter to request an image version with the desired pixel width. 248`clients` may use the `w` query parameter to request an image version with the desired pixel width.
249`Servers` can then serve the variant with the closest width to the parameter value 249`servers` can then serve the variant with the closest width to the parameter value
250or an image variant generated on the fly. 250or an image variant generated on the fly.
251 251
252Example: `https://your-file-server.example/custom-api-path/<sha256-file-hash>.png?w=32` 252Example: `$api_url/<sha256-hash>.png?w=32`
253 253
254## Deletion 254## Deletion
255 255
256`Servers` must make available the route `https://deletion.domain/deletion-path/<sha256-file-hash>(.ext)` (route taken from `https://your-file-server.example/.well-known/nostr/nip96.json` "api_url" field) with `DELETE` method for file deletion. 256`DELETE $api_url/<sha256-hash>(.ext)`
257 257
258Note that the "\<sha256-file-hash\>" part is from the **original** file, **not** from the **transformed** file if the uploaded file went through any server transformation. 258**AUTH required**
259 259
260The extension is optional as the file hash is the only needed file identification. 260Note that the `/<sha256-hash>` part is from the **original** file, **not** from the **transformed** file if the uploaded file went through any server transformation.
261 261
262`Clients` should send a `DELETE` request to the server deletion route in the above format. It must include a NIP-98 `Authorization` header. 262The extension is optional as the file hash is the only needed file identification.
263 263
264The `server` should reject deletes from users other than the original uploader. The `pubkey` encoded on the header value identifies the user. 264The `server` should reject deletes from users other than the original uploader with the appropriate http response code (403 Forbidden).
265 265
266It should be noted that more than one user may have uploaded the same file (with the same hash). In this case, a delete must not really delete the file but just remove the user's `pubkey` from the file owners list (considering the server keeps just one copy of the same file, because multiple uploads of the same file results 266It should be noted that more than one user may have uploaded the same file (with the same hash). In this case, a delete must not really delete the file but just remove the user's `pubkey` from the file owners list (considering the server keeps just one copy of the same file, because multiple uploads of the same file results
267in the same file hash). 267in the same file hash).
@@ -275,6 +275,46 @@ The successful response is a 200 OK one with just basic JSON fields:
275} 275}
276``` 276```
277 277
278## Listing files
279
280`GET $api_url?page=x&count=y`
281
282**AUTH required**
283
284Returns a list of files linked to the authenticated users pubkey.
285
286Example Response:
287
288```js
289{
290 "count": 1, // server page size, eg. max(1, min(server_max_page_size, arg_count))
291 "total": 1, // total number of files
292 "page": 0, // the current page number
293 "files": [
294 {
295 "tags": [
296 ["ox": "719171db19525d9d08dd69cb716a18158a249b7b3b3ec4bbdec5698dca104b7b"],
297 ["x": "5d2899290e0e69bcd809949ee516a4a1597205390878f780c098707a7f18e3df"],
298 ["size", "123456"],
299 ["alt", "a meme that makes you laugh"],
300 ["expiration", "1715691139"],
301 // ...other metadata
302 ]
303 "content": "haha funny meme", // caption
304 "created_at": 1715691130 // upload timestmap
305 },
306 ...
307 ]
308}
309```
310
311`files` contains an array of NIP-94 events
312
313### Query args
314
315- `page` page number (`offset=page*count`)
316- `count` number of items per page
317
278## Selecting a Server 318## Selecting a Server
279 319
280Note: HTTP File Storage Server developers may skip this section. This is meant for client developers. 320Note: HTTP File Storage Server developers may skip this section. This is meant for client developers.
diff --git a/BREAKING.md b/BREAKING.md
index 3693c34..720d27b 100644
--- a/BREAKING.md
+++ b/BREAKING.md
@@ -5,7 +5,10 @@ reverse chronological order.
5 5
6| Date | Commit | NIP | Change | 6| Date | Commit | NIP | Change |
7| ----------- | --------- | -------- | ------ | 7| ----------- | --------- | -------- | ------ |
8| 2024-05-25 | [5d1d1c17](https://github.com/nostr-protocol/nips/commit/5d1d1c17) | [NIP-71](71.md) | 'aes-256-gcm' tag was removed |
9| 2024-04-30 | [bad88262](https://github.com/nostr-protocol/nips/commit/bad88262) | [NIP-34](34.md) | 'earliest-unique-commit' tag was removed (use 'r' tag instead) |
8| 2024-02-25 | [4a171cb0](https://github.com/nostr-protocol/nips/commit/4a171cb0) | [NIP-18](18.md) | quote repost should use `q` tag | 10| 2024-02-25 | [4a171cb0](https://github.com/nostr-protocol/nips/commit/4a171cb0) | [NIP-18](18.md) | quote repost should use `q` tag |
11| 2024-02-21 | [c6cd655c](https://github.com/nostr-protocol/nips/commit/c6cd655c) | [NIP-46](46.md) | Params were stringified |
9| 2024-02-16 | [cbec02ab](https://github.com/nostr-protocol/nips/commit/cbec02ab) | [NIP-49](49.md) | Password first normalized to NFKC | 12| 2024-02-16 | [cbec02ab](https://github.com/nostr-protocol/nips/commit/cbec02ab) | [NIP-49](49.md) | Password first normalized to NFKC |
10| 2024-02-15 | [afbb8dd0](https://github.com/nostr-protocol/nips/commit/afbb8dd0) | [NIP-39](39.md) | PGP identity was removed | 13| 2024-02-15 | [afbb8dd0](https://github.com/nostr-protocol/nips/commit/afbb8dd0) | [NIP-39](39.md) | PGP identity was removed |
11| 2024-02-07 | [d3dad114](https://github.com/nostr-protocol/nips/commit/d3dad114) | [NIP-46](46.md) | Connection token format was changed | 14| 2024-02-07 | [d3dad114](https://github.com/nostr-protocol/nips/commit/d3dad114) | [NIP-46](46.md) | Connection token format was changed |
diff --git a/README.md b/README.md
index 90a6394..87c5cb3 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
25- [NIP-01: Basic protocol flow description](01.md) 25- [NIP-01: Basic protocol flow description](01.md)
26- [NIP-02: Follow List](02.md) 26- [NIP-02: Follow List](02.md)
27- [NIP-03: OpenTimestamps Attestations for Events](03.md) 27- [NIP-03: OpenTimestamps Attestations for Events](03.md)
28- [NIP-04: Encrypted Direct Message](04.md) --- **unrecommended**: deprecated in favor of [NIP-44](44.md) 28- [NIP-04: Encrypted Direct Message](04.md) --- **unrecommended**: deprecated in favor of [NIP-17](17.md)
29- [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](05.md) 29- [NIP-05: Mapping Nostr keys to DNS-based internet identifiers](05.md)
30- [NIP-06: Basic key derivation from mnemonic seed phrase](06.md) 30- [NIP-06: Basic key derivation from mnemonic seed phrase](06.md)
31- [NIP-07: `window.nostr` capability for web browsers](07.md) 31- [NIP-07: `window.nostr` capability for web browsers](07.md)
@@ -36,6 +36,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
36- [NIP-13: Proof of Work](13.md) 36- [NIP-13: Proof of Work](13.md)
37- [NIP-14: Subject tag in text events](14.md) 37- [NIP-14: Subject tag in text events](14.md)
38- [NIP-15: Nostr Marketplace (for resilient marketplaces)](15.md) 38- [NIP-15: Nostr Marketplace (for resilient marketplaces)](15.md)
39- [NIP-17: Private Direct Messages](17.md)
39- [NIP-18: Reposts](18.md) 40- [NIP-18: Reposts](18.md)
40- [NIP-19: bech32-encoded entities](19.md) 41- [NIP-19: bech32-encoded entities](19.md)
41- [NIP-21: `nostr:` URI scheme](21.md) 42- [NIP-21: `nostr:` URI scheme](21.md)
@@ -50,6 +51,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
50- [NIP-31: Dealing with Unknown Events](31.md) 51- [NIP-31: Dealing with Unknown Events](31.md)
51- [NIP-32: Labeling](32.md) 52- [NIP-32: Labeling](32.md)
52- [NIP-34: `git` stuff](34.md) 53- [NIP-34: `git` stuff](34.md)
54- [NIP-35: Torrents](35.md)
53- [NIP-36: Sensitive Content](36.md) 55- [NIP-36: Sensitive Content](36.md)
54- [NIP-38: User Statuses](38.md) 56- [NIP-38: User Statuses](38.md)
55- [NIP-39: External Identities in Profiles](39.md) 57- [NIP-39: External Identities in Profiles](39.md)
@@ -65,11 +67,14 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
65- [NIP-51: Lists](51.md) 67- [NIP-51: Lists](51.md)
66- [NIP-52: Calendar Events](52.md) 68- [NIP-52: Calendar Events](52.md)
67- [NIP-53: Live Activities](53.md) 69- [NIP-53: Live Activities](53.md)
70- [NIP-54: Wiki](54.md)
71- [NIP-55: Android Signer Application](55.md)
68- [NIP-56: Reporting](56.md) 72- [NIP-56: Reporting](56.md)
69- [NIP-57: Lightning Zaps](57.md) 73- [NIP-57: Lightning Zaps](57.md)
70- [NIP-58: Badges](58.md) 74- [NIP-58: Badges](58.md)
71- [NIP-59: Gift Wrap](59.md) 75- [NIP-59: Gift Wrap](59.md)
72- [NIP-65: Relay List Metadata](65.md) 76- [NIP-65: Relay List Metadata](65.md)
77- [NIP-71: Video Events](71.md)
73- [NIP-72: Moderated Communities](72.md) 78- [NIP-72: Moderated Communities](72.md)
74- [NIP-75: Zap Goals](75.md) 79- [NIP-75: Zap Goals](75.md)
75- [NIP-78: Application-specific data](78.md) 80- [NIP-78: Application-specific data](78.md)
@@ -99,12 +104,14 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
99| `11` | Group Thread | [29](29.md) | 104| `11` | Group Thread | [29](29.md) |
100| `12` | Group Thread Reply | [29](29.md) | 105| `12` | Group Thread Reply | [29](29.md) |
101| `13` | Seal | [59](59.md) | 106| `13` | Seal | [59](59.md) |
107| `14` | Direct Message | [17](17.md) |
102| `16` | Generic Repost | [18](18.md) | 108| `16` | Generic Repost | [18](18.md) |
103| `40` | Channel Creation | [28](28.md) | 109| `40` | Channel Creation | [28](28.md) |
104| `41` | Channel Metadata | [28](28.md) | 110| `41` | Channel Metadata | [28](28.md) |
105| `42` | Channel Message | [28](28.md) | 111| `42` | Channel Message | [28](28.md) |
106| `43` | Channel Hide Message | [28](28.md) | 112| `43` | Channel Hide Message | [28](28.md) |
107| `44` | Channel Mute User | [28](28.md) | 113| `44` | Channel Mute User | [28](28.md) |
114| `818` | Merge Requests | [54](54.md) |
108| `1021` | Bid | [15](15.md) | 115| `1021` | Bid | [15](15.md) |
109| `1022` | Bid confirmation | [15](15.md) | 116| `1022` | Bid confirmation | [15](15.md) |
110| `1040` | OpenTimestamps | [03](03.md) | 117| `1040` | OpenTimestamps | [03](03.md) |
@@ -114,9 +121,13 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
114| `1617` | Patches | [34](34.md) | 121| `1617` | Patches | [34](34.md) |
115| `1621` | Issues | [34](34.md) | 122| `1621` | Issues | [34](34.md) |
116| `1622` | Replies | [34](34.md) | 123| `1622` | Replies | [34](34.md) |
124| `1630`-`1633` | Status | [34](34.md) |
117| `1971` | Problem Tracker | [nostrocket][nostrocket] | 125| `1971` | Problem Tracker | [nostrocket][nostrocket] |
118| `1984` | Reporting | [56](56.md) | 126| `1984` | Reporting | [56](56.md) |
119| `1985` | Label | [32](32.md) | 127| `1985` | Label | [32](32.md) |
128| `2003` | Torrent | [35](35.md) |
129| `2004` | Torrent Comment | [35](35.md) |
130| `2022` | Coinjoin Pool | [joinstr][joinstr] |
120| `4550` | Community Post Approval | [72](72.md) | 131| `4550` | Community Post Approval | [72](72.md) |
121| `5000`-`5999` | Job Request | [90](90.md) | 132| `5000`-`5999` | Job Request | [90](90.md) |
122| `6000`-`6999` | Job Result | [90](90.md) | 133| `6000`-`6999` | Job Result | [90](90.md) |
@@ -137,6 +148,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
137| `10009` | User groups | [51](51.md), [29](29.md) | 148| `10009` | User groups | [51](51.md), [29](29.md) |
138| `10015` | Interests list | [51](51.md) | 149| `10015` | Interests list | [51](51.md) |
139| `10030` | User emoji list | [51](51.md) | 150| `10030` | User emoji list | [51](51.md) |
151| `10050` | Relay list to receive DMs | [17](17.md) |
140| `10096` | File storage server list | [96](96.md) | 152| `10096` | File storage server list | [96](96.md) |
141| `13194` | Wallet Info | [47](47.md) | 153| `13194` | Wallet Info | [47](47.md) |
142| `21000` | Lightning Pub RPC | [Lightning.Pub][lnpub] | 154| `21000` | Lightning Pub RPC | [Lightning.Pub][lnpub] |
@@ -150,6 +162,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
150| `30002` | Relay sets | [51](51.md) | 162| `30002` | Relay sets | [51](51.md) |
151| `30003` | Bookmark sets | [51](51.md) | 163| `30003` | Bookmark sets | [51](51.md) |
152| `30004` | Curation sets | [51](51.md) | 164| `30004` | Curation sets | [51](51.md) |
165| `30005` | Video sets | [51](51.md) |
153| `30008` | Profile Badges | [58](58.md) | 166| `30008` | Profile Badges | [58](58.md) |
154| `30009` | Badge Definition | [58](58.md) | 167| `30009` | Badge Definition | [58](58.md) |
155| `30015` | Interest sets | [51](51.md) | 168| `30015` | Interest sets | [51](51.md) |
@@ -167,17 +180,25 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
167| `30402` | Classified Listing | [99](99.md) | 180| `30402` | Classified Listing | [99](99.md) |
168| `30403` | Draft Classified Listing | [99](99.md) | 181| `30403` | Draft Classified Listing | [99](99.md) |
169| `30617` | Repository announcements | [34](34.md) | 182| `30617` | Repository announcements | [34](34.md) |
183| `30818` | Wiki article | [54](54.md) |
184| `30819` | Redirects | [54](54.md) |
185| `31890` | Feed | [NUD: Custom Feeds](https://wikifreedia.xyz/cip-01/97c70a44366a6535c1) |
170| `31922` | Date-Based Calendar Event | [52](52.md) | 186| `31922` | Date-Based Calendar Event | [52](52.md) |
171| `31923` | Time-Based Calendar Event | [52](52.md) | 187| `31923` | Time-Based Calendar Event | [52](52.md) |
172| `31924` | Calendar | [52](52.md) | 188| `31924` | Calendar | [52](52.md) |
173| `31925` | Calendar Event RSVP | [52](52.md) | 189| `31925` | Calendar Event RSVP | [52](52.md) |
174| `31989` | Handler recommendation | [89](89.md) | 190| `31989` | Handler recommendation | [89](89.md) |
175| `31990` | Handler information | [89](89.md) | 191| `31990` | Handler information | [89](89.md) |
176| `39000-9` | Group metadata events | [29](29.md) | 192| `34235` | Video Event | [71](71.md) |
193| `34236` | Short-form Portrait Video Event | [71](71.md) |
194| `34237` | Video View Event | [71](71.md) |
177| `34550` | Community Definition | [72](72.md) | 195| `34550` | Community Definition | [72](72.md) |
196| `39000-9` | Group metadata events | [29](29.md) |
178 197
198[NUD: Custom Feeds]: https://wikifreedia.xyz/cip-01/97c70a44366a6535c1
179[nostrocket]: https://github.com/nostrocket/NIPS/blob/main/Problems.md 199[nostrocket]: https://github.com/nostrocket/NIPS/blob/main/Problems.md
180[lnpub]: https://github.com/shocknet/Lightning.Pub/blob/master/proto/autogenerated/client.md 200[lnpub]: https://github.com/shocknet/Lightning.Pub/blob/master/proto/autogenerated/client.md
201[joinstr]: https://gitlab.com/1440000bytes/joinstr/-/blob/main/NIP.md
181 202
182## Message types 203## Message types
183 204
@@ -203,62 +224,62 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
203| `AUTH` | used to send authentication challenges | [42](42.md) | 224| `AUTH` | used to send authentication challenges | [42](42.md) |
204| `COUNT` | used to send requested event counts to clients | [45](45.md) | 225| `COUNT` | used to send requested event counts to clients | [45](45.md) |
205 226
206Please update these lists when proposing NIPs introducing new event kinds.
207
208## Standardized Tags 227## Standardized Tags
209 228
210| name | value | other parameters | NIP | 229| name | value | other parameters | NIP |
211| ----------------- | ------------------------------------ | -------------------- | ------------------------------------- | 230| ----------------- | ------------------------------------ | ------------------------------- | ------------------------------------- |
212| `e` | event id (hex) | relay URL, marker | [01](01.md), [10](10.md) | 231| `e` | event id (hex) | relay URL, marker, pubkey (hex) | [01](01.md), [10](10.md) |
213| `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) | 232| `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) |
214| `a` | coordinates to an event | relay URL | [01](01.md) | 233| `a` | coordinates to an event | relay URL | [01](01.md) |
215| `d` | identifier | -- | [01](01.md) | 234| `d` | identifier | -- | [01](01.md) |
216| `g` | geohash | -- | [52](52.md) | 235| `g` | geohash | -- | [52](52.md) |
217| `i` | identity | proof | [39](39.md) | 236| `i` | identity | proof | [39](39.md) |
218| `k` | kind number (string) | -- | [18](18.md), [25](25.md), [72](72.md) | 237| `k` | kind number (string) | -- | [18](18.md), [25](25.md), [72](72.md) |
219| `l` | label, label namespace | annotations | [32](32.md) | 238| `l` | label, label namespace | annotations | [32](32.md) |
220| `L` | label namespace | -- | [32](32.md) | 239| `L` | label namespace | -- | [32](32.md) |
221| `m` | MIME type | -- | [94](94.md) | 240| `m` | MIME type | -- | [94](94.md) |
222| `q` | event id (hex) | relay URL | [18](18.md) | 241| `q` | event id (hex) | relay URL | [18](18.md) |
223| `r` | a reference (URL, etc) | petname | | 242| `r` | a reference (URL, etc) | petname | [24](24.md) |
224| `r` | relay url | marker | [65](65.md) | 243| `r` | relay url | marker | [65](65.md) |
225| `t` | hashtag | -- | | 244| `t` | hashtag | -- | |
226| `alt` | summary | -- | [31](31.md) | 245| `alt` | summary | -- | [31](31.md) |
227| `amount` | millisatoshis, stringified | -- | [57](57.md) | 246| `amount` | millisatoshis, stringified | -- | [57](57.md) |
228| `bolt11` | `bolt11` invoice | -- | [57](57.md) | 247| `bolt11` | `bolt11` invoice | -- | [57](57.md) |
229| `challenge` | challenge string | -- | [42](42.md) | 248| `challenge` | challenge string | -- | [42](42.md) |
230| `client` | name, address | relay URL | [89](89.md) | 249| `client` | name, address | relay URL | [89](89.md) |
231| `clone` | git clone URL | -- | [34](34.md) | 250| `clone` | git clone URL | -- | [34](34.md) |
232| `content-warning` | reason | -- | [36](36.md) | 251| `content-warning` | reason | -- | [36](36.md) |
233| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) | 252| `delegation` | pubkey, conditions, delegation token | -- | [26](26.md) |
234| `description` | description | -- | [34](34.md), [57](57.md), [58](58.md) | 253| `description` | description | -- | [34](34.md), [57](57.md), [58](58.md) |
235| `emoji` | shortcode, image URL | -- | [30](30.md) | 254| `emoji` | shortcode, image URL | -- | [30](30.md) |
236| `encrypted` | -- | -- | [90](90.md) | 255| `encrypted` | -- | -- | [90](90.md) |
237| `expiration` | unix timestamp (string) | -- | [40](40.md) | 256| `expiration` | unix timestamp (string) | -- | [40](40.md) |
238| `goal` | event id (hex) | relay URL | [75](75.md) | 257| `goal` | event id (hex) | relay URL | [75](75.md) |
239| `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) | 258| `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) |
240| `imeta` | inline metadata | -- | [92](92.md) | 259| `imeta` | inline metadata | -- | [92](92.md) |
241| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) | 260| `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) |
242| `location` | location string | -- | [52](52.md), [99](99.md) | 261| `location` | location string | -- | [52](52.md), [99](99.md) |
243| `name` | name | -- | [34](34.md), [58](58.md) | 262| `name` | name | -- | [34](34.md), [58](58.md) |
244| `nonce` | random | -- | [13](13.md) | 263| `nonce` | random | difficulty | [13](13.md) |
245| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) | 264| `preimage` | hash of `bolt11` invoice | -- | [57](57.md) |
246| `price` | price | currency, frequency | [99](99.md) | 265| `price` | price | currency, frequency | [99](99.md) |
247| `proxy` | external ID | protocol | [48](48.md) | 266| `proxy` | external ID | protocol | [48](48.md) |
248| `published_at` | unix timestamp (string) | -- | [23](23.md) | 267| `published_at` | unix timestamp (string) | -- | [23](23.md) |
249| `relay` | relay url | -- | [42](42.md) | 268| `relay` | relay url | -- | [42](42.md), [17](17.md) |
250| `relays` | relay list | -- | [57](57.md) | 269| `relays` | relay list | -- | [57](57.md) |
251| `server` | file storage server url | -- | [96](96.md) | 270| `server` | file storage server url | -- | [96](96.md) |
252| `subject` | subject | -- | [14](14.md) | 271| `subject` | subject | -- | [14](14.md), [17](17.md) |
253| `summary` | article summary | -- | [23](23.md) | 272| `summary` | article summary | -- | [23](23.md) |
254| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) | 273| `thumb` | badge thumbnail | dimensions in pixels | [58](58.md) |
255| `title` | article title | -- | [23](23.md) | 274| `title` | article title | -- | [23](23.md) |
256| `web` | webpage URL | -- | [34](34.md) | 275| `web` | webpage URL | -- | [34](34.md) |
257| `zap` | pubkey (hex), relay URL | weight | [57](57.md) | 276| `zap` | pubkey (hex), relay URL | weight | [57](57.md) |
277
278Please update these lists when proposing new NIPs.
258 279
259## Criteria for acceptance of NIPs 280## Criteria for acceptance of NIPs
260 281
2611. They should be implemented in at least two clients and one relay -- when applicable. 2821. They should be fully implemented in at least two clients and one relay -- when applicable.
2622. They should make sense. 2832. They should make sense.
2633. They should be optional and backwards-compatible: care must be taken such that clients and relays that choose to not implement them do not stop working when interacting with the ones that choose to. 2843. They should be optional and backwards-compatible: care must be taken such that clients and relays that choose to not implement them do not stop working when interacting with the ones that choose to.
2644. There should be no more than one way of doing the same thing. 2854. There should be no more than one way of doing the same thing.