upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiatjaf <fiatjaf@gmail.com>2024-03-23 10:31:34 -0300
committerfiatjaf <fiatjaf@gmail.com>2024-03-23 10:31:34 -0300
commitb2d6af6fe5d875404cb8eed9277a141f54eab754 (patch)
treeceafb001f779cbecd7953baf69802e3290f83ada
parent9e9ae1eb88db13471faa660a3e4f66d2d5e60a31 (diff)
nip-64: inbox model.
-rw-r--r--64.md65
1 files changed, 65 insertions, 0 deletions
diff --git a/64.md b/64.md
new file mode 100644
index 0000000..d6f82c3
--- /dev/null
+++ b/64.md
@@ -0,0 +1,65 @@
1NIP-64
2======
3
4Inbox model
5-----------
6
7`draft` `optional`
8
9Suppose **Sarah** wants to subscribe to the notes **Walter** writes.
10
11She must let Walter know she is following him. The first step is to find Walter's _inbox list_:
12
13```jsonc
14{
15 "kind": 10064,
16 "pubkey": "<walter>",
17 "tags": [
18 ["relay", "wss://walter.inbox"]
19 ]
20}
21```
22
23Now Sarah can publish a `kind:6401` _follow intent_ to `wss://walter.inbox` tagging Walter:
24
25```jsonc
26{
27 "kind": 6401,
28 "pubkey": "<sarah>"
29 "tags": [
30 ["p", "<walter>"],
31 ["relay", "wss://sarah.inbox"],
32 ["relay", "wss://other.inbox"]
33 ]
34}
35```
36
37Sarah also publishes these to her own inbox relays (`wss://sarah.inbox` and `wss://other.inbox`) so they are aware.
38
39From the Walter side, whenever he is about to publish a note, he downloads all the `kind:6401` events from his inbox relays and sends his note to all the relays he finds in these.
40
41Whenever Sarah's inbox relay receive a note from Walter, they will know that Sarah is following him, so they index that note in a way that it is associated with Sarah. If the relays receive a note from someone else they can simply reject the note.
42
43When Sarah turns on her client she will connect to her inbox relay, perform [NIP-42](42.md) `AUTH` and create a subscription that doesn't specify `"authors"` (for example, `["REQ", "_", {}]`). The relays, aware of who she is and who she is following, can deliver to her just Walter's notes.
44
45If Sarah ever decides to stop following Walter, she can send a `kind:6402` _unfollow intent_ to both Walter's relays and her own, so her relay can start rejecting (and maybe delete previous) Walter's notes, and Walter can know to not send her his notes anymore. As an optimization, Walter's inbox relay can just delete Sarah's `kind:6401` upon receiving a `kind:6402`.
46
47```jsonc
48{
49 "kind": 6402,
50 "pubkey": "<sarah>"
51 "tags": [
52 ["p", "<walter>"]
53 ]
54}
55```
56
57---
58
59The approach described in this NIP doesn't replace any of the other models for following people that are already in use in Nostr, and doesn't claim to be strictly superior to the Outbox Model, but just provides an alternative way to do things.
60
61In reality, clients should implement both approaches and can never assume others will implement this.
62
63For example, if Sarah wanted to follow Wesley and he didn't have a `kind:10064` she would have to do the normal "outbox" approach of subscribing to his relays and fetching his notes from there.
64
65In the same vein, if for any reason Sarah noticed that she had stopped receiving notes from Walter for a long time (~7 days) it would make sense for her to go to his relays (obtained from [NIP-65](65.md), [NIP-05](05.md), relay hints or other means) and check if he is publishing to these. In the affirmative case, she would turn Walter into an "outbox follow" instead of an "inbox follow".