Documentation
    Preparing search index...

    Function verifyPresentationMediaBytes

    • Apply the NIP-5D client checks to fetched presentation media bytes: the SHA-256 must equal the declaration's x, the bytes must carry a decodable screenshot or preview container for kind, and a declared m must match the recognised format. Hosts keep placeholder artwork on undefined.

      Parameters

      • bytes: Uint8Array

        Complete blob bytes fetched by hash

      • media: Pick<PresentationMedia, "sha256" | "mimeType">

        The parsed declaration the bytes are meant to satisfy

      • kind: PresentationMediaKind

        screenshot expects an image container, preview a video container

      Returns PresentationMediaFormat | undefined

      The recognised format when every check passes, else undefined

      const format = verifyPresentationMediaBytes(bytes, screenshot, 'screenshot');
      if (format) img.src = URL.createObjectURL(new Blob([bytes], { type: format }));