aeat.adapters.outbound.storage._integrity module¶
Shared content-hash integrity verification for outbound storage backends.
Both
adapters.outbound.storage._local.LocalFileSystemProvider and
adapters.outbound.storage._google_drive.GoogleDriveProvider
persist a content_hash (optionally sha256--prefixed) alongside each
object and re-check it on read. This module centralises the
strip_sha256_prefix() convention and the verify_content_hash()
compare-and-raise kernel so the two backends share one integrity contract; each
backend keeps its own message, context, and verification policy.
- strip_sha256_prefix(stored_hash)[source]¶
Return the bare hex digest from a possibly
sha256--prefixed stored hash.Used by
verify_content_hash()before comparing a stored provider digest with a caller-suppliedcore.hashing.sha256_hex()value.
- verify_content_hash(actual_hash, stored_hash, *, message, context, translated_message, require_full_digest=False)[source]¶
Raise
OutboundStorageIntegrityErrorwhen a stored hash disagrees.A no-op when
stored_hashis empty or carries no digest. Withrequire_full_digestthe check is skipped unless the stripped digest is a full 64-character hex string (adapters.outbound.storage._google_drive.GoogleDriveProviderpolicy); without it any non-empty stripped digest is compared againstactual_hash(adapters.outbound.storage._local.LocalFileSystemProviderpolicy).actual_hashis supplied by the caller because the local backend reuses it to stamp the written sidecar.