upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Fernandez <p@f7z.io>2023-06-07 21:56:17 +0200
committerGitHub <noreply@github.com>2023-06-07 16:56:17 -0300
commit867c8bb334b0d9bb22a6af5c16ce6d186852af5a (patch)
treeb7d086bafac1f0020500c23b24efdbd941e12e13
parentfe9ed69dc3aec54ae437ca09a6d61aa2ce175577 (diff)
NIP-89: Recommended Application Handlers (#530)
-rw-r--r--89.md116
1 files changed, 116 insertions, 0 deletions
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