Skip to content

nip94: add missing tags to FileMetadata (ox, thumb, image, summary, alt)#1321

Closed
PrarthanaPurohit wants to merge 1 commit into
nostrdevkit:masterfrom
PrarthanaPurohit:feat/nip94-complete-file-metadata-tags
Closed

nip94: add missing tags to FileMetadata (ox, thumb, image, summary, alt)#1321
PrarthanaPurohit wants to merge 1 commit into
nostrdevkit:masterfrom
PrarthanaPurohit:feat/nip94-complete-file-metadata-tags

Conversation

@PrarthanaPurohit

@PrarthanaPurohit PrarthanaPurohit commented Mar 31, 2026

Copy link
Copy Markdown

Description

Completes the FileMetadata struct in nostr::nips::nip94 to match the full NIP-94 spec.

The following tags were missing from the struct and are now supported:

Tag Field Description
ox original_hash SHA-256 of the original file before any server-side transforms
thumb thumb Thumbnail URL
image image Preview image URL
summary summary Short text description
alt alt Accessibility alt text
fallback fallback List of fallback download URLs (one tag per URL)

Changes span three files:

  • event/tag/kind.rs — adds TagKind::Ox ("ox") and TagKind::Fallback ("fallback")
  • event/tag/standard.rs — adds TagStandard::OriginalHash(Sha256Hash) and TagStandard::Fallback(Url) with parsing and serialization
  • nips/nip94.rs — adds the six new fields to FileMetadata, builder methods for each, and updates From<FileMetadata> for Vec<Tag> and TryFrom<Vec<Tag>> for FileMetadata for full round-trip fidelity. Three new tests cover the added fields.

Notes to the reviewers

  • ox is a two-character tag so it cannot use SingleLetterTag. A dedicated TagKind::Ox variant is added following the same pattern as other named kinds (e.g. TagKind::Blurhash, TagKind::Magnet).
  • fallback maps to multiple tags (one per URL) rather than a single multi-value tag, matching the NIP-94 spec. FileMetadata stores them as Vec<Url> and From emits one ["fallback", url] tag per entry; TryFrom collects all of them.
  • thumb and image already existed as TagStandard::Thumb(Url, Option<ImageDimensions>) and TagStandard::Image(Url, Option<ImageDimensions>). FileMetadata stores only the Url (NIP-94 does not specify dimensions for these) and serializes with None for the dimension slot.
  • This PR was motivated by real-world use in nostreye, a Raspberry Pi camera that publishes Kind 1063 events to Nostr relays via Blossom.

Checklist

@TheAwiteb

Copy link
Copy Markdown
Member

Hi @PrarthanaPurohit, thank you for your work, but we no longer update the tags until we done this refactor #907. it also block #1216, #1283 and #1204.

I'll make this PR a draft and you can continue work on it after #907 closed.

@TheAwiteb TheAwiteb marked this pull request as draft April 1, 2026 15:31
yukibtc added a commit to yukibtc/nostr that referenced this pull request Apr 30, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request Apr 30, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 1, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 4, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 5, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 5, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 5, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 5, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc yukibtc mentioned this pull request May 5, 2026
3 tasks
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 5, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 7, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 7, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 7, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
yukibtc added a commit to yukibtc/nostr that referenced this pull request May 12, 2026
Closes nostrdevkit#1320
Replaces nostrdevkit#1321

Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
@yukibtc

yukibtc commented May 12, 2026

Copy link
Copy Markdown
Member

Replaced by #1347

@yukibtc yukibtc closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants