Add streaming encrypt decrypt and hash pipeline#48
Merged
Conversation
…6B): magic/version/algorithm/reserved - ChunkAad (9B): index(u64 LE) + is_final(u8) for truncation protection - ChunkReader: fill-in-place zero-alloc read_chunk(&mut chunk) - ChunkWriter: internal buffer for single-syscall writes - Last-chunk padding with zero-byte validation - EncryptedChunk pre-allocation + Default - StreamAlgorithm <-> Algorithm conversion bridge - Generic finish() + finish_file() for fsync - 22 unit tests covering all acceptance criteria
feat(streaming): add low-level streaming primitives …
- encrypt_file_impl / decrypt_file_impl: 64KB AEAD chunk streaming - Per-chunk AAD (index + is_final) prevents reorder/truncation/append - Last-chunk padding to uniform ENCRYPTED_CHUNK_SIZE - Atomic temp-file-then-rename: failed ops leave no partial output - Algorithm cross-check between header and CipherHandle - Progress callbacks (0.0..1.0) via closure, FRB StreamSink wrappers - CipherHandle: add pub(crate) encrypt_raw/decrypt_raw/algorithm_id - 16 tests: roundtrip, tamper detection, progress, cleanup guarantees
- Remove needless borrows in fs::write test calls - Replace unwrap_err() with expect_err() to satisfy deny(clippy::unwrap_used)
…pt-decrypt feat(streaming): add high-level streaming encrypt/decrypt API
…noop.dart referenced core/traits.dart which is not generated (#[frb(ignore)] on Encryption trait).NoopEncryption itself does not need FRB scanning only create_noop_encryption() returning CipherHandle is the public API.
- hash_file_impl reads file in 64KB chunks, feeds raw bytes to hasher - No encryption padding digest matches one-shot blake3_hash/sha3_hash - stream_hash_file FRB wrapper with StreamSink<f64> progress - pub(crate) update_raw/finalize_raw/reset_raw on HasherHandle - New tests: BLAKE3, SHA-3, empty file, 1MB+ file, exact boundary
…noop.dart referenced core/traits.dart which is not generated (#[frb(ignore)] on Encryption trait).NoopEncryption itself does not need FRB scanning only create_noop_encryption() returning CipherHandle is the public API.
feat(streaming): add streaming file hash with BLAKE3/SHA-3
…ity FRB drops the Vec<u8> return when a function also has StreamSink. Stream_hash_file now only feeds data Dart calls hasherFinalize() to obtain the digest.
- Add StreamingService with encryptFile, decryptFile, hashFile - Add 8 integration tests (6/8 pass) - Export StreamingService from lib/m_security.dart
… unawaited(executeNormal) for stream functions, so Rust errors arrive as zone errors after the progress stream closes. _guardedStream uses runZonedGuarded + deferred close to forward these to the stream. All 8 integration tests pass on macOS, Android, and iOS.
feat(streaming): add Dart StreamingService wrapper and integration tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
padding with zero-byte validation — 22 unit tests
arithmetic — 16 API tests
chunk sizes, tampered padding detection
Security hardening