Skip to main content
Introducing packages.sweber.dev
Witness overview

WitnessLive demo, free and Pro.

Everything in the first four sections runs the real @sweberdev/witness build in your browser: the two custom elements, the text watermark and the marking of images, audio and video. The Pro section shows output of the real Pro tools for a made-up travel agency.

Nothing you type or upload leaves your browser. Files are marked in memory and offered back as a download.

Witness helps you implement the transparency duties of Article 50 of the EU AI Act. It is a tool, not legal advice, and using it does not confirm compliance.

Chatbot notice

Tell people they are talking to an AIArticle 50(1).

This is <witness-notice> in a made-up support chat. It is expanded until the visitor acknowledges it, then it shrinks to a compact label in the chat that can be reopened. Each step fires an event you can keep as evidence.

Muster Travel support

Loading Witness…

  • Hello! I can help with bookings, travel documents and changes to your trip.

Events (witness-shown, witness-acknowledged)

No events yet.

AI labels

Label generated and edited contentArticles 50(2) and 50(4).

<witness-label> is a small badge with a details popover. Put it next to a text or as an overlay on an image. Open it with a click or the keyboard; Escape closes it.

Illustration of a turquoise lagoon at dusk

Five lagoons worth the detour

Loading Witness…

Our editors picked five lagoons for a quiet week in autumn: shallow water, short transfers and small guesthouses instead of resorts.

Markup

<witness-label kind="generated" locale="en" reviewed></witness-label>

<figure style="position: relative">
  <img src="/lagoon.jpg" alt="…">
  <witness-label variant="overlay" kind="generated" locale="en"
    generator="Image model (example)" created="2026-10-05">
  </witness-label>
</figure>

Text watermark

Mark generated text invisiblyMachine-readable, copy-paste safe.

Witness hides a short record in Unicode variation selectors at the end of a text, or of every paragraph. It looks the same, survives copy and paste in most apps, and can be read back. It is easy to remove on purpose, so treat it as one layer next to the visible label, not as proof.

Image, audio and video marking

Write the marking into the filePNG, JPEG, WebP, MP3, WAV, MP4, MOV and M4A.

Witness writes XMP metadata with the IPTC digital source type into the file itself, the format news agencies, platforms and ExifTool read. Pick an image, a sound file or a video to mark it here, or check whether a file already carries a marking, in XMP or in C2PA Content Credentials. The pixels and the sound are not touched, and files with a C2PA manifest are left unchanged.

Loading Witness…

The same from the command line

npx witness mark image.png --out marked \
  --kind generated --generator "Image model (example)"
npx witness inspect marked/image.png

Pro

Check every build and document it for your clientWitness Pro.

Muster Travel AG is a made-up agency client with a support chat, AI images and AI newsletter drafts. Below is what the Pro tools produce from its build folder and its AI register: the scanner output in CI, the transparency report for the client and the public "How we use AI" page.

witness.config.json (scan)

{
  "scan": {
    "root": "dist",
    "chat": [
      {
        "pages": [
          "support/**/*.html"
        ],
        "selector": "#chat"
      }
    ],
    "aiImages": [
      "images/**"
    ]
  }
}
Show the AI register (witness.config.json, register)
{
  "register": {
    "organisation": {
      "name": "Muster Travel AG",
      "url": "https://muster-travel.example",
      "contact": "ai@muster-travel.example"
    },
    "systems": [
      {
        "id": "support-chat",
        "name": "Support assistant",
        "purpose": "Answers questions about bookings and travel documents.",
        "vendor": "Example AI",
        "model": "example-chat-2",
        "role": "provider",
        "uses": [
          "chatbot",
          "generated-text"
        ],
        "pages": [
          "/support"
        ],
        "since": "2026-06-01",
        "measures": [
          "Notice above the chat with <witness-notice>",
          "Answers carry the invisible text watermark"
        ],
        "owner": "Customer service"
      },
      {
        "id": "images",
        "name": "Image generator",
        "purpose": "Creates illustrations for the website and the blog.",
        "vendor": "Example AI",
        "model": "example-image-1",
        "role": "deployer",
        "uses": [
          "generated-image"
        ],
        "pages": [
          "/",
          "/blog"
        ],
        "since": "2026-03-15",
        "measures": [
          "IPTC marking in every file",
          "Visible label next to each image"
        ],
        "owner": "Marketing"
      },
      {
        "id": "newsletter",
        "name": "Newsletter drafts",
        "purpose": "Drafts newsletter texts that an editor reviews and signs off.",
        "vendor": "Example AI",
        "role": "deployer",
        "uses": [
          "public-interest-text"
        ],
        "humanReview": true,
        "since": "2026-05-01",
        "owner": "Marketing"
      }
    ]
  }
}

witness-scan dist

Witness scan: 3 pages, 1 notices, 1 labels, 1 marked elements, 2 AI-marked images, 1 with C2PA, 0 AI-marked audio/video, 0 watermarked texts
ERROR   blog/lagoon.html img[src="/images/lagoon.png"]: Shows the AI-generated image images/lagoon.png without a visible label next to it. [ai-image-unlabelled]
ERROR   images/studio-portrait.png: The C2PA manifest does not hold up: The file content does not match its hash. Signed by CN=Example Image Studio, O=Example. [c2pa-invalid]
2 errors, 0 warnings

The scanner found the blog image that is marked as AI-generated but has no visible label. In CI this fails the build and shows up as an annotation on the pull request.

Commands

