Canonical Rust core for CapGlyph — pure codec and carrier primitives shared with capglyph-cli, capglyph-wasm, and capglyphd.
Extracted from
CapGlyph/capglyph-clicrates/capglyph-corein CTX-0040.
This crate is the source of truth for all CapGlyph SDKs (WASM/FFI) after extraction. The embeddedcrates/capglyph-coreincapglyph-cliis deprecated and now depends on this repo via path../capglyph-corefor the isolated monorepo layout (/mnt/data/Workspace/Projects/capglyph/).
| Module | Purpose |
|---|---|
carrier |
Carrier trait + Placement (Skeleton/Prng/Edge) + AlphaCarrier (presence-only) |
ecc |
Channel coding: Repetition8, BCH, RsInterleaved + SoftBit LLR + Profile |
framing |
CBOR version/len/type + HMAC framing (seal/open) |
geometry |
GeometryFile (Chaikin-smoothed polylines, JSON v1) + AnalysisParams |
interleave |
Burst-error interleaving (interleave/deinterleave) |
keying |
HKDF-SHA256 KeyMaterial {K_embed,K_mac,K_object} + PRF helpers |
registration |
Registration trait (Identity, Translation, NCC) + CoverVault/HybridMatch residual extraction |
signal |
SignalMetrics for alpha-channel presence detection |
placement |
Placement enum |
spread_spectrum |
Legacy repetition-8 shim (replaced by ecc::Profile::Repetition8) |
Explicitly not here: clap, glob, tracing-subscriber, c2pa, trustmark/trustmark-ONNX, tiny-skia, vectomancy-raster/geometry, dct/dwt coefficient lattice (still in capglyph-cli/src/{dct,dwt_embed,carrier}.rs until next phase), CLI embed/verify/extract/batch/c2pa/learned orchestration.
cargo tree --target wasm32-unknown-unknown | grep -E 'clap|glob|trustmark|c2pa'
# expect no output
cargo check --lib --target wasm32-unknown-unknownThis crate must stay wasm32-unknown-unknown clean. It has no clap/glob/c2pa/trustmark dependencies; image is gated to png+jpeg only.
[dependencies]
capglyph-core = { path = "../capglyph-core" } # isolated monorepo
# or, once published:
# capglyph-core = "0.1"
# or via git for CI without crates.io:
# capglyph-core = { git = "https://github.com/CapGlyph/capglyph-core", tag = "v0.1.0" }use capglyph_core::{framing::PayloadType, ecc::Profile, keying::KeyMaterial};
// Framing + ECC roundtrip (carrier-agnostic)
let keys = KeyMaterial::from_keys([0x11; 32], [0x22; 32]);
let sealed = capglyph_core::framing::seal(b"credential", &Default::default(), keys.k_mac());
let coded = capglyph_core::ecc::encode(&sealed, Profile::Repetition8);
// ... interleave → embed via DctCarrier/DwtCarrier in capglyph-cli ...DCT/DWT carrier impls (DctCarrier/DwtCarrier) still live in capglyph-cli/src/carrier.rs (facade over crate::dct/dwt_embed) until they are moved here in a follow-up. capglyph-cli re-exports this crate as capglyph_core (alias sigil_core retained for compat).
cargo build
cargo test
cargo clippy --all-targets -- -D warnings
cargo fmt --check
cargo tree --target wasm32-unknown-unknown
cargo check --target wasm32-unknown-unknown/mnt/data/Workspace/Projects/capglyph/
capglyph-cli/ → CapGlyph/capglyph-cli (binary, depends on ../capglyph-core via path)
capglyph-core/ → CapGlyph/capglyph-core (this repo, standalone core)
vectomancy -> /mnt/data/Workspace/Projects/vectomancy/vectomancy (symlink for raster/geometry)
capglyph-cli/Cargo.toml declares:
[dependencies]
capglyph-core = { path = "../capglyph-core" }
# legacy embedded path "crates/capglyph-core" removed in CTX-0040CI for capglyph-cli checks out CapGlyph/capglyph-core alongside CapGlyph/capglyph-cli and Xuepoo/vectomancy so the sibling path resolves (see capglyph-cli/.github/workflows/ci.yml).
0.1.0 — initial CapGlyph release (formerly Sigil v0.2.0, reset per CTX-0044). capglyph and capglyph-core share the version.
Apache-2.0. See LICENSE.