Skip to content

Commit 8081400

Browse files
Merge branch 'nostr-protocol:master' into master
2 parents 1079d5f + 6e6b987 commit 8081400

File tree

18 files changed

+540
-181
lines changed

18 files changed

+540
-181
lines changed

11.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ When a relay receives an HTTP(s) request with an `Accept` header of `application
2020
"contact": <administrative alternate contact>,
2121
"supported_nips": <a list of NIP numbers supported by the relay>,
2222
"software": <string identifying relay software URL>,
23-
"version": <string version identifier>
23+
"version": <string version identifier>,
2424
"privacy_policy": <a link to a text file describing the relay's privacy policy>,
2525
"terms_of_service": <a link to a text file describing the relay's term of service>,
26-
27-
2826
}
2927
```
3028

@@ -162,7 +160,7 @@ a specific niche kind or content. Normal anti-spam heuristics, for example, do n
162160

163161
- `created_at_upper_limit`: 'created_at' upper limit
164162

165-
- `default_limit`: The maximum returned events if you send a filter with the limit set to 0.
163+
- `default_limit`: The maximum returned events if you send a filter without a `limit`.
166164

167165
### Event Retention
168166

18.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@ reposted.
2121

2222
## Quote Reposts
2323

24-
Quote reposts are `kind 1` events with an embedded `q` tag of the note being
25-
quote reposted. The `q` tag ensures quote reposts are not pulled and included
26-
as replies in threads. It also allows you to easily pull and count all of the
27-
quotes for a post.
24+
Mentions to [NIP-21](21.md) entities like `nevent`, `note` and `naddr` on any
25+
event must be converted into `q` tags. The `q` tag ensures quote reposts are
26+
not pulled and included as replies in threads. It also allows you to easily
27+
pull and count all of the quotes for a post. The syntax follows
2828

29-
`q` tags should follow the same conventions as NIP 10 `e` tags, with the exception
30-
of the `mark` argument.
31-
32-
`["q", <event-id>, <relay-url>, <pubkey>]`
33-
34-
Quote reposts MUST include the [NIP-21](21.md) `nevent`, `note`, or `naddr` of the
35-
event in the content.
29+
`["q", "<event-id> or <event-address>", "<relay-url>", "<pubkey-if-a-regular-event>"]`
3630

3731
## Generic Reposts
3832

