Skip to content

Commit a2ebbe6

Browse files
Merge branch 'nostr-protocol:master' into master
2 parents d642ea7 + 3430b8b commit a2ebbe6

File tree

9 files changed

+269
-103
lines changed

9 files changed

+269
-103
lines changed

01.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ As a convention, all single-letter (only english alphabet letters: a-z, A-Z) key
8585

8686
### Kinds
8787

88-
Kinds specify how clients should interpret the meaning of each event and the other fields of each event (e.g. an `"r"` tag may have a meaning in an event of kind 1 and an entirely different meaning in an event of kind 10002). Each NIP may define the meaning of a set of kinds that weren't defined elsewhere. [NIP-10](10.md), for instance, especifies the `kind:1` text note for social media applications.
88+
Kinds specify how clients should interpret the meaning of each event and the other fields of each event (e.g. an `"r"` tag may have a meaning in an event of kind 1 and an entirely different meaning in an event of kind 10002). Each NIP may define the meaning of a set of kinds that weren't defined elsewhere. [NIP-10](10.md), for instance, specifies the `kind:1` text note for social media applications.
8989

9090
This NIP defines one basic kind:
9191

@@ -144,7 +144,7 @@ All conditions of a filter that are specified must match for an event for it to
144144

145145
A `REQ` message may contain multiple filters. In this case, events that match any of the filters are to be returned, i.e., multiple filters are to be interpreted as `||` conditions.
146146

147-
The `limit` property of a filter is only valid for the initial query and MUST be ignored afterwards. When `limit: n` is present it is assumed that the events returned in the initial query will be the last `n` events ordered by the `created_at`. Newer events should appear first, and in the case of ties the event with the lowest id (first in lexical order) should be first. It is safe to return less events than `limit` specifies, but it is expected that relays do not return (much) more events than requested so clients don't get unnecessarily overwhelmed by data.
147+
The `limit` property of a filter is only valid for the initial query and MUST be ignored afterwards. When `limit: n` is present it is assumed that the events returned in the initial query will be the last `n` events ordered by the `created_at`. Newer events should appear first, and in the case of ties the event with the lowest id (first in lexical order) should be first. Relays SHOULD use the `limit` value to guide how many events are returned in the initial response. Returning fewer events is acceptable, but returning (much) more should be avoided to prevent overwhelming clients.
148148

149149
### From relay to client: sending events and notices
150150

19.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These are the possible bech32 prefixes with `TLV`:
3434

3535
- `nprofile`: a nostr profile
3636
- `nevent`: a nostr event
37-
- `naddr`: a nostr _replaceable event_ coordinate
37+
- `naddr`: a nostr _addressable event_ coordinate
3838
- `nrelay`: a nostr relay (deprecated)
3939

4040
These possible standardized `TLV` types are indicated here:

21.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,27 @@ The scheme is `nostr:`.
1212

1313
The identifiers that come after are expected to be the same as those defined in [NIP-19](19.md) (except `nsec`).
1414

15-
## Examples
15+
#### Examples
1616

