c2pa_text_binding/lib.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3//! Reference implementation of the WritersLogic C2PA text soft-binding family.
4//!
5//! Each algorithm links text content to its C2PA manifest without a byte-exact
6//! hash, so provenance is recoverable after copying, reformatting, excerpting,
7//! or light editing. All algorithms are registered in the C2PA Soft Binding
8//! Algorithm List and referenced from a `c2pa.soft-binding` assertion.
9//!
10//! | Module | Algorithm | Kind |
11//! | --- | --- | --- |
12//! | [`stego`] | `com.writerslogic.zwc-watermark.2` | watermark (embedded) |
13//! | [`simhash`] | `com.writerslogic.text-fingerprint.1` | fingerprint (surface) |
14//! | [`minhash`] | `com.writerslogic.text-minhash.1` | fingerprint (excerpt) |
15//! | [`structure`] | `com.writerslogic.text-structure.1` | fingerprint (structural) |
16//!
17//! [`normalize`] is the shared canonical stream; [`soft_binding`] emits the
18//! `c2pa.soft-binding` assertion (CBOR that round-trips through the c2pa-rs
19//! reader); [`crosscheck`] recomputes a candidate's fingerprint from the current
20//! text and classifies it into a BOUND / LIKELY / REVIEW confidence tier, whose
21//! boundaries are grounded in the measured false-match rates in
22//! `examples/threshold_sweep.rs`.
23//!
24//! Everything here compiles to `wasm32-unknown-unknown`. All cryptography is
25//! pure Rust with no C bindings (sha2, hmac, blake2, ed25519-dalek, coset); the
26//! soft-binding assertion is CBOR via ciborium, and reed-solomon-erasure backs
27//! watermark recovery. Registration in the C2PA algorithm list is not the same
28//! as C2PA conformance certification, which is a separate program this crate
29//! makes no claim to.
30
31pub mod crosscheck;
32pub mod error;
33pub mod manifest;
34pub mod minhash;
35pub mod normalize;
36pub mod simhash;
37pub mod soft_binding;
38pub mod stego;
39pub mod structure;
40
41#[cfg(target_arch = "wasm32")]
42mod wasm;
43
44#[cfg(feature = "python")]
45mod python;
46
47pub use crosscheck::{
48 classify, crosscheck_tag, fingerprint_evidence, verify, Confidence, Evidence,
49};
50pub use error::Error;
51pub use manifest::{public_key, sign_cose, verify_cose};
52pub use minhash::MinHash;
53pub use simhash::{Fingerprint, Hash256};
54pub use soft_binding::{SoftBinding, SOFT_BINDING_LABEL};
55pub use stego::{embed, extract, Recovered};