2023-04-24 17:57:37 +00:00
NIP-94
2023-03-09 14:01:19 +00:00
======
2023-04-24 17:57:37 +00:00
File Metadata
-------------
2023-04-28 15:21:18 +00:00
`draft` `optional` `author:frbitten` `author:kieran` `author:lovvtide` `author:fiatjaf` `author:staab`
2023-04-24 17:57:37 +00: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.
## Event format
2023-03-09 14:01:19 +00:00
2023-04-05 14:11:59 +00: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 17:57:37 +00:00
2023-04-12 13:03:52 +00:00
* `url` the url to download the file
2023-09-08 12:11:38 +00:00
* `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-04-12 13:03:52 +00:00
* `"aes-256-gcm"` (optional) key and nonce for AES-GCM encryption with tagSize always 128bits
2023-09-27 15:20:41 +00:00
* `x` containing the SHA-256 hexencoded string of the **transformed** file after any server transformations
2023-09-27 15:23:38 +00:00
* `ox` containing the SHA-256 hexencoded string of the **original** file before any server transformations
2023-04-12 13:03:52 +00:00
* `size` (optional) size of file in bytes
2023-04-28 15:21:18 +00:00
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
2023-04-12 13:03:52 +00:00
* `magnet` (optional) URI to magnet file
* `i` (optional) torrent infohash
2023-04-24 17:57:37 +00:00
* `blurhash` (optional) the [blurhash ](https://github.com/woltapp/blurhash ) to show while the file is being loaded by the client
2023-09-12 14:58:34 +00: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 13:49:21 +00:00
* `alt` (optional) description for accessibility
2023-03-09 14:01:19 +00:00
```json
{
"id": < 32-bytes lowercase hex-encoded sha256 of the the serialized event data > ,
"pubkey": < 32-bytes lowercase hex-encoded public key of the event creator > ,
"created_at": < unix timestamp in seconds > ,
2023-03-17 13:41:46 +00:00
"kind": 1063,
2023-03-09 14:01:19 +00:00
"tags": [
2023-04-12 13:03:52 +00:00
["url",< string with URI of file > ],
["aes-256-gcm",< key > , < iv > ],
["m", < MIME type > ],
["x",< Hash SHA-256 > ],
2023-09-27 15:23:38 +00:00
["ox",< Hash SHA-256 > ],
2023-04-12 13:03:52 +00:00
["size", < size of file in bytes > ],
2023-04-28 15:21:18 +00:00
["dim", < size of file in pixels > ],
2023-04-12 13:03:52 +00:00
["magnet",< magnet URI > ],
["i",< torrent infohash > ],
2023-09-12 12:50:25 +00:00
["blurhash", < value > ],
2023-09-12 14:58:34 +00:00
["thumb", < string with thumbnail URI > ],
["image", < string with preview URI > ],
["summary", < excerpt > ],
2023-09-12 13:49:21 +00:00
["alt", < description > ]
2023-03-09 14:01:19 +00:00
],
2023-09-12 13:49:21 +00:00
"content": < caption > ,
2023-03-09 14:01:19 +00:00
"sig": < 64-bytes hex of the signature of the sha256 hash of the serialized event data , which is the same as the " id " field >
}
2023-03-10 10:04:00 +00:00
```
2023-03-09 14:01:19 +00:00
2023-04-24 17:57:37 +00:00
## Suggested use cases
2023-03-10 10:11:55 +00:00
2023-04-24 17:57:37 +00: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 14:01:19 +00:00
* A simple way to distribute configurations and software updates.