Check downloaded originals against their recorded content hash (closes #68)
check / check (push) Successful in 35s
check / check (push) Successful in 35s
downloadFile, shared by quak get, the content cache and backup, hashes the decrypted bytes (unkeyed BLAKE2b-512, standard base64) and stores nothing on a mismatch, failing with an error naming the file ID. A live photo ZIP is unpacked as it streams with fflate's Unzip, in small slices so memory stays bounded however far an entry expands, and its image and video hashed separately as <imageHash>:<videoHash>. decryptFile reads the older imageHash/videoHash fields for live photos. A file with no recorded hash is stored unchecked. Model: opus-5-5
This commit is contained in:
@@ -677,10 +677,13 @@ Under `cacheDirectory`:
|
||||
```
|
||||
|
||||
A stored file appears only via an atomic temp-then-rename, so its presence means
|
||||
it is complete. The design also calls for a content-hash comparison against
|
||||
`FileMetadata.hash` on each fetched original; that check is deferred (issue
|
||||
https://git.eeqj.de/sneak/quak/issues/68) because the exact hash construction
|
||||
cannot yet be confirmed against the repo's fixtures.
|
||||
it is complete. Every downloaded original (by `quak get`, the cache, or
|
||||
`backup`) whose metadata records a content hash (`FileMetadata.hash`) is hashed
|
||||
as it is written: unkeyed BLAKE2b with a 64-byte output, standard base64. For a
|
||||
live photo, which is stored as a ZIP, the image and the video are hashed
|
||||
separately and joined as `<imageHash>:<videoHash>`. A mismatch stores nothing
|
||||
and fails the download with an error naming the file ID. An original with no
|
||||
recorded hash, from a very old client, is stored unchecked.
|
||||
|
||||
### Key types by source file
|
||||
|
||||
|
||||
Reference in New Issue
Block a user