upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrbittencourt <fbittencourt@neadvance.com>2023-03-09 14:01:19 +0000
committerfiatjaf_ <fiatjaf@gmail.com>2023-04-20 08:06:14 -0300
commita090de2b90f9fd83e49fa39ff4c7ef52750e904b (patch)
treee3e12df4cc03eedde6506cdb9471d150ec7c4ce0
parentbb4a805f11e0c9438d0ee513f2071602e5403382 (diff)
create draft NIP 94 and 95
-rw-r--r--94.md43
-rw-r--r--95.md35
2 files changed, 78 insertions, 0 deletions
diff --git a/94.md b/94.md
new file mode 100644
index 0000000..06b03c8
--- /dev/null
+++ b/94.md
@@ -0,0 +1,43 @@
1NIP-94 - File Header
2======
3`draft` `optional` `author:frbitten`
4
5The 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.
6Also the goal is to create a base on the protocol for this bountsr "Filesharing App" (https://bountsr.org/p2p-filesharing/) to be implemented.
7
8Nostr event
9------------------
10This 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:
11* `d` containing the name of the shared file to allow it to be overwritten in the future.
12* `url` the url to download the file
13* `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)
14* `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 information (the key) that allow the decryption of the file
15
16```json
17{
18 "id": <32-bytes lowercase hex-encoded sha256 of the the serialized event data>,
19 "pubkey": <32-bytes lowercase hex-encoded public key of the event creator>,
20 "created_at": <unix timestamp in seconds>,
21 "kind": 30063,
22 "tags": [
23 ["d", <string with name of file>],
24 ["url",<string with URL of file>],
25 ["decrypt",<algorithm>,<key>],
26 ["p", <32-bytes hex of a pubkey>, <recommended relay URL>],
27 ],
28 "content": "A beautiful picture of a wild toucan",
29 "sig": <64-bytes hex of the signature of the sha256 hash of the serialized event data, which is the same as the "id" field>
30}
31
32Client Behavior
33---------------
34The 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
35It 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. Exemple: <https://ibb.co/Fnj5TMg>
36To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image
37
38Suggested Use Cases
39-------------------
40* A relay for indexing shared files. For example to promote torrents
41* A Pinterest-like relay and app where people can share their portfolio and inspire others.
42* A simple way to distribute configurations and software updates.
43* Specialized relays can provide collections of emojis, memes and animated gifs to be used in notes.
diff --git a/95.md b/95.md
new file mode 100644
index 0000000..680496c
--- /dev/null
+++ b/95.md
@@ -0,0 +1,35 @@
1NIP-95 Base64 File
2======
3`draft` `optional` `author:frbitten`
4
5This NIP allows users to send binary data to be stored in the relay. This data can be small pieces of information or even large files.
6
7Nostr event
8------------------
9This NIP specifies the use of the `30064` event type (parameterized replaceable event), having in `content` the binary data that you want to be stored in Base64 format.
10* `d` containing the name of the shared file to allow it to be overwritten in the future.
11* `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)
12* `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 information (the key) that allow the decryption of the file
13
14This event must not be returned in generic searches. It should only be returned if specifically requested by your ID. This avoids bandwidth consumption and unnecessary overload on the relay and client.
15
16The `NIP-94` can be used to broadcast the ID of that event, with the ` and ` tag referencing the event id, without having to send the full event which can be a lot of data.
17
18Relay Behavior
19---------------
20Relays that use a relational database may have more difficulty implementing this NIP, but a possible solution is for this NIP not to be recorded in the database, but on disk, the file name being the event id. So it can be easily found and searched. And because it is not in the database, it does not interfere with the indexing of common events.
21
22Another solution is for Relays that want to implement this functionality and use a No-SQL database with mongodb that already supports large documents without harming performance.
23
24The relay can allow access to this data via URL, having its own URL pattern for these cases. And if you receive a `NIP-94` referring to a `NIP-95` you can include the URL in the proper `NIP-94` tag
25
26Client Behavior
27---------------
28The client can use this event for any type of storage it wants. The functionality of uploading an image directly through the client's interface and including it in the note that is being created is a very useful facility for the end user. In this case, 3 events would be created. Kind 30064 with the file converted to base64, Kind 30063 which is the header of this file for dissemination and Kind 1 with the post and the image.
29
30Also, when used in conjunction with `NIP-94`, it allows the app to create image galleries (memes, animations) that can be reused countless times in different notes. As it exists in whatsapp, tegegran, etc.Exemple: <https://ibb.co/Fnj5TMg>. To do this, just select the image from the gallery (events NIP-94) and include the URL of the selected image
31
32Suggested Use Cases
33-------------------
34* Provide file storage service that is quickly integrable with nostr clients.
35* Create an application similar to pinterest without the need for other protocols.