feat/hash_passthrough #48

Merged
n merged 14 commits from feat/hash_passthrough into develop 2026-03-27 10:02:44 +00:00
Owner

🛠 Type of Change

  • 🐛 Bug fix
  • New Feature (androidqf module)
  • ️ Performance / Refactoring
  • 📝 Documentation

📖 Description

What does this PR do?
Implementa un servizio di hashing in grado di accogliere uno streaming
Ci ho infilato inoltre diversi refactoring per migliorare l'architettura generale

🧪 Testing

  • Manually tested with device: Pixel 7
  • Unit tests passed (pnpm test)
  • Lint verified (pnpm lint)

⚖️ Forensics Integrity Checklist

  • The change does not alter the integrity of extracted data.
  • Logs are clear and follow project standards.
  • No sensitive data is leaked in logs.
### 🛠 Type of Change - [x] 🐛 Bug fix - [x] ✨ New Feature (androidqf module) - [x] ⚡️ Performance / Refactoring - [ ] 📝 Documentation ### 📖 Description What does this PR do? Implementa un servizio di hashing in grado di accogliere uno streaming Ci ho infilato inoltre diversi refactoring per migliorare l'architettura generale ### 🧪 Testing - [x] Manually tested with device: Pixel 7 - [x] Unit tests passed (`pnpm test`) - [x] Lint verified (`pnpm lint`) ### ⚖️ Forensics Integrity Checklist - [x] The change does not alter the integrity of extracted data. - [x] Logs are clear and follow project standards. - [x] No sensitive data is leaked in logs.
- Move commands from adb/commands/ to src/commands/
- Extract ShellCommand to adb/shell.ts (@internal)
- Add Device.shell() and Device.spawn() as transport interface
- Commands now depend on Device instead of Adb directly
- Inline getProperties() and isRooted() into Device, removing
  dependency on GetPropCommand and IsRootedCommand
- Rename ADBDevice → Device, ADBCommands → DeviceCommand,
  CommandOptions → ShellOptions
- Move ShellResult, SpawnResult, ShellOptions to adb/index.ts
- Remove ShellCommand from public exports
Complete rewrite of the test infrastructure to align with the new
Device abstraction layer, replacing all direct Adb/shellProtocol
references with Device.shell() and Device.spawn().
Implements incremental hashing as a TransformStream passthrough using
hash-wasm. Memory usage is O(1) — each chunk is hashed in-place and
forwarded immediately without buffering, making it safe for large
streams (backups, dumpsys, etc.).

- utils/stream-helpers.ts: add hashingPassthrough(algorithm) async fn
  returning { writable, readable, hashPromise }. Supports sha-1,
  sha-256, sha-512 via lazy WASM import.
- tsup.config.ts: hash-wasm already in external (was pre-configured)
- package.json / pnpm-lock.yaml: add hash-wasm ^4.12.0 dependency
- backup.ts: first integration — wraps backup stream with passthrough
  when computeHash is true, attaches hashPromise to AcquisitionFile
Add utility functions to handle streams and incremental hashing.
- bytesToStream: wraps Uint8Array into a ReadableStream.
- hashingPassthrough: creates a TransformStream that computes SHA-256 hash incrementally.
- Update AcquisitionFile interface to include hashPromise.
Replace blob-based output with streaming for all acquirers.
- Use bytesToStream to convert buffered data (JSON, text) into streams.
- Integrate hashingPassthrough when computeHash is true, providing hashPromise.
- Remove blob field, rely on stream for all file outputs.
- Adjust progress reporting to reflect streaming phases.
Enhance StreamingZipWriter to accept AcquisitionFile objects.
- Add addAcquisitionFile method that routes to addFileFromStream or addFile.
- Await hashPromise (if present) and store resolved hash on the file object.
- Simplify internal code, unify header generation with a streaming flag.
- Keep compatibility for legacy addFile and addFileFromStream.
Add readStream to drain ReadableStreams in tests.
- Replace blob.text() with readStream across all acquirer test files.
- Introduce drainAndHash to consume streams and wait for hashPromise resolution.
- Update assertions to check stream instead of blob, and hashPromise instead of hash.
- Adjust tests to use parseBlob (now accepting streams) and other stream-aware helpers.
Update UI component to leverage addAcquisitionFile.
- Replace manual stream handling with zip.addAcquisitionFile.
- Apply progress tracking via trackStreamProgress wrapper.
- Remove explicit blob handling; rely on unified method.
JSZip is only used in tests (streaming-zip.test.ts). Move it to devDependencies in core and remove entirely from web where it was unused.
Device information is already stored at the session level in the frontend. Repeating it inside each acquirer's result.data is unnecessary and bloats the manifest. Remove all occurrences and update tests accordingly.
Enforce streaming-only acquisition by removing the optional 'blob' field and making 'stream' required. Update StreamingZipWriter to accept only streams. All acquirers already produce streams via bytesToStream or direct ADB streams.
fix(web): improve hash handling and timestamp in ZIP filename
Some checks failed
WAFB CI + Deploy / quality (pull_request) Failing after 52s
WAFB CI + Deploy / deploy-dev (pull_request) Has been skipped
WAFB CI + Deploy / release (pull_request) Has been skipped
1d66a9d1ce
- Use timestamp with time in folder name (e.g., 2026-03-24T13-30-45) to avoid collisions.
- Explicitly await hashPromise and set file.hash after zip.addAcquisitionFile to ensure hash appears in manifest.
- Use satisfies for configuration types and cast to AcquisitionConfig to maintain type safety.
- Remove blob handling now that stream is mandatory.
chore: remove constant expressions
All checks were successful
WAFB CI + Deploy / quality (pull_request) Successful in 2m39s
WAFB CI + Deploy / deploy-dev (pull_request) Has been skipped
WAFB CI + Deploy / release (pull_request) Has been skipped
4144dc7511
n merged commit 197728bf7a into develop 2026-03-27 10:02:44 +00:00
n deleted branch feat/hash_passthrough 2026-03-27 10:02:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
garrett/wafb!48
No description provided.