Expand description
C2PA manifest embedding for AI/ML model container formats.
A C2PA Manifest Store is associated with a model by writing it into the format’s own metadata slot, so the model stays loadable by its usual runtime:
- GGUF (llama.cpp) — a
c2pa.manifestkey/value metadata entry (gguf). - SafeTensors — a
c2pa.manifestentry in the JSON header’s__metadata__(safetensors). - ONNX — a
c2pa.manifestentry in the protobufmetadata_props(onnx).
A remote (or side-car) manifest can instead be referenced by URI under
c2pa.manifest.uri, or both an embedded store and a URI can be written
together (see ManifestSource).
The top-level functions auto-detect the format:
use c2pa_ml::{embed_manifest, read_manifest, ManifestSource};
let signed = embed_manifest(model, &ManifestSource::embedded(store))?;
let manifest = read_manifest(&signed)?;§Asset type
The C2PA core specification defines no dedicated embedding method for model
containers; a manifest embedded in a model declares what the asset is with
the asset type assertion. Format::model_type and asset_type::ModelType
provide the canonical c2pa.types.model.* strings for that assertion.
§Scope
This crate implements embedding and extraction only. Manifest construction,
signing, and content (hard/soft) binding are out of scope; use the
official C2PA SDK to build and sign
manifests. The c2pa.hash.data assertion should exclude the metadata region
carrying the Manifest Store.
Zero dependencies on native targets; the WebAssembly/npm build uses only
wasm-bindgen.
Re-exports§
pub use asset_type::ModelType;
Modules§
- asset_
type - The C2PA asset type values for AI/ML assets, from Table 11 (“Asset type values”) of the C2PA Technical Specification.
- gguf
- GGUF (the llama.cpp model container) embedding.
- onnx
- ONNX embedding.
- safetensors
- SafeTensors embedding.
Structs§
- Manifest
Source - What to associate with a model: an embedded Manifest Store, a remote manifest URI, or both.
- Report
- A report on a model’s C2PA embedding.
Enums§
Functions§
- embed_
manifest - Embed a C2PA manifest into a model, auto-detecting the container format.
- embed_
manifest_ as - Embed a C2PA manifest into a model of a known format.
- read_
manifest - Read the embedded C2PA Manifest Store from a model, auto-detecting the format.
- read_
manifest_ uri - Read the remote manifest URI from a model, if present, auto-detecting the format.
- remove_
manifest - Remove any C2PA metadata from a model, auto-detecting the format.
- verify
- Report on a model’s C2PA embedding, auto-detecting the format.