diff options
Diffstat (limited to '96.md')
| -rw-r--r-- | 96.md | 34 |
1 files changed, 20 insertions, 14 deletions
| @@ -1,8 +1,6 @@ | |||
| 1 | NIP-96 | 1 | # NIP-96 |
| 2 | ====== | ||
| 3 | 2 | ||
| 4 | HTTP File Storage Integration | 3 | ## HTTP File Storage Integration |
| 5 | ----------------------------- | ||
| 6 | 4 | ||
| 7 | `draft` `optional` | 5 | `draft` `optional` |
| 8 | 6 | ||
| @@ -84,8 +82,7 @@ it must use the "api_url" field instead. | |||
| 84 | 82 | ||
| 85 | See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers. | 83 | See https://github.com/aljazceru/awesome-nostr#nip-96-file-storage-servers. |
| 86 | 84 | ||
| 87 | 85 | ## Auth | |
| 88 | ## Auth | ||
| 89 | 86 | ||
| 90 | 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). | 87 | 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). |
| 91 | 88 | ||
| @@ -96,6 +93,7 @@ When indicated, `clients` must add an [NIP-98](98.md) `Authorization` header (** | |||
| 96 | **AUTH required** | 93 | **AUTH required** |
| 97 | 94 | ||
| 98 | List of form fields: | 95 | List of form fields: |
| 96 | |||
| 99 | - `file`: **REQUIRED** the file to upload | 97 | - `file`: **REQUIRED** the file to upload |
| 100 | - `caption`: **RECOMMENDED** loose description; | 98 | - `caption`: **RECOMMENDED** loose description; |
| 101 | - `expiration`: UNIX timestamp in seconds. Empty string if file should be stored forever. The server isn't required to honor this. | 99 | - `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: | |||
| 276 | 274 | ||
| 277 | ## Listing files | 275 | ## Listing files |
| 278 | 276 | ||
| 279 | `GET $api_url` | 277 | `GET $api_url?page=x&count=y` |
| 280 | 278 | ||
| 281 | **AUTH required** | 279 | **AUTH required** |
| 282 | 280 | ||
| 283 | Returns a list of files linked to the authenticated users pubkey. | 281 | Returns a list of files linked to the authenticated users pubkey. |
| 284 | 282 | ||
| 285 | Example Response: | 283 | Example Response: |
| 284 | |||
| 286 | ```js | 285 | ```js |
| 287 | [ | 286 | [ |
| 288 | { | 287 | { |
| 289 | "id": "<sha256-hash>", | 288 | "id": "<sha256-hash>", |
| 290 | "nip94_event": {...}, | 289 | "nip94_event": { |
| 291 | "expires": 1715691139, // unix timestamp | 290 | "tags": [ |
| 292 | "size": 123456, | 291 | ["size", "123456"], |
| 293 | "alt": "a meme that makes you laugh", | 292 | ["alt", "a meme that makes you laugh"], |
| 294 | "caption": "haha funny meme" | 293 | ["expiration", "1715691139"] |
| 294 | // ...other metadata | ||
| 295 | ] | ||
| 296 | "content": "haha funny meme" // caption | ||
| 297 | } | ||
| 295 | }, | 298 | }, |
| 296 | ... | 299 | ... |
| 297 | ] | 300 | ] |
| @@ -301,7 +304,10 @@ Example Response: | |||
| 301 | 304 | ||
| 302 | `nip94_event` is the same as in the upload result. | 305 | `nip94_event` is the same as in the upload result. |
| 303 | 306 | ||
| 304 | `alt` / `caption` are optional. | 307 | ### Query args |
| 308 | |||
| 309 | - `page` page number (`offset=page*count`) | ||
| 310 | - `count` number of items per page | ||
| 305 | 311 | ||
| 306 | ## Selecting a Server | 312 | ## Selecting a Server |
| 307 | 313 | ||