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

Đang mở
#1,776 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript
Lĩnh vực
cryptography, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Haskell
Star
865
Fork
125
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
64

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Đọc hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của simplex-chat/simplexmq

Tất cả issue của simplex-chat/simplexmq

Issue tương tự

Thêm issue về Haskell

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.