contentauth / c2pa-rs

Rust SDK for the core C2PA (Coalition for Content Provenance and Authenticity) specification
Other
118 stars 52 forks source link

Add iterators over manifests and resources in unstable API #482

Closed ok-nick closed 3 months ago

ok-nick commented 3 months ago

Changes in this pull request

While migrating c2patool to the unstable API, I ran across an issue where it's not possible to iterate unknown manifests and parse the format from a resource. Previously, Manifest::from_file_with_resources was used to extract resources, however, this has two downsides: (1) we have no control over how they are stored on the filesystem and (2) it only extracts known resources (with standardized labels, like thumbnails).

So, we introduce two new methods:

The first one allows us to iterate all manifests (even if we don't know the label) and the second one allows us to iterate all resources (including unknown ones) into a ResourceRef, which provides us with a mime type (format) and uri (identifier).

Checklist