Skip to main content

verify_derivative_manifests

Function verify_derivative_manifests 

Source
pub fn verify_derivative_manifests(
    encoded: &[Vec<u8>],
    asset_id: Uuid,
    directory: &DeviceDirectory,
    authority: &dyn AlbumAuthority,
) -> VerifiedDerivatives
Expand description

Decode and verify a feed entry’s derivative manifests (FeedEntry::derivative_manifests) for the asset asset_id, so that only verified ones reach AssetBlobs::derivative_manifests.

The feed serves every manifest the asset has accumulated, in content-address order — not in chain order, and not only the heads — so each role’s chain is rebuilt from its start here rather than resumed from a stored head: beginning with the manifest whose prior_provenance_hash is None, each next link is the one manifest naming the previous one’s link_hash, and each link is checked by core’s verify_derivative against exactly that head.

The walk of a role stops at the first link that is refused, and at a fork. What it never reached is quarantined with the reason verify_derivative gives it against the head the walk stopped at. So a poisoned derivative-replace — one that does not chain to the role’s head — is quarantined and the head it tried to displace stays accepted: the existing derivative is preserved.

directory is the published directory of the account whose devices generate this asset’s derivatives (as for verify_asset, the caller resolves whose it is); authority is the album’s MLS-attested authority.