Revise Oficina ID slice 1 for Home and Equipo
Apply Paul’s 2026-11-13 rulings and the supplied Fable review fixes. Specify recovery replacement, pinned keys, fresh linking, transactional unlink and local sign-out. Defer Contra with pairwise subjects and a Home-side passkey requirement. Correct AGENTS.md on SubjectFor and the remaining readable link store. Independently reviewed by GPT-6 Astra (gpt-6-astra), acceptable as a spec with no blocking findings. No implementation or deployment.
2 files changed,
+63
−60
AGENTS.md+13 −8docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md+50 −52
CI passed — run details
diff --git a/AGENTS.md b/AGENTS.md| index 14aeabb..fe6540c 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -229,14 +229,19 @@ quietly ignored). |
| continuously, so a transiently readable write reaches the bucket before |
| any delete. `PRAGMA secure_delete` is on. |
| - **The session Subject is an opaque person ref, never an address.** |
| - `rastrillo/auth` as shipped sets `Subject: id.Address` and stores readable |
| - addresses in `auth_links.address` and, via `Subject: id.Address`, in |
| - `sessions.subject` — `auth_sessions` is no longer written at v0.22.0, its |
| - rows having been migrated into the shared `sessions` table, so the leak |
| - moved rather than closed. Verified at source, filed upstream as |
| - `rastrillo/rastrillo` #2. We hand-roll session minting until that lands, |
| - and take classification and the Keymail upgrade from **`keymaildev/signin` |
| - directly, not from `auth`** — corrected 2026-09-05: `auth`'s |
| + **Corrected 2026-11-13, verified at pin `29e4491`:** |
| + `rastrillo/auth.Config.SubjectFor` exists and can map a verified address |
| + to an opaque subject before session minting. Without that hook, auth |
| + defaults to the address in `sessions.subject`; `auth_sessions` stopped |
| + being written at v0.22.0 when rows moved to the shared sessions table. |
| + The hook does **not** fix link storage: `auth.New` still installs |
| + `Links: &linkStore{db: cfg.DB}`, which writes readable |
| + `auth_links.address`. The older claim that no subject-remapping hook |
| + exists is stale; the sealed-link-store requirement from upstream |
| + `rastrillo/rastrillo` #2 remains. Home keeps its sealed link store and |
| + opaque-subject session minting until both guarantees can be supplied |
| + upstream. Take classification and the Keymail upgrade from |
| + **`keymaildev/signin` directly, not from `auth`** — corrected 2026-09-05: `auth`'s |
| classification is reachable only through `auth.Begin`, which hardwires |
| `Links: &linkStore{db: cfg.DB}` and writes `auth_links.address`, so "use |
| `auth` only for the parts that hold nothing" was never a thing that could |
diff --git a/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md b/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md| index 310b809..03d5063 100644 |
| --- a/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md |
| +++ b/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md |
| @@ -1,100 +1,98 @@ |
| # 🤖 Oficina ID: slice 1 |
| -Status: design proposal, 2026-11-13; independently reviewed by GPT-6 Astra (`gpt-6-astra`), acceptable as a proposal after corrections; no blocking findings remain. Paul’s three policy decisions remain open. No implementation, deployment or merge approval. Author: Codex. Base: Home `14c83d7`. |
| +Status: revised design, 2026-11-13, applying Paul's rulings and Fable's READY AFTER FIXES review as supplied by Paul. Independently reviewed after these fixes by GPT-6 Astra (`gpt-6-astra`): acceptable as a spec, no blocking findings. Author: Codex. No implementation, deployment or merge approval. |
| ## Decision and boundary |
| -**Paul, 2026-11-13:** every Oficina app keeps its own sign-in **and** offers “Sign in with Oficina ID”. Contra (`carlos/contra`) and Equipo (`oficina/equipo`) come first; Docs, Sheets and Slides follow. Local sign-in must remain reachable without contacting Home, including for linked accounts. |
| +**Paul, 2026-11-13:** every Oficina app keeps its own sign-in **and** offers “Sign in with Oficina ID”. **Slice 1 is Home plus Equipo only.** Contra adopts in slice 2; Docs, Sheets and Slides follow. Local sign-in remains reachable without contacting Home, including for linked accounts. |
| -This slice supplies credential sign-in, recovery, signed identity handoffs, explicit account linking/unlinking and published verification keys. Directory, provisioning, roster changes and preferences beyond display are outside it. An ID assertion grants no team membership, invitation acceptance or item access. |
| +Slice 1 covers passkey/email sign-in, recovery, signed identity handoffs, explicit linking/unlinking and configured verification keys. Directory, provisioning, roster changes and preferences beyond display are outside it. Assertions grant no membership, invitation acceptance or item access. Existing roster rules remain binding where already used; Equipo gains no roster dependency here. |
| -This proposal extends [Home §4–5](2026-08-30-home-design.md): standalone passkey authentication supplements the current second-factor gate; key publication supplements the current pinned-key transport. These changes need approval before implementation. Existing roster rules remain binding on consumers that already use them; this slice introduces no roster dependency for Contra or Equipo. |
| +This design extends [Home §4–5](2026-08-30-home-design.md) with standalone passkeys and Paul's recovery replacement ruling. Key publication is later work. The former cached-key proposal is withdrawn. |
| -## Evidence and domains |
| +## Evidence, domains and registration |
| -Read against Home `14c83d7`, `connect/README.md`, `handoff/`, the credential-return and transactional-link-resolution specs, suite README, Equipo's `internal/equipo/auth.go` and `setup/session_handlers.go`, and Contra's README and `internal/contra/auth/auth.go`. |
| +Checked against Home `14c83d7`, `connect`, `handoff`, the credential-return and transactional-link-resolution specs, suite README, Equipo's `auth.go` and `setup/session_handlers.go`, and pinned rastrillo `29e4491`. Home already implements P-256 assertions and explicit linking. Commit `462df84` records the primary-domain decision; `0dc863c` merged assertion exchange and `47301e8` tightened freshness. Older Ed25519 plans are historical. |
| -Home already signs P-256 assertions, implements browser-bound handoff and provides an explicit linking bridge. Commit `0dc863c` merged assertion exchange; `47301e8` requires actual fresh authentication. `462df84` records the primary-domain decision; `243c2d4` and `7bdddfa` confirm its public apex and credential-host split. Older plans describing Ed25519 or an unbuilt exchange are historical. |
| +The issuer is [https://id.oficina.works](https://id.oficina.works), and the WebAuthn relying-party ID is exactly **id.oficina.works**, never the parent domain. The directory is [https://oficina.works](https://oficina.works); team apps use `<team>.<app>.oficina.works`. Credential pages never render account-authored strings. Cookies are host-only, Secure and HttpOnly; no parent-domain session cookie. |
| -The credential origin and issuer are [https://id.oficina.works](https://id.oficina.works); the WebAuthn relying-party ID is exactly **id.oficina.works**, never `oficina.works`. The directory is [https://oficina.works](https://oficina.works). Team apps use `<team>.<app>.oficina.works`. Credentials, recovery and assertion minting stay on the credential origin, which never renders account-authored names, addresses or other strings. Use fixed service labels and generated identifiers. Cookies are host-only, Secure and HttpOnly; no parent-domain session cookie. |
| +Registration uses existing `HOME_CONSUMERS`: a JSON object mapping consumer IDs to exact canonical HTTPS origins. Equivalently, `HOME_CONSUMERS_BASE64` contains standard-base64 encoding of that JSON; set only one. Keep the required `directory` entry pointing at the configured directory origin and add Equipo's consumer/origin entry. The environment manifest permits 1–16 entries, at most 8,192 decoded bytes; IDs are 1–64 ASCII letters, digits, underscores or hyphens. Refuse collisions with existing database registrations. |
| -An operator registers each consumer ID against one exact canonical HTTPS origin, identifying both app and instance. Return only to its fixed `/auth/assertion` path. No wildcard, suffix trust, request-supplied redirect URL or automatic registration. Registration is configuration in this slice, independent of provisioning. |
| - |
| -Contra's actual production HTTPS origin can be registered outside `oficina.works`; no domain move, shared cookie or cross-origin browser API is required. Alias hosts do not become alternate audiences. Native deep-link delivery is outside this browser slice. |
| +Each origin identifies one app instance, with fixed callback `/auth/assertion`. No wildcard, suffix trust, arbitrary return URL or automatic registration. Alias hosts are separate audiences. External HTTPS consumers need no domain move or shared cookies, but their pairwise-subject policy belongs to later slices. Native deep-link delivery is outside this browser slice. |
| ## Home sign-in and recovery |
| -Offer direct passkey sign-in and email sign-in. First registration verifies the mailbox through Keymail or an emailed link, then allocates/reuses an opaque person ref through Home's existing normalized, peppered address index. The pepper never leaves Home. Do not infer identity from an unverified address or normalize differently between registration and return visits. |
| +Offer direct passkey and email sign-in. First registration verifies the mailbox through Keymail or an emailed link, then allocates/reuses an opaque person ref through Home's normalized, peppered index. The pepper stays at Home. Never resolve from an unverified address or use different normalization on return visits. |
| + |
| +Direct passkey sign-in uses a discoverable credential bound to the person ref. WebAuthn `user.id` is an opaque handle; `user.name` and `user.displayName` are generated identifiers, never an address or entered name. Require user verification, exact origin/RP checks, a five-minute browser-bound single-use challenge and the stored credential/person binding. Enrollment requires fresh authentication and request-forgery protection. Existing nondiscoverable credentials retain gated sign-in until a discoverable replacement is enrolled. Keep `LegacyRPID` unchanged. |
| -Direct passkey sign-in uses a discoverable credential whose user handle identifies the person ref. Require user verification, exact origin/RP checks, a five-minute browser-bound single-use challenge and the stored credential-to-person binding. No email step is needed for this path. Existing nondiscoverable credentials retain their current gated sign-in path until fresh authentication permits enrolling a discoverable replacement. Enrollment requires fresh authentication, request-forgery protection and binding to that same person. Never widen `LegacyRPID` for this feature. |
| +Keep Home's `keymaildev/signin.Flow`: Keymail upgrade, platform SMTP for emailed links, explicit email fallback after classification/Keymail failure. Rate-limit by IP and blinded address without disclosing account existence. SMTP failure never authenticates. GET displays confirmation; POST redeems once with existing browser protections. Email completed in another browser cannot finish the original app's handoff; restart there. |
| -For email, keep Home's `keymaildev/signin.Flow`: Keymail upgrade for supported inboxes, platform SMTP for emailed links, and explicit email fallback when classification or Keymail fails. Rate-limit by IP and blinded address; responses must not disclose account existence. SMTP failure yields a retryable failure, never successful authentication. GET displays link confirmation; POST redeems once, with the existing confirmation/browser protections. Completing email in another browser cannot complete the original app's handoff: restart there. |
| +Equipo keeps its existing `rastrillo/auth` local path and active-member/invitation checks. At pin `29e4491`, `auth.Config.SubjectFor` exists, but `auth.New` still installs the readable `auth_links.address` store. The corrected `AGENTS.md` records this: a subject hook alone is insufficient. Home keeps its sealed link store and opaque session subjects. |
| -Equipo currently uses `rastrillo/auth`, verified active membership or a pending invitation, normalized email subjects and configured mail delivery. Preserve that local path. Home cannot copy its storage: at Home's pin `29e4491`, `auth.Config.SubjectFor` **does exist**, contrary to the older binding text, but `auth.New` still installs a link store writing `auth_links.address`. A subject hook alone does not make it safe. Keep Home's sealed link store and opaque session subjects; reconcile the stale hook statement when this proposal is approved. |
| +Seal addresses before persistent link writes; expire the sealed state. No readable-address column, log, error, metric or queue payload. Keep `secure_delete` and scan SQLite, WAL, store objects and backups. Sessions, passkeys and codes key on person refs. |
| -Seal addresses before any persistent link write; bound retention by link expiry. No readable-address column, log, error, metric, queue payload or backup; keep `secure_delete` enabled and scan SQLite, WAL and store objects. Session, passkey and recovery subjects are person refs. Home's key is not shared with Contra's independent local blind index. |
| +After passkey enrollment, email/Keymail sign-in requires a passkey or recovery code. Issue ten hashed, single-use codes, shown once, each with **at least 80 bits of random entropy**. Code redemption is a protected form POST. Limit failed attempts persistently and atomically per account and IP: initially five per account and twenty per IP per fifteen minutes. Neither restart nor parallel requests resets the allowance. |
| -Recommended recovery policy preserves the existing enrolled-account gate: after enrolling a passkey, email/Keymail sign-in still requires that passkey or a recovery code. Mailbox compromise must not silently remove the factor. Issue ten hashed, single-use recovery codes, shown once; email proof plus a code restores sign-in when the passkey is lost. Codes work by ordinary form POST. A direct passkey still works after mailbox loss. With no working permitted path, access is lost; no operator reset. |
| +**Paul's ruling: email plus a recovery code is full account control.** It can replace the last lost passkey. Require fresh mailbox proof and an unused code bound to the same person and browser; provide an explicit replacement confirmation. Verify the new passkey ceremony, then atomically install that credential, consume the recovery proof, remove all previous passkeys, revoke **all Home sessions** and invalidate every remaining recovery code. Failure rolls back replacement; success requires a new sign-in with the new passkey. Generate replacement codes only after that proof. |
| -Recovery does not satisfy operations requiring a real passkey step-up. Replacing a lost last passkey under recovery needs an explicit policy decision below; do not disguise it as ordinary freshness. Preserve the person ref across recovery. Email, recovery and handoff work without scripts; only the WebAuthn ceremony requires them. |
| +Send a replacement notice to the just-proven address held in memory, without storing it or adding it to a retry queue. Delivery failure must not undo revocation; allow a retry while the address remains available and report only a content-free failure. Recovery cannot satisfy unrelated passkey-only step-up. A working passkey survives mailbox loss; with no permitted recovery path, access is lost. No operator reset. Email/recovery work without scripts; WebAuthn requires its ceremony script. |
| ## Assertion and browser exchange |
| -Reuse `rastrillo/assertion` version 1: P-256, context `rastrillo/assertion/v1`, `base64url(payload).base64url(signature)`. Do not introduce JWT, algorithm negotiation or app-specific verifiers. |
| +Reuse `rastrillo/assertion` v1: P-256, context `rastrillo/assertion/v1`, `base64url(payload).base64url(signature)`. No JWT, algorithm negotiation or separate app verifiers. |
| -| Claim | Consumer interpretation | |
| +| Claim | Interpretation | |
| |---|---| |
| -| `v`, `kid` | Fixed wire version; key from the configured issuer's trusted key set. | |
| -| `iss`, `aud` | Exact credential origin and exact registered consumer origin. | |
| -| `sub` | Stable opaque Home person ref; resolve through this app's explicit link. | |
| -| `iat`, `exp` | Mint for exactly 120 seconds. Require positive lifetime at most 120 seconds, `exp > now`, and `iat <= now + 30 seconds`. No expiry grace. | |
| -| `jti`, `nonce` | Independent random identifiers: replay prevention and browser-transaction binding. | |
| -| `auth_time` | Actual credential authentication time; handoff never refreshes it. It proves recency, not factor strength or authorization. | |
| -| `ext` | Omit initially. Future display values require a closed enum already held by Home; unknown values mean absent. | |
| +| `v`, `kid` | Fixed wire version and configured pinned verification key. | |
| +| `iss`, `aud` | Exact credential origin and registered app-instance origin. | |
| +| `sub` | Stable opaque Home person ref for Equipo; resolve through its explicit link. | |
| +| `iat`, `exp` | Mint for 120 seconds; require positive lifetime at most 120, `exp > now`, `iat <= now + 30 seconds`. No expiry grace. | |
| +| `jti`, `nonce` | Independent random replay identifier and browser-transaction nonce. | |
| +| `auth_time` | Actual authentication time, never refreshed by handoff; recency grants no authorization or factor strength. | |
| +| `ext` | Omit initially; future cosmetic values require closed enums already held by Home, unknown values treated as absent. | |
| -No email, role, team grant, plan, document list, encryption key or authentication-strength claim. Signed identity is trusted for identity; cosmetic values cannot affect admission. Existing roster hints, if introduced separately, remain invalidation-only under Home §5.4. |
| +No email, role, grants, document list, encryption keys or authentication-strength claim. Existing roster hints remain separately reviewed, invalidation-only exceptions under Home §5.4. |
| -1. The app stores a short-lived transaction with an independent random browser secret, nonce, purpose and validated local return path/query. It sets a `__Host-` pending cookie and redirects to `/authorize?consumer=…&nonce=…`. The target document, local account and privileges remain app-side. |
| -2. Home validates the consumer, authenticates the person and POSTs the signed assertion to that consumer's fixed callback. Use the current form with optional static auto-submit and a manual Continue button. No assertion in URL, history, referrer or logs; responses are `no-store`. Preserve `strict-origin-when-cross-origin` on delivery: `no-referrer` can null the POST Origin. |
| -3. The callback accepts only a bounded form POST with the exact issuer `Origin`. Verify signature, issuer, audience, types and times; reserve `(iss,jti)` uniquely in the inbox so repeated callbacks refuse. Storage failure refuses. |
| -4. Reuse `handoff`'s two-stage return: callback stores a sealed, expiring inbox receipt and redirects to `/auth/finish`; the top-level GET receives the original SameSite=Lax cookie, validates the browser secret and consumes the transaction. Recheck expiry and the signed nonce there; atomically consume the inbox and pending transaction and persist `(iss,jti)` replay consumption before minting. Preserve the existing clock watermark and replay retention through expiry plus thirty seconds across restarts. Only then resolve the link and mint an app session. Never mint at the cross-site POST, where Lax cookies may be absent. |
| +1. The app stores a short-lived transaction with independent browser secret, nonce, purpose and validated local return path/query. Set a `__Host-` pending cookie. Redirect to `/authorize` with exactly one `consumer`, one `nonce`, and optionally one `max_age=300`. No other parameters, duplicates or other `max_age` values; this matches `handleAuthorize`'s closed parser. Linking always includes `max_age=300`. Local accounts, documents and privileges stay app-side. |
| +2. Home validates the consumer and authenticates. For an ordinary existing session, **show a fixed-label Continue page before minting**; do not issue silently. Use operator-controlled service labels, no account-authored text. Linking always requires new authentication, regardless of session age. After Continue/authentication, deliver by form POST with optional static auto-submit and a manual button. Never put assertions in URLs or logs; use `no-store` and `strict-origin-when-cross-origin`, since `no-referrer` can null the POST Origin. |
| +3. Accept only a bounded form POST with exact issuer `Origin`. Verify signature, issuer, audience, types and times. Before storing a receipt, require its signed nonce to match a live pending transaction; check and insert atomically. Reserve `(iss,jti)` uniquely so repeated callbacks refuse. Unknown nonces and storage failures store nothing. |
| +4. Store a sealed, expiring inbox receipt, then redirect to `/auth/finish`. Its top-level GET receives the original SameSite=Lax cookie. Recheck the browser secret, nonce, expiry and account binding. Consume the pending/inbox proof, record replay use, resolve the current mapping/admission and mint the session atomically. Preserve the clock watermark and replay retention through expiry plus thirty seconds across restarts. Never mint at the cross-site POST. |
| -Reject swapped browsers, sessions, nonces, purposes and accounts. A valid assertion must not silently replace a different signed-in app account. The callback is the sole narrow cross-origin request-forgery exception. Safe local return paths preserve their query locally; Home receives no resource URL. Bound pending/inbox rows and prune on writes and startup. |
| +The final transaction boundary is a required adapter change: today's `handoff.Finish` commits before `Complete`. Do not leave a consumed proof in memory that can mint after unlink/relink. Reject swapped browsers, purposes or accounts; an assertion cannot silently replace another signed-in account. Only the callback bypasses ordinary cross-origin request-forgery checks. Bound pending/inbox rows and prune them; keep local return queries app-side. |
| ## Linking and unlinking |
| -Store the mapping **in the sibling**: `(issuer, person_ref) → immutable local account ID`. Enforce uniqueness in both directions within that app instance. Nothing about the local account is sent to Home. Equal email addresses never create, repair or transfer a link. |
| +The sibling stores `(issuer, person_ref) → immutable local account ID`, unique in both directions within its instance. Nothing about that account goes to Home. Email equality never creates, repairs or transfers a link. |
| -Linking starts from the actual local session with request-forgery protection. Require genuine local reauthentication and Home authentication within five minutes, both still fresh at confirmation. Use Home's existing `max_age=300` flow and actual `auth_time`; a silent Keymail session is not fresh proof. Bind the proof to the original local account, session, nonce and purpose. Show confirmation on the sibling, then consume both proofs and write the link in one transaction, rechecking current account existence and admission. Conflict means refusal, never merge or overwrite. |
| +Start from the actual local session with request-forgery protection. **Equipo completes local reauthentication before creating the link transaction and starting the Home leg.** Record the transaction start server-side. Both proofs must be within five minutes at confirmation, and Home's `auth_time` must be **at or after that start**, with no backward allowance. Bind proofs to the original local account, session, nonce and purpose; never restart the clock by continuing a stale flow. |
| -Use `connect`/`linkstore`'s existing proof stages. Equipo resolves Home subjects to its existing member identity before applying its active-member, invitation and session-epoch checks. Never send a Home ref into its address-based helpers. An unlinked ID returns to local sign-in and explicit linking; it does not allocate a duplicate account or accept an invitation. |
| +`max_age=300` alone currently permits session reuse. For this slice, these requests must force a new Home authentication gesture, even with a recent session; a passive Keymail approval is insufficient. The consumer independently rejects an older `auth_time`. This tightens issuance behavior without adding request parameters. Show confirmation on Equipo, then consume both proofs and write the link in one transaction, rechecking existence/admission. Conflict refuses; never merge or overwrite. |
| -Contra needs a reviewed adapter: today's `connect.LookupPerson` requires a verified address label and integer ID, while Contra uses opaque account IDs and no readable address. Preserve proof binding and nonreuse checks against its immutable local account identifier; never invent an address or relax the bridge globally. ID sign-in creates only a locked, identity-authenticated app session. Unlock, enrollment of devices, key changes and destructive vault operations retain Contra's own cryptographic proofs. Home receives no passphrase, Account Key, recovery sheet, vault key or plaintext. Recovering Oficina ID cannot recover a vault. |
| +Retain `connect`/`linkstore`'s proof stages. Resolve Home subjects to Equipo's member identity before its active-member, invitation and session-epoch checks. Never pass a person ref to address-based helpers. An unlinked ID returns to local sign-in/linking; no duplicate account or implicit invitation acceptance. |
| -Unlink requires fresh **local** authentication and explicit protected confirmation; it works while Home is down. Atomically delete the mapping, invalidate all pending link proofs and advance a persistent per-account link generation. Resolve Home-derived sessions against the current mapping and generation on every request, including before writes; revoke them on unlink. A later relink cannot revive old sessions. Fence ordinary handoffs too: save a global monotonic revision at each start and record the account’s last-unlink revision. Refuse completion if unlink occurred since that start, even after relink. Check mapping/generation inside the session-creation transaction and every protected-write transaction. Retain local credentials, local sessions and data. An assertion arriving afterward is unlinked and cannot reconnect automatically. Deleting the local account removes its links transactionally; identifiers are never reused. Address changes under today's address-bound bridge require fresh linking. |
| +Unlink requires fresh local authentication and protected confirmation, and works while Home is down. In one transaction delete the mapping, every Home-derived session for it, and pending link/handoff proofs and receipts. Anonymous pending flows cannot yet be attributed: clear the instance's bounded pending/inbox/link-proof sets rather than add revision machinery. Other in-progress sign-ins may need restarting. Serialize callback receipt insertion, completion/session minting, linking and unlinking through the database writer; minting checks the live mapping in that same transaction. A later relink cannot revive deleted proofs or sessions. Keep local credentials, local sessions and data. Account deletion removes links transactionally; IDs are never reused. Address changes under today's address-bound bridge require fresh linking. |
| -## Published keys and rotation |
| +## Pinned keys and rotation |
| -Propose `GET /.well-known/oficina-id-keys` on the credential origin: JSON shaped as `{v:1, iss, keys:[{kid,pub}]}`, containing the exact issuer and up to eight unique `kid` entries; `pub` is the base64url 65-byte uncompressed P-256 public key. Bound response size to 16 KiB; reject malformed points, duplicates and unknown versions. Private signing keys remain credential-only platform secrets. |
| +Use `connect`'s existing `EQUIPO_HOME_ISSUER`, `EQUIPO_HOME_CONSUMER_ID`, `EQUIPO_HOME_KEYS_BASE64` and `EQUIPO_HOME_DEK_BASE64`. The keys value is standard-base64 JSON mapping `kid` to standard-base64 65-byte uncompressed P-256 public keys, at most eight keys/4,096 decoded bytes. The dedicated 32-byte storage key protects handoff/link state, not content; keep it stable. Unknown `kid` fails closed without fetching. Private signing keys stay in credential-only configuration. |
| -Consumers configure the issuer and fixed endpoint out of band. Fetch over authenticated HTTPS with no redirects; never follow token-supplied key URLs. This explicitly extends today's pinned-key-only transport. Add a shared refresh seam to `handoff` and replace its immutable verifier after validating the complete document; do not implement fetching separately in each app. TLS at that origin is the discovery trust anchor; possession of a self-published key alone proves nothing. |
| +Rotate by configuration: install old and new public pins in consumers first, activate that configuration, then switch Home's signer. Keep the old public pin for at least 150 seconds after its last assertion, then remove it through configuration. A consumer missing the new pin refuses ID sign-in until updated; local sign-in remains. Remove a compromised pin immediately and revoke affected Home-derived sessions separately. There is no cache-based revocation bound. Publication/discovery requires a later design; slice 1 has no key endpoint, refresh or cached-key policy. |
| -Publish with `Cache-Control: no-store`; fetch with cache bypass and no stale-response fallback. Only a fresh origin response renews the trust deadline; stale intermediary responses cannot extend it. Revalidate key trust at `/auth/finish`. Refresh after five minutes. Permit a last-good set for at most fifteen minutes since successful fetch; a cache hit or restart cannot renew that deadline. Refetch once on unknown `kid`, coalesced and rate-limited, then fail closed. Expired/missing keys disable ID exchange only. Bootstrap pins may seed a cache but must obey the same deadline; retired pins cannot override a newer set. |
| +## Sign-out, outages and gates |
| -Prepublish a new key for fifteen minutes plus thirty seconds before signing with it. Keep the previous public key for at least 150 seconds after its last assertion, then remove it. Retention is a fixed horizon, never waiting for every hibernating consumer. A cold consumer fetches before exchanging; inability to refresh fails closed. |
| +Capture the session’s authentication source before revocation. Every sign-out revokes locally and lands on the local signed-out page without waiting for Home. Local-authenticated sessions never redirect to Home. Only a Home-derived session may offer a separate optional Home sign-out hop from that page; this is best-effort and cannot gate local completion or local sign-in. Do not use `connect.Routes.Signout`'s unconditional redirect unchanged. No global logout guarantee. |
| -On compromise, remove the key immediately and stop signing with it. Cached acceptance can persist for fifteen minutes; notify operators to disable the affected key sooner. Existing app sessions are not retroactively revoked by key removal: incident response must revoke affected Home-derived sessions separately. Never disable local sign-in as a rotation mechanism. |
| +Home outage blocks new ID authentication/linking. Existing app sessions retain local expiry, revocation and admission checks; local sign-in and unlink continue. Failures offer deliberate retry or local sign-in without redirect loops. |
| -## Failures and acceptance |
| +Required gates: RP/origin isolation and generated WebAuthn names; address-at-rest/log scans; both sign-in paths; recovery entropy, concurrent attempt limits, replacement revocation and notice privacy; expired/replayed/swapped assertions; unmatched nonce stores no receipt; closed authorize parameters; real cross-site scriptless return; concurrent link/unlink/relink/mint; pinned rotation; and identical Equipo admission through either sign-in path. Linking must reject an otherwise valid five-minute-old proof whose `auth_time` precedes transaction start, and demonstrate Home re-prompts. Sign-out/outage tests use an issuer that accepts connections and **hangs**, proving local landing/revocation/sign-in work; refused connections alone are insufficient. |
| -Home outage prevents new ID authentication, fresh linking and expired-key refresh. Existing app sessions continue under local expiry, revocation and admission checks. Local sign-in and unlink remain usable. Home logout ends Home's session; app logout must always revoke locally even if its subsequent Home logout fails. No global logout guarantee. |
| +## Slice 2: Contra |
| -Reject bad audiences, unknown keys, replay, stale proofs and storage failures without account changes. Offer local sign-in or a deliberate retry, without automatic redirect loops. A deleted link cannot be reconstructed from email. |
| +Paul ruled that Home mints for Contra **only after passkey-backed sign-in**, enforced at Home per consumer, never delegated to an assertion-strength claim. Recovery alone does not qualify. Linking is opt-in with disclosure of the new identity association; amend Contra's threat model before adoption. |
| -Before implementation approval, require gates for the exact RP/origin split, no account-authored credential rendering, address-at-rest/log scans, both sign-in paths and recovery, expired/replayed/swapped handoffs, real cross-site scriptless delivery, concurrent link/unlink/relink, rotation and outage. Contra additionally proves ID recovery cannot decrypt or replace vault keys; Equipo proves identical local admission checks through either sign-in path. |
| +Contra receives a pairwise subject: a domain-separated HMAC of person ref and immutable consumer identity under a dedicated Home key. Never send the global ref; define key rotation/migration before use. Consumers outside `oficina.works` need this policy in their later slice too. No domain move is required. |
| -## Questions only Paul can answer |
| +Move the adapter here: `connect.LookupPerson` expects a verified address label and integer ID, while Contra uses opaque IDs and no readable address. Preserve proof binding without inventing addresses. Oficina ID cannot supply vault keys, recover vault plaintext or bypass Contra's cryptographic proofs. |
| -1. **May recovery replace the last lost passkey?** Recommend a narrowly scoped email-plus-code replacement ceremony, retaining the separate ban on recovery satisfying unrelated passkey-only step-up. Without it, recovery restores sessions but cannot repair the lost credential. |
| -2. **Is fifteen minutes of cached-key trust acceptable after compromise?** Recommend this bound for outage tolerance, with explicit emergency session revocation; shorter bounds increase Home availability dependence. |
| -3. **May voluntary linking expose Contra's account-to-Home-ref association at rest?** Recommend explicit opt-in and disclosure. Content stays encrypted, but cross-service identity correlation is new metadata and requires a Contra threat-model amendment before integration. |
| +**Open for slice 2:** what may a locked ID-authenticated session read or do? Default to nothing beyond the unlock screen. No Contra adapter or locked-session permissions are implemented in slice 1. |