1717
- `nostr:npub1sn0wdenkukak0d9dfczzeacvhkrgz92ak56egt7vdgzn8pv2wfqqhrjdv9`
1818
- `nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpp4mhxue69uhhytnc9e3k7mgpz4mhxue69uhkg6nzv9ejuumpv34kytnrdaksjlyr9p`
1919
- `nostr:note1fntxtkcy9pjwucqwa9mddn7v03wwwsu9j330jj350nvhpky2tuaspk6nqc`
2020
- `nostr:nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5nxnepm`
21+
22+
### Linking HTML pages to Nostr entities
23+
24+
`<link>` tags with `rel="alternate"` can be used to associate webpages to Nostr events, in cases where the same content is served via the two mediums (for example, a web server that exposes Markdown articles both as HTML pages and as `kind:30023' events served under itself as a relay or through some other relay). For example:
25+
26+
```
27+
<head>
28+
<link rel="alternate" href="nostr:naddr1qqyrzwrxvc6ngvfkqyghwumn8ghj7enfv96x5ctx9e3k7mgzyqalp33lewf5vdq847t6te0wvnags0gs0mu72kz8938tn24wlfze6qcyqqq823cph95ag" />
29+
</head>
30+
```
31+
32+
Likewise, `<link>` tags with `rel="me"` or `rel="author"` can be used to assign authorship of webpages to Nostr profiles. For example:
33+
34+
```
35+
<head>
36+
<link rel="me" href="nostr:nprofile1qyxhwumn8ghj7mn0wvhxcmmvqyd8wumn8ghj7un9d3shjtnhv4ehgetjde38gcewvdhk6qpq80cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwswpnfsn" />
37+
</head>
38+
```

25.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ Reactions
77

88
`draft` `optional`
99

10-
A reaction is a `kind 7` event that is used to react to other events.
10+
A reaction is a `kind 7` event that is used to indicate user reactions to other events. A
11+
reaction's `content` field MUST include user-generated-content indicating the value of the
12+
reaction (conventionally `+`, `-`, or an emoji).
1113

12-
The generic reaction, represented by the `content` set to a `+` string, SHOULD
13-
be interpreted as a "like" or "upvote".
14+
A reaction with `content` set to `+` or an empty string MUST be interpreted as a "like" or "upvote".
15+
A reaction with `content` set to `-` MUST be interpreted as a "dislike" or "downvote".
1416

15-
A reaction with `content` set to `-` SHOULD be interpreted as a "dislike" or
16-
"downvote". It SHOULD NOT be counted as a "like", and MAY be displayed as a
17-
downvote or dislike on a post. A client MAY also choose to tally likes against
18-
dislikes in a reddit-like system of upvotes and downvotes, or display them as
19-
separate tallies.
20-
21-
The `content` MAY be an emoji, or [NIP-30](30.md) custom emoji in this case it MAY be interpreted as a "like" or "dislike",
22-
or the client MAY display this emoji reaction on the post. If the `content` is an empty string then the client should
23-
consider it a "+".
17+
A reaction with `content` set to an emoji or [NIP-30](30.md) custom emoji SHOULD NOT be interpreted
18+
as a "like" or "dislike". Clients MAY instead display this emoji reaction on the post.
2419

2520
Tags
2621
----
2722

2823
There MUST be always an `e` tag set to the `id` of the event that is being reacted to. The `e` tag SHOULD include a relay hint pointing to a relay where the event being reacted to can be found. If a client decides to include other `e`, which not recommended, the target event `id` should be last of the `e` tags.
2924

30-
The SHOULD be a `p` tag set to the `pubkey` of the event being reacted to. If a client decides to include other `p` tags, which not recommended, the target event `pubkey` should be last the `p` tags.
25+
There SHOULD be a `p` tag set to the `pubkey` of the event being reacted to. If a client decides to include other `p` tags, which not recommended, the target event `pubkey` should be last the `p` tags.
3126

3227
If the event being reacted to is an addressable event, an `a` SHOULD be included together with the `e` tag, it must be set to the coordinates (`kind:pubkey:d-tag`) of the event being reacted to.
3328

3429
The reaction SHOULD include a `k` tag with the stringified kind number of the reacted event as its value.
3530

31+
The `e` and `a` tags SHOULD include relay and pubkey hints. The `p` tags SHOULD include relay hints.
32+
33+
The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value.
34+
3635
**Example code**
3736

3837
```swift
39-
func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent {
40-
tags.append(["e", liked.id, liked.source_relays.first ?? ""])
41-
tags.append(["p", liked.pubkey])
38+
func make_like_event(pubkey: String, privkey: String, liked: NostrEvent, hint: String) -> NostrEvent {
39+
var tags: [[String]] = []
40+
tags.append(["e", liked.id, hint, liked.pubkey])
41+
tags.append(["p", liked.pubkey, hint])
4242
tags.append(["k", String(liked.kind)])
4343
let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags)
4444
ev.calculate_id()

51.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Aside from their main identifier, the `"d"` tag, sets can optionally have a `"ti
6060
| Emoji sets | 30030 | categorized emoji groups | `"emoji"` (see [NIP-30](30.md)) |
6161
| Release artifact sets | 30063 | group of artifacts of a software release | `"e"` (kind:1063 [file metadata](94.md) events), `"a"` (software application event) |
6262
| App curation sets | 30267 | references to multiple software applications | `"a"` (software application event) |
63+
| Calendar | 31924 | a set of events categorized in any way | `"a"` (calendar event event) |
6364
| Starter packs | 39089 | a named set of profiles to be shared around with the goal of being followed together | `"p"` (pubkeys) |
6465
| Media starter packs | 39092 | same as above, but specific to multimedia (photos, short video) clients | `"p"` (pubkeys) |
6566

@@ -103,9 +104,9 @@ Some clients have used these lists in the past, but they should work on transiti
103104
"kind": 30004,
104105
"tags": [
105106
["d", "jvdy9i4"],
106-
["name", "Yaks"],
107-
["picture", "https://cdn.britannica.com/40/188540-050-9AC748DE/Yak-Himalayas-Nepal.jpg"],
108-
["about", "The domestic yak, also known as the Tartary ox, grunting ox, or hairy cattle, is a species of long-haired domesticated cattle found throughout the Himalayan region of the Indian subcontinent, the Tibetan Plateau, Gilgit-Baltistan, Tajikistan and as far north as Mongolia and Siberia."],
107+
["title", "Yaks"],
108+
["image", "https://cdn.britannica.com/40/188540-050-9AC748DE/Yak-Himalayas-Nepal.jpg"],
109+
["description", "The domestic yak, also known as the Tartary ox, grunting ox, or hairy cattle, is a species of long-haired domesticated cattle found throughout the Himalayan region of the Indian subcontinent, the Tibetan Plateau, Gilgit-Baltistan, Tajikistan and as far north as Mongolia and Siberia."],
109110
["a", "30023:26dc95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:95ODQzw3ajNoZ8SyMDOzQ"],
110111
["a", "30023:54af95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:1-MYP8dAhramH9J5gJWKx"],
111112
["a", "30023:f8fe95542e18b8b7aec2f14610f55c335abebec76f3db9e58c254661d0593a0c:D2Tbd38bGrFvU0bIbvSMt"],

0 commit comments

Comments
 (0)