The MIP-04-specific fields (filename, n, v) are read directly from
the raw tag entries because applesauce's getFileMetadataFromImetaTag
only copies known NIP-92 fields and silently drops unknown keys. Standard
NIP-92 fields (url, type/m, sha256/x, size, dimensions/dim,
blurhash, thumbnail/thumb, alt, etc.) are delegated to applesauce.
Returns null if:
The tag is not a valid imeta tag (first element is not "imeta")
The v field is absent or does not match MIP04_VERSION
The n (nonce) field is absent or is not exactly 24 characters (hex-encoded 12-byte nonce)
The filename field is absent or empty
The x (sha256) field is absent or is not exactly 64 characters (hex-encoded 32-byte hash)
The m (MIME type) field is absent or is not a valid type/subtype string
Per the MIP-04 spec, clients MUST reject deprecated mip04-v1 tags.
Parameters
tag: string[]
A raw imeta tag array from a Nostr event (e.g. rumor.tags)
Parses an
imetatag array into a MediaAttachment.The MIP-04-specific fields (
filename,n,v) are read directly from the raw tag entries because applesauce's getFileMetadataFromImetaTag only copies known NIP-92 fields and silently drops unknown keys. Standard NIP-92 fields (url,type/m,sha256/x,size,dimensions/dim,blurhash,thumbnail/thumb,alt, etc.) are delegated to applesauce.Returns
nullif:imetatag (first element is not"imeta")vfield is absent or does not match MIP04_VERSIONn(nonce) field is absent or is not exactly 24 characters (hex-encoded 12-byte nonce)filenamefield is absent or emptyx(sha256) field is absent or is not exactly 64 characters (hex-encoded 32-byte hash)m(MIME type) field is absent or is not a validtype/subtypestringPer the MIP-04 spec, clients MUST reject deprecated
mip04-v1tags.