# OSPP Protocol 1 (`ospp.v1`): passports and how to verify them

Status: DRAFT for public review, 2026-11-04. Normative unless marked *informative*. The key words MUST, MUST NOT, SHOULD and MAY are as in
RFC 2119. This document supersedes `kit/docs/02-PROTOCOL-AND-DATA.md` for everything a verifier checks. The lists marked *generated* are
produced from the reference implementation by `spec/tools/spec_tables.py`, and the protocol test suite fails when they disagree with it.

Reference implementations: Python `packages/protocol` (rules in `ospp_protocol/rules.py`) and TypeScript `ts/verifier`; they are
cross-checked against each other on every vector (`spec/tools/compare_verifiers.py`). Test vectors: `spec/test-vectors/`.
Shape-only JSON Schemas: `spec/schemas/`.

## 1. What a passport claims (informative)

An OSPP passport is an issuer-signed **origin certificate** for one run of a registered AI step (a *node*, also *procedure version*). It
records that a gateway committed to the exact request it would send (H-E) and witnessed that commitment in a transparency log *before* the
provider call, then committed to the response (H-R) and witnessed that afterwards, at the signed request of a client key. It does **not**
establish that the response is correct, that the provider executed the request, or that any later reported outcome is true. The gateway
is trusted for the bytes it reports. Status after issuance (suspension, revocation) is checked online.

## 2. Encoding and cryptographic profile

- SHA-256 for every commitment and tree hash; Ed25519 (RFC 8032) for every signature.
- Structured objects are canonicalised with **RFC 8785 (JCS)** before hashing or signing. Hashed objects MUST contain only strings, booleans,
  null, objects, arrays and **integers** within ±(2^53−1); floats, NaN and infinities MUST be rejected. Larger quantities travel as decimal
  strings; money is integer minor units (or millionths, `*_micro`) with an ISO 4217 code.
- Binary values in JSON are base64url without padding, except where a field is named `*_hash`/`root_hash`/`hashes` (lowercase hex) and inside
  C2SP notes (standard base64, as C2SP specifies).
- Timestamps are RFC 3339 UTC with the `Z` suffix; others MUST be rejected.

<!-- BEGIN GENERATED: constants -->
- `protocol_version`: `ospp.v1`
- commitment prefix: `OSPP/v1/<LABEL>\n`
- governance signer id: `ospp-governance`; governance threshold: 2 valid signatures
<!-- END GENERATED: constants -->

### 2.1 Commitments

`H(label, obj) = "sha256:" || hex(SHA256(UTF8("OSPP/v1/" || label || "\n") || JCS(obj)))`. A commitment is the 71-character string
`sha256:` + 64 lowercase hex digits. A verifier MUST recompute a commitment under the label the rule names; the same object under another
label is a different value (vector `commitment_wrong_label_differs`).

<!-- BEGIN GENERATED: labels -->
39 labels: `ATTESTATION_COLLATERAL`, `BOOT_AUTHORIZATION`, `CANARY`, `CERTIFICATE_CONTENT`, `CLIENT_REQUEST`, `COST_ADJUSTMENT`, `DEPLOYMENT_CONFIG`, `DISCLOSURE_GRANT`, `EFFORT_BASELINE`, `EVENT_RECEIPT`, `EVENT_UNSIGNED`, `EXECUTION_ASSIGNMENT`, `FINDING`, `FINDING_RESOLUTION`, `GATEWAY_LICENSE`, `GATEWAY_PULL`, `GATEWAY_STATEMENT`, `INPUTS`, `INTENT`, `KEY_REGISTRY`, `LOG_CONFLICT`, `MONITOR_ATTESTATION`, `OSPP_JOB`, `OUTCOME_DEF`, `OUTCOME_OBSERVATION`, `P2P_HEARTBEAT`, `PARTY_ADMISSION`, `PLATFORM_RELEASE`, `PRIVATE_PAYLOAD`, `PROCEDURE`, `RECEIPT`, `RELEASE_ALLOWLIST`, `REQUEST`, `RESPONSE`, `REVIEW_DECISION`, `STATUS_CHANGE`, `USAGE`, `WITNESS_POLICY`, `WORKFLOW`
<!-- END GENERATED: labels -->

