upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher David <chris@arcade.city>2022-09-10 12:28:08 -0500
committerGitHub <noreply@github.com>2022-09-10 14:28:08 -0300
commit3423a6dfbc36c2039bb32a32e34186af875f820a (patch)
treec46586e970e8ef33084ac4558bc8b3ef68f04fad
parent3e0e6ca2d65eca76fbe929859d5f359f3ed6bfcf (diff)
NIP-28: Public Chat (#38)
-rw-r--r--28.md158
1 files changed, 158 insertions, 0 deletions
diff --git a/28.md b/28.md
new file mode 100644
index 0000000..f37299e
--- /dev/null
+++ b/28.md
@@ -0,0 +1,158 @@
1
2NIP-28
3======
4
5Public Chat
6-----------
7
8`draft` `optional` `author:ChristopherDavid` `author:fiatjaf` `author:jb55` `author:Cameri`
9
10This NIP defines new event kinds for public chat channels, channel messages, and basic client-side moderation.
11
12It reserves five event kinds (40-44) for immediate use and five event kinds (45-49) for future use.
13
14- `40 - channel create`
15- `41 - channel metadata`
16- `42 - channel message`
17- `43 - hide message`
18- `44 - mute user`
19
20Client-centric moderation gives client developers discretion over what types of content they want included in their apps, while imposing no additional requirements on relays.
21
22## Kind 40: Create channel
23
24Create a public chat channel.
25
26In the channel creation `content` field, Client SHOULD include basic channel metadata (`name`, `about`, `picture` as specified in kind 41).
27
28```json
29{
30 "content": "{\"name\": \"Demo Channel\", \"about\": \"A test channel.\", \"picture\": \"https://placekitten.com/200/200\"}",
31 ...
32}
33```
34
35
36## Kind 41: Set channel metadata
37
38Update a channel's public metadata.
39
40Clients and relays SHOULD handle kind 41 events similar to kind 0 `metadata` events.
41
42Clients SHOULD ignore kind 41s from pubkeys other than the kind 40 pubkey.
43
44Clients SHOULD support basic metadata fields:
45
46- `name` - string - Channel name
47- `about` - string - Channel description
48- `picture` - string - URL of channel picture
49
50Clients MAY add additional metadata fields.
51
52Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay.
53
54```json
55{
56 "content": "{\"name\": \"Updated Demo Channel\", \"about\": \"Updating a test channel.\", \"picture\": \"https://placekitten.com/201/201\"}",
57 "tags": [["e", <channel_create_event_id> <relay-url>]],
58 ...
59}
60```
61
62
63## Kind 42: Create channel message
64
65Send a text message to a channel.
66
67Clients SHOULD use [NIP-10](10.md) marked "e" tags to recommend a relay and specify whether it is a reply or root message.
68
69Clients SHOULD append [NIP-10](10.md) "p" tags to replies.
70
71Root message:
72
73```json
74{
75 "content": <string>,
76 "tags": [["e", <kind_40_event_id> <relay-url> "root"]],
77 ...
78}
79```
80
81Reply to another message:
82
83```json
84{
85 "content": <string>,
86 "tags": [
87 ["e", <kind_42_event_id> <relay-url> "reply"],
88 ["p", <pubkey> <relay-url>],
89 ...
90 ],
91 ...
92}
93```
94
95
96## Kind 43: Hide message
97
98User no longer wants to see a certain message.
99
100The `content` may optionally include metadata such as a `reason`.
101
102Clients SHOULD hide event 42s shown to a given user, if there is an event 43 from that user matching the event 42 `id`.
103
104Clients MAY hide event 42s for other users other than the user who sent the event 43.
105
106(For example, if three users 'hide' an event giving a reason that includes the word 'pornography', a Nostr client that is an iOS app may choose to hide that message for all iOS clients.)
107
108```json
109{
110 "content": "{\"reason\": \"Dick pic\"}",
111 "tags": [["e", <kind_42_event_id>]],
112 ...
113}
114```
115
116## Kind 44: Mute user
117
118User no longer wants to see messages from another user.
119
120The `content` may optionally include metadata such as a `reason`.
121
122Clients SHOULD hide event 42s shown to a given user, if there is an event 44 from that user matching the event 42 `pubkey`.
123
124Clients MAY hide event 42s for users other than the user who sent the event 44.
125
126```json
127{
128 "content": "{\"reason\": \"Posting dick pics\"}",
129 "tags": [["p", <pubkey>]],
130 ...
131}
132```
133
134## NIP-10 relay recommendations
135
136For [NIP-10](10.md) relay recommendations, clients generally SHOULD use the relay URL of the original (oldest) kind 40 event.
137
138Clients 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.
139
140
141Future extensibility
142--------------------
143
144We reserve event kinds 45-49 for other events related to chat, to potentially include new types of media (photo/video), moderation, or support of private or group messaging.
145
146
147Motivation
148----------
149If we're solving censorship-resistant communication for social media, we may as well solve it also for Telegram-style messaging.
150
151We can bring the global conversation out from walled gardens into a true public square open to all.
152
153
154Additional info
155---------------
156
157- [Chat demo PR with fiatjaf+jb55 comments](https://github.com/ArcadeCity/arcade/pull/28)
158- [Conversation about NIP16](https://t.me/nostr_protocol/29566)