Expand description
Integrity checking for anything fetched over the network. Compiled always, feature flags or not, so its tests cannot be skipped out of CI. Integrity checking for files fetched over the network.
§Why this module exists
The PaddleOCR backend used to fetch up to ~84 MB of ONNX model weights from a third-party public repository and write them straight to the cache, with no integrity check of any kind. Whoever served those bytes decided what our inference engine executed. For an SDK sold on privacy and on not phoning home, that is the wrong default — and a warning in the README is not a fix, it is a note explaining why the product is wrong.
So fetching is now opt-in and always verified, and this module is the
verification. It is compiled unconditionally, without the paddle feature,
for one specific reason: tests behind a non-default feature flag do not run in
CI, and a security check whose tests never execute is indistinguishable from no
check at all. That exact mistake has cost this project three regressions.
Enums§
- Integrity
Error - Why a downloaded file was rejected.
Functions§
- sha256_
hex - Hex-encoded SHA-256 of
bytes. - verify_
sha256 - Check
bytesagainst an expected hex SHA-256.