mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-12 18:08:52 +00:00
Compare commits
5 Commits
djot
...
a3c5554e34
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3c5554e34 | ||
|
|
7b24bf803f | ||
|
|
d54c426709 | ||
|
|
179e421011 | ||
|
|
74681c3c14 |
39
37.md
39
37.md
@@ -1,50 +1,57 @@
|
||||
NIP-37
|
||||
======
|
||||
|
||||
Draft Events
|
||||
------------
|
||||
Draft Wraps
|
||||
-----------
|
||||
|
||||
`draft` `optional`
|
||||
|
||||
This NIP defines kind `31234` as a private wrap for drafts of any other event kind.
|
||||
This NIP defines kind `31234` as an encrypted storage for unsigned draft events of any other kind.
|
||||
|
||||
The draft event is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content` of the event.
|
||||
The draft is JSON-stringified, [NIP44-encrypted](44.md) to the signer's public key and placed inside the `.content`.
|
||||
|
||||
An additional `k` tag identifies the kind of the draft event.
|
||||
`k` tags identify the kind of the draft.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": 31234,
|
||||
"tags": [
|
||||
["d", "<identifier>"],
|
||||
["k", "<kind of the draft event>"],
|
||||
["e", "<anchor event event id>", "<relay-url>"],
|
||||
["a", "<anchor event address>", "<relay-url>"],
|
||||
["k", "<kind of the draft event>"], // required
|
||||
["expiration", "now + 90 days"] // recommended
|
||||
],
|
||||
"content": nip44Encrypt(JSON.stringify(draft_event)),
|
||||
// other fields
|
||||
}
|
||||
```
|
||||
|
||||
A blanked `.content` means this draft has been deleted by a client but relays still have the event.
|
||||
A blanked `.content` field signals that the draft has been deleted.
|
||||
|
||||
Tags `e` and `a` identify one or more anchor events, such as parent events on replies.
|
||||
[NIP-40](40.md) `expiration` tags are recommended.
|
||||
|
||||
Clients SHOULD publish kind `31234` events to relays listed on kind `10013` below.
|
||||
|
||||
## Relay List for Private Content
|
||||
|
||||
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.
|
||||
Kind `10013` indicates the user's preferred relays to store private events like Draft Wraps.
|
||||
|
||||
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.
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": 10013,
|
||||
"tags": [],
|
||||
"content": nip44Encrypt(JSON.stringify([
|
||||
["relay", "wss://myrelay.mydomain.com"]
|
||||
]))
|
||||
"content": nip44Encrypt(
|
||||
JSON.stringify(
|
||||
[
|
||||
["relay", "wss://myrelay.mydomain.com"]
|
||||
]
|
||||
)
|
||||
)
|
||||
//...other fields
|
||||
}
|
||||
```
|
||||
|
||||
Relays listed in this event SHOULD be authed and only allow downloads to events signed by the authed user.
|
||||
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.
|
||||
|
||||
Clients SHOULD publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.
|
||||
Clients MUST publish kind `10013` events to the author's [NIP-65](65.md) `write` relays.
|
||||
|
||||
22
45.md
22
45.md
@@ -14,17 +14,17 @@ Some queries a client may want to execute against connected relays are prohibiti
|
||||
|
||||
## Filters and return values
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, <filters JSON>...]
|
||||
["COUNT", <query_id>, <filters JSON>...]
|
||||
```
|
||||
|
||||
Counts are returned using a `COUNT` response in the form `{"count": <integer>}`. Relays may use probabilistic counts to reduce compute requirements.
|
||||
In case a relay uses probabilistic counts, it MAY indicate it in the response with `approximate` key i.e. `{"count": <integer>, "approximate": <true|false>}`.
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"count": <integer>}]
|
||||
["COUNT", <query_id>, {"count": <integer>}]
|
||||
```
|
||||
|
||||
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
|
||||
### Followers count
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"kinds": [3], "#p": [<pubkey>]}]
|
||||
["COUNT", <subscription_id>, {"count": 238}]
|
||||
["COUNT", <query_id>, {"kinds": [3], "#p": [<pubkey>]}]
|
||||
["COUNT", <query_id>, {"count": 238}]
|
||||
```
|
||||
|
||||
### Count posts and reactions
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
|
||||
["COUNT", <subscription_id>, {"count": 5}]
|
||||
["COUNT", <query_id>, {"kinds": [1, 7], "authors": [<pubkey>]}]
|
||||
["COUNT", <query_id>, {"count": 5}]
|
||||
```
|
||||
|
||||
### Count posts approximately
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"kinds": [1]}]
|
||||
["COUNT", <subscription_id>, {"count": 93412452, "approximate": true}]
|
||||
["COUNT", <query_id>, {"kinds": [1]}]
|
||||
["COUNT", <query_id>, {"count": 93412452, "approximate": true}]
|
||||
```
|
||||
|
||||
### Relay refuses to count
|
||||
|
||||
```
|
||||
["COUNT", <subscription_id>, {"kinds": [4], "authors": [<pubkey>], "#p": [<pubkey>]}]
|
||||
["CLOSED", <subscription_id>, "auth-required: cannot count other people's DMs"]
|
||||
["COUNT", <query_id>, {"kinds": [1059], "#p": [<pubkey>]}]
|
||||
["CLOSED", <query_id>, "auth-required: cannot count other people's DMs"]
|
||||
```
|
||||
|
||||
22
54.md
22
54.md
@@ -28,18 +28,16 @@ Articles are identified by lowercase, normalized ascii `d` tags.
|
||||
|
||||
## Content
|
||||
|
||||
The `content` should be [Djot](https://djot.net/) with two special functionalities:
|
||||
The `content` should be Asciidoc with two extra functionalities: **wikilinks** and **nostr:...** links.
|
||||
|
||||
1. Links can have target URIs in NIP-21 format, like `[bob](nostr:npub1bob4npub4here4qwxek)`.
|
||||
2. When a reference can't be found for a "Reference"-style link should link to the wiki article with that name instead, like a "wikilink". For example:
|
||||
Unlike normal Asciidoc links `http://example.com[]` that link to external webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink.
|
||||
|
||||
> a tree is a [vegetable][] that grows big.
|
||||
>
|
||||
> trees are often [green][green color], but they can also be [red][red color] as [bob][] says.
|
||||
>
|
||||
> [bob]: nostr:npub1bob4npub4here4qwxek
|
||||
Wikilinks can take these two forms:
|
||||
|
||||
In the article above, "vegetable" will link to the wiki article **"vegetable"** (with a `d` tag set to `"vegetable"`), "green" will link to the article **green color** (with `d` set to `"green-color"`), same for "red". But "bob" will link to the specified npub as in the reference.
|
||||
1. `[[Target Page]]` -- in this case it will link to the page `target-page` (according to `d` tag normalization rules above) and be displayed as `Target Page`;
|
||||
2. `[[target page|see this]]` -- in this case it will link to the page `target-page`, but will be displayed as `see this`.
|
||||
|
||||
`nostr:...` links, as per [NIP-21](21.md), should link to profiles or arbitrary Nostr events. Although it is not recommended to link to specific versions of articles -- instead the _wikilink_ syntax should be preferred, since it should be left to the reader and their client to decide what version of any given article they want to read.
|
||||
|
||||
## Optional extra tags
|
||||
|
||||
@@ -89,11 +87,11 @@ This is a stronger signal of trust than a `+` reaction.
|
||||
|
||||
This marker is useful when a user edits someone else's entry; if the original author includes the editor's changes and the editor doesn't want to keep/maintain an independent version, the `link` tag could effectively be a considered a "deletion" of the editor's version and putting that pubkey's WoT weight behind the original author's version.
|
||||
|
||||
## Why Djot?
|
||||
## Why Asciidoc?
|
||||
|
||||
Wikitext is unimplementable. Markdown and Asciidoc do not have strict specs. In Markdown every implementation has its own set of special functionalities that would cause conflict and protocol bloat, also it lacks standardized features that are good to have on encyclopaedias: subscript, superscript, description lists, math, comments and custom labeled blocks. Asciidoc, on the other hand, has all features under the sun, but its spec is so huge no one has ever implemented it, not even in JavaScript (the canonical JavaScript library that most people use is transpiled from the original in Ruby).
|
||||
Wikitext is [garbage](nostr:nevent1qqsqt0gcggry60n72uglhuhypdlmr2dm6swjj69jex5v530gcpazlzsprpmhxue69uhhyetvv9ujumn0wdmksetjv5hxxmmdqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsygpm7rrrljungc6q0tuh5hj7ue863q73qlheu4vywtzwhx42a7j9n5ueneex) and Markdown is not powerful enough (besides being too freeform and unspecified and prone to generate incompatibilities in the future).
|
||||
|
||||
Djot is a much faster parser, made by John MacFarlane (the guy behind Pandoc) with years of experience and lessons learned behind him. The spec is well-defined and simple, and has all the features listed above, while also being basically the same as the most basic Markdown.
|
||||
Asciidoc has a strict spec, multiple implementations in many languages, and support for features that are very much necessary in a wiki article, like _sidebars_, _tables_ (with rich markup inside cells), many levels of _headings_, _footnotes_, _superscript_ and _subscript_ markup and _description lists_. It is also arguably easier to read in its plaintext format than Markdown (and certainly much better than Wikitext).
|
||||
|
||||
## Appendix 1: Merge requests
|
||||
Users can request other users to get their entries merged into someone else's entry by creating a `kind:818` event.
|
||||
|
||||
4
55.md
4
55.md
@@ -295,6 +295,8 @@ For the other types Signer Application returns the column "result"
|
||||
|
||||
If the user chose to always reject the event, signer application will return the column "rejected" and you should not open signer application
|
||||
|
||||
Clients SHOULD save the user pubkey locally and avoid calling the `get_public_key` after the user is logged in to the Client
|
||||
|
||||
#### Methods
|
||||
|
||||
- **get_public_key**
|
||||
@@ -303,7 +305,7 @@ If the user chose to always reject the event, signer application will return the
|
||||
```kotlin
|
||||
val result = context.contentResolver.query(
|
||||
Uri.parse("content://com.example.signer.GET_PUBLIC_KEY"),
|
||||
listOf("login"),
|
||||
listOf(hex_pub_key),
|
||||
null,
|
||||
null,
|
||||
null
|
||||
|
||||
2
66.md
2
66.md
@@ -53,7 +53,7 @@ Example:
|
||||
["g", "ww8p1r4t8"],
|
||||
["l", "en", "ISO-639-1"],
|
||||
["t", "nsfw" ],
|
||||
["rtt-open", 234 ]
|
||||
["rtt-open", "234" ]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
12
71.md
12
71.md
@@ -26,6 +26,11 @@ The primary source of video information is the `imeta` tags which is defined in
|
||||
|
||||
Each `imeta` tag can be used to specify a variant of the video by the `dim` & `m` properties.
|
||||
|
||||
This NIP defines the following additional `imeta` properties aside form those listen in [NIP-92](92.md) & [NIP-94](94.md):
|
||||
|
||||
* `duration` (recommended) the duration of the video/audio in seconds (floating point number)
|
||||
* `bitrate` (recommended) the average bitrate of the video/audio in bits/sec
|
||||
|
||||
Example:
|
||||
```json
|
||||
[
|
||||
@@ -39,6 +44,8 @@ Example:
|
||||
"fallback https://myotherserver.com/1080/12345.mp4",
|
||||
"fallback https://andanotherserver.com/1080/12345.mp4",
|
||||
"service nip96",
|
||||
"bitrate 3000000",
|
||||
"duration 29.223"
|
||||
],
|
||||
["imeta",
|
||||
"dim 1280x720",
|
||||
@@ -50,6 +57,8 @@ Example:
|
||||
"fallback https://myotherserver.com/720/12345.mp4",
|
||||
"fallback https://andanotherserver.com/720/12345.mp4",
|
||||
"service nip96",
|
||||
"bitrate 2000000",
|
||||
"duration 29.24"
|
||||
],
|
||||
["imeta",
|
||||
"dim 1280x720",
|
||||
@@ -61,6 +70,7 @@ Example:
|
||||
"fallback https://myotherserver.com/720/12345.m3u8",
|
||||
"fallback https://andanotherserver.com/720/12345.m3u8",
|
||||
"service nip96",
|
||||
"duration 29.21"
|
||||
],
|
||||
]
|
||||
```
|
||||
@@ -74,7 +84,6 @@ Additionally `service nip96` may be included to allow clients to search the auth
|
||||
### Other tags:
|
||||
* `title` (required) title of the video
|
||||
* `published_at`, for the timestamp in unix seconds (stringified) of the first time the video was published
|
||||
* `duration` (optional) video duration in seconds
|
||||
* `text-track` (optional, repeated) link to WebVTT file for video, type of supplementary information (captions/subtitles/chapters/metadata), optional language code
|
||||
* `content-warning` (optional) warning about content of NSFW video
|
||||
* `alt` (optional) description for accessibility
|
||||
@@ -108,7 +117,6 @@ Additionally `service nip96` may be included to allow clients to search the auth
|
||||
"service nip96",
|
||||
],
|
||||
|
||||
["duration", "<duration of video in seconds>"],
|
||||
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
|
||||
["content-warning", "<reason>"],
|
||||
["segment", <start>, <end>, "<title>", "<thumbnail URL>"],
|
||||
|
||||
Reference in New Issue
Block a user