From bd9c7a1b8e372b3c8e518861b1f4ea5c92ef1888 Mon Sep 17 00:00:00 2001 From: kieran Date: Mon, 20 May 2024 21:38:36 +0100 Subject: [PATCH] add pagination / drop duplicate fields --- 96.md | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/96.md b/96.md index 4203b63e..e882870e 100644 --- a/96.md +++ b/96.md @@ -1,8 +1,6 @@ -NIP-96 -====== +# NIP-96 -HTTP File Storage Integration ------------------------------ +## HTTP File Storage Integration `draft` `optional` @@ -84,8 +82,7 @@ it must use the "api_url" field instead. See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers. - -## Auth +## Auth When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (**optionally** with the encoded `payload` tag set to the base64-encoded 256-bit SHA-256 hash of the file - not the hash of the whole request body). @@ -96,6 +93,7 @@ When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (** **AUTH required** List of form fields: + - `file`: **REQUIRED** the file to upload - `caption`: **RECOMMENDED** loose description; - `expiration`: UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this. @@ -276,22 +274,27 @@ The successful response is a 200 OK one with just basic JSON fields: ## Listing files -`GET $api_url` +`GET $api_url?page=x&count=y` **AUTH required** Returns a list of files linked to the authenticated users pubkey. Example Response: + ```js [ - { + { "id": "", - "nip94_event": {...}, - "expires": 1715691139, // unix timestamp - "size": 123456, - "alt": "a meme that makes you laugh", - "caption": "haha funny meme" + "nip94_event": { + "tags": [ + ["size", "123456"], + ["alt", "a meme that makes you laugh"], + ["expiration", "1715691139"] + // ...other metadata + ] + "content": "haha funny meme" // caption + } }, ... ] @@ -301,7 +304,10 @@ Example Response: `nip94_event` is the same as in the upload result. -`alt` / `caption` are optional. +### Query args + +- `page` page number (`offset=page*count`) +- `count` number of items per page ## Selecting a Server