# CI: fail the build when AI content has no label or marking
npx witness-scan dist --json witness-scan.json

# Transparency report for the client, with scan results and notice evidence
npx witness-report build --scan witness-scan.json --events notice-events.jsonl \
  --out ai-transparency-report.html

# Public "How we use AI" page
npx witness-report page --show-vendors --out public/ai.html

Transparency report (witness-report build)

Public AI page (witness-report page)

Witness Pro also adds the notice and label wording in the 20 further official EU languages, so all 24 are covered.

See Witness Pro

Free 2.0

Marking layers and Content CredentialsWitness, free.

Witness 2.0 records and checks the marking layers the final Code of Practice asks for, and shows Content Credentials in the browser. Everything is MIT and a drop-in for 1.x markings, with Node 22 as the new minimum.

Record which layers mark your content

Markings now carry a schema version and a list of layers (visible, metadata, watermark, credentials), so you can document which techniques you apply. Old markings stay readable.

createMarking with layers

import { createMarking, markingAttributes } from "@sweberdev/witness";

const marking = createMarking({
  generator: "image-model",
  layers: ["visible", "metadata", "watermark"],
});
markingAttributes(marking);

Real output (@sweberdev/witness 2.0.0)

{
  'data-ai-generated': 'true',
  'data-ai-schema': '2',
  'data-ai-kind': 'generated',
  'data-ai-source-type': 'http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia',
  'data-ai-created': '2026-10-13T16:00:17.383Z',
  'data-ai-generator': 'image-model',
  'data-ai-layers': 'visible metadata watermark'
}

Check against the two-layer expectation

assessLayers tells you whether audio, image and video content reaches the two machine-readable techniques the Code of Practice asks for, and what is missing. inspectLayers reads the layers straight from a file.

assessLayers and inspectLayers

import { assessLayers, inspectLayers } from "@sweberdev/witness";

assessLayers("image", ["visible", "metadata"]);
inspectLayers(bytes); // bytes of a PNG marked with markFile / witness mark

Real output

{
  required: 2,
  present: [ 'metadata' ],
  satisfied: false,
  missing: [ 'watermark', 'credentials' ],
  notes: []
}
{
  contentType: 'image',
  layers: [ 'metadata' ],
  watermarkChecked: false
}

Gate your build with witness layers

The CLI lists the layers of each file and, with --require, exits 1 when a file has fewer machine-readable layers than the Code asks for. Use --assume for a watermark your provider applies and Witness cannot see.

Terminal

npx witness layers ./out/*.png --require
npx witness layers ./out/*.png --assume watermark --require

Real output (first run exits 1, second exits 0)

out/plain.png: image, layers metadata, 1 of 2 machine-readable, missing e.g. watermark or credentials
out/plain.png: image, layers metadata + watermark, 2 of 2 machine-readable

Show Content Credentials in the browser

The new <witness-credentials> element reads the C2PA manifest of an image, audio or video file client-side and shows who made it and whether it declares AI. It reads the manifest but does not verify the signature, and says so.

HTML (element) and readC2pa (same reader, in Node)

<script type="module">
  import "@sweberdev/witness/elements";
</script>

<witness-credentials src="/media/picture.jpg"></witness-credentials>

// Node, same reader:
readC2pa(bytes);

Real readC2pa output on the package's test fixture (trimmed)

{
  aiGenerated: true,
  sourceType: 'trainedAlgorithmicMedia',
  generator: 'Image Model X 3',
  verified: false,
  claimGenerator: 'Witness test generator 1.0',
  actions: [ 'c2pa.created' ]
}

Outputs were produced by running @sweberdev/witness 2.0.0 from npm. The credentials example uses a test fixture, and the output was reduced to selected fields.

Read the docs

Pro 2.1.0

Watch your site and hand proof to an auditorWitness Pro.

Pro 2.1.0 turns the one-off scan into ongoing monitoring: only new findings fail a run, and a webhook tells your team. It also adds an evidence bundle that you can give to an auditor or a client.

Only new findings fail the build

Save the findings you already know as a baseline. From then on a scan only fails when something new appears, so old findings no longer block every deploy.

Terminal

# once: save today's findings as the baseline
npx witness-scan dist --write-baseline witness-baseline.json

# every build: only findings not in the baseline fail the run
npx witness-scan dist --baseline witness-baseline.json

A comparison for every pull request

Write a Markdown comparison with the baseline (new, fixed, unchanged) and post it as the pull request comment.

Terminal

npx witness-scan dist \
  --baseline witness-baseline.json \
  --comment witness-comment.md

An alert when something new appears

Send a message to Slack, Mattermost, Discord or any JSON endpoint when a scan finds something new. Only https URLs are accepted.

Terminal

export WITNESS_WEBHOOK_URL="https://hooks.example.com/..."
npx witness-scan dist \
  --baseline witness-baseline.json \
  --label "example.com"

An evidence bundle with a hash manifest

Collect the register, client report, public AI page, scan, change log and legal status in one folder with SHA-256 hashes. Verify later that nothing has changed. The bundle is not signed.

Terminal

npx witness-report evidence --out evidence/
npx witness-report evidence --verify evidence/

The demo runs in your browser and cannot run the CLI. Scanning, alerts and the evidence bundle need your own build output, CI or server.

Read the docs

Next

Add it to your projectMIT, free.

Install @sweberdev/witness, put the notice into your chat and the labels next to generated content, and add the AI SDK middleware so text and images are marked as they are generated.

Get started