Expand description
Verify-before-destroy: the client half of storage verification (SSoT: Storage Verification — Verify Before Destroy).
Before any post-write local cleanup of irreplaceable bytes — releasing a device-owned original, deleting a Move-import source, a streaming-mode release — a client requires three complementary facts, all fetched here and combined through the offline data plane’s pure predicates:
- Durability.
StorageVerifyClient::verifycallsPOST /storage/verifyand maps the response intocapsule_library::library::StorageVerdict; the gate appliescapsule_library::library::release_is_safe, which re-checks every declared blob rather than trusting the server’s aggregate. - Accountability.
StorageVerifyClient::fetch_receiptfetches the write’sCustodyReceiptandcapsule_library::library::verify_receiptchecks the hybrid signature under the pinned attestation key plus a field match against what the client sent. A server that withholds receipts never becomes the sole holder of an only-copy. - Crypto validity.
verify_asset(the caller’s offline check) must have accepted the asset — passed in asverify_asset_accepted.
Beside the gate, StorageVerifyClient::verify_signed asks for the verdict in its signed
form, bound to a client nonce and verified under the same pinned attestation keys, so a
client can keep the server’s own statement of what it holds — or has lost — as evidence.
ReleaseCoordinator composes the three and enforces the 60-second re-verify window:
the verdict is a point-in-time fact, so a verdict older than the window is re-fetched before
release. The result is a capsule_library::library::ReleaseDecision; a non-Release outcome
never destroys — the caller retains the local copy, retries with backoff, and surfaces
“not yet confirmed on server”. Streaming import drives this per asset in its
import→upload→verify→release window.
Structs§
- Asset
Query - One asset to verify: the exact blob hashes the client is relying on.
- Custody
Verifier - The production
StorageVerifier: server facts resolved overStorageVerifyClientbyReleaseCoordinator::resolve_custody, answered synchronously to the offline gate. - Held
Release - One asset whose local bytes wait on server custody before they may be released, asked
about through
ReleaseCoordinator::resolve_custody. - Release
Coordinator - Composes durability, accountability, and crypto validity into a single release decision, and enforces the 60-second re-verify window. One coordinator serves one asset’s release attempts; it caches the last verdict so a re-attempt inside the window skips a redundant round-trip.
- Release
Request - Everything the gate checks for one write: the asset, its required blob hashes, the upload session that produced custody, and what the client sent (so the receipt’s server-recomputed facts can be matched).
- Static
Token - A fixed bearer token, for tests and callers that already hold a live token.
- Storage
Verify Client - The storage-verification + custody-receipt client over an authorized
VerifyTransport. - System
Clock - The wall clock (
jiff::Timestamp::now). - Verified
Attestation - A signed verdict that verified for the request it answers.
- Verify
Transport - The authorized HTTP transport for the storage-verification + receipt surfaces: the API root (no trailing slash) plus the authorization seam.
Enums§
- Verify
Error - A failure fetching or decoding a verdict, receipt, or attestation-key document. The gate
folds these into a
Retaindecision — a client never destroys on an unresolved fetch.
Constants§
- DEFAULT_
REVERIFY_ WINDOW_ SECS - The default re-verify window: a verdict older than this is re-fetched before any release (SSoT: Storage Verification — “the client re-verifies if more than a bounded interval, default 60 s, elapses between verdict and release”).
Traits§
- Release
Clock - The client’s clock, injected so the re-verify window is deterministic under test.