# ARCH-1 — Product and Technical Architecture

Version 0.2.6-draft · Part of the AllowedBy specification set · Informative, not normative · Changes since 0.1: CHANGES-0.2

## 1. Three design axes

Everything in this document is measured against three axes. When they conflict, the order below wins.

| Axis | What it means here | The test |
|---|---|---|
| **Secure** | No private key is ever a file, no secret ever crosses the wire, every document is signed, every acceptance is offline and replay-proof, every issuance is committed to a public log. | A compromise of any single component (runtime, service, node, approval page, network) is contained and detectable. §9 lists each one. |
| **Fast** | A service decides in well under a millisecond with zero network calls. A human's tap turns into a retried request in under a second. Standing grants make most calls cost one signature check. | §4 and §5 give the budget per step. |
| **Simple** | A runtime learns three verbs. A service adds one middleware and a route map. A human taps once. A node is one binary and a DNS name. Nobody parses anything they did not produce. | §10 shows the full integration in a few lines per role. |

"Fast" is mostly a consequence of "secure" done right: because verification needs nothing but what is in the request and a local trust list, there is nothing to wait for.

## 2. Product architecture

**AllowedBy** is the product. The identity layer keeps the wire prefix `oaid` (`/.well-known/oaid`, `oaid-node`); **AskMyHuman** is the name of the approval page and its link domain.

Five surfaces, one network. Each surface has exactly one job.

```
                           ┌──────────────────────────────┐
                           │  AskMyHuman (human's HOME node)│
                           │  approval page · passkey ·    │
                           │  push · wallet (all grants,   │
                           │  revoke)                      │
                           └──────────────┬───────────────┘
                                          │ tap → WebAuthn signature
                                          ▼
 ┌────────────────────┐    ┌──────────────────────────────┐    ┌────────────────────┐
 │  Runtime SDK       │    │  Node  (open source binary)   │    │  Service SDK       │
 │  (agent side)      │◄──►│  passports · countersign ·    │◄───│  (verifier side)   │
 │  key custody ·     │    │  approvals · Merkle log ·     │    │  trust list ·      │
 │  grant store ·     │    │  status · witness             │    │  verify() ·        │
 │  http wrapper /    │    └──────────────┬───────────────┘    │  route map ·       │
 │  MCP wrapper/proxy │                   │ cosign / monitor    │  edge module       │
 └─────────┬──────────┘                   ▼                    └─────────▲──────────┘
           │               ┌──────────────────────────────┐              │
           │               │  Other nodes (federation)     │              │
           │               └──────────────────────────────┘              │
           │                                                              │
           └──────────── Allowed-By + AllowedBy-Proof  (two headers) ─────┘
                         The only thing that crosses the agent→service boundary.
```

| Surface | Who installs it | Job | Talks to |
|---|---|---|---|
| **Runtime SDK** | The agent vendor or the operator, once per runtime | Hold the key in the best custody available, keep a passport fresh, keep grants, sign one proof per request, hand approval links (with their binding code) to the human, retry | Its node (rarely), services (every call) |
| **Service SDK** | The service, once per API | Verify the two headers offline, map routes to capabilities, create approval requests, publish the vocabulary and sentence templates | Nothing at request time; a node only to create an approval |
| **Node** | Anyone; public nodes run by AllowedBy and others | Issue passports, countersign grants, run the approval flow, keep the log, witness peers, serve status | Runtimes, services, humans, peer nodes |
| **AskMyHuman** | Nobody; it is served by the human's **home node** (where they enrolled their passkey) | Build what the human sees and signs (`display` from the service's templates, pairwise ids, the core), show it with the binding code and two buttons, collect a passkey signature; act as the human's **wallet**: every grant they signed at any node, one-tap revoke, "revoke everything from this operator" | The home node; trusted nodes forward approval requests to it and return the countersigned grant |
| **Operator console** (paid) | Operators who need L2, L3, QES or organisational authority | Identity verification of humans, authority policies, monitors, evidence packs, billing | A node |

The free product is the first four surfaces, including unlimited offline verification. The paid product is the fifth (§16).

## 3. Component map

| Component | Runs where | State | Open source | Notes |
|---|---|---|---|---|
| `allowedby` runtime library (TS, Python, Go, Rust, Java) | Inside the agent process | Private key handle, passport, grant cache | Yes | Three verbs: `identify`, `ask`, `call` (§10) |
| `allowedby-proxy` sidecar | Next to an agent that cannot be modified | Same as the library | Yes | HTTP(S) forward proxy and MCP wrapper; injects the two headers, handles challenges |
| `allowedby` verifier library (same languages) | Inside the service process | Trust list, node statements, status lists, replay set | Yes | One function, one config file |
| Edge verifier (Envoy WASM filter, NGINX njs, Cloudflare Worker) | At the edge | Same as the verifier library | Yes | Rejects before the origin is touched; passes identity downstream as headers |
| `oaid-node` | Any host with a DNS name | Postgres (or SQLite for a single node), signing keys in KMS/HSM, Merkle tiles on object storage | Yes | One binary, ACME for TLS, `docker run` to start |
| Approval page (PWA) | Served by every node at `{approval_page}`; used for the humans it hosts | None server-side beyond the approval record | Yes | Static files, WebAuthn, published as `page_hash` (§6) |
| Witness service | Part of `oaid-node`, enabled by flag | Cosignature history | Yes | Any node can witness any other |
| Monitor | Part of `oaid-node`, enabled by flag | Last seen checkpoint per watched node | Yes | Checks log promises; alerts on unexpected entries and unannounced `page_hash` changes |
| Operator console | AllowedBy hosted, or self-hosted with a licence | Verification records (encrypted), policies, plans | No | The only closed component; it never sits on any request path |

