Skip to main content

Module verify

Module verify 

Source
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:

  1. Durability. StorageVerifyClient::verify calls POST /storage/verify and maps the response into capsule_library::library::StorageVerdict; the gate applies capsule_library::library::release_is_safe, which re-checks every declared blob rather than trusting the server’s aggregate.
  2. Accountability. StorageVerifyClient::fetch_receipt fetches the write’s CustodyReceipt and capsule_library::library::verify_receipt checks 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.
  3. Crypto validity. verify_asset (the caller’s offline check) must have accepted the asset — passed in as verify_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§

AssetQuery
One asset to verify: the exact blob hashes the client is relying on.
CustodyVerifier
The production StorageVerifier: server facts resolved over StorageVerifyClient by ReleaseCoordinator::resolve_custody, answered synchronously to the offline gate.
HeldRelease
One asset whose local bytes wait on server custody before they may be released, asked about through ReleaseCoordinator::resolve_custody.
ReleaseCoordinator
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.
ReleaseRequest
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).
StaticToken
A fixed bearer token, for tests and callers that already hold a live token.
StorageVerifyClient
The storage-verification + custody-receipt client over an authorized VerifyTransport.
SystemClock
The wall clock (jiff::Timestamp::now).
VerifiedAttestation
A signed verdict that verified for the request it answers.
VerifyTransport
The authorized HTTP transport for the storage-verification + receipt surfaces: the API root (no trailing slash) plus the authorization seam.

Enums§

VerifyError
A failure fetching or decoding a verdict, receipt, or attestation-key document. The gate folds these into a Retain decision — 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§

ReleaseClock
The client’s clock, injected so the re-verify window is deterministic under test.