Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capglyph-core

Canonical Rust core for CapGlyph — pure codec and carrier primitives shared with capglyph-cli, capglyph-wasm, and capglyphd.

Extracted from CapGlyph/capglyph-cli crates/capglyph-core in CTX-0040.
This crate is the source of truth for all CapGlyph SDKs (WASM/FFI) after extraction. The embedded crates/capglyph-core in capglyph-cli is deprecated and now depends on this repo via path ../capglyph-core for the isolated monorepo layout (/mnt/data/Workspace/Projects/capglyph/).

What it contains

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.

WASM invariant

cargo tree --target wasm32-unknown-unknown | grep -E 'clap|glob|trustmark|c2pa'
# expect no output
cargo check --lib --target wasm32-unknown-unknown

This crate must stay wasm32-unknown-unknown clean. It has no clap/glob/c2pa/trustmark dependencies; image is gated to png+jpeg only.

Usage

[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).

Development

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

Workspace layout (isolated monorepo)

/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-0040

CI 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).

Version

0.1.0 — initial CapGlyph release (formerly Sigil v0.2.0, reset per CTX-0044). capglyph and capglyph-core share the version.

License

Apache-2.0. See LICENSE.

About

CapGlyph core — canonical Rust implementation (watermark codec, framing, ECC, keying, registration) — source of truth for all SDKs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages