Marmot-TS
    Preparing search index...

    Function getMediaAttachmentFromFileEvent

    • Extracts a MIP-04 v2 attachment from a NIP-94 kind 1063 file-metadata event.

      Kind 1063 events use flat tags (url, m, x, filename, n, v, …) rather than the space-separated imeta format. Standard NIP-94 fields are parsed by applesauce's getFileMetadata; the MIP-04-specific fields (filename, n, v) are read directly from the flat tag list.

      Returns null if:

      • The v tag is absent or does not match MIP04_VERSION
      • The n (nonce) tag is absent or is not exactly 24 characters (hex-encoded 12-byte nonce)
      • The filename tag is absent or empty
      • The x (sha256) tag is absent or is not exactly 64 characters (hex-encoded 32-byte hash)
      • The m (MIME type) tag is absent or is not a valid type/subtype string

      Parameters

      Returns MediaAttachment | null

      A fully-typed MediaAttachment, or null if the event does not carry a valid MIP-04 v2 attachment