Skip to main content

verify_custody

Function verify_custody 

Source
pub async fn verify_custody(
    client: &StorageVerifyClient,
    attestation_keys: &[HybridVerifyingKey],
    bundle: &UploadBundle,
    report: &AssetPushReport,
    now_unix: i64,
) -> Result<VerifiedCustody, PushError>
Expand description

Confirm the server holds what push_bundle sent, and collect the evidence that it does.

Two facts, both required, in this order:

  1. Durability. POST /storage/verify over exactly report.custody_hashes. The verdict’s aggregate is not trusted on its own: every declared hash must appear in the per-blob detail as stored ∧ indexed ∧ retrievable, the re-check release_is_safe makes before a release.
  2. Accountability. The asset’s receipt log (GET /assets/{id}/receipts), and for every declared blob a receipt that verifies under one of attestation_keys (the pinned history, not a fetch the caller has not checked against its pin) and names the bytes, size, role and — for the provenance blob — the chain position the client sent.

The durable log rather than the per-session fetch, because a blob this run did not transfer — one the feed said was held, or one a retry of this same asset found finalized as duplicate_blob — has no session to ask about, and its custody needs the same evidence as a fresh one. A duplicate_blob naming a different asset is covered the same way: the server adopts that blob onto this asset before refusing (#672), indexing it under this asset and receipting it in this asset’s log.

now_unix is the client’s clock, injected for the receipt’s drift bound.