Compare commits

..

2 Commits

Author SHA1 Message Date
Kieran
a3c5554e34 Add duration & bitrate to NIP-71 (#1723)
Co-authored-by: Vitor Pamplona <vitor@vitorpamplona.com>
2025-10-15 16:15:27 -04:00
Vitor Pamplona
7b24bf803f NIP-37: Improving Draft events (#2016) 2025-10-15 16:09:36 -04:00
2 changed files with 33 additions and 18 deletions

39
37.md
View File

@@ -1,50 +1,57 @@
NIP-37 NIP-37
====== ======
Draft Events Draft Wraps
------------ -----------
`draft` `optional` `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 ```js
{ {
"kind": 31234, "kind": 31234,
"tags": [ "tags": [
["d", "<identifier>"], ["d", "<identifier>"],
["k", "<kind of the draft event>"], ["k", "<kind of the draft event>"], // required
["e", "<anchor event event id>", "<relay-url>"], ["expiration", "now + 90 days"] // recommended
["a", "<anchor event address>", "<relay-url>"],
], ],
"content": nip44Encrypt(JSON.stringify(draft_event)), "content": nip44Encrypt(JSON.stringify(draft_event)),
// other fields // 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 ## 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 ```js
{ {
"kind": 10013, "kind": 10013,
"tags": [], "tags": [],
"content": nip44Encrypt(JSON.stringify([ "content": nip44Encrypt(
["relay", "wss://myrelay.mydomain.com"] JSON.stringify(
])) [
["relay", "wss://myrelay.mydomain.com"]
]
)
)
//...other fields //...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.

12
71.md
View File

@@ -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. 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: Example:
```json ```json
[ [
@@ -39,6 +44,8 @@ Example:
"fallback https://myotherserver.com/1080/12345.mp4", "fallback https://myotherserver.com/1080/12345.mp4",
"fallback https://andanotherserver.com/1080/12345.mp4", "fallback https://andanotherserver.com/1080/12345.mp4",
"service nip96", "service nip96",
"bitrate 3000000",
"duration 29.223"
], ],
["imeta", ["imeta",
"dim 1280x720", "dim 1280x720",
@@ -50,6 +57,8 @@ Example:
"fallback https://myotherserver.com/720/12345.mp4", "fallback https://myotherserver.com/720/12345.mp4",
"fallback https://andanotherserver.com/720/12345.mp4", "fallback https://andanotherserver.com/720/12345.mp4",
"service nip96", "service nip96",
"bitrate 2000000",
"duration 29.24"
], ],
["imeta", ["imeta",
"dim 1280x720", "dim 1280x720",
@@ -61,6 +70,7 @@ Example:
"fallback https://myotherserver.com/720/12345.m3u8", "fallback https://myotherserver.com/720/12345.m3u8",
"fallback https://andanotherserver.com/720/12345.m3u8", "fallback https://andanotherserver.com/720/12345.m3u8",
"service nip96", "service nip96",
"duration 29.21"
], ],
] ]
``` ```
@@ -74,7 +84,6 @@ Additionally `service nip96` may be included to allow clients to search the auth
### Other tags: ### Other tags:
* `title` (required) title of the video * `title` (required) title of the video
* `published_at`, for the timestamp in unix seconds (stringified) of the first time the video was published * `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 * `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 * `content-warning` (optional) warning about content of NSFW video
* `alt` (optional) description for accessibility * `alt` (optional) description for accessibility
@@ -108,7 +117,6 @@ Additionally `service nip96` may be included to allow clients to search the auth
"service nip96", "service nip96",
], ],
["duration", "<duration of video in seconds>"],
["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"], ["text-track", "<encoded `kind 6000` event>", "<recommended relay urls>"],
["content-warning", "<reason>"], ["content-warning", "<reason>"],
["segment", <start>, <end>, "<title>", "<thumbnail URL>"], ["segment", <start>, <end>, "<title>", "<thumbnail URL>"],