Nothing closed is on the request path. A service verifying an agent uses only open code and public documents.

## 4. The hot path: one request, zero network calls

The service receives a request carrying `Allowed-By` and `AllowedBy-Proof` (ABY-2). Both headers together are at most 8 KiB (depth ≤ 1: a root and one child); larger envelopes fail with `envelope_too_large`. This is the budget on one commodity core.

| Step | Work | Typical cost | Cached? |
|---|---|---|---|
| 1 | Read the two headers, parse the proof JWT header and claims | 5 µs | — |
| 2 | Hash the `Allowed-By` header value (SHA-256, 2 to 6 KB) | 5 to 15 µs | — |
| 3 | Look up the grant chain in the **verified-grant cache** by that hash | 1 µs | Hit on every call after the first under the same grant |
| 3a | Cache miss: verify each grant JWS against the node keys from the trust list, `typ`, `nbf`, `exp`, chain rules, class lifetime; verify `human.reg` against the home node and `human_sig` as a full WebAuthn assertion (`type`, challenge = core hash, `origin` and `rpIdHash` from `human.reg.rp_id`, UP and UV flags, signature with `human.reg.key`) | 60 to 90 µs per grant (Ed25519), plus one passkey check per grant | Signature results cached with the chain until the earliest `exp` |
| 4 | Status bit of every grant in the chain from the local status list copy | 1 µs | **Never cached with the signature result**; the list itself is refreshed in the background |
| 5 | Verify the proof: signature with `actor.key` (Ed25519 or ES256), `actor.exp`, `iat` in `[now − 120 s, now + 60 s]`, `htm`, `htu`, `dth`, `bdh` | 60 to 90 µs | Never (one per request, by design) |
| 6 | Replay check: `(kid, jti)` for 300 s | 1 µs local, ~0.3 ms shared | Shared set for non-safe methods (below) |
| 7 | Body hash while the body streams in | memory bandwidth | — |
| 8 | Route → capability, class, level, tier, `authn`, `authority`, `initiator` (service for `write-hard`+); match against the chain's capabilities and constraints | 2 to 5 µs | Route map compiled at start |
| 9 | Emit the request context (agent URI, pairwise human id, level, capabilities) | 1 µs | — |

Totals: **~100 µs on a cache hit, a few hundred µs on a cache miss with a depth-1 chain**, and no I/O except the shared replay set. A single core verifies several thousand requests per second; the limit is the service's own handler.

What makes it possible:

- **Nothing is looked up at request time.** Node keys come from the trust list and node statements fetched out of band (OAID-5). Status lists are refreshed in the background: at least every 300 s for `read`/`write` (a stale list is used for at most 1 h, then fail closed), and at most 60 s old for `write-hard`/`irreversible` (else fail closed). The key that signs the proof is inside the grant (`actor.key`), copied there by the node.
- **One signature per request.** The chain, `human_sig` and `human.reg` are verified once per grant and cached with it; thereafter the service only checks the proof and the status bit.
- **Two curves on the agent path.** Runtime keys are Ed25519 or ES256 (hardware keystores and most KMS only do P-256); verifiers implement both. RS256 is accepted only inside `human_sig`.
- **Small documents.** A grant is 1.5 to 2.5 KB; a proof is under 400 bytes.

**Replay across instances.** For non-safe methods (anything but GET, HEAD, OPTIONS) a service with more than one instance MUST use a **shared** replay set (Redis or equivalent), and single-use grants MUST be consumed atomically across instances. Safe methods may use a per-instance set. `irreversible` routes may additionally require `AllowedBy-Nonce`.

**Large bodies.** The body hash (`bdh`, identical to RFC 9530 `Content-Digest: sha-256`) is computed as the body streams. Verification completes with the last byte, before the handler runs.

## 5. The approval path: bounded by the human only

When a grant is missing or too narrow, the sequence in ABY-2 §6 to §8 runs. The engineering goal is that every machine step is invisible next to the human's reaction time.

