oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Equipo's apps sign in with Oficina ID (spec, 2026-11-20)
2
3Status: APPROVED by Paul on 2026-11-20 with every recommendation (E1 session then
4device credential; E2 7 days, renewed silently; E3 pairing kept as a fallback;
5E4 Equipo joins Alta and the directory). Author: Claude (`claude-opus-5-5`).
6
7## Why
8
9Paul, 2026-11-20, on the pairing screen: "Ideally though we'd never have to
10type anything in ... it should just do 'Sign in' and it would know all the
11Oficina accounts I have access to." He chose to do this next, before the rest
12of slice 2 (notifications and Live Activities).
13
14Today Equipo's iPhone and Mac apps pair: you type the team's address, the app
15shows a code, you approve it in the browser, and the app gets a device
16credential (`equipo.person.v1` bearer, 30 days). Docs already signs in the
17way Paul wants, through Home's Oficina ID native slice
18(`home/docs/superpowers/specs/2026-11-14-oficina-id-native.md`, "the native
19spec") and rastrillo/native's shared kit (`RastrilloApple/OficinaID`): one
20Oficina ID on the device signs the next app straight in, with the person's
21teams from the directory.
22
23## What a person sees
24
251. First Oficina app on the device: Equipo shows the kit's onboarding:
26 Welcome, then "Sign in with a passkey" or email and a 6-digit code.
272. An Oficina ID already on the device (Docs signed in, say): no screen at
28 all. Equipo reads the identity, asks the directory for the person's teams
29 that have Equipo, and with one team is signed in; with several, the kit's
30 Team step; with none, the kit's zero-teams help.
313. "Other ways to sign in…" keeps today's pairing (team address, code,
32 browser approval) for a team outside the directory or a self-hosted one.
334. The account menu and Sign out are the kit's; signing out also revokes this
34 device's Equipo credential (as today).
35
36## How (the parts, in order)
37
38**1. Equipo server: the native exchange.** `POST <origin>/native/oficina-id
39{assertion, verifier, choice?}`, the contract the kit already calls
40(`OficinaIDService.exchange`) and the native spec defines in §7 and §8:
41verify the assertion (pinned Home keys, exact issuer and audience, the native
42nonce recomputed from the verifier); read the person's link; for a roster
43member with no link answer `409 {"state":"choose"}` and allocate only on
44`choice:"new"`; a non-member gets `403 {"state":"unknown"}` byte for byte the
45same as any unknown; roster unavailable is `503`; reserve the `jti` in its own
46short transaction; no hook and no session mint with the writer held; mint a
47session with method `home-assertion-native`, refused 7 days after its `At`.
48Equipo has its own Oficina ID package from slice 1
49(`internal/equipo/oficinaid`), not rastrillo's `connect`, so this is written
50there, following `connect.Bridge.NativeExchange` and its gates (native spec
51§13, "Assert and exchange") as the reference. JSON only, no cookies set,
52`Origin` refused.
53
54**2. Equipo server: a device credential from that session.**
55`POST /api/v1/auth/devices/native {public_key, label}` with the session the
56exchange minted (same-origin, JSON, the session's own person only): registers
57this device with its Curve25519 key, already approved, and answers with the
58same `DeviceCredential` pairing gives (`id`, `token`, `expires_at`). The
59engine's routes keep taking only device bearers, unchanged. The credential's
60lifetime follows the session's 7-day rule: it expires with the Oficina ID
61session it came from, and the app renews it silently (the kit's
62`renewIfNeeded` on foreground and after 24 hours, then this call again).
63Audit: device registered via Oficina ID, with no credential in it. Revoking
64the Oficina ID's sessions (unlink, Home's sign-out-all) revokes these devices.
65
66**3. Home: the directory lists Equipo.** The native spec's
67`GET /api/native/teams` lists "live instances of the five apps". Equipo
68becomes the sixth (`apps:[{app:"equipo", origin, consumer_id}]`), and Home's
69`assert` accepts each Equipo instance's origin as an audience (they are
70already consumers from slice 1 on the web; checked, not assumed).
71
72**4. Alta: Paul's teams have Equipo in the directory.** The directory's team
73`oficina` exists (Alta adoption, 2026-11-17/18, run on Paul's other Mac).
74Equipo's instance is added the same way Calendar's was (`alta-adopt activate
75--apps equipo`, then Home's confirms). This is an operator step for Paul;
76the runbook is `native-levelup/ALTA-ROLLOUT.md`.
77
78**5. Native: adopt the kit.** EquipoKit shows `OficinaOnboardingView` until
79`.signedIn`, then for the chosen team runs step 2 and keeps the device
80credential exactly as pairing does today (Keychain, `DeviceAccounts`); the
81rest of the app is unchanged. Pairing moves behind "Other ways to sign in…".
82Entitlements, as the kit requires: `keychain-access-groups` =
83`9U4A84C4WK.works.oficina.equipo` first, then `9U4A84C4WK.works.oficina.id`;
84the App Group (`9U4A84C4WK.works.oficina` on Mac, `group.works.oficina` on
85iOS); `webcredentials:id.oficina.works`. That means new provisioning profiles
86for iPhone and Mac (the Mac's Developer ID build must embed one), made through
87the App Store Connect API.
88
89## Decisions for Paul
90
91| | Decision | Recommendation |
92| --- | --- | --- |
93| E1 | How the app turns an Oficina ID into Equipo access | The kit's exchange as it is (a session), then one Equipo call that registers this device and returns the usual device credential. The kit stays shared and unchanged, and Equipo's API keeps one kind of credential. The alternative, Equipo's routes accepting the session cookie, would give Equipo a second credential type on every route. |
94| E2 | Lifetime of a device credential that came from Oficina ID | 7 days, renewed silently, matching the native spec's rule for Oficina ID sessions (yours, confirmed). Paired devices keep their 30 days. |
95| E3 | Pairing | Kept, behind "Other ways to sign in…", for teams outside the directory and self-hosted ones. |
96| E4 | Alta | Equipo joins Alta and the directory like the other apps; you run the adoption step on the Mac that holds Alta's operator state. |
97
98## Gates
99
100The native spec's §13 exchange gates, applied to Equipo's implementation;
101tests first with each guard broken on purpose; the device contract test and
102OpenAPI document cover the new route; a live run against a local Equipo with
103a fake Home (the kit's `FakeOficinaIDService` on the app side); one review
104(Fable, or Codex Astra while Fable is limited); Paul lands each branch per
105his slice 2 ruling.
106
107## Order
108
1091. Equipo server: exchange and device route (one branch).
110 Scope clarification approved 2026-11-20: this branch admits only an
111 Oficina ID already explicitly linked to an active Equipo roster member.
112 Every unlinked subject, including `choice:"new"`, receives the identical
113 `403 {"state":"unknown"}`. There is no 409 choice or allocation path here:
114 Equipo has no trusted Home roster mapping for an unlinked subject.
115 Follow-up: integrate Home's team roster for unlinked members, then build
116 the member choice and allocation path described in parts 1 and 2.
1172. Home: the directory and `assert` include Equipo (Home branch).
1183. Native: the kit, entitlements, profiles (one branch); TestFlight and Mac.
1194. Alta: Paul adopts Equipo for his teams.
1205. Then back to slice 2: the CARLOS push sender and the native push branch.
121