Skip to main content

validate_asset

Function validate_asset 

Source
pub fn validate_asset(
    asset: &ManifestAsset,
) -> Result<(Vec<u8>, AssetKind), String>
Expand description

Decode and fully validate one declared asset, returning its decoded bytes and sniffed format on success. Checks, first-error-wins: a filename-safe id, a 64-char lowercase-hex sha256, valid base64, the decoded-byte cap, that the bytes hash to the declared sha256, an allowed format, and the pixel cap.