Separating C2PA Trust, TC260:AIGC Metadata, and Noise Residuals in Browser Image Checks
Most web-based "AI image detectors" collapse everything into a single percentage bar. From an engineering standpoint, that mixes three completely different types of signals: cryptographic signatures, editable file header
Most web-based "AI image detectors" collapse everything into a single percentage bar. From an engineering standpoint, that mixes three completely different types of signals: cryptographic signatures, editable file headers, and statistical pixel guesses.
While building client-side inspection modules for an image verification workflow, three implementation details stood out as worth sharing: splitting C2PA integrity from certificate trust, parsing TC260:AIGC alongside IPTC source types, and keeping noise-residual heatmaps strictly separated from automated verdicts.
1. C2PA in WebAssembly: Integrity vs. Trust Lists
Using @contentauth/c2pa-web, a browser tab can inspect JUMBF Content Credentials boxes locally without uploading the image. Because the WebAssembly binary is roughly 9 MB, lazy-loading it on drop-zone hover or file selection keeps initial page load light.
Once reader.manifestStore() resolves, a common trap is treating store.validation_state === "Invalid" as "this file was tampered with."
In practice, validation failure codes fall into two very different buckets:
- Content or claim tampering (hashes no longer match the pixels or assertions).
- Certificate profile or trust-list gaps (who signed the manifest, or whether the certificate carries a specific Extended Key Usage).
In our local checks on untouched OpenAI image downloads, cryptographic claim signatures and data hashes passed while validation flagged signingCredential.untrusted and signingCredential.invalid. Filtering trust-only codes separately lets the UI report what actually passed and what did not:
const TRUST_ONLY = /^(signingCredential\.|timeStamp\.)/;
export function summarizeManifest(manifest, validationState, failureCodes = []) {
const actions = [];
for (const a of manifest?.assertions || []) {
if (typeof a?.label === "string" && a.label.startsWith("c2pa.actions")) {
for (const act of a.data?.actions || []) actions.push(act);
}
}
const created =
actions.find((a) => a.digitalSourceType) ||
actions.find((a) => a.action === "c2pa.created");
return {
found: true,
sourceType: created?.digitalSourceType || "",
signer:
manifest?.signature_info?.issuer ||
manifest?.signature_info?.common_name ||
"",
// Content hashes and claim signature hold if only trust/timestamp codes fired
integrityOk: failureCodes.every((c) => TRUST_ONLY.test(c)),
trusted:
validationState === "Trusted" ||
(validationState !== "Invalid" && failureCodes.length === 0),
};
}
Equally important: when Reader.fromBlob finds no JUMBF box at all, that only means no C2PA manifest is present in those bytes. Standard JPEG re-saves and many export workflows omit or discard metadata, so missing credentials never prove that an image is an authentic camera photo.
2. IPTC Nuances and TC260:AIGC Entity Decoding
When C2PA is absent, exifr can read EXIF, IPTC, and XMP blocks in a few milliseconds on the client. Two details are easy to miss:
First, in IPTC's DigitalSourceType vocabulary, algorithmicMedia by itself means media created algorithmically without training data (such as procedural shaders or fractals). Generative AI specifically uses trainedAlgorithmicMedia or compositeWithTrainedAlgorithmicMedia.
Second, generators following China's GB 45438-2025 standard (such as Dreamina / Jimeng, Doubao, or Kling) often write an XMP JSON string under the TC260:AIGC field rather than C2PA. When extracted via exifr, that string can retain HTML entities like ":
export function parseAigcLabel(value) {
if (!value) return null;
let obj = value;
if (typeof value === "string") {
const cleaned = value.replace(/"/g, '"').replace(/&/g, "&");
try {
obj = JSON.parse(cleaned);
} catch {
return null;
}
}
if (!obj || typeof obj !== "object") return null;
const label = obj.Label ?? obj.label;
if (label == null || label === "") return null;
// Label "1" is an explicit AI-generated declaration; XMP remains unsigned/editable
return {
label: String(label),
producer: String(obj.ContentProducer || obj.contentProducer || ""),
};
}
Because XMP and EXIF fields are unsigned, anyone with exiftool can edit or strip them. A viewer should always surface them as editable metadata declarations rather than cryptographic proof. If you want to test how different originals and re-saved copies expose these fields, our browser-based C2PA and EXIF metadata viewer runs both parsers locally in your tab.
3. Why Noise Residuals Belong in the UIβNot in the Verdict
Camera sensors leave high-frequency photon and readout noise across an image, whereas synthetic renders or heavily smoothed edits often show unusually uniform or patterned high-frequency regions.
Computing a simple high-pass residual (|luma β 3Γ3 box blur(luma)|) in a Web Worker or <canvas> buffer is fast enough to run in pure JavaScript:
export function computeLumaResidual(rgba, width, height, gain = 9) {
const luma = new Float32Array(width * height);
for (let i = 0, p = 0; i < luma.length; i++, p += 4) {
luma[i] = 0.299 * rgba[p] + 0.587 * rgba[p + 1] + 0.114 * rgba[p + 2];
}
const out = new Float32Array(width * height);
for (let y = 1; y < height - 1; y++) {
for (let x = 1; x < width - 1; x++) {
let sum = 0;
for (let dy = -1; dy <= 1; dy++) {
for (let dx = -1; dx <= 1; dx++) {
sum += luma[(y + dy) * width + (x + dx)];
}
}
const diff = Math.abs(luma[y * width + x] - sum / 9);
out[y * width + x] = Math.min(1, (diff * gain) / 255);
}
}
return out;
}
However, heavy JPEG compression, phone night-mode denoising, and social-media resizing also alter local noise structure. Because of that, feeding a raw residual heuristic into an automated "AI vs. Real" score creates false positives on ordinary phone photos.
Keeping the residual map strictly as a visual inspection layerβnever an input to the verdictβlets human reviewers spot localized splicing or smoothing while keeping the decision logic honest.
Putting the Layers in Order
When we wired these pieces into our evidence-layered AI image checker, we kept the boundaries explicit:
- Signed Content Credentials (C2PA) are checked locally first, with content integrity reported separately from certificate trust.
-
Unsigned metadata (
IPTC,TC260:AIGC, software tags) is parsed locally and labeled as editable file context. - Statistical model scoring runs as a separate step when file headers do not settle the questionβand a low AI score is reported as "no AI signs found," never as proof that a scene is real.
- SHA-256 file hashing ties any saved report to the exact byte sequence inspected, since a re-saved copy of the same image is a different file with different evidence.
If you are building moderation or provenance tooling on the web, separating what the file cryptographically proves, what its editable tags claim, and what a model estimates makes every downstream review far easier to defend.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.