| Step | Who | Target latency | How |
|---|---|---|---|
| Service creates the approval request | service → node | < 50 ms | One HTTPS call signed with the service's key (from its `/.well-known/allowedby`; `audience` must be exactly that origin). The creating node assigns a 4-character **binding code** and forwards the *request* to the human's home node if it is elsewhere |
| Home node builds the core | home node | < 50 ms | Fetches the audience's templates itself, renders `display`, computes pairwise `human.id`, embeds its own `human.reg`; it never shows or signs a core built elsewhere |
| Service answers the challenge | service → runtime | same response | The `approve` link, the code and the `poll` URL are in the 401 |
| The human receives the link | runtime → human | depends on channel | The runtime posts link and code in its own channel. In parallel the home node pushes to the human's installed AskMyHuman PWA when the human is known (`human_hint`) |
| The page opens and shows the sentence | human | < 300 ms | Static PWA on the home node, pre-cached shell, one fetch of the approval record |
| The human checks the code, taps Allow, passkey prompt | human | 1 to 3 s | WebAuthn, `uv=1`; challenge = `SHA-256(JCS(grant core))`, which contains `display` |
| Verify, countersign, log | home node → creating node | < 30 ms | Home node checks the assertion; creating node countersigns in one Postgres transaction with the log promise and sends the grant back to the home node (wallet) |
| The runtime receives the grant | node → runtime | < 100 ms | `poll` supports `Prefer: wait=25` long-polling and SSE |
| The runtime retries the original request | runtime → service | normal request | |

Tap-to-retry under one second end to end.

**Who may initiate.** The core carries `initiator`: `{ by: "service", kid }` or `{ by: "runtime" }`. Runtime-initiated approvals (pre-approval, case 0) are limited to `read` and `write`: verifiers require `initiator.by == "service"` with one of their own `kid`s for `write-hard` and `irreversible`, with `human_hint` set to the human linked to the account (§8). Nodes do not need to know classes.

Avoiding the round-trip altogether is the bigger win: standing grants for `read` and `write` last days, pre-approval collects consent before the first call, and renewal prompts arrive before expiry (AMH-1 §9). The approval state machine is in AMH-1 §5; one approval lifetime applies everywhere (default 15 min, maximum 60 min).

## 6. Node architecture

A node is one stateless API binary in front of one database, with signing keys that never leave a key manager, and read paths that are entirely cacheable.

```
          runtimes · services · humans · peer nodes
                            │ HTTPS (TLS 1.3, ACME)
                            ▼
                 ┌─────────────────────┐
                 │  oaid-node API      │  stateless, N replicas
                 │  issue · countersign│
                 │  approvals · humans │
                 │  witness · monitor  │
                 └──┬────────┬─────────┘
          sign()    │        │ SQL
                    ▼        ▼
          ┌──────────┐  ┌─────────────┐      ┌──────────────────────┐
          │ KMS/HSM  │  │ Postgres    │ ───► │ Object storage + CDN │
          │ node     │  │ passports   │ tile │ log tiles            │
          │ (offline)│  │ grants      │writer│ checkpoints (+cosigs)│
          │ issue    │  │ approvals   │      │ status list (30 s)   │
          │ counter- │  │ humans      │      │ node statement       │
          │ sign     │  │ log leaves  │      │ approval page (PWA)  │
          │ checkpnt │  └─────────────┘      └──────────────────────┘
          │ witness  │
          └──────────┘
```

**Keys.** A long-lived **`node` identity key** (offline HSM) signs the node statement, which delegates four role keys (`issue`, `countersign`, `checkpoint`, `witness`, OAID-2 §3), all in a KMS or HSM. Trust lists pin the node key, so role-key rotation never breaks a service. The statement lists `revoked_keys: [{ kid, after }]`; anything signed by that key after that log index is invalid. The API process holds handles, never key material.

**Database.** Postgres for any node that matters; SQLite for a single-operator node on a laptop. Tables: `passports`, `grants`, `approvals`, `humans` (internal id, passkey public key, `authn` class, level), `log_leaves`, `cosignatures`, `witnessed`. Every signed document is stored as the exact JWS bytes issued.

**Humans.** The node where a human enrolled is their home node: passkey `rpId` = its approval origin. It signs the human registration (`oaid-human+jwt`, OAID-7 §4: passkey key, `rp_id`, `authn` from attestation and FIDO MDS, level, log index) that every grant embeds as `human.reg`, and issues **pairwise** `human.id` values per audience (`HMAC-SHA-256(home_secret, utf8(internal_id) ‖ utf8(audience))`). It is the only party that builds the core a human signs; a creating node elsewhere sends it only the request and returns the countersigned grant to it.

**Log.** RFC 6962 Merkle tree. Leaves are **commitments** `SHA-256(salt ‖ document)`; documents and salts go to the parties (wallet, operator, audience) and to authorised monitors. Every countersigned document carries `log: { idx }`, the leaf index assigned in the issuing transaction: a promise monitors check. Checkpoints, cosignatures, witnessing and tiles follow C2SP `tlog-checkpoint`, `tlog-cosignature`, `tlog-witness` and `tlog-tiles` verbatim (signed notes). Checkpoints at least every 10 s while the tree grows; cosignatures within 10 min (OAID-4).

