nips/94.md

50 lines
2.6 KiB
Markdown
Raw Normal View History

2023-03-09 14:01:19 +00:00
NIP-94 - File Header
======
`draft` `optional` `author:frbitten`
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.
Also the goal is to create a base on the protocol for this bountsr "Filesharing App" (https://bountsr.org/p2p-filesharing/) to be implemented.
Nostr event
------------------
This NIP specifies the use of the `30063` event type (parameterized replaceable event), having in `content` a description of the file content, and a list of tags described below:
* `url` the url to download the file
* `type` a string indicating the data type of the file. The MIME types format must be used (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)
2023-03-10 10:18:53 +00:00
* `decrypt` (optional) If the file is encrypted, you must indicate in the first value the algorithm used to encrypt the file and in the second value the parameters that allow the decryption of the file
* `hash` containing the SHA-256 hexencoded string of the file or the BlurHash string (for images). The third array value is the lowercase chosen algorithm name: "sha256" or "blurhash".
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>,
"kind": 30063,
"tags": [
["url",<string with URL of file>],
2023-03-10 10:15:01 +00:00
["decrypt",<algorithm>,<Decryption Params>],
["type", "image/webp"],
["hash", "LKN]Rv%2Tw=w]~RBVZRi};RPxuwH", "blurhash"]
2023-03-09 14:01:19 +00:00
],
2023-03-09 14:04:57 +00:00
"content": <description>,
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
Client Behavior
---------------
2023-03-10 10:11:55 +00:00
The client can use this event as they see fit. Either showing events in the same feed as kind 1 events or creating a specific feed for file listings.
2023-03-10 10:09:38 +00:00
It allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, telegram, etc.
2023-03-10 10:11:55 +00:00
2023-03-10 10:09:38 +00:00
Example: <https://ibb.co/Fnj5TMg>
2023-03-10 10:11:55 +00:00
2023-03-09 14:01:19 +00:00
To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image
2023-03-10 10:11:55 +00:00
2023-03-09 14:01:19 +00:00
Suggested Use Cases
-------------------
* A relay for indexing shared files. For example to promote torrents
* A Pinterest-like relay and app where people can share their portfolio and inspire others.
* A simple way to distribute configurations and software updates.
* Specialized relays can provide collections of emojis, memes and animated gifs to be used in notes.