Consider streaming decryption/write path to reduce peak memory usage for large files

未關閉
#1,776 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
冷清
技術堆疊
javascript

研究方向

Start by locating the download verification/decryption flow that accumulates chunks[], calls concatBytes(...chunks), and allocates Uint8Array(pLen), then read the streaming primitives sbInit and sbDecryptChunk. The issue does not define an implementation scope; clarify the architecture and acceptance criteria for incremental writes, final authentication failure cleanup, padding/header parsing, and resumable downloads before coding.

由索引模型根據 Issue 內容生成。

描述

I noticed the current download verification/decryption flow buffers the full encrypted file into memory before decrypting.

Current flow appears to:

accumulate encrypted chunks in chunks[]
concatenate them via concatBytes(...chunks)
allocate another full plaintext buffer with new Uint8Array(pLen)

This can significantly increase peak memory usage for large files, especially on mobile browsers.

The crypto layer itself already seems stream-capable (sbInit, sbDecryptChunk, incremental Poly1305 state), so I was wondering whether a more streaming-oriented architecture could be considered in the future.

Possible direction:

download chunk
→ decrypt incrementally
→ write plaintext directly to OPFS/temp storage
→ finalize/verify auth tag at end

This could reduce peak RAM usage from approximately full-file-size multiples down to near chunk-size memory usage.

I understand there are important tradeoffs around:

final authentication validation
temporary storage cleanup on auth failure
padding/header parsing
resumable download behavior

So I wanted to ask whether this direction would be desirable before experimenting with an implementation.

主要語言
Haskell
星號
865
分支
125
平均合併
1 天 20 小時
30 天內合併 PR
64

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

simplex-chat/simplexmq 的其他 Issue

查看 simplex-chat/simplexmq 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。