**Status list.** IETF Token Status List format, regenerated every 30 s and served from the CDN with `Cache-Control: max-age=30`. Revoking a key flips every grant revision bound to it.

**Approval page.** Static bundle published as `page_hash` (SRI SHA-384) in the node statement and logged on every change; monitors alert on unannounced changes. The page renders only from the signed `display`.

**Rate limiting and abuse.** Every mutating endpoint requires an `AllowedBy-Proof` (OAID-2 §5). Issuance is limited per operator, approvals per human (default 30 pending). Home nodes accept forwarded approvals only from nodes on their own trust list. Public nodes apply a fair-use cap on runtime-initiated approval **creation** (1,000 / month / operator); verification is never metered.

**Scale.** One API replica on two cores issues or countersigns about 2,000 documents per second. Replicas scale horizontally; the database grows by about 3 KB per document; public reads land on the CDN.

**Federation.** A node witnesses peers it is configured to witness and asks the witnesses in its statement to cosign its checkpoints. No coordinator, no discovery service; nodes find each other through trust lists and vouches (OAID-5). A node that stops being cosigned stops meeting services' `witnesses_min`.

**Operations.** TLS from ACME, metrics on `/metrics`, structured logs without personal data. Retention: log commitments 7 years; approvals and disclosures pruned 90 days after a terminal state. Erasure deletes documents and salts; commitments remain and are not personal data (OAID-1 §10).

## 7. Runtime architecture (agent side)

The runtime library is deliberately thin: hold a key, keep a passport, keep grants, sign proofs, surface links.

```
  agent code ──► allowedby.call(method, url, body)
                      │
                      ├─ grant store: pick the narrowest valid grant for (audience, capability)
                      ├─ passport: renew at 1/3 lifetime left (same key); rebind (new revision) after a tier 0 restart or as actor.exp nears
                      ├─ proof: sign {htm, htu, iat, jti, dth, bdh} with the leaf grant's actor key
                      ├─ send the two headers
                      └─ on 401 AllowedBy: → on_approval(link, code, summary) → wait on poll (SSE) → retry

  custody handle ──► tier 2: KMS/HSM · tier 1: TPM / Secure Enclave / StrongBox / Windows Hello · tier 0: process memory
```

**Custody is chosen automatically**: configured KMS (tier 2), then platform keystore (tier 1), then process memory (tier 0). Keys are Ed25519 or ES256, whichever the custody supports (OAID-6).

**Grants bind the key until `actor.exp`**, the earlier of the passport's `exp` and the attestation's validity. A tier 0 key therefore dies with its passport (≤ 1 h) even if the grant lives for days.

**Rebind** after a tier 0 restart, or when `actor.exp` approaches, issues a new **revision** of the same grant (same `gid`, `rev` + 1, new `actor`). It is authenticated by a proof signed with the **new** passport's key, plus either a `prev` chain to the old passport or an `operator_sig` (`aby-operator+jwt` over `{ gid, sub, aud: <node>, iat, exp ≤ iat + 300 }`) by an operator key published at `https://<domain>/.well-known/oaid-operator`. Operators without a verified domain cannot rebind after a tier 0 restart; they request new approvals. Single-use grants and grants with children are never rebound. Older revisions are not revoked; they die at their own `actor.exp`. `actor` (except `actor.operator` and `actor.runtime`) and `rev` sit outside the human-signed core, so `human_sig` survives.

**Grants are cached locally, encrypted at rest**, indexed by audience and capability prefix; selection picks the narrowest grant that satisfies the call.

**The approval callback is the only integration point an agent author touches.** `on_approval(link, code, summary)` receives the AskMyHuman link, the binding code and the sentence; the agent posts them into its channel. Defaults exist for stdout, Slack, email and MCP (a tool result rendered as a button).

**MCP and unmodifiable agents.** `allowedby-proxy` is the same library as an HTTP forward proxy and an MCP server wrapper; challenges come back to the agent as a tool result containing the link and code.

