nips/94.md

59 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2023-04-24 13:57:37 -04:00
NIP-94
2023-03-09 09:01:19 -05:00
======
2023-04-24 13:57:37 -04:00
File Metadata
-------------
2023-11-15 19:42:51 -05:00
`draft` `optional`
2023-04-24 13:57:37 -04:00
The purpose of this NIP is to allow an organization and classification of shared files. So that relays can filter and organize in any way that is of interest. With that, multiple types of filesharing clients can be created. NIP-94 support is not expected to be implemented by "social" clients that deal with `kind:1` notes or by longform clients that deal with `kind:30023` articles.
2023-04-24 13:57:37 -04:00
## Event format
2023-03-09 09:01:19 -05:00
2023-04-05 10:11:59 -04:00
This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below:
2023-04-24 13:57:37 -04:00
* `url` the url to download the file
* `m` a string indicating the data type of the file. The [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) format must be used, and they should be lowercase.
2023-09-27 11:59:33 -04:00
* `x` containing the SHA-256 hexencoded string of the file.
NIP-96 - HTTP File Storage Integration (#547) * Add NIP-95 - File Storage * Add missing response info * Make it clear that is is an HTTP file storage server integration * Add monetization suggestion * Use zap split tags for monetization suggestion * Add resize option * Add Zap Gates Integration * Replace /nip96 convention with /.well-known/nostr.json configuration * Relays can choose to also act as HTTP file storage server * Remove nip96 tag in favor of x tags third element * Fix typo * Remove redirect cooperation * Replaced 422 with 400 status code * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Update 96.md Co-authored-by: Jon Staab <jstaab@protonmail.com> * Make file expiration a range and add terms_of_service * Add optional content_type field * Add plans and tos * Remove monetization * Apply minor fixes * Update 96.md Co-authored-by: Semisol <45574030+Semisol@users.noreply.github.com> * Fix after review * Add kind 10096 * Apply suggestions * Add suggestions * Remove duplicate field * Add optional is_nip98_required plan config * Add suggestions * Replace x with ox tag for original file hash * Make minor changes * Remove nip96 namespace response field * Add note about alternative file processing flow * Simplify processing flow * Add nostrcheck to server list * Add audio/* example * Explain what metadata to show before processing is done * Add nostrage to list * Add eta * Add sove to list and replace eta with percentage * Fix status code * Add nostr.build to list * Add sovbit * Add optional extra http servers to ox tag * Add void.cat to list * Small fix * Remove ox third array element --------- Co-authored-by: Jon Staab <jstaab@protonmail.com> Co-authored-by: Semisol <45574030+Semisol@users.noreply.github.com>
2024-01-08 12:05:01 -05:00
* `ox` containing the SHA-256 hexencoded string of the original file, before any transformations done by the upload server
* `size` (optional) size of file in bytes
2023-04-28 11:21:18 -04:00
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
* `magnet` (optional) URI to magnet file
* `i` (optional) torrent infohash
2023-04-24 13:57:37 -04:00
* `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client
2023-09-12 10:58:34 -04:00
* `thumb` (optional) url of thumbnail with same aspect ratio
* `image` (optional) url of preview image with same dimensions
* `summary` (optional) text excerpt
2023-09-12 09:49:21 -04:00
* `alt` (optional) description for accessibility
2023-11-27 17:47:04 -05:00
* `fallback` (optional) zero or more fallback file sources in case `url` fails
2024-05-27 07:18:27 -04:00
* `service` (optional) service type which is serving the file (eg. [NIP-96](96.md))
2023-03-09 09:01:19 -05:00
2024-09-03 13:11:31 -04:00
```jsonc
2023-03-09 09:01:19 -05:00
{
2023-03-17 09:41:46 -04:00
"kind": 1063,
2023-03-09 09:01:19 -05:00
"tags": [
["url",<string with URI of file>],
["m", <MIME type>],
2024-05-27 07:18:27 -04:00
["x", <Hash SHA-256>],
["ox", <Hash SHA-256>],
["size", <size of file in bytes>],
2023-04-28 11:21:18 -04:00
["dim", <size of file in pixels>],
2024-05-27 07:18:27 -04:00
["magnet", <magnet URI> ],
["i", <torrent infohash>],
2023-09-12 08:50:25 -04:00
["blurhash", <value>],
2024-05-27 07:18:27 -04:00
["thumb", <string with thumbnail URI>, <Hash SHA-256>],
["image", <string with preview URI>, <Hash SHA-256>],
2023-09-12 10:58:34 -04:00
["summary", <excerpt>],
2023-09-12 09:49:21 -04:00
["alt", <description>]
2023-03-09 09:01:19 -05:00
],
"content": "<caption>",
2024-09-03 13:11:31 -04:00
// other fields...
2023-03-09 09:01:19 -05:00
}
2023-03-10 05:04:00 -05:00
```
2023-03-09 09:01:19 -05:00
2023-04-24 13:57:37 -04:00
## Suggested use cases
2023-03-10 05:11:55 -05:00
2023-04-24 13:57:37 -04:00
* A relay for indexing shared files. For example, to promote torrents.
* A pinterest-like client where people can share their portfolio and inspire others.
2023-03-09 09:01:19 -05:00
* A simple way to distribute configurations and software updates.