Overview
Implements the Structured Text Embedding section of the C2PA Technical Specification, which defines how to associate 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 modelled on RFC 4880:
-----BEGIN C2PA MANIFEST----- <reference> -----END C2PA MANIFEST-----
Quick Start
[]
= "0.1"
Embed a manifest reference
use ;
let text = "print('hello')\n";
let signed = embed_manifest;
// Result:
// # -----BEGIN C2PA MANIFEST----- https://example.com/manifests/abc.c2pa -----END C2PA MANIFEST-----
// print('hello')
Extract a manifest reference
use extract_manifest;
let text = "# -----BEGIN C2PA MANIFEST----- https://example.com/m.c2pa -----END C2PA MANIFEST-----\nprint('hello')\n";
let result = extract_manifest.unwrap;
assert_eq!;
Supported Formats
Any text format with a comment syntax or front matter convention:
| Comment Style | Formats | Example |
|---|---|---|
# |
Python, Ruby, Shell, YAML, TOML | # -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- |
// |
JavaScript, TypeScript, Go, Rust, C++ | // -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- |
-- |
SQL, Lua, Haskell | -- -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- |
/* */ |
CSS, C, Java | /* -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- */ |
<!-- --> |
HTML, XML, Markdown | <!-- -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- --> |
NOTE |
WebVTT | NOTE -----BEGIN C2PA MANIFEST----- ... -----END C2PA MANIFEST----- |
| Front matter | Markdown (YAML), TOML | Multi-line form between front matter delimiters |
Related Crates
| Crate | Description |
|---|---|
| c2pa-text-binding | Soft binding and content fingerprinting for text assets |
| c2pa-text | Unstructured text embedding via Unicode Variation Selectors |
| c2pa-rs | Official C2PA SDK |
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Built by WritersLogic