Skip to main content

Crate c2pa_structured_text

Crate c2pa_structured_text 

Source
Expand description

C2PA manifest embedding, hard binding, and validation for structured text.

Implements the Embedding Manifests into Structured Text section of the C2PA Technical Specification, which associates a C2PA Manifest Store with source code, configuration files, markup, and other text formats that support comment syntax or front matter conventions.

The manifest block uses fixed ASCII armour-style delimiters: -----BEGIN C2PA MANIFEST----- and -----END C2PA MANIFEST-----.

§Scope

This crate owns three things:

Signature verification, certificate trust, and assertion validation are not implemented here; the bridge (feature c2pa) delegates them to c2pa-rs.

§Features

No feature is enabled by default; the core embed/extract/binding-range API has no dependencies.

Modules§

bridge
Validation bridge to c2pa-rs.
hardbinding
The hard binding for structured text.

Structs§

ExtractionResult
The result of extracting a manifest block: the reference plus the byte offset and length of the block’s line(s) in the source text.

Enums§

Error
ManifestRef
A manifest reference to embed: either a URI to an external C2PA Manifest Store (preferred) or the store itself, which is encoded as a data:application/c2pa;base64, URI.
Reference
A classified manifest reference: an external URI or an embedded C2PA Manifest Store decoded from a data:application/c2pa;base64, URI.

Functions§

classify_reference
Classify and resolve a reference string as extracted from a manifest block.
embed_front_matter
Embed a manifest block in multi-line front matter form. fm_delim is the host format’s front matter fence (--- for YAML, +++ for TOML).
embed_manifest
Embed a manifest block as the first line of the file using single-line comment syntax. This is the recommended placement.
embed_manifest_at_end
Embed a manifest block as the last line of the file. Use this when the first line is reserved by the host format (a shebang #!/... or an XML declaration <?xml ...?>), so the -----END C2PA MANIFEST----- delimiter appears on the final line as the specification requires.
extract_manifest
Locate and extract the single manifest block from structured text.