34.md

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This NIP defines all the ways code collaboration using and adjacent to [`git`](h
1010

1111
## Repository announcements
1212

13-
Git repositories are hosted in Git-enabled servers, but their existence can be announced using Nostr events, as well as their willingness to receive patches, bug reports and comments in general.
13+
Git repositories are hosted in Git-enabled servers, but their existence can be announced using Nostr events. By doing so the author asserts themselves as a maintainer and expresses a willingness to receive patches, bug reports and comments in general, unless `t` tag `personal-fork` is included.
1414

1515
```jsonc
1616
{
@@ -25,6 +25,7 @@ Git repositories are hosted in Git-enabled servers, but their existence can be a
2525
["relays", "<relay-url>", ...], // relays that this repository will monitor for patches and issues
2626
["r", "<earliest-unique-commit-id>", "euc"],
2727
["maintainers", "<other-recognized-maintainer>", ...],
28+
["t","personal-fork"], // optionally indicate author isn't a maintainer
2829
["t", "<arbitrary string>"], // hashtags labelling the repository
2930
]
3031
}
@@ -66,9 +67,13 @@ The `refs` tag can be optionally extended to enable clients to identify how many
6667
}
6768
```
6869

69-
## Patches
70+
## Patches and Pull Requests (PRs)
7071

71-
Patches can be sent by anyone to any repository. Patches to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch events SHOULD include an `a` tag pointing to that repository's announcement address.
72+
Patches and PRs can be sent by anyone to any repository. Patches and PRs to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch and PR events SHOULD include an `a` tag pointing to that repository's announcement address.
73+
74+
Patches SHOULD be used if each event is under 60kb, otherwise PRs SHOULD be used.
75+
76+
### Patches
7277

7378
Patches in a patch set SHOULD include a [NIP-10](10.md) `e` `reply` tag pointing to the previous patch.
7479

@@ -103,9 +108,66 @@ The first patch revision in a patch revision SHOULD include a [NIP-10](10.md) `e
103108

104109
The first patch in a series MAY be a cover letter in the format produced by `git format-patch`.
105110

111+
### Pull Requests
112+
113+
The PR or PR update tip SHOULD be successfully pushed to `refs/nostr/<[PR|PR-Update]-event-id>` in all repositories listed in its `clone` tag before the event is signed.
114+
115+
An attempt SHOULD be made to push this ref to all repositories listed in the repository's announcement event's `"clone"` tag, for which their is reason to believe the user might have write access. This includes each [grasp server](https://njump.me/naddr1qvzqqqrhnypzpgqgmmc409hm4xsdd74sf68a2uyf9pwel4g9mfdg8l5244t6x4jdqy28wumn8ghj7un9d3shjtnwva5hgtnyv4mqqpt8wfshxuqlnvh8x) which can be identified using this method: `clone` tag includes `[http|https]://<grasp-path>/<valid-npub>/<string>.git` and `relays` tag includes `[ws/wss]://<grasp-path>`.
116+
117+
Clients MAY fallback to creating a 'personal-fork' `repository announcement` listing other grasp servers, e.g. from the `User grasp list`, for the purpose of serving the specified commit(s).
118+
119+
```jsonc
120+
{
121+
"kind": 1618,
122+
"content": "<markdown text>",
123+
"tags": [
124+
["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>"],
125+
["r", "<earliest-unique-commit-id-of-repo>"] // so clients can subscribe to all PRs sent to a local git repo
126+
["p", "<repository-owner>"],
127+
["p", "<other-user>"], // optionally send the PR to another user to bring it to their attention
128+
129+
["subject", "<PR-subject>"],
130+
["t", "<PR-label>"], // optional
131+
["t", "<another-PR-label>"], // optional
132+
133+
["c", "<current-commit-id>"], // tip of the PR branch
134+
["clone", "<clone-url>", ...], // at least one git clone url where commit can be downloaded
135+
["branch-name", "<branch-name>"], // optional recommended branch name
136+
137+
["e", "<root-patch-event-id>"], // optionally indicate PR is a revision of an existing patch, which should be closed
138+
["merge-base", "<commit-id>"], // optional: the most recent common ancestor with the target branch
139+
]
140+
}
141+
```
142+
143+
### Pull Request Updates
144+
145+
A PR Update changes the tip of a referenced PR event.
146+
147+
```jsonc
148+
{
149+
"kind": 1619,
150+
"content": "",
151+
"tags": [
152+
["a", "30617:<base-repo-owner-pubkey>:<base-repo-id>"],
153+
["r", "<earliest-unique-commit-id-of-repo>"] // so clients can subscribe to all PRs sent to a local git repo
154+
["p", "<repository-owner>"],
155+
["p", "<other-user>"], // optionally send the PR to another user to bring it to their attention
156+
157+
// NIP-22 tags
158+
["E", "<pull-request-event-id>"],
159+
["P", "<pull-request-author>"],
160+
161+
["c", "<current-commit-id>"], // updated tip of PR
162+
["clone", "<clone-url>", ...], // at least one git clone url where commit can be downloaded
163+
["merge-base", "<commit-id>"], // optional: the most recent common ancestor with the target branch
164+
]
165+
}
166+
```
167+
106168
## Issues
107169

108-
Issues are Markdown text that is just human-readable conversational threads related to the repository: bug reports, feature requests, questions or comments of any kind. Like patches, these SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag.
170+
Issues are Markdown text that is just human-readable conversational threads related to the repository: bug reports, feature requests, questions or comments of any kind. Like patches, these SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag.
109171

110172
Issues may have a `subject` tag, which clients can utilize to display a header. Additionally, one or more `t` tags may be included to provide labels for the issue.
111173

@@ -125,11 +187,11 @@ Issues may have a `subject` tag, which clients can utilize to display a header.
125187

126188
## Replies
127189

128-
Replies to either a `kind:1621` (_issue_) or a `kind:1617` (_patch_) event should follow [NIP-22 comment](22.md).
190+
Replies to either a `kind:1621` (_issue_), `kind:1617` (_patch_) or `kind:1618` (_pull request_) event should follow [NIP-22 comment](22.md).
129191

130192
## Status
131193

132-
Root Patches and Issues have a Status that defaults to 'Open' and can be set by issuing Status events.
194+
Root Patches, PRs and Issues have a Status that defaults to 'Open' and can be set by issuing Status events.
133195

134196
```jsonc
135197
{
@@ -139,7 +201,7 @@ Root Patches and Issues have a Status that defaults to 'Open' and can be set by
139201
"kind": 1633, // Draft
140202
"content": "<markdown text>",
141203
"tags": [
142-
["e", "<issue-or-original-root-patch-id-hex>", "", "root"],
204+
["e", "<issue-or-PR-or-original-root-patch-id-hex>", "", "root"],
143205
["e", "<accepted-revision-root-id-hex>", "", "reply"], // for when revisions applied
144206
["p", "<repository-owner>"],
145207
["p", "<root-event-author>"],
@@ -165,8 +227,22 @@ The most recent Status event (by `created_at` date) from either the issue/patch
165227

166228
The Status of a patch-revision is to either that of the root-patch, or `1632` (_Closed_) if the root-patch's Status is `1631` (_Applied/Merged_) and the patch-revision isn't tagged in the `1631` (_Applied/Merged_) event.
167229

230+
## User grasp list
231+
232+
List of [grasp servers](https://njump.me/naddr1qvzqqqrhnypzpgqgmmc409hm4xsdd74sf68a2uyf9pwel4g9mfdg8l5244t6x4jdqy28wumn8ghj7un9d3shjtnwva5hgtnyv4mqqpt8wfshxuqlnvh8x) the user generally wishes to use for NIP-34 related activity. It is similar in function to the NIP-65 relay list and NIP-B7 blossom list.
233+
234+
The event SHOULD include a list of `g` tags with grasp service websocket URLs in order of preference.
235+
236+
```jsonc
237+
{
238+
"kind": 10317,
239+
"content": "",
240+
"tags": [
241+
["g", "<grasp-service-websocket-url>"], // zero or more grasp sever urls
242+
]
243+
}
244+
```
168245

169246
## Possible things to be added later
170247

171-
- "branch merge" kind (specifying a URL from where to fetch the branch to be merged)
172248
- inline file comments kind (we probably need one for patches and a different one for merged files)

37.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,57 @@
11
NIP-37
22
======
33

4-
Draft Events
5-
------------
4+
Draft Wraps
5+
-----------
66

77
`draft` `optional`
88

9-
This NIP defines kind `31234` as a private wrap for drafts of any other event kind.
9+
This NIP defines kind `31234` as an encrypted storage for unsigned draft events of any other kind.
1010

11-
The draft event is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content` of the event.
11+
The draft is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content`.
1212

13-
An additional `k` tag identifies the kind of the draft event.
13+
`k` tags identify the kind of the draft.
1414

1515
```js
1616
{
1717
"kind": 31234,
1818
"tags": [
1919
["d", "<identifier>"],
20-
["k", "<kind of the draft event>"],
21-
["e", "<anchor event event id>", "<relay-url>"],
22-
["a", "<anchor event address>", "<relay-url>"],
20+
["k", "<kind of the draft event>"], // required
21+
["expiration", "now + 90 days"] // recommended
2322
],
2423
"content": nip44Encrypt(JSON.stringify(draft_event)),
2524
// other fields
2625
}
2726
```
2827

29-
A blanked `.content` means this draft has been deleted by a client but relays still have the event.
28+
A blanked `.content` field signals that the draft has been deleted.
3029

31-
Tags `e` and `a` identify one or more anchor events, such as parent events on replies.
30+
[NIP-40](40.md) `expiration` tags are recommended.
31+
32+
Clients SHOULD publish kind `31234` events to relays listed on kind `10013` below.
3233

3334
## Relay List for Private Content
3435

35-
Kind `10013` indicates the user's preferred relays to store private events like Drafts. The event MUST include a list of `relay` URLs in private tags. Private tags are JSON Stringified, NIP-44-encrypted to the signer's keys and placed inside the .content of the event.
36+
Kind `10013` indicates the user's preferred relays to store private events like Draft Wraps.
37+
38+
The event MUST include a list of `relay` URLs in private tags. Private tags are JSON Stringified, [NIP44-encrypted](44.md) to the signer's keys and placed inside the .content of the event.
3639

3740
```js
3841
{
3942
"kind": 10013,
4043
"tags": [],
41-
"content": nip44Encrypt(JSON.stringify([
42-
["relay", "wss://myrelay.mydomain.com"]
43-
]))
44+
"content": nip44Encrypt(
45+
JSON.stringify(
46+
[
47+
["relay", "wss://myrelay.mydomain.com"]
48+
]
49+
)
50+
)
4451
//...other fields
4552
}
4653
```
4754

48-
Relays listed in this event SHOULD be authed and only allow downloads to events signed by the authed user.
55+
It's recommended that Private Storage relays SHOULD be [NIP-42](42.md)-authed and only allow downloads of events signed by the authed user.
4956

50-
Clients SHOULD publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.
57+
Clients MUST publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.

42.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ And, when sent by clients, the following form:
3232
["AUTH", <signed-event-json>]
3333
```
3434

35+
Clients MAY provide signed events from multiple pubkeys in a sequence of `AUTH` messages. Relays MUST treat all pubkeys as authenticated accordingly.
36+
3537
`AUTH` messages sent by clients MUST be answered with an `OK` message, like any `EVENT` message.
3638

3739
### Canonical authentication event
@@ -69,7 +71,9 @@ relay: ["AUTH", "<challenge>"]
6971
client: ["REQ", "sub_1", {"kinds": [4]}]
7072
relay: ["CLOSED", "sub_1", "auth-required: we can't serve DMs to unauthenticated users"]
7173
client: ["AUTH", {"id": "abcdef...", ...}]
74+
client: ["AUTH", {"id": "abcde2...", ...}]
7275
relay: ["OK", "abcdef...", true, ""]
76+
relay: ["OK", "abcde2...", true, ""]
7377
client: ["REQ", "sub_1", {"kinds": [4]}]
7478
relay: ["EVENT", "sub_1", {...}]
7579
relay: ["EVENT", "sub_1", {...}]

45.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ Some queries a client may want to execute against connected relays are prohibiti
1414

1515
## Filters and return values
1616

17-
This NIP defines the verb `COUNT`, which accepts a subscription id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result.
17+
This NIP defines the verb `COUNT`, which accepts a query id and filters as specified in [NIP 01](01.md) for the verb `REQ`. Multiple filters are OR'd together and aggregated into a single count result.
1818

1919
```
20-
["COUNT", <subscription_id>, <filters JSON>...]
20+
["COUNT", <query_id>, <filters JSON>...]
2121
```
2222

2323
Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements.
2424
In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`.
2525

2626
```
27-
["COUNT", <subscription_id>, {"count": <integer>}]
27+
["COUNT", <query_id>, {"count": <integer>}]
2828
```
2929

3030
Whenever the relay decides to refuse to fulfill the `COUNT` request, it MUST return a `CLOSED` message.
@@ -34,27 +34,27 @@ Whenever the relay decides to refuse to fulfill the `COUNT` request, it MUST ret
3434
### Followers count
3535

3636
```
37-
["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}]
38-
["COUNT", <subscription_id>, {"count": 238}]
37+
["COUNT", <query_id>, {"kinds": [3], "#p": [<pubkey>]}]
38+
["COUNT", <query_id>, {"count": 238}]
3939
```
4040

4141
### Count posts and reactions
4242

4343
```
44-
["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
45-
["COUNT", <subscription_id>, {"count": 5}]
44+
["COUNT", <query_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
45+
["COUNT", <query_id>, {"count": 5}]
4646
```
4747

4848
### Count posts approximately
4949

5050
```
51-
["COUNT", <subscription_id>, {"kinds": [1]}]
52-
["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}]
51+
["COUNT", <query_id>, {"kinds": [1]}]
52+
["COUNT", <query_id>, {"count": 93412452, "approximate": true}]
5353
```
5454

5555
### Relay refuses to count
5656

5757
```
58-
["COUNT", <subscription_id>, {"kinds": [4], "authors": [<pubkey>], "#p": [<pubkey>]}]
59-
["CLOSED", <subscription_id>, "auth-required: cannot count other people's DMs"]
58+
["COUNT", <query_id>, {"kinds": [1059], "#p": [<pubkey>]}]
59+
["CLOSED", <query_id>, "auth-required: cannot count other people's DMs"]
6060
```

0 commit comments

Comments
 (0)