# signed web citations

- Status: `experiment`
- Track: [content negotiation, signed citations & attribution](https://aifoc.us/labs/web-protocols/)
- Layer: 4. Network Stack, Content Negotiation & Protocols
- Updated: 1 December 2026
- Live demo: https://signed-web-citations.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/signed-web-citations

## Inspired by

- [hypermedia was always the point](https://aifoc.us/hypermedia/)
- [A link is all you need](https://aifoc.us/a-link-is-all-you-need/)

## Hypothesis

- **Claim:** Combining RFC 9530 `Content-Digest` and RFC 9421 HTTP Message Signatures lets browsers verify offline or in-tab that a quoted passage or transcluded card matches exact origin bytes served by the publisher.
- **Confirms it:** Origin signatures validate via browser `crypto.subtle.verify()` against `/.well-known/http-message-signatures-directory`, and altering a single word highlights the diff and invalidates the signature immediately.
- **Falsifies or bounds it:** Dynamic ad wrappers, CDN HTML rewrites, or minor whitespace normalization break byte-level `Content-Digest` checks across real websites unless canonical block spans are signed independently.

> **Why this exists:** When an application summarizes or quotes an article, readers currently have no cryptographic proof that the quoted excerpt matches what the publisher actually served. This lab signs origin bytes using RFC 9530 `Content-Digest` and RFC 9421 HTTP Message Signatures and verifies them directly inside the browser via `crypto.subtle.verify()`.


## What this lab tests

When downstream tools summarize pages or transclude snippets, readers currently lack cryptographic proof that quoted spans match what the origin actually served.

[Signed Web Citations](https://signed-web-citations.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/signed-web-citations)) emits real [RFC 9530 `Content-Digest`](https://www.rfc-editor.org/rfc/rfc9530) (`SHA-256`) and [RFC 9421 HTTP Message Signatures](https://www.rfc-editor.org/rfc/rfc9421) headers (`Signature-Input`, `Signature`) over origin payloads paired with [`/.well-known/http-message-signatures-directory`](https://signed-web-citations.kinlan-test.workers.dev/.well-known/http-message-signatures-directory). Mutating a single word highlights the exact diff and causes browser `crypto.subtle.verify()` to fail.


## Open questions to iterate on

- Can canonical text-fragment spans or block-level digests survive CMS template tweaks better than whole-body signatures?
- What minimal key-discovery UX lets any reader inspect publisher signature validity without trusting an intermediary aggregator?

## Iteration log

- **2026-12-01:** Built edge RFC 9421 + RFC 9530 signer, `/.well-known/http-message-signatures-directory`, and live browser tamper verifier.
- **2026-12-01:** Wired `/.well-known` JWK discovery, signed per-paragraph `X-Block-Digests` with a CDN wrapper/whitespace falsification test, LCS word diffs, CSP-safe syntax highlighting, 700px layout fixes, and Worker CSP/`no-cache` headers.

## Primitives tested

- `RFC 9421 HTTP Message Signatures`
- `Content-Digest SHA-256`
- `crypto.subtle`
- `#:~:text=`

## Connected labs in other tracks

- [attribution & metering protocol lab](https://aifoc.us/labs/web-protocols/attribution-metering-lab/) — Connects cryptographic quote provenance with referral click verification.
- [hypermedia islands lab](https://aifoc.us/labs/hypermedia-and-islands/hypermedia-islands-lab/) — Transcludes quoted passages using `#:~:text=` and StretchText.

---
Canonical: https://aifoc.us/labs/web-protocols/signed-web-citations/
