Marmot-TS
    Preparing search index...

    Function decryptMediaFile

    • Decrypts a fetched encrypted-media-v1 blob.

      Performs the receive-side integrity checks in order (features/encrypted-media.md — Validation):

      1. the fetched bytes match ciphertextSha256
      2. ChaCha20-Poly1305 authentication succeeds
      3. the decrypted bytes match plaintextSha256

      Parameters

      • encrypted: Uint8Array

        The encrypted blob downloaded from a blob store

      • fileKey: Uint8Array

        32-byte key from deriveMediaEncryptionKey

      • attachment: MediaAttachment

        The parsed attachment from the message's imeta tag

      Returns Uint8Array

      The decrypted file bytes

      If any integrity check fails or required fields are missing