Marmot-TS
    Preparing search index...

    Function decryptMediaFileWithKeys

    • Decrypts a fetched encrypted-media-v2 blob, trying each candidate key in order until one authenticates the ciphertext.

      This low-level helper accepts an explicit caller-managed key set. Client v2 receiving uses exactly the authenticated source state instead of key probing.

      Parameters

      • encrypted: Uint8Array

        The encrypted blob downloaded from a blob store

      • fileKeys: Uint8Array<ArrayBufferLike>[]

        Candidate keys from deriveMediaEncryptionKey, one per retained epoch; tried in order. MUST be non-empty.

      • attachment: MediaAttachment

        The parsed attachment from the message's imeta tag

      Returns Uint8Array

      The decrypted file bytes from the first key that authenticates

      If no candidate key authenticates the ciphertext, or a check fails