**Sub-agents** get attenuated child grants (`POST /grants/{gid}/attenuate` with the child's own passport). Each child carries the sub-agent's own `actor.key`; proofs are always signed by the **leaf** grant's key. Depth ≤ 1 (a root and one child); every child is narrower in capabilities, constraints, audience and time.

## 8. Service architecture (verifier side)

```
  request ──► [edge verifier]  or  [middleware]
                  │  trust list (signed file, hot-reloaded)
                  │  node statements + status lists (background refresh)
                  │  route map: POST /payments → payments:release, class by amount, authn, authority
                  │
                  ├─ accept → request context: agent URI, pairwise human id, level, capabilities, gid chain
                  └─ reject → 401 with the AllowedBy challenge (approval created at a node), 403 for policy refusals
```

**Config is the trust list plus a route map.** The trust list says which nodes and what minimums (OAID-5). The route map gives, per route: capability, **class** (fixed, or by amount: e.g. `write-hard` up to a threshold, `irreversible` above), level, tier, `authn` (e.g. `hardware`), `authority` (require organisational approval), and the JSON Pointer of the amount field. Class defaults (ABY-3) are defaults; the route map may raise or lower them. The class is always the verifier's: a grant whose lifetime exceeds the class maximum is rejected whatever it claims. The same file generates `/.well-known/allowedby` (vocabulary, sentence templates, `disclosure_key`).

**Constraints are JSON.** `{ "amount": { "max": "5000.00", "currency": "EUR", "per": "call", "field": "/total" } }`, plus `count`, `scope`, `fields`, `window` (ABY-3). The shorthand `amount<=5000` exists only as SDK sugar.

**Account linking.** A service that cares which human approves (`write-hard` and above, any multi-user resource) links the pairwise `human.id` to its own account once, through the reserved capability **`aby:link`** approved while the user is signed in. The link stores the pair `(human.reg.iss, human.id)`; thereafter the service sets `human_hint` and accepts a human only when both match (`human_not_linked` otherwise). This is the service's own authorisation, done on the verifier output.

**Organisational authority.** The resource owner's organisation publishes an authority policy (`aby-authority-policy+jwt`, signed with a key from its `/.well-known/allowedby`: approver groups, thresholds, quorum). Co-approvers each sign the same core hash on their own home node; the grant carries their assertions in `authority` (ABY-1 §5). Routes with `authority: true` reject grants without a satisfied quorum (`authority_required`).

**Verification output is a context, not a session.** No cookies, no sessions, no tokens to store. **Edge deployment** uses the same verifier compiled for Envoy, NGINX and Cloudflare. **Audit** is one structured line per accepted request: `gid` chain and `rev`, `actor.sub`, `human.id`, level, `jti`.

## 9. Security architecture

### 9.1 Principles

1. **No secret on the wire.** Headers carry public documents and signatures. A captured request is useless against any other URL, method, query or body, useless after its proof window, and useless against any instance for non-safe methods because the replay set is shared.
2. **No secret at rest in the open.** Private keys live in custody boundaries; disclosure data is encrypted to the service's key.
3. **Offline acceptance.** A service decides with local data only, so no node outage or network attacker can change an acceptance decision, and no node learns which services an agent calls.
4. **Everything issued is committed to a witnessed log.** A node cannot issue in secret, rewrite history, or equivocate without detection; every document carries a log promise.
5. **What you see is what you sign.** The passkey signs `SHA-256(JCS(grant core))`, and the core contains `display`, rendered from the service's templates. The page code is pinned by `page_hash`.
6. **Least privilege by construction.** Capabilities with JSON constraints and explicit audiences; children only narrow; single-use grants bind method, URL, query and body.
7. **Compromise is contained per component**, see 9.2.

### 9.2 Threat model

| Threat | Control | Residual |
|---|---|---|
| Replay of a captured envelope | Proof bound to method, URL, query, body, 180 s window; `(kid, jti)` set held 300 s, shared across instances for non-safe methods; single-use grants consumed atomically; optional `AllowedBy-Nonce` | A safe (GET) request can be replayed once per extra instance within the window; it reads what the grant already allows |
| Runtime key theft, tier 0 | Passport ≤ 1 h; grants bind the key only until `actor.exp` ≤ passport `exp`; rebinds are logged and need `prev` or the operator key; revocation by key | Attacker acts as the agent for at most 1 h, within the grant's capabilities |
| Runtime key theft, tier 1/2 | Non-exportable keys; routes can require tier ≥ 1 | Attacker must stay on the host; same capability bound |
| Prompt injection | The runtime writes no text the human reads and cannot widen anything signed | The agent can do what it was already allowed |
| Phishing the human | Binding code shown in the runtime's channel and on the page; sentence from the service's templates; passkey bound to the home node origin; push from the home node; service-initiated approvals with `human_hint` for `write-hard`+ | A human can still approve an honest but unwise request; single-use bounds it to one action |
| Mismatch between what is shown and what is signed (WYSIWYS) | `display` inside the signed core; page renders only from it; `page_hash` logged and monitored | A compromised home node can serve a modified page until monitors flag the hash change |
| Malicious creating node | Cannot build what the human signs: the home node fetches the templates, renders `display`, computes pairwise ids and builds the core itself, and never signs a core built elsewhere | It can refuse to countersign or delay; the runtime asks again |
| Cross-audience service approvals | A service-initiated approval's `audience` must equal the origin whose key signed it; `initiator` is in the signed core | A service can only ask for itself |
| Forwarding floods | Home nodes accept forwarded approvals only from nodes on their trust list; per-human cap (default 30 pending); fair-use cap on runtime-initiated creation | A trusted node can still annoy until removed from the list |
| Malicious or compromised node | Cannot invent humans: `human.reg` must come from a trusted home node, carry attested `authn`, and match a fully verified `human_sig` (origin and `rpIdHash` bound to `rp_id`); every document carries a log promise checked by monitors; `display` is signed; node key pins and `revoked_keys`; trust-list removal | A node can misuse the humans it hosts (it controls their page) until detected; every such grant is committed in its log |
| Node operator reads personal data | Pairwise human ids; log holds commitments only; disclosure is a separate encrypted SD-JWT VC never logged | The home node and the L2 verification provider hold identity data; they are the only places |
| Correlation of a human across services | Pairwise `human.id` per audience | Services that share other identifiers (email) can still correlate |
| Service compromise | The service holds no AllowedBy secret | Attacker reads what the service could read |
| Denial of service on nodes | Static reads behind a CDN; signed proof before any write; per-operator limits and fair-use cap | Approval pages can be slowed; runtimes keep long-polling |
| Downgrade or confusion | One mode per request; `typ`, `alg` and `kid` checked on every JWS; `alg` allow-list; `crit` forbidden | None known |
| Stale revocation | Status bit never cached with the signature; refresh 300 s / 60 s; `write-hard`/`irreversible` fail closed past 60 s, `read`/`write` past 1 h | Normally ≤ 360 s (`read`/`write`) or ≤ 90 s (`write-hard`/`irreversible`); under a blocked status fetch up to 1 h for `read`/`write`; `irreversible` is single-use anyway |
| Witness collusion | `witnesses_min` per service; witnesses chosen by the service's trust list | A service that trusts few witnesses trusts those witnesses |

### 9.3 Key and secret inventory

| Holder | Secret | Where | Lifetime |
|---|---|---|---|
| Runtime | One private key (Ed25519 or ES256) | Custody boundary | Until `actor.exp` |
| Human | Passkey private key | Authenticator (`authn` class recorded) | Until the human replaces it |
| Node | `node` identity key + four role keys; `home_secret` for pairwise ids | Offline HSM / KMS | Node key long-lived; role keys rotate with overlap |
| Service | None to verify. One signing key, published in its `/.well-known/allowedby`, only to create approvals | Service's own KMS or secret store | Local |
| Operator | Optional rebind key, public half at `https://<domain>/.well-known/oaid-operator` | Operator's KMS | Local |
| Operator console | Verification evidence encryption key | KMS | Rotated yearly |

A service *verifies* with zero secrets. The only key it ever holds signs approval requests, and it publishes the public half itself; nobody registers anything.

### 9.4 What is deliberately absent

No shared secrets, no API keys, no bearer tokens, no sessions, no cookies, no custom cryptography, no blockchain, no free text from runtimes, no central authority that can stop a service from verifying.

## 10. The simplicity contract

### 10.1 A runtime: three verbs

```python
from allowedby import Runtime

rt = Runtime(operator="acme.example", name="assistant",
             on_approval=lambda a: chat.post(f"{a.summary}\nCode {a.code}\n{a.link}"))

rt.identify()                                   # best custody, passport issued, grants rebound

resp = rt.call("POST", "https://api.example.com/invoices/4711/approve",
               json={"comment": "ok"})          # headers added; if challenged, the human is
                                                # pinged, the grant arrives, the call is retried
```

`ask` collects consent before starting (pre-approval, `read` and `write` only):

```python
rt.ask("api.example.com",
       [{"capability": "invoices:read"},
        {"capability": "invoices:comment",
         "constraints": {"count": {"max": 20}}}],
       for_days=7)
# SDK sugar, same result: rt.ask("api.example.com", ["invoices:read", "invoices:comment count<=20"], for_days=7)
```

### 10.2 A service: one middleware, one route map

```yaml
# allowedby.yaml
trust: ./trust-list.json          # which nodes you accept; defaults to the public anchors
public_origin: https://api.example.com
routes:
  "GET  /invoices/**":           { capability: "invoices:read", class: read }
  "POST /invoices/{id}/approve": { capability: "invoices:approve", class: write-hard, level: 1,
                                   authn: hardware, amount_field: "/total" }
  "POST /payments":              { capability: "payments:release", amount_field: "/amount",
                                   class: [ { up_to: "5000.00", class: write-hard }, { class: irreversible } ],
                                   authority: true }   # requires a satisfied authority quorum
```

```ts
app.use(allowedby({ config: "./allowedby.yaml", replay: process.env.REDIS_URL }));

app.post("/invoices/:id/approve", (req, res) => {
  // req.allowedby.human.id (pairwise, linked via aby:link), .level, .agent, .capabilities
});
```

The middleware rejects, challenges (creating the approval at the node) and publishes `/.well-known/allowedby` with the vocabulary and sentence templates from the same file.

### 10.3 A human: one tap

A link and a 4-character code arrive in the channel they already use. The home node's page shows the same code, the service's sentence, who is asking and for how long. Allow prompts the passkey. L2 and L3 are one-time identity checks (EU Digital Identity Wallet by default) and QES an extra signing step, each only when the service's route demands it.

### 10.4 A node: one binary

```
docker run -p 443:443 -e OAID_DOMAIN=node.acme.example -e OAID_KMS=gcp://... ghcr.io/allowedby/oaid-node
```

The statement, TLS, log, status list and approval page are served from the domain within a minute.

### 10.5 What we refuse to add

| Rejected | Why |
|---|---|
| A second header for the passport on granted requests | The node copies the identity into the grant; one document, one proof |
| RFC 9421 HTTP Message Signatures as a requirement | Supported through the Web Bot Auth profile (`tag="web-bot-auth"`, `Signature-Agent`) so aware edges recognise agents; never required |
| A client-registration step for services | A service verifies offline and is known to nobody |
| Scopes with a central registry | Capabilities are published by each service |
| Session establishment between runtime and service | Every request stands alone |
| Blockchain or token | A witnessed Merkle log gives non-equivocation without the cost |
| Verifier profiles (basic / full) | One verifier profile: chain, `human_sig`, `human.reg`, status, class, constraints |

## 11. Deployment topologies

| Who | What they run | What they trust |
|---|---|---|
| Solo developer | Runtime SDK with a public node | Public anchors in the default trust list |
| Agent platform vendor | Runtime SDK or MCP wrapper, optional vendor node | Its own node plus public anchors |
| Service accepting agents | Verifier middleware or edge module | A trust list it edits; public anchors by default |
| Enterprise with its own humans | Private node (home node for its staff, authority policies), monitors, own trust list | Itself and its vouched peers |
| Verification provider | Public node with the operator console | Everyone chooses whether to list it |

The same binaries and libraries in every row; only trust lists differ.

## 12. Service levels and targets

| Metric | Target |
|---|---|
| Service verification, cache hit, p99 | < 0.3 ms CPU, 0 network calls |
| Service verification, cache miss, depth 1, p99 | < 1 ms CPU |
| Envelope size | about 4.3 KB at depth 0 and 7 KB at depth 1 (ABY-2 §2); hard limit 8 KiB |
| Node countersign, p99 | < 30 ms |
| Approval tap to grant delivered, p99 | < 500 ms after the WebAuthn response |
| Tap to retried request, p99 | < 1 s |
| Revocation effective at verifiers | Normally ≤ 360 s `read`/`write`, ≤ 90 s `write-hard`/`irreversible`; with status fetch blocked, `read`/`write` fail closed after 1 h |
| Checkpoint cadence | 10 s while the tree grows; cosignatures within 10 min |
| Node availability (public nodes) | 99.95 % for writes; reads from CDN at 99.99 % |
| Runtime overhead per call | one signature, ~50 µs, plus body hashing |

## 13. Technology choices

| Area | Choice | Reason |
|---|---|---|
| Node | Go, single static binary; Postgres; S3-compatible object storage; any CDN | Operable by anyone, trivial to self-host |
| Signatures | Nodes Ed25519; runtimes Ed25519 or ES256; passkeys ES256, EdDSA, RS256 (only in `human_sig`); ML-DSA-44 reserved | Fast where we choose; P-256 where hardware forces it |
| Key custody | Offline HSM for the node key; KMS/HSM for role keys; TPM 2.0, Secure Enclave, StrongBox, Windows Hello for runtimes | Keys never exportable; attestation available |
| Log | RFC 6962 tree of commitments, C2SP checkpoints, witnessing and tiles verbatim | Existing witnesses and monitors work unchanged |
| Revocation | IETF Token Status List | Standard format, CDN-cacheable |
| Delivery of grants | Long-poll with `Prefer: wait` and SSE | Instant delivery without a broker |
| Approval page | Static PWA, WebAuthn, hash-pinned | Fast on any phone, auditable |
| SDKs | TypeScript, Python, Go, Rust, Java; one vector suite (CONF-1, `vectors/`) | Same behaviour across languages |
| Serialisation | JWS compact, RFC 8785 (JCS) wherever bytes are hashed | Universal library support |

## 14. Build order

| Phase | Delivers | Proves | Success metric |
|---|---|---|---|
| **1. Wedge** | Hosted public node, TS and Python runtime and verifier libraries, approval page and wallet, **MCP wrapper and `allowedby-proxy`**, test vectors; design partners in enterprise finance approvals and MCP servers | An agent gets a 401, a human taps, the call succeeds; a service verifies offline | Time to first verified call < 10 min; approval completion > 80 %; median time-to-tap < 30 s; ≥ 3 production services |
| **2. Network** | Second public node run by an independent operator, witnessing, monitors, trust lists with vouching | Services choose whom to trust; no single operator | ≥ 2 independent node operators; ≥ 1 external witness cosigning |
| **3. Verified** | L2 and L3 via EUDI wallet, QES through a qualified provider, authority policies, enterprise private node, Go and Rust SDKs, edge modules | Paid tier; serious actions behind verified humans and policies | Paying enterprise customers on monthly-active-approver pricing |
| **4. Everywhere** | Java SDK, agent-platform integrations, conformance programme, neutral body, 1.0 freeze | Interoperability across independent implementations | ≥ 3 independent operators; ≥ 2 independent implementations passing CONF-1 |

Phase 1 is small on purpose: one node, Postgres, a static page, two libraries, the wrappers, and a vector suite. Everything after is additive.

## 15. Open decisions

- Push to the human: home-node web push to the PWA versus operator channel only. Current lean: both; push is an acceleration, never the only path.
- Rust versus Go for the node: Go for speed of delivery in Phase 1; the vector suite makes a later port safe.
- Neutral home for the specs and default trust list: OpenID Foundation working group or IETF (via Web Bot Auth / OAuth). Decided before 1.0.

## 16. Product, market and governance

**Wedge.** Beachhead: enterprise finance agents (invoice, PO and payment approvals under a delegation-of-authority policy), where "which human allowed this, under which policy" is already an audit question. Developer channel: MCP servers, through the MCP wrapper.

| Audience | Value |
|---|---|
| Service owner | Accept agents safely with one middleware and zero secrets; know which human allowed each call |
| Agent platform | Agents that can act on real systems without credential sharing; one SDK or wrapper for every service |
| Human | One tap with a sentence they can trust; one wallet to see and revoke everything |
| Enterprise buyer | Delegation-of-authority policies enforced on agents, evidence packs for audit, an organisation node with SSO/SCIM, mandates, budgets and a fleet console (ORG-1) |

**Interop must-haves.** Web Bot Auth (key directory and RFC 9421 profile); MCP and OAuth via a mapping to RAR `authorization_details` type `allowedby` (no bearer tokens); a CIBA-compatible façade for approval routing; EUDI wallet as the default L2/L3 source and a QES signer; AP2 mandates coexist (an AllowedBy grant can authorise the agent that carries one).

**Packaging.**

| Plan | Contents | Price |
|---|---|---|
| Community | All open source; unlimited offline verification; public nodes with fair-use 1,000 approvals / month / operator | Free |
| Team | Hosted node and wallet for a team, higher approval volume, monitors | ~€49–99 / month |
| Enterprise | Authority policies, private node, SSO/SCIM, L2/L3 verification, QES at cost, evidence packs, support | Platform fee + €4–8 per monthly active approver |
| Service Pro (optional) | Dashboards and tooling for services | Add-on; never needed to verify |

The charge metric is **monthly active approvers**. Verification is never charged.

**Neutrality and governance.** The specs and the default trust list move to a neutral body before 1.0. Inclusion criteria are public; AllowedBy cannot add itself unilaterally; 1.0 requires at least three independent node operators.

**Levels are the service's choice.** Every scenario below works at whatever level the service's route asks for: L0 (agent only), L1 (passkey), L2 (eIDAS substantial), L3 (eIDAS high, hardware passkey), plus QES on top where a route needs a qualified signature. The plan delivers levels as they become available, not per scenario.

**90-day plan, by scenario** (scenarios as in `comparison.html` §5).

| Days | Scenarios delivered | Levels available | Exit criteria |
|---|---|---|---|
| 0–30 | Main flow: agent tries, service answers `401` with a link, human approves, agent forwards the grant. A: agent already approved. H: deny and revoke | L0, L1, L2 (EUDI wallet) | 2 finance design partners with a first verified call; median time-to-tap < 30 s |
| 30–60 | B: agent asks first. C: standing permission with renewal prompts. D: service starts the approval from the ERP, no chat. E: company quorum | + L3 (eIDAS high, hardware passkey) | ≥ 3 production services; approval completion > 80 % |
| 60–90 | F: sub-agents. G: restart and rebind. QES routes through one qualified provider. `payee` constraint for payments | + QES | 1 paid pilot; 1 external node operator |
| After 90 | I: payment-rail bridge (AP2 mandates). Organisations (ORG-1): verified profiles and provider tenants first, then human budgets and disclosure, then organisation nodes with SCIM, mandates and fleet console | — | Decided at the go/no-go |

**Day-90 go/no-go:** ≥ 3 production services, approval completion > 80 %, 1 paid pilot, 1 external node operator.

## Change log

Every change to this document adds a row here and increments its version (README, Versioning).

| Version | Date | Change |
|---|---|---|
| 0.2.6-draft | 2026-11-28 | §12: the envelope size target follows ABY-2 §2's arithmetic (about 4.3 KB at depth 0, 7 KB at depth 1), no longer below 3 KB. |
| 0.2.5-draft | 2026-11-28 | A chain is at most depth 1 (ABY-1 0.2.6, ABY-2 0.2.14), in the limits and in Sub-agents. |
| 0.2.4-draft | 2026-10-29 | Organisations (ORG-1) in the plan and the enterprise value (CHANGES §18). |
| 0.2.3-draft | 2026-10-28 | Levels L0–L3 and QES chosen per route; §16 90-day plan rewritten by scenario (CHANGES §17). |
| 0.2.2-draft | 2026-10-27 | Pairwise id formula written with explicit UTF-8 concatenation (CHANGES §16). |
| 0.2.1-draft | 2026-10-27 | Home node builds the core and display; role keys under a node identity key; status freshness ceilings (CHANGES §15). |
| 0.2.0-draft | 2026-10-27 | Rewritten for 0.2: home node as wallet, L0–L2 plus authority, one verifier profile, §16 product, market and governance (CHANGES §1–§14). |
