pub fn verify_derivative(
manifest: &DerivativeManifest,
asset_id: Uuid,
directory: &DeviceDirectory,
authority: &dyn AlbumAuthority,
role_head: Option<Hash32>,
) -> VerifyOutcomeExpand description
Verify a received derivative manifest for the asset asset_id.
directoryis the published directory of the account whose device generated the derivative;generated_by_deviceis resolved in it.role_headis thelink_hashof the manifest this receiver already trusts as the head of(asset_id, role), orNonewhen it trusts none yet. A manifest whoseprior_provenance_hashisNonestarts the role’s chain and is only placed when there is no head; any other must name the head exactly.
The derivative’s ciphertext is not an argument: its content address is checked where the bytes arrive (the blob fetch recomputes it against the address the manifest names), and a manifest is verified before any byte is fetched.
Steps, in order — the first that fails decides the RejectReason:
- the authority’s admin chain verifies (
RejectReason::UntrustedAuthority); versionisderivative-manifest/v1, and the two fields that are wire-optional only on pre-binding fixtures —amk_versionandprotocol_version— are present (RejectReason::Structural): withoutamk_versionthere is no key to checkwrite_sigunder;crypto_suite_idis implemented by this build (RejectReason::SuiteDowngrade);source_asset_idisasset_id(RejectReason::WrongAsset);generated_by_deviceis indirectory(RejectReason::UnknownDevice) and was added no later thangenerated_at(RejectReason::DeviceAddedAfter/RejectReason::BadTimestamp);device_sigverifies under that entry’s key and declared algorithm (RejectReason::BadDeviceSig);- the epoch is within the attested ceiling and
write_sigverifies under its write-tier key (RejectReason::WrongEpoch/RejectReason::BadWriteSig); - chain placement against
role_head(RejectReason::Replayedfor a chain start when a head exists,RejectReason::ForgedChainfor any other mismatch); - accept iff the epoch’s AMK is held locally, else
VerifyOutcome::Pending(PendingReason::AmkNotYetLocal).