From 9f545ee94974cbd8ffec411196a90175e30f8a5a Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 29 Aug 2023 11:30:47 -0500 Subject: [PATCH] NIP-34: Media Attachments --- 34.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 49 insertions(+) create mode 100644 34.md diff --git a/34.md b/34.md new file mode 100644 index 0000000000..d93d73a78a --- /dev/null +++ b/34.md @@ -0,0 +1,47 @@ +NIP-34 +====== + +Media Attachments +----------------- + +`draft` `optional` `author:alexgleason` + +Media attachments may be added to events with the `"media"` tag, in the form: + +``` +["media", , ] +``` + +Where: + +- `` is the URL of the media file. +- `` (optional) is a stringified JSON object containing metadata about the media file. + +### Data + +The `data` field may contain any of the keys listed as tags in [NIP-94](./94.md). For example, `["m", "image/png"]` would become `{"m": "image/png"}` in the `data` field. + +### Application behavior + +Clients will typically display media attachments as thumbnail previews, separate from the content of the event. + +Relays are not expected to index this tag. + +### Examples + +```json5 +{ + "kind": 1, + "content": "Been goin hard on the Open Source Software.", + "tags": [ + [ + "media", + "https://media.gleasonator.com/074862413a7fe1d18a2bee0f626280c8f795b392e9400419cc34ca4f3cb560ee.png", + "{\"m\":\"image/png\",\"dim\":\"1342x704\",\"blurhash\":\"MnR3f,%M%2%MjZ~Wj@j[t7Rjs:ayfkj[WB\"}" + ] + ], + "pubkey": "79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6", + "created_at": 1691091365, + // ... +} +``` \ No newline at end of file diff --git a/README.md b/README.md index 7951339f75..1709dda134 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos - [NIP-30: Custom Emoji](30.md) - [NIP-31: Dealing with Unknown Events](31.md) - [NIP-32: Labeling](32.md) +- [NIP-34: Media Attachments](34.md) - [NIP-36: Sensitive Content](36.md) - [NIP-38: User Statuses](38.md) - [NIP-39: External Identities in Profiles](39.md) @@ -180,6 +181,7 @@ Please update these lists when proposing NIPs introducing new event kinds. | `image` | image URL | dimensions in pixels | [23](23.md), [58](58.md) | | `lnurl` | `bech32` encoded `lnurl` | -- | [57](57.md) | | `location` | location string | -- | [52](52.md), [99](99.md) | +| `media` | media URL | media metadata | [34](34.md) | | `name` | badge name | -- | [58](58.md) | | `nonce` | random | -- | [13](13.md) | | `preimage` | hash of `bolt11` invoice | -- | [57](57.md) |