fix: verify blob hash after download and decryption (closes #5) #39

Merged
sneak merged 3 commits from fix/verify-blob-hash into main 2026-03-19 00:21:11 +01:00

3 Commits

Author SHA1 Message Date
clawbot
a1018fcae3 fix: reuse blobgen.Reader hash instead of redundant SHA-256 pass
hashVerifyReader now uses blobgen.Reader.Sum256() for the first hash
instead of maintaining its own sha256 hasher over the same bytes.
Eliminates duplicate SHA-256 computation on every read.
2026-03-17 01:41:38 -07:00
22efd90f8c refactor: stream blob hash verification instead of buffering in memory
FetchAndDecryptBlob now returns io.ReadCloser with a hashVerifyReader
that computes the double-SHA-256 on-the-fly during reads. Hash is
verified on Close() after the stream is fully consumed. This avoids
loading entire blobs into memory, which could exceed available RAM.

Addresses review feedback on PR #39.
2026-02-20 02:29:19 -08:00
user
2bdbf38be6 fix: verify blob hash after download and decryption (closes #5)
Add double-SHA-256 hash verification of decrypted plaintext in
FetchAndDecryptBlob. This ensures blob integrity during restore
operations by comparing the computed hash against the expected
blob hash before returning data to the caller.

Includes test for both correct hash (passes) and mismatched hash
(returns error).
2026-02-20 02:26:15 -08:00