upleb.uk

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

summaryrefslogtreecommitdiff
path: root/89.md
diff options
context:
space:
mode:
authorPablo Fernandez <p@f7z.io>2023-11-23 17:52:48 +0200
committerGitHub <noreply@github.com>2023-11-23 17:52:48 +0200
commit60256a62675a165c4d4fd9811a19a9cbf6a9e7fd (patch)
tree5c450154d373caafc37f324dd01e20338308c9d6 /89.md
parent43d50ee42409252a1313928cd437d55fd7bf7bf4 (diff)
parent7822a8b12670312aff104ddc03066425882f739d (diff)
Merge branch 'master' into nip88
Diffstat (limited to '89.md')
-rw-r--r--89.md97
1 files changed, 56 insertions, 41 deletions
diff --git a/89.md b/89.md
index 4503ecf..be3d075 100644
--- a/89.md
+++ b/89.md
@@ -4,15 +4,17 @@ NIP-89
4Recommended Application Handlers 4Recommended Application Handlers
5-------------------------------- 5--------------------------------
6 6
7`draft` `optional` `author:pablof7z` 7`draft` `optional`
8 8
9This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds. 9This NIP describes `kind:31989` and `kind:31990`: a way to discover applications that can handle unknown event-kinds.
10 10
11## Rationale 11## Rationale
12
12Nostr's discoverability and transparent event interaction is one of its most interesting/novel mechanics. 13Nostr'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. 14This 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
15### Parties involved 16### Parties involved
17
16There are three actors to this workflow: 18There are three actors to this workflow:
17 19
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) 20* 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)
@@ -22,18 +24,18 @@ There are three actors to this workflow:
22* user B, who seeks a recommendation for an app that handles a specific event kind 24* 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` 25 * Queries for `kind:31989` and, based on results, queries for `kind:31990`
24 26
25# Events 27## Events
26 28
27## Recommendation event 29### Recommendation event
28```json 30```json
29{ 31{
30 "kind": 31989, 32 "kind": 31989,
31 "pubkey": <recommender-user-pubkey>, 33 "pubkey": <recommender-user-pubkey>,
32 "tags": [ 34 "tags": [
33 [ "d", <supported-event-kind> ], 35 ["d", <supported-event-kind>],
34 [ "a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios" ], 36 ["a", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios"],
35 [ "a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web" ] 37 ["a", "31990:app2-pubkey:<d-identifier>", "wss://relay2", "web"]
36 ] 38 ]
37} 39}
38``` 40```
39 41
@@ -47,70 +49,83 @@ The third value of the tag SHOULD be the platform where this recommendation migh
47## Handler information 49## Handler information
48```json 50```json
49{ 51{
50 "kind": 31990, 52 "kind": 31990,
51 "pubkey": <pubkey>, 53 "pubkey": "<application-pubkey>",
52 "content": "<optional-kind:0-style-metadata>", 54 "content": "<optional-kind:0-style-metadata>",
53 "tags": [ 55 "tags": [
54 [ "d", <random-id> ], 56 ["d", <random-id>],
55 [ "k", <supported-event-kind> ], 57 ["k", <supported-event-kind>],
56 [ "web", "https://..../a/<bech32>", "nevent" ], 58 ["web", "https://..../a/<bech32>", "nevent"],
57 [ "web", "https://..../p/<bech32>", "nprofile" ], 59 ["web", "https://..../p/<bech32>", "nprofile"],
58 [ "web", "https://..../e/<bech32>" ], 60 ["web", "https://..../e/<bech32>"],
59 [ "ios", ".../<bech32>" ] 61 ["ios", ".../<bech32>"]
60 ] 62 ]
61} 63}
62``` 64```
63 65
64* `content` is an optional `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.) 66* `content` is an optional `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`. 67* `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: 68Using 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 * 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 * 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. 71* `bech32` in a URL MUST be replaced by clients with the NIP-19-encoded entity that should be loaded by the application.
72 72
73Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array. 73Multiple tags might be registered by the app, following NIP-19 nomenclature as the second value of the array.
74 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. 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 76
77# User flow 77## Client tag
78When publishing events, clients MAY include a `client` tag in the same format as the recommendation event's `a` tags. This has privacy implications for users, so clients SHOULD allow users to opt-out of using this tag.
79
80```json
81{
82 "kind": 1,
83 "tags": [
84 ["client", "31990:app1-pubkey:<d-identifier>", "wss://relay1", "ios"]
85 ]
86 ...
87}
88```
89
90## User flow
78A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application. 91A user A who uses a non-`kind:1`-centric nostr app could choose to announce/recommend a certain kind-handler application.
79 92
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). 93When 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 94
82The client MIGHT query for the user's and the user's follows handler. 95The client MIGHT query for the user's and the user's follows handler.
83 96
84# Example 97## Example
85 98
86## User A recommends a `kind:31337`-handler 99### 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. 100User 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 101
89```json 102```json
90{ 103{
91 "kind": 31989, 104 "kind": 31989,
92 "tags": [ 105 "tags": [
93 [ "d", "31337" ], 106 ["d", "31337"],
94 [ "a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web" ] 107 ["a", "31990:1743058db7078661b94aaf4286429d97ee5257d14a86d6bfa54cb0482b876fb0:abcd", <relay-url>, "web"]
95 ] 108 ],
109 ...
96} 110}
97``` 111```
98 112
99## User B interacts with a `kind:31337`-handler 113### User B interacts with a `kind:31337`-handler
100User B might see in their timeline an event referring to a `kind:31337` event 114User B might see in their timeline an event referring to a `kind:31337` event (e.g. a `kind:1` tagging a `kind:31337`).
101(e.g. a `kind:1` tagging a `kind:31337`).
102 115
103User B's client, not knowing how to handle a `kind:31337` might display the event 116User B's client, not knowing how to handle a `kind:31337` might display the event using its `alt` tag (as described in NIP-31). When the user clicks on the event, the application queries for a handler for this `kind`:
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 117
107`["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']` 118```json
119["REQ", <id>, '[{ "kinds": [31989], "#d": ["31337"], 'authors': [<user>, <users-contact-list>] }]']
120```
108 121
109User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information. 122User B, who follows User A, sees that `kind:31989` event and fetches the `a`-tagged event for the app and handler information.
110 123
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. 124User 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 125
113## Alternative query bypassing `kind:31989` 126### 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. 127Alternatively, users might choose to query directly for `kind:31990` for an event kind. Clients SHOULD be careful doing this and use spam-prevention mechanisms or querying high-quality restricted relays to avoid directing users to malicious handlers.
115 128
116`["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']` \ No newline at end of file 129```json
130["REQ", <id>, '[{ "kinds": [31990], "#k": [<desired-event-kind>], 'authors': [...] }]']
131```