upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Pamplona <vitor@vitorpamplona.com>2023-06-10 19:56:03 -0400
committerGitHub <noreply@github.com>2023-06-10 19:56:03 -0400
commit4d0929b278cfc748f30be48c549cfc87ef429202 (patch)
tree78135b2eb1f396faf2045886dd48e8981ab73ae0
parent91bdf63b130cadb89c3908cab09305526e9f2092 (diff)
parent2e842b496a740f89ad80bf8257c37535d538ba54 (diff)
Merge branch 'master' into zap-plits
-rw-r--r--01.md4
-rw-r--r--07.md3
-rw-r--r--09.md2
-rw-r--r--16.md2
-rw-r--r--26.md6
-rw-r--r--31.md15
-rw-r--r--33.md4
-rw-r--r--89.md116
-rw-r--r--README.md5
9 files changed, 150 insertions, 7 deletions
diff --git a/01.md b/01.md
index e36f4f5..2700dab 100644
--- a/01.md
+++ b/01.md
@@ -99,7 +99,7 @@ This NIP defines no rules for how `NOTICE` messages should be sent or treated.
99## Basic Event Kinds 99## Basic Event Kinds
100 100
101 - `0`: `set_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 past `set_metadata` events once it gets a new one for the same pubkey. 101 - `0`: `set_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 past `set_metadata` events once it gets a new one for the same pubkey.
102 - `1`: `text_note`: the `content` is set to the plaintext content of a note (anything the user wants to say). Do not use Markdown! Clients should not have to guess how to interpret content like `[]()`. Use different event kinds for parsable content. 102 - `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.
103 - `2`: `recommend_server`: the `content` is set to the URL (e.g., `wss://somerelay.com`) of a relay the event creator wants to recommend to its followers. 103 - `2`: `recommend_server`: the `content` is set to the URL (e.g., `wss://somerelay.com`) of a relay the event creator wants to recommend to its followers.
104 104
105A relay may choose to treat different message kinds differently, and it may or may not choose to have a default way to handle kinds it doesn't know about. 105A relay may choose to treat different message kinds differently, and it may or may not choose to have a default way to handle kinds it doesn't know about.
@@ -107,6 +107,6 @@ A relay may choose to treat different message kinds differently, and it may or m
107## Other Notes: 107## Other Notes:
108 108
109- Clients should not open more than one websocket to each relay. One channel can support an unlimited number of subscriptions, so clients should do that. 109- Clients should not open more than one websocket to each relay. One channel can support an unlimited number of subscriptions, so clients should do that.
110- The `tags` array can store a tag identifier as the first element of each subarray, plus arbitrary information afterward (always as strings). This NIP defines `"p"` — meaning "pubkey", which points to a pubkey of someone that is referred to in the event —, and `"e"` — meaning "event", which points to the id of an event this event is quoting, replying to or referring to somehow. See [NIP-10](https://github.com/nostr-protocol/nips/blob/127d5518bfa9a4e4e7510490c0b8d95e342dfa4b/10.md) for a detailed description of "e" and "p" tags. 110- The `tags` array can store a tag identifier as the first element of each subarray, plus arbitrary information afterward (always as strings). This NIP defines `"p"` — meaning "pubkey", which points to a pubkey of someone that is referred to in the event —, and `"e"` — meaning "event", which points to the id of an event this event is quoting, replying to or referring to somehow. See [NIP-10](10.md) for a detailed description of "e" and "p" tags.
111- The `<recommended relay URL>` item present on the `"e"` and `"p"` tags is an optional (could be set to `""`) URL of a relay the client could attempt to connect to fetch the tagged event or other events from a tagged profile. It MAY be ignored, but it exists to increase censorship resistance and make the spread of relay addresses more seamless across clients. 111- The `<recommended relay URL>` item present on the `"e"` and `"p"` tags is an optional (could be set to `""`) URL of a relay the client could attempt to connect to fetch the tagged event or other events from a tagged profile. It MAY be ignored, but it exists to increase censorship resistance and make the spread of relay addresses more seamless across clients.
112- Clients should use the created_at field to judge the age of a metadata event and completely replace older metadata events with newer metadata events regardless of the order in which they arrive. Clients should not merge any filled fields within older metadata events into empty fields of newer metadata events. 112- Clients should use the created_at field to judge the age of a metadata event and completely replace older metadata events with newer metadata events regardless of the order in which they arrive. Clients should not merge any filled fields within older metadata events into empty fields of newer metadata events.
diff --git a/07.md b/07.md
index 7112366..ee4e372 100644
--- a/07.md
+++ b/07.md
@@ -26,9 +26,10 @@ async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext
26 26
27- [horse](https://github.com/fiatjaf/horse) (Chrome and derivatives) 27- [horse](https://github.com/fiatjaf/horse) (Chrome and derivatives)
28- [nos2x](https://github.com/fiatjaf/nos2x) (Chrome and derivatives) 28- [nos2x](https://github.com/fiatjaf/nos2x) (Chrome and derivatives)
29- [Alby](https://getalby.com) (Chrome and derivatives, Firefox, Safari) 29- [Alby](https://getalby.com) (Chrome and derivatives, Firefox)
30- [Blockcore](https://www.blockcore.net/wallet) (Chrome and derivatives) 30- [Blockcore](https://www.blockcore.net/wallet) (Chrome and derivatives)
31- [nos2x-fox](https://diegogurpegui.com/nos2x-fox/) (Firefox) 31- [nos2x-fox](https://diegogurpegui.com/nos2x-fox/) (Firefox)
32- [Flamingo](https://www.getflamingo.org/) (Chrome and derivatives) 32- [Flamingo](https://www.getflamingo.org/) (Chrome and derivatives)
33- [AKA Profiles](https://github.com/neilck/aka-extension) (Chrome, stores multiple keys) 33- [AKA Profiles](https://github.com/neilck/aka-extension) (Chrome, stores multiple keys)
34- [TokenPocket](https://www.tokenpocket.pro/) (Android, IOS, Chrome and derivatives) 34- [TokenPocket](https://www.tokenpocket.pro/) (Android, IOS, Chrome and derivatives)
35- [Nostrmo](https://github.com/haorendashu/nostrmo_faq#download) (Android, IOS)
diff --git a/09.md b/09.md
index 89781fb..a73e0ab 100644
--- a/09.md
+++ b/09.md
@@ -20,7 +20,7 @@ For example:
20 "pubkey": <32-bytes hex-encoded public key of the event creator>, 20 "pubkey": <32-bytes hex-encoded public key of the event creator>,
21 "tags": [ 21 "tags": [
22 ["e", "dcd59..464a2"], 22 ["e", "dcd59..464a2"],
23 ["e", "968c5..ad7a4"], 23 ["e", "968c5..ad7a4"]
24 ], 24 ],
25 "content": "these posts were published by accident", 25 "content": "these posts were published by accident",
26 ...other fields 26 ...other fields
diff --git a/16.md b/16.md
index 4d9481d..8ef4af4 100644
--- a/16.md
+++ b/16.md
@@ -20,6 +20,8 @@ Upon a replaceable event with a newer timestamp than the currently known latest
20effectively replacing what gets returned when querying for 20effectively replacing what gets returned when querying for
21`author:kind` tuples. 21`author:kind` tuples.
22 22
23If two events have the same timestamp, the event with the lowest id (first in lexical order) SHOULD be retained, and the other discarded.
24
23Ephemeral Events 25Ephemeral Events
24---------------- 26----------------
25An *ephemeral event* is defined as an event with a kind `20000 <= n < 30000`. 27An *ephemeral event* is defined as an event with a kind `20000 <= n < 30000`.
diff --git a/26.md b/26.md
index b8fa902..9117699 100644
--- a/26.md
+++ b/26.md
@@ -52,7 +52,9 @@ For example, the following condition strings are valid:
52- `kind=0&kind=1&created_at>1675721813` 52- `kind=0&kind=1&created_at>1675721813`
53- `kind=1&created_at>1674777689&created_at<1675721813` 53- `kind=1&created_at>1674777689&created_at<1675721813`
54 54
55For the vast majority of use-cases, it is advisable that query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf. 55For the vast majority of use-cases, it is advisable that:
561. Query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf.
572. Query strings should include a `created_at` ***before*** condition that is not empty and is not some extremely distant time in the future. If delegations are not limited in time scope, they expose similar security risks to simply using the root key for authentication.
56 58
57#### Example 59#### Example
58 60
@@ -105,4 +107,4 @@ Clients should display the delegated note as if it was published directly by the
105 107
106Relays should answer requests such as `["REQ", "", {"authors": ["A"]}]` by querying both the `pubkey` and delegation tags `[1]` value. 108Relays should answer requests such as `["REQ", "", {"authors": ["A"]}]` by querying both the `pubkey` and delegation tags `[1]` value.
107 109
108Relays SHOULD allow the delegator (8e0d3d3e) to delete the events published by the delegatee (477318cf). \ No newline at end of file 110Relays SHOULD allow the delegator (8e0d3d3e) to delete the events published by the delegatee (477318cf).
diff --git a/31.md b/31.md
new file mode 100644
index 0000000..e77ae34
--- /dev/null
+++ b/31.md
@@ -0,0 +1,15 @@
1NIP-31
2======
3
4Dealing with unknown event kinds
5--------------------------------
6
7`draft` `optional` `author:pablof7z` `author:fiatjaf`
8
9When creating a new custom event kind that is part of a custom protocol and isn't meant to be read as text (like `kind:1`), clients should use an `alt` tag to write a short human-readable plaintext summary of what that event is about.
10
11The intent is that social clients, used to display only `kind:1` notes, can still show something in case a custom event pops up in their timelines. The content of the `alt` tag should provide enough context for a user that doesn't know anything about this event kind to understand what it is.
12
13These clients that only know `kind:1` are not expected to ask relays for events of different kinds, but users could still reference these weird events on their notes, and without proper context these could be nonsensical notes. Having the fallback text makes that situation much better -- even if only for making the user aware that they should try to view that custom event elsewhere.
14
15`kind:1`-centric clients can make interacting with these event kinds more functional by supporting [NIP-89](https://github.com/nostr-protocol/nips/blob/master/89.md).
diff --git a/33.md b/33.md
index 10681fa..5128bec 100644
--- a/33.md
+++ b/33.md
@@ -10,7 +10,7 @@ This NIP adds a new event range that allows for replacement of events that have
10 10
11Implementation 11Implementation
12-------------- 12--------------
13The value of a tag is defined as the first parameter of a tag after the tag name. 13The value of a tag can be any string and is defined as the first parameter of a tag after the tag name.
14 14
15A *parameterized replaceable event* is defined as an event with a kind `30000 <= n < 40000`. 15A *parameterized replaceable event* is defined as an event with a kind `30000 <= n < 40000`.
16Upon a parameterized replaceable event with a newer timestamp than the currently known latest 16Upon a parameterized replaceable event with a newer timestamp than the currently known latest
@@ -18,6 +18,8 @@ replaceable event with the same kind, author and first `d` tag value being recei
18SHOULD be discarded, effectively replacing what gets returned when querying for 18SHOULD be discarded, effectively replacing what gets returned when querying for
19`author:kind:d-tag` tuples. 19`author:kind:d-tag` tuples.
20 20
21If two events have the same timestamp, the event with the lowest id (first in lexical order) SHOULD be retained, and the other discarded.
22
21A missing or a `d` tag with no value should be interpreted equivalent to a `d` tag with the 23A missing or a `d` tag with no value should be interpreted equivalent to a `d` tag with the
22value as an empty string. Events from the same author with any of the following `tags` 24value as an empty string. Events from the same author with any of the following `tags`
23replace each other: 25replace each other:
diff --git a/89.md b/89.md
new file mode 100644
index 0000000..5eee3b8
--- /dev/null
+++ b/89.md
@@ -0,0 +1,116 @@
1NIP-89
2======
3
4Recommended Application Handlers
5--------------------------------
6
7`draft` `optional` `author:pablof7z`
8
9This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds.
10
11## Rationale
12Nostr's discoverability and transparent event interaction is one of its most interesting/novel mechanics.
13This NIP provides a simple way for clients to discover applications that handle events of a specific kind to ensure smooth cross-client and cross-kind interactions.
14
15### Parties involved
16There are three actors to this workflow:
17
18* application that handles a specific event kind (note that an application doesn't necessarily need to be a distinct entity and it could just be the same pubkey as user A)
19 * Publishes `kind:31990`, detailing how apps should redirect to it
20* user A, who recommends an app that handles a specific event kind
21 * Publishes `kind:31989`
22* user B, who seeks a recommendation for an app that handles a specific event kind
23 * Queries for `kind:31989` and, based on results, queries for `kind:31990`
24
25# Events
26
27## Recommendation event
28```json
29{
30 "kind": 31989,
31 "pubkey": <recommender-user-pubkey>,
32 "tags": [
33 [ "d", <supported-event-kind> ],
34 [ "a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios" ],
35 [ "a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web" ]
36 ]
37}
38```
39
40The `d` tag in `kind:31989` is the supported event kind this event is recommending.
41
42Multiple `a` tags can appear on the same `kind:31989`.
43
44The second value of the tag SHOULD be a relay hint.
45The third value of the tag SHOULD be the platform where this recommendation might apply.
46
47## Handler information
48```json
49{
50 "kind": 31990,
51 "pubkey": <pubkey>,
52 "content": "<optional-kind:0-style-metadata>",
53 "tags": [
54 [ "d", <random-id> ],
55 [ "k", <supported-event-kind> ],
56 [ "web", "https://..../a/<bech32>", "nevent" ],
57 [ "web", "https://..../p/<bech32>", "nprofile" ],
58 [ "web", "https://..../e/<bech32>" ],
59 [ "ios", ".../<bech32>" ]
60 ]
61}
62```
63
64* `content` is an optional `set_metadata`-like stringified JSON object, as described in NIP-01. This content is useful when the pubkey creating the `kind:31990` is not an application. If `content` is empty, the `kind:0` of the pubkey should be used to display application information (e.g. name, picture, web, LUD16, etc.)
65
66* `k` tags' value is the event kind that is supported by this `kind:31990`.
67Using a `k` tag(s) (instead of having the kind onf the NIP-33 `d` tag) provides:
68 * Multiple `k` tags can exist in the same event if the application supports more than one event kind and their handler URLs are the same.
69 * The same pubkey can have multiple events with different apps that handle the same event kind.
70
71* `bech32` in a URL MUST be replaced by clients with the NIP-19-encoded entity that should be loaded by the application.
72
73Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array.
74
75A tag without a second value in the array SHOULD be considered a generic handler for any NIP-19 entity that is not handled by a different tag.
76
77# User flow
78A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application.
79
80When user B sees an unknown event kind, e.g. in a social-media centric nostr client, the client would allow user B to interact with the unknown-kind event (e.g. tapping on it).
81
82The client MIGHT query for the user's and the user's follows handler.
83
84# Example
85
86## User A recommends a `kind:31337`-handler
87User A might be a user of Zapstr, a `kind:31337`-centric client (tracks). Using Zapstr, user A publishes an event recommending Zapstr as a `kind:31337`-handler.
88
89```json
90{
91 "kind": 31989,
92 "tags": [
93 [ "d", "31337" ],
94 [ "a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web" ]
95 ]
96}
97```
98
99## User B interacts with a `kind:31337`-handler
100User B might see in their timeline an event referring to a `kind:31337` event
101(e.g. a `kind:1` tagging a `kind:31337`).
102
103User B's client, not knowing how to handle a `kind:31337` might display the event
104using its `alt` tag (as described in NIP-31). When the user clicks on the event,
105the application queries for a handler for this `kind`:
106
107`["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']`
108
109User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information.
110
111User B's client sees the application's `kind:31990` which includes the information to redirect the user to the relevant URL with the desired entity replaced in the URL.
112
113## Alternative query bypassing `kind:31989`
114Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms to avoid directing users to malicious handlers.
115
116`["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']` \ No newline at end of file
diff --git a/README.md b/README.md
index 963fd79..a940ba6 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
46- [NIP-27: Text Note References](27.md) 46- [NIP-27: Text Note References](27.md)
47- [NIP-28: Public Chat](28.md) 47- [NIP-28: Public Chat](28.md)
48- [NIP-30: Custom Emoji](30.md) 48- [NIP-30: Custom Emoji](30.md)
49- [NIP-31: Dealing with Unknown Events](31.md)
49- [NIP-33: Parameterized Replaceable Events](33.md) 50- [NIP-33: Parameterized Replaceable Events](33.md)
50- [NIP-36: Sensitive Content](36.md) 51- [NIP-36: Sensitive Content](36.md)
51- [NIP-39: External Identities in Profiles](39.md) 52- [NIP-39: External Identities in Profiles](39.md)
@@ -61,6 +62,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
61- [NIP-58: Badges](58.md) 62- [NIP-58: Badges](58.md)
62- [NIP-65: Relay List Metadata](65.md) 63- [NIP-65: Relay List Metadata](65.md)
63- [NIP-78: Application-specific data](78.md) 64- [NIP-78: Application-specific data](78.md)
65- [NIP-89: Recommended Application Handlers](89.md)
64- [NIP-94: File Metadata](94.md) 66- [NIP-94: File Metadata](94.md)
65 67
66## Event Kinds 68## Event Kinds
@@ -101,6 +103,8 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
101| `30018` | Create or update a product | [15](15.md) | 103| `30018` | Create or update a product | [15](15.md) |
102| `30023` | Long-form Content | [23](23.md) | 104| `30023` | Long-form Content | [23](23.md) |
103| `30078` | Application-specific Data | [78](78.md) | 105| `30078` | Application-specific Data | [78](78.md) |
106| `31989` | Handler recommendation | [89](89.md) |
107| `31990` | Handler information | [89](89.md) |
104 108
105### Event Kind Ranges 109### Event Kind Ranges
106 110
@@ -143,6 +147,7 @@ When experimenting with kinds, keep in mind the classification introduced by [NI
143| name | value | other parameters | NIP | 147| name | value | other parameters | NIP |
144| ----------------- | ------------------------------------ | -------------------- | ------------------------ | 148| ----------------- | ------------------------------------ | -------------------- | ------------------------ |
145| `a` | coordinates to an event | relay URL | [33](33.md), [23](23.md) | 149| `a` | coordinates to an event | relay URL | [33](33.md), [23](23.md) |
150| `alt` | Alt tag | -- | [31](31.md) |
146| `d` | identifier | -- | [33](33.md) | 151| `d` | identifier | -- | [33](33.md) |
147| `e` | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) | 152| `e` | event id (hex) | relay URL, marker | [1](01.md), [10](10.md) |
148| `g` | geohash | -- | [12](12.md) | 153| `g` | geohash | -- | [12](12.md) |