# keyless browser proxy

- Status: `experiment`
- Track: [delegated authority & keyless execution](https://aifoc.us/labs/delegated-authority/)
- Layer: 3. Identity, Permissions & Delegated Authority
- Updated: 1 December 2026
- Live demo: https://keyless-browser-proxy.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/keyless-browser-proxy

## Inspired by

- [calling apis from the browser shouldn't mean exposing keys](https://aifoc.us/dangerous/)

## Hypothesis

- **Claim:** Origin-verified short-TTL HMAC-SHA256 tokens tracked in an edge SQLite quota ledger allow public pure-frontend web apps to invoke metered capabilities without shipping static secrets in JS or requiring visitors to paste API keys.
- **Confirms it:** Same-origin requests succeed cleanly within quota (`200`), while missing origins, tampered HMAC tokens, or exhausted quotas fail deterministically (`401` / `403` / `429`) against `QuotaLedger`.
- **Falsifies or bounds it:** Spoofed non-browser `Origin` scripts abuse public anonymous quotas quickly without proof-of-work, Turnstile, or passkey identity binding.

> **Why this exists:** Shipping a browser demo or client-side web app against paid APIs normally forces an ugly choice: either expose a static secret in public JavaScript (where anyone can steal it) or make every visitor paste their own API key. Binding short-lived signed session tokens to the caller's `Origin` and counting calls in an edge quota ledger lets pure frontend apps call downstream capabilities safely without shipping static keys.


## What this lab tests

[Keyless Browser Proxy](https://keyless-browser-proxy.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/keyless-browser-proxy)) replaces static client API secrets with origin-verified HMAC-SHA256 ephemeral tokens enforced against a Cloudflare Durable Object SQLite `QuotaLedger` across `401`, `403`, and `429` boundaries.


## Open questions to iterate on

- How well do per-IP + per-Origin quotas hold up compared to attaching lightweight WebAuthn or Turnstile challenges before minting ephemeral tokens?
- Can Cloudflare Workers `no-store` ephemeral token minting generalize into a drop-in proxy template for every `/labs/` demo?

## Iteration log

- **2026-12-01:** Deployed origin-verified HMAC-SHA256 broker + SQLite Durable Object `QuotaLedger` (`401`/`403`/`429` tests).
- **2026-12-01:** Updated `/` `Cache-Control` to `must-revalidate` and added complete code blueprint at top of page.
- **2026-12-01:** Enforced fail-closed 403 rejection on missing Origin/Referer headers, reordered the proxy workbench above setup code, added pure-DOM syntax highlighting across JS/SQL/JSON/wire views, hardened 700px embed layout, and routed static assets through the Worker with no-cache headers.

## Primitives tested

- `Cloudflare Workers`
- `Durable Objects SQLite`
- `Origin Verification`
- `HMAC-SHA256 Ephemeral Tokens`

## Connected labs in other tracks

- [passkey attenuated capabilities](https://aifoc.us/labs/delegated-authority/passkey-agent-caps/) — Adds explicit hardware-backed user presence and per-tool dollar limits.

---
Canonical: https://aifoc.us/labs/delegated-authority/keyless-browser-proxy/
