1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2026 WritersLogic. All rights reserved.
// Licensed under the Apache License, Version 2.0 or the MIT license,
// at your option.
//! 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.manifest` key/value metadata entry
//! ([`gguf`]).
//! - **SafeTensors** — a `c2pa.manifest` entry in the JSON header's
//! `__metadata__` ([`safetensors`]).
//! - **ONNX** — a `c2pa.manifest` entry in the protobuf `metadata_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};
//! # fn demo(model: &[u8], store: Vec<u8>) -> Result<(), c2pa_ml::Error> {
//! let signed = embed_manifest(model, &ManifestSource::embedded(store))?;
//! let manifest = read_manifest(&signed)?;
//! # let _ = manifest;
//! # Ok(())
//! # }
//! ```
//!
//! # 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](https://crates.io/crates/c2pa) 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`.
pub use ModelType;
pub use Error;
pub use ;
pub use ManifestSource;