oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

Equipo's apps sign in with Oficina ID (spec, 2026-11-20)

Status: APPROVED by Paul on 2026-11-20 with every recommendation (E1 session then device credential; E2 7 days, renewed silently; E3 pairing kept as a fallback; E4 Equipo joins Alta and the directory). Author: Claude (claude-opus-5-5).

Why

Paul, 2026-11-20, on the pairing screen: "Ideally though we'd never have to type anything in ... it should just do 'Sign in' and it would know all the Oficina accounts I have access to." He chose to do this next, before the rest of slice 2 (notifications and Live Activities).

Today Equipo's iPhone and Mac apps pair: you type the team's address, the app shows a code, you approve it in the browser, and the app gets a device credential (equipo.person.v1 bearer, 30 days). Docs already signs in the way Paul wants, through Home's Oficina ID native slice (home/docs/superpowers/specs/2026-11-14-oficina-id-native.md, "the native spec") and rastrillo/native's shared kit (RastrilloApple/OficinaID): one Oficina ID on the device signs the next app straight in, with the person's teams from the directory.

What a person sees

  1. First Oficina app on the device: Equipo shows the kit's onboarding: Welcome, then "Sign in with a passkey" or email and a 6-digit code.
  2. An Oficina ID already on the device (Docs signed in, say): no screen at all. Equipo reads the identity, asks the directory for the person's teams that have Equipo, and with one team is signed in; with several, the kit's Team step; with none, the kit's zero-teams help.
  3. "Other ways to sign in…" keeps today's pairing (team address, code, browser approval) for a team outside the directory or a self-hosted one.
  4. The account menu and Sign out are the kit's; signing out also revokes this device's Equipo credential (as today).

How (the parts, in order)

1. Equipo server: the native exchange. POST <origin>/native/oficina-id {assertion, verifier, choice?}, the contract the kit already calls (OficinaIDService.exchange) and the native spec defines in §7 and §8: verify the assertion (pinned Home keys, exact issuer and audience, the native nonce recomputed from the verifier); read the person's link; for a roster member with no link answer 409 {"state":"choose"} and allocate only on choice:"new"; a non-member gets 403 {"state":"unknown"} byte for byte the same as any unknown; roster unavailable is 503; reserve the jti in its own short transaction; no hook and no session mint with the writer held; mint a session with method home-assertion-native, refused 7 days after its At. Equipo has its own Oficina ID package from slice 1 (internal/equipo/oficinaid), not rastrillo's connect, so this is written there, following connect.Bridge.NativeExchange and its gates (native spec §13, "Assert and exchange") as the reference. JSON only, no cookies set, Origin refused.

2. Equipo server: a device credential from that session. POST /api/v1/auth/devices/native {public_key, label} with the session the exchange minted (same-origin, JSON, the session's own person only): registers this device with its Curve25519 key, already approved, and answers with the same DeviceCredential pairing gives (id, token, expires_at). The engine's routes keep taking only device bearers, unchanged. The credential's lifetime follows the session's 7-day rule: it expires with the Oficina ID session it came from, and the app renews it silently (the kit's renewIfNeeded on foreground and after 24 hours, then this call again). Audit: device registered via Oficina ID, with no credential in it. Revoking the Oficina ID's sessions (unlink, Home's sign-out-all) revokes these devices.

3. Home: the directory lists Equipo. The native spec's GET /api/native/teams lists "live instances of the five apps". Equipo becomes the sixth (apps:[{app:"equipo", origin, consumer_id}]), and Home's assert accepts each Equipo instance's origin as an audience (they are already consumers from slice 1 on the web; checked, not assumed).

4. Alta: Paul's teams have Equipo in the directory. The directory's team oficina exists (Alta adoption, 2026-11-17/18, run on Paul's other Mac). Equipo's instance is added the same way Calendar's was (alta-adopt activate --apps equipo, then Home's confirms). This is an operator step for Paul; the runbook is native-levelup/ALTA-ROLLOUT.md.

5. Native: adopt the kit. EquipoKit shows OficinaOnboardingView until .signedIn, then for the chosen team runs step 2 and keeps the device credential exactly as pairing does today (Keychain, DeviceAccounts); the rest of the app is unchanged. Pairing moves behind "Other ways to sign in…". Entitlements, as the kit requires: keychain-access-groups = 9U4A84C4WK.works.oficina.equipo first, then 9U4A84C4WK.works.oficina.id; the App Group (9U4A84C4WK.works.oficina on Mac, group.works.oficina on iOS); webcredentials:id.oficina.works. That means new provisioning profiles for iPhone and Mac (the Mac's Developer ID build must embed one), made through the App Store Connect API.

Decisions for Paul

| | Decision | Recommendation | | --- | --- | --- | | 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. | | 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. | | E3 | Pairing | Kept, behind "Other ways to sign in…", for teams outside the directory and self-hosted ones. | | 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. |

Gates

The native spec's §13 exchange gates, applied to Equipo's implementation; tests first with each guard broken on purpose; the device contract test and OpenAPI document cover the new route; a live run against a local Equipo with a fake Home (the kit's FakeOficinaIDService on the app side); one review (Fable, or Codex Astra while Fable is limited); Paul lands each branch per his slice 2 ruling.

Order

  1. Equipo server: exchange and device route (one branch). Scope clarification approved 2026-11-20: this branch admits only an Oficina ID already explicitly linked to an active Equipo roster member. Every unlinked subject, including choice:"new", receives the identical 403 {"state":"unknown"}. There is no 409 choice or allocation path here: Equipo has no trusted Home roster mapping for an unlinked subject. Follow-up: integrate Home's team roster for unlinked members, then build the member choice and allocation path described in parts 1 and 2.
  2. Home: the directory and assert include Equipo (Home branch).
  3. Native: the kit, entitlements, profiles (one branch); TestFlight and Mac.
  4. Alta: Paul adopts Equipo for his teams.
  5. Then back to slice 2: the CARLOS push sender and the native push branch.