Labels a passport verifier uses: `CERTIFICATE_CONTENT` (certificate minus `issuer_signature`), `CLIENT_REQUEST`, `INTENT` and `RECEIPT`
(leaf bodies minus `signature`), `WORKFLOW` (§5.3), `WITNESS_POLICY` and the other governance labels (§3.3), `EVENT_UNSIGNED`,
`EVENT_RECEIPT` and `PRIVATE_PAYLOAD` (history, §6), `EFFORT_BASELINE` (baselines and OSPP's time estimate). `INPUTS`, `PROCEDURE`, `REQUEST`
and `RESPONSE` are computed by clients and gateways (H-P, H-E, H-R, the inputs commitment) and are opaque to a verifier. `GATEWAY_PULL`,
`OSPP_JOB` and `P2P_HEARTBEAT` sign channel traffic and never appear in a passport. `USAGE` is reserved (see §9).

### 2.2 Signatures

Every object signature except log heads and cosignatures signs an **envelope**:

```
Sign(key, JCS({"domain": D, "scheme": "Ed25519", "message_digest": H(label, object_without_its_signature),
               "key_id": K, "signer_id": S, "protocol_version": "ospp.v1", "signed_at": T}))
```

The signature is base64url. `signer_id` is the signing key's `owner_id` from its key record, except governance signatures (`ospp-governance`).
`signed_at` is the time key validity is checked against. A verifier MUST reject a domain outside this list.

<!-- BEGIN GENERATED: domains -->
18 domains: `BOOT_AUTHORIZATION`, `CLIENT_REQUEST`, `CLIENT_REVIEW`, `DEPLOYMENT_CONFIG`, `EVENT_AUTHOR`, `EVENT_RECEIPT`, `GATEWAY_INTENT`, `GATEWAY_PULL`, `GATEWAY_RECEIPT`, `GATEWAY_STATEMENT`, `GOVERNANCE`, `ISSUER_CANARY`, `ISSUER_CERTIFICATE`, `ISSUER_RESOLUTION`, `MONITOR`, `OSPP_JOB`, `REGISTRY`, `WITNESS`
<!-- END GENERATED: domains -->

## 3. Keys, parties and governance

### 3.1 Key records

`{key_id, public_key, role, owner_id, valid_from, valid_until?, revoked_effective?, party_id?, witness_name?, log_id?}`.
`key_id = base64url(SHA256(public_key)[0:16])`; `public_key` is the raw 32-byte Ed25519 key, base64url. Roles a verifier meets: `issuer`,
`gateway`, `client`, `log`, `witness`, `governance`, `registry`, `connector`, `history`. A key is **valid at T** iff
`valid_from ≤ T`, and `T < valid_until` when set, and `T < revoked_effective` when set. A verifier MUST check the role a rule requires.

### 3.2 Parties

A witness key belongs to a **party** (`party_id`). Many keys of one controlling party count as one party in every quorum.

### 3.3 Governance-signed objects

`governance_signatures = [{governance_key_id, signed_at, signature}]`, each an envelope signature (domain `GOVERNANCE`, signer id
`ospp-governance`) over `H(label, unsigned)`, where `unsigned` is the object without `governance_signatures`, `signature` and
`governance_key_id`. Valid when at least 2 **distinct** governance keys, each valid at its `signed_at`, verify.

<!-- BEGIN GENERATED: governance -->
| Object (leaf type) | Commitment label |
|---|---|
| `ATTESTATION_COLLATERAL` | `ATTESTATION_COLLATERAL` |
| `FINDING_RESOLUTION` | `FINDING_RESOLUTION` |
| `GATEWAY_LICENSE` | `GATEWAY_LICENSE` |
| `KEY_REGISTRY` | `KEY_REGISTRY` |
| `PARTY_ADMISSION` | `PARTY_ADMISSION` |
| `PLATFORM_RELEASE` | `PLATFORM_RELEASE` |
| `RELEASE_ALLOWLIST` | `RELEASE_ALLOWLIST` |
| `STATUS_CHANGE` | `STATUS_CHANGE` |
| `WITNESS_POLICY` | `WITNESS_POLICY` |
<!-- END GENERATED: governance -->

A witness policy MAY instead carry the legacy single signature `{governance_key_id, signed_at, signature}` (domain `GOVERNANCE` over
`H(WITNESS_POLICY, policy without signature)`, signer id = the key's `owner_id`); verifiers MUST accept either form.

### 3.4 Witness policy

`{protocol_version, policy_version, log_id, parties[] = {party_id, display_name, witness_key_ids[]}, threshold, min_distinct_parties,
monitor_parties[], effective_from, governance_signatures[]}`. A head is **cosigned under the policy** when the number of distinct parties
with a valid cosignature from a key listed in `parties` is at least `max(threshold, min_distinct_parties)`.

## 4. The log

### 4.1 Leaves

`leaf = {"leaf_version": 1, "leaf_type": T, "body": {...}}`, `leaf_bytes = JCS(leaf)`. A leaf MUST have exactly those three members, a type
from the table, and only allowlisted body fields; and no field anywhere in the body (at any depth) may carry a forbidden name. A leaf that
fails is rejected, never repaired.

<!-- BEGIN GENERATED: leaves -->
| Leaf type | Body fields (allowlist) |
|---|---|
| `CANARY` | `expected_h_e`, `expected_h_r`, `gateway_id`, `issuer_key_id`, `observed_h_e`, `observed_h_r`, `protocol_version`, `result`, `run_id`, `signature`, `signed_at` |
| `DISCLOSURE_GRANT` | `expires_at`, `grantee_key_id`, `h_p`, `owner_key_id`, `procedure_version_id`, `protocol_version`, `revokes_grant_leaf`, `run_ids`, `scope`, `signature`, `signed_at` |
| `EFFORT_BASELINE` | `approver_key_id`, `baseline_hash`, `baseline_id`, `evidence_class`, `organization_id`, `procedure_version_id`, `protocol_version`, `registry_key_id`, `signature`, `signed_at`, `version` |
| `EXECUTION_ASSIGNMENT` | `basis_log_id`, `basis_root_hash`, `basis_tree_size`, `candidates_hash`, `gateway_id`, `organization_id`, `policy`, `protocol_version`, `registry_key_id`, `run_id`, `shadow_of`, `signature`, `signed_at` |
| `EXECUTION_INTENT` | `api_version`, `attempt`, `call_id`, `client_key_id`, `client_request_hash`, `client_request_signature`, `credential_id`, `credential_source`, `currency`, `endpoint`, `execution_session`, `expires_at`, `gateway_id`, `gateway_key_id`, `h_e`, `h_p`, `inputs_commitment`, `max_cost_minor`, `max_tokens`, `model`, `nonce`, `policy_epoch`, `procedure_version_id`, `protocol_version`, `provider`, `run_id`, `signature`, `signed_at` |
| `EXECUTION_RECEIPT` | `attempt`, `call_id`, `execution_session`, `finished_at`, `gateway_attestation`, `gateway_id`, `gateway_key_id`, `h_e`, `h_r`, `intent_leaf`, `protocol_version`, `provider_claim`, `run_id`, `signature`, `signed_at`, `started_at`, `status`, `usage_record_hash` |
| `FINDING` | `evidence`, `leaf_indexes`, `log_id`, `monitor_key_id`, `rule_id`, `signature`, `signed_at` |
| `FINDING_RESOLUTION` | `effective_from`, `finding_leaf`, `governance_signatures`, `issuer_key_id`, `reason`, `resolution`, `signature`, `signed_at` |
| `GATEWAY_LICENSE` | `action`, `effective_from`, `gateway_id`, `governance_signatures`, `grace_days`, `license_id`, `limits`, `mode`, `organization_id`, `plan`, `protocol_version`, `valid_from`, `valid_until` |
| `GATEWAY_STATEMENT` | `architecture`, `attestation`, `challenge`, `clock`, `code_hash`, `config_hash`, `execution_public_key`, `gateway_id`, `gateway_key_id`, `image_digest`, `key_backend`, `license_id`, `mode`, `protocol_version`, `signature`, `signed_at`, `uptime_s`, `version` |
| `KEY_REGISTRY` | `governance_signatures`, `key_id`, `log_id`, `owner_id`, `party_id`, `public_key`, `registry_key_id`, `revoked_effective`, `role`, `signature`, `signed_at`, `valid_from`, `valid_until`, `witness_name` |
| `LOG_CONFLICT` | `head_a`, `head_b`, `log_id`, `reporter_key_id`, `signature`, `signed_at`, `tree_size` |
| `MONITOR_ATTESTATION` | `findings_root`, `host_integrity`, `log_id`, `monitor_key_id`, `monitored_through_size`, `package_version`, `party_id`, `release_digest`, `root_hash`, `rules_version`, `signature`, `signed_at` |
| `ORIGIN_CERTIFICATE` | `certificate_hash`, `certificate_id`, `issued_at`, `issuer_key_id`, `issuer_signature`, `run_id` |
| `PARTY_ADMISSION` | `action`, `declared_affiliates`, `display_name`, `effective_from`, `governance_signatures`, `party_id`, `role_scope` |
| `PROCEDURE_REGISTERED` | `h_p`, `owner_id`, `procedure_family_id`, `procedure_version_id`, `registry_key_id`, `signature`, `signed_at`, `visibility` |
| `PROVENANCE_EVENT` | `author_signature`, `envelope`, `receipt` |
| `RELEASE_ALLOWLIST` | `action`, `code_hash`, `effective_from`, `execution_key_policy`, `governance_signatures`, `image_digests`, `measurements`, `platform_release`, `protocol_version`, `release_version` |
| `SHARD_HEAD` | `root_hash`, `shard_id`, `tree_size` |
| `STATUS_CHANGE` | `certificate_hash`, `certificate_id`, `effective_from`, `governance_signatures`, `protocol_version`, `reason`, `reason_code`, `status` |
| `WITNESS_POLICY` | `effective_from`, `governance_key_id`, `governance_signatures`, `log_id`, `min_distinct_parties`, `monitor_parties`, `parties`, `policy_version`, `protocol_version`, `signature`, `signed_at`, `threshold` |
<!-- END GENERATED: leaves -->

Forbidden field names, at any depth of a leaf body:

<!-- BEGIN GENERATED: forbidden -->
`api_key`, `completion`, `credential`, `input`, `inputs`, `inputs_nonce`, `messages`, `output`, `password`, `payload`, `private_nonce`, `prompt`, `prompt_template`, `response`, `response_text`, `secret`, `template`
<!-- END GENERATED: forbidden -->

The log therefore holds hashes and metadata only: never a prompt, input, output, template, credential or blinding nonce.

### 4.2 Tree

RFC 9162 §2.1 exactly: `leaf_hash = SHA256(0x00 || leaf_bytes)`, `node_hash = SHA256(0x01 || left || right)`, split at the largest power of
two strictly less than n, empty tree `SHA256("")`. Inclusion and consistency proofs and their verification are RFC 9162 §2.1.3 and §2.1.4.
An object commitment (§2.1) MUST NOT be used as a leaf hash.

### 4.3 Heads (C2SP checkpoints)

Each log (`log_id`, with origin string `origin`, e.g. `www.delphia.cloud/ospp/shard-org-x/v1`) publishes heads as C2SP tlog-checkpoint notes:

```
body = origin "\n" tree_size "\n" base64(root) "\n"          (standard base64, 32-byte root; extension lines MAY follow)
note = body "\n" signature-line+                             signature-line = "— " name " " base64(keyhash4 || sig) "\n"
```

- **Log signature** (type 0x01): name = the log's `origin`; `keyhash4 = SHA256(name || "\n" || 0x01 || pubkey)[0:4]`; `sig = Ed25519(body)`.
  One log key MAY sign several logs; a verifier tries each key with role `log`.
- **Cosignature** (C2SP cosignature/v1, type 0x04): name = the witness key's `witness_name`;
  `keyhash4 = SHA256(name || "\n" || 0x04 || pubkey)[0:4]`; `sig = BE64(timestamp) || Ed25519("cosignature/v1\ntime " timestamp "\n" || body)`.
  The timestamp (seconds) is the witnessed time of every leaf the head covers.

JSON transport of a head: `{protocol_version, log_id, origin, tree_size, root_hash (hex), note, log_signature, issued_at,
cosignatures[] = {witness_key_id, party_id, timestamp, signature}}`, where `note` is the exact note text and `signature` the full
cosignature line. A log that has signed two heads of equal size with different roots has misbehaved (`LOG_CONFLICT`).

## 5. The passport bundle

### 5.1 Format

A `.ospp` file is a JSON object `{format: "ospp.passport.json/v1", ospp_version: "ospp.v1", origin_certificate, keys[], leaves[],
witness_policy, client_request, history?, effort?}`.

- `keys[]`: key records (§3.1) for every key the rules need. **Trusted issuer keys are never taken from the bundle**: a verifier is
  configured with the issuer key ids it pins.
- `leaves[] = {log_id, leaf_index, leaf}`: at least every intent and receipt leaf the certificate references.
- `client_request`: the client's signed request (§5.2).

### 5.2 Client request

`{protocol_version, procedure_version_id, h_p, inputs_commitment, idempotency_key, credential_id?, client_key_id, signed_at, signature}`,
signed in domain `CLIENT_REQUEST` over `H(CLIENT_REQUEST, request without signature)`. `inputs_commitment = H(INPUTS, {nonce, inputs})`
with a 32-byte random nonce the client keeps, so the inputs cannot be guessed from the commitment.

### 5.3 Origin certificate

Fields: `protocol_version, certificate_id, run_id, procedure_version_id, procedure_visibility, h_p, inputs_commitment, client_key_id,
client_request_hash, client_request_signature, gateway_id, gateway_profile, operator_name, hosting, client_party_id, operator_party_id, h_w,
calls[], cosigned_heads[], inclusion_proofs[], witness_policy_version, rules_version, assurance_profile, trust_assumptions[], claim_text,
issued_at, issuer_key_id, issuer_signature, extensions[]`.

- `calls[] = {call_id, step_id, attempt, h_e, h_r, intent_leaf, receipt_leaf, intent_head_size, receipt_head_size, usage_record_hash, status}`,
  where `intent_leaf` and `receipt_leaf` are `{log_id, leaf_index}`.
- `inclusion_proofs[] = {protocol_version, proof_type: "inclusion", log_id, leaf_index, tree_size, leaf_hash (hex), hashes[] (hex)}`.
- `h_w = H(WORKFLOW, {run_id, procedure_version_id, h_p, inputs_commitment, calls: [each call restricted to call_id, step_id, attempt, h_e,
  h_r, intent_leaf, receipt_leaf, usage_record_hash, status], final_status: "COMPLETED"})`. Head sizes are not part of it.
- `certificate_hash = H(CERTIFICATE_CONTENT, certificate without issuer_signature)` is the passport's identity; the issuer signs it in
  domain `ISSUER_CERTIFICATE` at `issued_at`.
- `extensions[] = {namespace, schema_uri, critical, value}`; namespaces are unique. Defined: `ospp.measurements` (§7), `ospp.effort` (§8). The reference verifiers also understand `ospp.attested-execution` and `ospp.platform-release`.

The claim text MUST be exactly (placeholders filled from the certificate):

> This certificate records that registered procedure version {version_id} (H-P {h_p}) was executed by a gateway operated by {operator_name} ({hosting}) at the request of client key {client_key_id}: each request commitment was witnessed in the OSPP transparency log before its response commitment, and the issuer verified the chain. The gateway is trusted to have sent and received exactly the committed bytes; no party outside the gateway saw the prompt or response. This certificate does not establish that the response is correct, that the provider executed the request, or that any later reported outcome is true. Its current status must be checked online.

### 5.4 Assurance profiles

<!-- BEGIN GENERATED: profiles -->
| Profile | Official |
|---|---|
| `OSPP-OPEN-RECORD` | no |
| `OSPP-ORIGIN-DEV` | no |
| `OSPP-ORIGIN-SELFGW-v1` | yes, when the issuer key is pinned |
| `OSPP-ORIGIN-TEE-v1` | yes, when the issuer key is pinned |
| `OSPP-ORIGIN-v1` | yes, when the issuer key is pinned |
<!-- END GENERATED: profiles -->

`SELFGW` and `TEE` passports name the organisation that operated the gateway; a verifier MUST say the bytes are attested by that operator.
Non-official profiles MUST NOT be presented as official in any output.

## 6. Verification

A verifier fetches nothing. Each rule yields `VALID`, `INVALID`, `UNDETERMINED` or `NOT_APPLICABLE`. The verdict is `INVALID` if any rule
is `INVALID`, else `VALID_WITH_UNDETERMINED` if any is `UNDETERMINED`, else `VALID`. A structurally malformed bundle MUST yield `V-00 INVALID`
(fail closed), never an exception.

<!-- BEGIN GENERATED: rules -->
Rule ids: `V-00`, `V-01`, `V-02`, `V-03`, `V-04`, `V-05`, `V-06`, `V-07`, `V-08`, `V-09`, `V-10`, `V-11`, `V-12`, `V-13`, `V-14`, `V-15`, `V-16`
<!-- END GENERATED: rules -->

- **V-00 Shape.** The bundle is an object with an object `origin_certificate`; `keys` and `leaves` are lists.
- **V-01 Leaf policy.** Every leaf in `leaves[]` passes §4.1.
- **V-02 Issuer signature.** The `issuer_key_id` key is in the bundle with role `issuer` (else `UNDETERMINED`), valid at `issued_at`, and
  verifies `issuer_signature` over `certificate_hash` (domain `ISSUER_CERTIFICATE`). A certificate that cannot be canonicalised is `INVALID`.
- **V-03 Claim text.** `claim_text` equals §5.3 with the certificate's values.
- **V-04 Profile.** An official profile with an issuer key the verifier pins is `VALID` (official); an official profile with an unpinned
  issuer is `UNDETERMINED`; a known non-official profile is `VALID` and reported as not official; an unknown profile is `INVALID`.
- **V-05 Calls.** There is at least one call. For each: the intent leaf (`EXECUTION_INTENT`) and receipt leaf (`EXECUTION_RECEIPT`) are in
  the bundle; both carry the call's `h_e`, the receipt its `h_r`; the intent's `h_p`, `inputs_commitment`, `run_id` and `gateway_id` equal
  the certificate's, and the receipt's `run_id`; the receipt's `intent_leaf` equals the call's; the receipt leaf index is greater than the
  intent's; the intent's gateway key (role `gateway`) is valid at each `signed_at` and verifies the intent (domain `GATEWAY_INTENT` over
  `H(INTENT, body without signature)`) and the receipt (domain `GATEWAY_RECEIPT` over `H(RECEIPT, …)`, by the receipt's gateway key, or
  the intent's if it names none in the bundle).
- **V-06 Client.** The client key (role `client`) is in the bundle (else `UNDETERMINED`); `client_request` is present; its hash equals
  `client_request_hash`; its signature equals `client_request_signature` and verifies (domain `CLIENT_REQUEST`) with the key valid at its
  `signed_at`; its `h_p` and `inputs_commitment` equal the certificate's; every included intent carries the same `client_request_signature`.
- **V-07 Workflow.** `h_w` equals the recomputation in §5.3.
- **V-08 Inclusion.** For every call's intent and receipt: the head of size `intent_head_size` / `receipt_head_size` is in
  `cosigned_heads`, a matching inclusion proof and the leaf are present, the proof's `leaf_hash` equals the leaf's hash, and the proof
  verifies (RFC 9162) against that head's `root_hash`.
- **V-09 Witnessing.** For every head in `cosigned_heads`: the note body agrees with `origin`, `tree_size` and `root_hash`; a log key
  verifies `log_signature`; and cosignatures from witness keys listed in the policy, whose cosignature verifies and whose timestamp equals the
  stated one, come from at least `max(threshold, min_distinct_parties)` distinct parties **not counting** the client's party and, for
  `SELFGW`/`TEE` profiles, the operator's party. Every call's `receipt_head_size` is greater than its `intent_head_size` (the receipt was
  witnessed after the intent). The bundle's policy `policy_version` equals `witness_policy_version`, and the policy's governance signature(s)
  verify (§3.3).
- **V-10 Status.** Always `UNDETERMINED` offline (`STATUS_UNKNOWN_OFFLINE`); online verifiers read the latest governance-signed
  `STATUS_CHANGE` for the certificate.
- **V-11 History.** `NOT_APPLICABLE` without events; otherwise §6.1.
- **V-12 Effort baseline.** `NOT_APPLICABLE` without an `ospp.effort` extension and `effort` section; otherwise §8.
- **V-13 Measurements.** `NOT_APPLICABLE` without an `ospp.measurements` extension; otherwise §7.
- **V-14 Extensions.** `NOT_APPLICABLE` without extensions. Otherwise `extensions` is a list of objects, each with a string `namespace` and
  a boolean `critical`; namespaces are unique; and every extension with `critical: true` has a namespace the verifier understands (in this
  version `ospp.measurements`, `ospp.effort`, `ospp.attested-execution` and `ospp.platform-release`). Unknown non-critical extensions are preserved and ignored.

### 6.1 History (V-11)

Each event is `{envelope, receipt, leaf?}` with proofs and heads in `history.proofs` / `history.heads`. The author-signed envelope has
`protocol_version, history_id, origin_certificate_hash, event_id, sequence, previous_event_hash, event_type, author_key_id, public_replay_nonce,
payload_commitment, payload_commitment_scheme ("ospp.private-blinded-sha256.v1"), evidence_class (CLIENT_DECLARED | SOURCE_AUTHENTICATED |
OSPP_DETERMINISTIC_CHECK), signed_at, author_signature`, optionally `claimed_observed_at, measurement_definition_id, extensions,
critical_extensions`, and no other field (in particular no server-assigned `accepted_at`, `leaf_index`, `server_key_id`, `receipt`).
For event i (from 1): `sequence = i`; `previous_event_hash` is null for the first and the previous `event_hash` after;
`origin_certificate_hash` is this passport's `certificate_hash`; `history_id` is the same throughout; non-empty `critical_extensions` fail.
`event_hash = H(EVENT_UNSIGNED, envelope without author_signature)`; the author key (role `client` for CLIENT_DECLARED, `connector` for
SOURCE_AUTHENTICATED) is valid at `signed_at` and verifies `author_signature` (domain `EVENT_AUTHOR`). The receipt names the same
`event_hash` and `sequence` and verifies (domain `EVENT_RECEIPT` over `H(EVENT_RECEIPT, receipt without signature and leaf_index)`, key role
`registry` or `history`). An event whose leaf (`PROVENANCE_EVENT {envelope, author_signature, receipt without leaf_index}`) is proven under a
head cosigned per the policy is EVENT_WITNESSED, otherwise EVENT_PROVISIONAL. Payloads are blinded: `payload_commitment =
H(PRIVATE_PAYLOAD, {nonce, payload})`, opened only by a holder who has both. An event item MAY disclose its payload (`payload_status:
"OPENED"`, `payload`, `payload_nonce`), as OSPP does for outcome updates of nodes whose outcome spec is public: the opening MUST reproduce
`payload_commitment`, and an opened `outcome.update` MUST name this passport (`payload.outcome.subject.certificate_id`); otherwise V-11 is
INVALID. Undisclosed payloads stay PAYLOAD_UNVERIFIED.

The P2P validators (monitors) apply the same history checks to the log itself, as rule **R-18**, for every `PROVENANCE_EVENT` leaf: the
envelope shape, the author signature for its evidence class, the receipt (`event_hash`, `sequence`, a `registry`/`history` key), an
`ORIGIN_CERTIFICATE` leaf with the same `certificate_hash` at a lower index of the same log, and the chain (sequence = previous + 1,
`previous_event_hash` = the previous event's hash; a gap, replay or fork is a finding naming both leaves). Payload contents are not judged.

### 6.2 Kept files and freshness (informative)

A bundle is a snapshot: offline, V-11 reports `LATEST_STATE_UNKNOWN`. History is append-only and hash-chained, so a later bundle of the same
passport can only extend an earlier one. Two checks place a kept bundle in time; they never replace the rules above.

- **Compare** (old, new): DIFFERENT_PASSPORT unless the origin certificates are identical (JCS); DIVERGED if the `history_id` differs, the
  new bundle has fewer events, or any event of the old bundle has another `event_hash` at the same position; otherwise EXTENDS (more events,
  or more witnessed: `witnessed_through_sequence`) or SAME. A DIVERGED pair is evidence that history was rewritten: keep both.
- **Freshness** (bundle, status), where status is `GET <api>/v1/public/passports/{id}/history-status` (`accepted_sequence`,
  `witnessed_through_sequence`, `head_hash` = the last `event_hash`, `certificate_status`): CONFLICT if the status names another passport,
  reports fewer events than the bundle, or the same number with another head; STALE if it reports more events or more witnessed; otherwise
  CURRENT. The passport's own status (ISSUED, SUSPENDED, REVOKED) is reported beside it.

Reference: `ospp_protocol/freshness.py` and `ts/verifier/src/freshness.ts`, which must agree on `spec/test-vectors/freshness-vectors.json`.

## 7. OSPP's measurements (`ospp.measurements`, V-13)

`value = {calc_version: "measure-v1", usage_records[], tokens, cost, time_saved}`. Every usage record names a `call_id` and `attempt` of the
certificate (at most one record per call) and its `run_id`, and **hashes to that call's `usage_record_hash`**, where
`usage_record_hash = "sha256:" || hex(SHA256(JCS(record)))` (no label; §9). A record's cost in millionths of its currency, when it carries
`price_per_1m_micro {input, output}` and integer `input_tokens`/`output_tokens`, is `ceil((input_tokens·input + output_tokens·output) / 10^6)`;
a stated `estimated_provider_cost_micro` MUST equal it. Then the derived members MUST equal the recomputation:

- `tokens`: `MEASURED` with the sums when every record has integer counts; `NOT_REPORTED` when some do not; `NOT_AVAILABLE` without records.
- `cost`: `PRICED` with the single currency and the sum when every record is priced and all share one currency; else `UNPRICED`.
- `time_saved`: `NO_ESTIMATE` without an estimate; `WORKLOAD_UNKNOWN` without `units`; else `ESTIMATED` with
  `estimate_hash = H(EFFORT_BASELINE, estimate)` and `minutes[k] = fixed_minutes[k] + per_unit_minutes[k] · units` for low, central, high.
  The estimate (`estimate_version: "ospp-estimate-v1"`) MUST be for this certificate's `procedure_version_id` and `h_p` and pass its shape
  rules (whole-minute ranges low ≤ central ≤ high, a unit, a count measure `items`/`words`/`one`, a rationale).

`VALID` means the figures are the gateway's own records and the arithmetic holds; the time saved is an estimate, not a measurement of people.

## 8. Effort baselines (`ospp.effort`, V-12)

An owner-approved, registry-signed human-effort baseline pinned by hash; the bundle's `effort` section carries the body, the workload and the
disclosed effort events, and the verifier recomputes the summary. Normative detail: `docs/EFFORT-BASELINES.md`. `VALID` means the
calculation is compliant, never that the estimate is accurate.

## 9. Known gaps and open questions (for review)

1. *Fixed 2026-11-04 (V-14, vectors `ospp.v1-vectors-2026-11-04`):* certificates with an unknown critical extension or a duplicate
   namespace were accepted by both reference verifiers. No issued passport carried a critical extension.
2. **The usage record hash has no domain label** (`SHA256(JCS(record))`), unlike every other commitment; the label `USAGE` is reserved for
   a future version that fixes this. Changing it now would invalidate issued passports.
3. **Legacy single-signature witness policies** (§3.3) remain accepted for passports issued before two-of-three governance.
4. **Shard heads and the root log.** Shard heads are cosigned directly by witnesses (ADR-003); the root log's `SHARD_HEAD` leaves are
   defined but not required by V-09.
5. **Gateway attestation** (`gateway_attestation`, TEE profile) is carried but not verified by any rule; V-15 binds the issuer-certified execution session to every receipt. The vendor attestation check is
   performed by clients before sealing inputs (ADR-006) and is specified there.

## 10. Conformance

An implementation conforms when it produces the expected result for every rule on every passport in `spec/test-vectors/` (positive and
negative cases), and agrees with both reference verifiers on them. *Informative:* `python spec/tools/compare_verifiers.py` shows how the two
reference implementations are compared.


## Security revision: rules-v2 (2026-11-04)

All verifiers MUST recompute every Ed25519 key ID from the supplied 32-byte public key and reject mismatches or conflicting duplicate records. A pinned key ID is a content-addressed trust anchor, never a caller-supplied label.

New certificates use `rules_version: rules-v2`. The issuer signs `witness_policy_hash = H(WITNESS_POLICY, complete signed policy)` and `verification_keys_hash = H(KEY_REGISTRY, key records sorted by key_id)`, and includes those issuance records in `verification_keys`. Exporters retain this snapshot. Extra keys for later history may be included outside it; they cannot replace a bound record. V-09 requires both hashes to match. Old signed certificates remain unchanged and return V-09 UNDETERMINED because their witness policy metadata was not cryptographically bound by the issuer. Key status after issuance remains unknown offline.

Witness keys must be valid at their signed cosignature timestamp; log keys at the head's issuer-bound timestamp. This also applies to history witnesses. Governance keys may additionally be pinned by the verifier operator (`trusted_governance_key_ids` / `trustedGovernanceKeyIds`, CLI `--trusted-governance`). With pins supplied, only pinned governance keys count toward authorization. Without them, governance identity is vouched for by the pinned issuer's signed snapshot; this does not independently establish organizational independence.

Production attested clients MUST require explicit measurement membership and a locally provisioned approved measurement pin. API-provided measurement lists alone are insufficient authorization. The Python SDK uses `trusted_measurements`, TypeScript `trustedMeasurements`, CLI `OSPP_TRUSTED_MEASUREMENTS` (comma-separated), and the browser's Approved executor measurements field. Obtain these from a separately approved enclave build, never by automatically trusting `/runs/prepare`. Missing pins fail closed before inputs are sealed. DEV attestations still require opt-in and explicit allowlist membership.

### Attested execution sessions (`rules-v3`, V-15)

An attested executor MUST generate its execution signing key and working-data encryption key inside the measured process. The operator's enrollment key MUST NOT be used as its execution key. A `GATEWAY_STATEMENT` carries `execution_public_key`; its attestation binds the derived execution key id, the in-memory input sealing key, and `challenge.nonce`. The outer statement remains signed by the registered enrollment key.

Before accepting a statement, the API MUST verify the hardware evidence and an active governance measurement approval carrying `execution_key_policy: "enclave-generated-v1"`. Prior generic approvals do not grant this capability. The challenge is a server-generated 256-bit random nonce, stored for that gateway, valid for at most 120 seconds, and consumed atomically on acceptance. A statement's own timestamp cannot renew hardware evidence. The accepted session lasts at most 3600 seconds.

The session identifier is `H(GATEWAY_STATEMENT, signed_statement)`, including the statement signature. Each run pins the accepted session; every intent and receipt carries `execution_session` and is signed by that session's execution key. Job admission, result submission and leaf relay MUST require the active execution key. Issuance MUST verify every receipt against the run's original session and its time bounds.

TEE certificates issued under this rule MUST carry the critical `ospp.attested-execution` extension and use `rules-v3`. V-15 checks the session hash, signed enrollment binding, session time bounds and all execution-leaf key/session bindings. The issuer's signature authenticates the session acceptance record. Vendor trust roots are checked at activation/issuance and independently by live clients; offline V-15 verifies the binding of that issuer-certified assertion, not a separate vendor-root policy. A legacy TEE certificate lacking the extension is `UNDETERMINED`; a `rules-v3` TEE certificate lacking it is `INVALID`.

### Certificate log inclusion (V-16, ADR-012)

A passport file MAY carry `history.certificate = {log_id, leaf_index, leaf}`: the certificate's own `ORIGIN_CERTIFICATE` leaf, with its inclusion
proof in `history.proofs` and the first head covering it in `history.heads`. V-16 checks that the leaf names this certificate (hash, id, issuer key
and signature), that the proof verifies, and that the head is cosigned per the witness policy by a note stating the head's size and root; the
time the policy was reached is when the certificate was proven logged.

A verifier MAY be configured with revoked issuer keys (`revoked_issuers`: key id → revocation time, as published by governance; never taken from
the file). For a certificate signed by such a key, V-16 is `VALID` only when the certificate was proven logged before the revocation, `INVALID`
when it was proven logged later, and `UNDETERMINED` when the file carries no inclusion. Without the section and without a revocation V-16 is
`NOT_APPLICABLE`. A key revoked for compromise therefore cannot sign certificates that pass as older than the revocation.

History heads (V-11 and V-16) MUST be bound to their cosigned note: the note's tree size and root hash equal the head's `tree_size` and
`root_hash`; an inclusion proof against a root the cosigned note does not state proves nothing.
