oficina / home Public

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

Plain git — no account needed to clone.

Download

Download this file

1# 🤖 The smart door: remember how you last signed in
2
3Status: **APPROVED by Paul, 2026-11-19 (r2, with option (a))**. Build in the order below.
4Author: Claude (Opus 5.5), for Paul. Reviewed: Fable (claude-fable-5-2), r1:
5READY AFTER FIXES. r2 applies every finding. Paul ruled the §4 question (a).
6
7## The ask and the rulings
8
9Paul, 2026-11-19: "Can we level up our ID flow? Inspired by e.g. Tito and
10Eleven, there should be a smart sign in screen that remembers the last
11signin method used."
12
13Paul's three rulings, picked the same day:
14
151. **Remember the address too, sealed.** It lives in a cookie on the person's
16 own device, sealed so only that host can read it. It is never kept at rest
17 on any server. The door shows it back only to that browser. This amends
18 Home's one rule (see "Home's one rule" below).
192. **Methods are the ones we have:** passkey, emailed link or Keymail, and
20 Oficina ID. No Apple or Google sign-in, which would need its own spec.
213. **Slice 1 is the web:** id.oficina.works plus estilo's door, the sign-in
22 page every app shares. Native sign-in sheets come later.
23
24## What already exists (most of it)
25
26- **rastrillo has shipped a remembering sign-in screen since v0.27**
27 (2026-09-28, plan `rastrillo/docs/superpowers/plans/2026-09-27-signin-screen.md`,
28 copy approved in copy review). `auth.Config.SigninScreen` turns it on.
29 `lastsignin` keeps the way in (keymail, magic link or passkey) plus the
30 address, in a sealed, host-only, HttpOnly cookie that lasts 400 days. The
31 cookie is bound to its origin, renewed on every sign-in, and kept on sign-out.
32 `auth.Forget` is the "Use a different email" button. The `ui` partial
33 `signin` draws these doors: *ask*, *link* ("Continue as {address}"),
34 *keymail*, *passkey* ("Sign in with your passkey" first), *sent*, *confirm*
35 and *continue*. The cookie is never evidence of anything: a one-tap posts the
36 address to `Begin`, which checks it from scratch, and the screen consults no
37 store, so it can't reveal whether an address is known.
38- **Of the suite, only Equipo has it turned on.** Every other app draws estilo's
39 door (`chrome.SignIn`), which is a bare email form. Docs, Sheets, Slides,
40 Calendar, Calls and Memoria pin rastrillo v0.27.1 to v0.29.2; Fichas and Mapa
41 pin v0.35. All of them are new enough.
42- **Home (id.oficina.works) has its own sign-in**, not rastrillo `auth`,
43 because Home is blind. It shows a passkey button once script runs, then the
44 email form. It remembers nothing.
45- **Docs with Home configured** sends `/signin` straight to Oficina ID. The
46 email form is at `/signin/local`.
47
48So most of the level-up is **adoption**. Two pieces are new: Oficina ID as a
49remembered method, and Home remembering for itself.
50
51## What each door shows
52
53**One way in per screen** (Paul, 2026-11-19: "We shouldn't offer two options
54on the same screen. One option, and below it 'other ways to sign in'"). The
55door shows the method used last on this browser as its single primary
56action. Below it is a quiet link, **Other ways to sign in**. Nothing labels
57the remembered method as last used: being the one on offer is the cue (Paul,
58same day: it "can easily be inferred"). Unless marked *new*, all copy is
59rastrillo's approved copy.
60
61**Other ways to sign in** is a page of its own, not a disclosure, so it needs
62no script. It is a chooser: a short list of rows, each opening a one-option
63screen for that method, plus **Back**. **Use a different email** moves there
64as the last row. It forgets this browser's record (`Forget`) and opens the
65email field.
66
67**An app's door** (Docs shown; any app with Oficina ID configured):
68
69| Last used here | The one option | Other ways lists |
70|---|---|---|
71| nothing | *new* **Continue with Oficina ID** | Email |
72| Oficina ID | *new* **Continue with Oficina ID**. Never captioned with an address | Email ({address}, if this app resolved one) · Use a different email |
73| emailed link | **Continue as {address}** | Oficina ID · Use a different email |
74| Keymail | **Continue to Keymail**, as {address} | Oficina ID · Use a different email |
75| (Email chosen) | **Continue as {address}** if one is remembered, else the field · **Continue** | Oficina ID |
76
77The chooser's email row is **Email**, with the remembered address as its
78second line. It opens the email screen, where `Begin` classifies the address
79as it does today (Keymail or a link). The row doesn't promise either one.
80
81An app without Oficina ID configured has only email. It shows "Continue as
82{address}" or the field, and under it **Use a different email** takes the
83place of the Other ways link.
84
85**id.oficina.works** (the brand is "Oficina ID"):
86
87| Last used here | The one option | Other ways lists |
88|---|---|---|
89| nothing | Email field · **Continue**. The field offers saved passkeys as autofill (WebAuthn conditional UI, `autocomplete="username webauthn"`), so a passkey holder never needs the list | Sign in with a passkey |
90| passkey | **Sign in with your passkey** | Email ({address}, if kept; see "The cookie") · Use a different email |
91| emailed link / Keymail | **Continue as {address}** | Sign in with a passkey · Use a different email |
92
93For someone who has enrolled a passkey, email on id.* still ends at the passkey
94or a recovery code (slice 1: email alone isn't enough after enrolment). The door
95can't know who has enrolled without consulting a store, which it must not do.
96So the Email row stays neutral, and the gate explains itself when it is reached.
97
98**How the buttons look** (Paul, 2026-11-19, option A of four). Every button on
99the door is a pill, as in Fichas' level-up: lit from above, with the primary's
100shadow tinted by its own accent. **Continue with Oficina ID** uses the app's own
101accent. Its icon is the Oficina mark's glyph alone, the two fanned cards, drawn in
102`currentColor`. It is never the full-colour app icon, whose gradient tile fought the
103button's fill. estilo ships the glyph (an inline SVG in the door template, so no
104request and no flash). The pill shape is the door's, not yet the suite's: a
105suite-wide switch is a separate estilo decision.
106
107**The smaller controls** (Paul's review of the mockups, 2026-11-19):
108- **Other ways to sign in, Back, Use a different email and Forget me on this
109 device** are text buttons, not thin underlined links, and a clear step below
110 the primary. They are medium weight, in the muted text colour that darkens on
111 hover, slightly smaller than body text, with a chevron where they move you on
112 or back and a soft pill on hover and focus. Semibold in full-strength text was
113 tried and was too bold.
114- **The chooser's rows are compact**: 48px for a single line, with the
115 remembered address as a small second line. Every icon in them is a
116 one-colour glyph, the Oficina one included.
117- **One focus ring, not two.** rastrillo draws a field's grey edge, then a 2px
118 accent outline 2px outside it, which reads as a double border. On the door,
119 the edge itself turns accent with a soft halo flush against it. The same
120 double ring is on every rastrillo field in the suite, so fix it in
121 rastrillo's tokens rather than only on the door, as part of step 1.
122
123**Nothing else on the card.** The door carries no footer links. Docs, Slides,
124Calls, Memoria and Mapa put a Colophon link there on 2026-10-26 through estilo's
125`SignIn.OpenSource` slot. Nobody ruled that, and Paul, 2026-11-19: "That makes
126no sense at all." The Colophon stays under Help. The slot is removed from
127estilo, and each app drops it as it moves to the new door.
128
129**What changes in rastrillo's screen.** Today its passkey door and ask door
130show the passkey button and the email form together, separated by "or", and
131its remembered doors end with a ghost "Use a different email" button.
132One-way-in becomes a **separate config field, default off** (`SigninOneWay`,
133or a better name in review), so Equipo and rastrillo's other users keep
134today's screen. It draws the single option plus Other ways, and the chooser is
135a new `Step`. The **federated slot** is page-supplied, like `Passkey`: an
136href and a label (`Federated{Href, Label}`). Equipo, which today appends its
137own Home button under the partial, moves into that slot when it opts in.
138`Door()` keeps "a passkey is never the only way in" by construction: the
139email way is always one tap away in the chooser.
140
141**Signed out** (every app): "You're signed out", **Sign in again**, and a
142quiet *new* **Forget me on this device**, which posts to `Forget` for a shared
143computer. connect's signed-out `PageData` and estilo's `estilo-signed-out`
144each gain that second POST form. Each host forgets separately, so a
145Home-derived app chains to id.* after its own Forget: the app's signed-out
146page links to `https://id.oficina.works/forget?return=<its own signed-out
147URL>`, which shows one button, *new* **Forget me on Oficina ID too** (a
148same-origin POST), and a quiet *new* **Not now** link back. After
149forgetting, id.* returns **only** to a URL whose origin is a registered
150consumer (`HOME_CONSUMERS`) and whose path is exactly `/signed-out`;
151anything else lands on id.*'s own signed-out page, which offers its own
152Forget. (Sign-out itself never passes through id.*'s signed-out page: the
153consumer hop lands on the app's own, so the chain starts there.) Apps add
154the link in step 6. Forget's request-forgery protection is unchanged:
155`csrf.SameOrigin` in apps and `csrf.Protect` on Home. The worst a forged
156request can do is forget.
157
158**Routes, and every state the door must answer** (r1 finding 3, 5, 6, 7, 11,
15914, 18):
160
161- **`/signin` always renders the door.** The query dispatch that sent a bare
162 `/signin` to Home (connect's `Routes.Signin`, Docs' `homeRoutes.signin`) is
163 deleted. **`/signin/local`**, where connect sends unknown, failed,
164 link-resume and choose-declined people, renders the door with **email as the
165 one option**: never Oficina ID, which would loop. **Continue with Oficina ID**
166 is `GET /signin/oficina?return_to=…`. It does today's `rememberReturn` plus
167 `handoff.StartPath`.
168- **Chooser and override:** `?ways=1` renders the chooser. `?way=email|passkey|oficina`
169 renders that method's one-option screen. The override picks a **method,
170 never an address**: the address only ever comes from the sealed cookie or
171 the field. Every chooser link, Back, and the Forget form carry `return_to`.
172- **Problems win.** Any `err` (including Keymail's), a rate limit, or `force=1`
173 renders the email door with the field, keeps `force`, and shows the problem.
174 `sent`, `confirm` and `continue` render as today: no chooser, and **Sent keeps
175 "Use a different email"**.
176- **App refusals** (Docs' in-response "refused", via `Config.Refused`) get a
177 slot: an app-supplied problem (text, plus "force the ask door") in the
178 partial's keys. Without it, a refused person would see "Continue as {old
179 address}" and no message.
180- **Reauth** (`?reauth=1`, or a fresh-auth step-up) offers a **local** method
181 only: email in apps, and passkey or email on id.*. A live id.* session would
182 hand back an old `auth_time`, and connect's link flow needs `FreshLocal`.
183- **Base path:** with `SigninState.Unavailable`, `estilo-signin-screen` draws
184 nothing, and the app answers as it does today.
185- **id.* specifics:** a `Begin` failure after "Continue as" re-renders the
186 field door, prefilled from the cookie. **Sent stays address-free**, as Home's
187 is by design. `?force=1` after a failed Keymail return is the field door with
188 force kept. The chooser, Back and Forget are served on routes that **don't
189 call `rememberReturn`**, or carry `return_to` explicitly. A test walks app →
190 id.* → Other ways → passkey → back in the app.
191
192**The returning path for an Oficina ID user** on an app: tap Continue with
193Oficina ID; id.oficina.works opens on Sign in with your passkey; one touch;
194back in the app. If an id.* session is still alive, there is no door at all:
195straight back in the app (Paul's ruling 2026-11-20, which retired the
196Continue page; slice 1 spec, Assertion and browser exchange, step 2).
197
198## The cookie
199
200It is lastsignin's cookie, unchanged in format. Every host keeps its own,
201because a parent-domain cookie is ruled out. Docs on `paulca.docs.oficina.works`
202and id.oficina.works each remember for themselves. That is what we want: each
203door reflects how *that* door was last used.
204
205Changes to lastsignin:
206
207- **A federated method:** `MethodFederated`, with a closed, app-set `Provider`
208 label (`"oficina"`) that `validRecord` checks against a closed set. rastrillo
209 stays generic, and the label names nothing about the person.
210- **No address carry-over** (r1 finding 2; rastrillo's `passkey.go` already
211 refuses it, because "keeping the old address would label one person's
212 passkey sign-in with another's name"). A record only ever holds the address
213 of **the person who just signed in**, or none:
214 - **Apps:** the federated record is written in the app's own
215 `MintHomeSession` hook, never in `connect`. The app calls
216 `RememberJar().Remember` with the address of the local account it just
217 resolved, or with none. It is written only on the session-minting path
218 (`Bridge.complete` → `mintSession`), never on link, choose, unknown or
219 failed. `connect` stays free of `lastsignin`, so its consumers aren't
220 forced onto a new rastrillo minor.
221 - **id.*:** a passkey sign-in keeps the remembered address only if that
222 address's blind index resolves to **the same person ref** as the
223 passkey's subject, checked at sign-in time. Otherwise the address is
224 blanked. A finished passkey gate (`idFinish("signin")`) records
225 *passkey*, so an enrolled person who used email and then their passkey is
226 offered the passkey next time.
227- **API:** `Remember` needs the address supplied by the caller, as above.
228 `AttemptCookie` becomes optional, because Home has no attempt cookie.
229 Old binaries read new records as Invalid and clear them, so a rollback is
230 safe.
231
232The jar on id.oficina.works is built with `lastsignin.New` directly. Its
233instance key is derived from `HOME_DEK` under its own label
234(`home/lastsignin/v1`). `seal.Sealer` gains a small domain-separated derive
235method for that. The origin is `https://id.oficina.works`.
236
237## Home's one rule
238
239Rastrillo's blind mode turns off address-remembering cookies on purpose,
240because Home's rule is "never stores a readable address". Paul's ruling 1
241allows the following, and nothing wider. It becomes **Home ruling 26**,
242recorded in the design spec's §1 table and in AGENTS.md's gloss when this
243lands:
244
245> Home may seal **the address this browser last proved** (an opened link, a
246> Keymail callback) into a cookie on **that person's own device**, and render
247> it back **only to the browser that presents it**, on a `no-store` page. It
248> is never written at rest by Home: not to the database, a log, an error, a
249> metric or a queue. It is not evidence of identity, and the page that shows
250> it consults no store.
251
252The falsifiable form is unchanged. Publish Home's database in full, and
253nothing in it is a readable address.
254
255**The gates** (r1 finding 12). Gate 9 is driven with a **validly sealed cookie
256whose address is a canary**, across every route, and asserts the address
257appears in no log line. The cookie's name isn't secret, and its ciphertext
258differs on every seal, so neither is a useful canary. The sign-in half of
259gates 1 and 2 also loads the door afterwards and re-scans the DB, WAL and store
260objects. **Before shipping, confirm the carlos edge logs neither Cookie
261headers nor response bodies.**
262
263**§4 and gate 5 are amended by ruling 26** (Paul chose option (a), below).
264The credential origin may render exactly one person-supplied string: the
265address Home sealed itself, under the limits in (a).
266
267What this costs, stated plainly: anyone using that browser sees the
268address, and so does anyone holding the cookie, who can load the door with it.
269"Use a different email" and "Forget me on this device" are the answer. Rotating
270`HOME_DEK` forgets everyone, which is harmless: the cookie reads as Invalid
271and is cleared.
272
273## Script, flashes and layout
274
275- Every door works with script off, except passkeys, which need their ceremony
276 script (ruling 25).
277- **No pop-in on a remembered passkey.** Today rastrillo writes the passkey
278 button `hidden` and the module reveals it. On the passkey door, where the
279 button is the primary, that moves the page after load. On that door alone,
280 the button is drawn visible and disabled before enhancement, with its space
281 reserved; the module enables it. **If enhancement fails** (no
282 `PublicKeyCredential`, the import fails, or `available()` is false), the
283 module doesn't return silently: it writes the status line and moves to the
284 email screen. With script off, a `<noscript>` line says passkeys need
285 JavaScript, and Other ways sits right below it. `disabled` is used only
286 before enhancement, never as the busy state (it drops focus). Home's
287 script-stripped gate (§12 gate 6) and `noscript_test.go` allow-list the
288 visible button.
289- **Conditional UI on id.*** (passkeys offered in the email field's autofill).
290 It runs only when `isConditionalMediationAvailable()` is true, and never where
291 `LegacyRPID` is set (Home's is empty). An `AbortController` aborts it when the
292 form submits. The conditional `get()` can outlive the five-minute
293 `__Host-oficina-ceremony` challenge, or another tab can replace it, so a
294 refused finish re-begins and retries once. Any failure falls silently back to
295 the field. This needs a `mediation`/`signal` parameter in rastrillo's
296 `webauthn.mjs` `authenticate`.
297- **Home renders the shared partial.** id.* fills an `auth.SigninState` itself
298 and renders rastrillo's `signin` partial, instead of hand-rolling templates
299 that would drift. Its passkey finish answers in rastrillo's shape
300 (`{"ok": true, "to": …}`), so one passkey glue serves both.
301- No new font and no icon font (never FOUT).
302
303## The work, in order
304
3051. **rastrillo:** `MethodFederated` + `Provider`, the `Remember` API change
306 (no carry-over), the one-way option and its chooser `Step`, the
307 `Federated` slot, the app-problem slot, the passkey-door no-shift and
308 failure path, `webauthn.mjs` conditional mediation, the single focus ring
309 in tokens, `seal` derive, and the new strings. Browser drives and axe run
310 on every new state, as for the existing ones. Release as a minor version.
3112. **estilo:** `estilo-signin-screen`, rastrillo's `signin` partial inside the
312 door chrome (sky, card, app mark), **template-only and duck-typed**. estilo's
313 go.mod stays on the old rastrillo path, so its tests render a fixture. It
314 draws nothing when Unavailable. The Oficina glyph is inline. The signed-out
315 page gains Forget. The `OpenSource` slot is removed. `estilo-signin` stays
316 for apps that haven't moved.
3173. **Home to the new rastrillo**, as its own step: v0.26.1 to the step-1
318 release, with AGENTS.md's ritual (`doctor --fix`, delete the shims, the
319 vendored tokens.css gate). `connect` doesn't import `lastsignin`.
3204. **Home connect:** the `/signin`, `/signin/local` and `/signin/oficina`
321 routes above, and the signed-out page's Forget form.
3225. **Home id.oficina.works:** the jar, the doors through the shared partial,
323 the same-person check, conditional UI, the `{ok,to}` passkey finish, ruling
324 26 (once the open question is answered), and the gates.
3256. **The apps,** Docs first, then Sheets, Slides, Calendar, Calls, Memoria,
326 Fichas and Mapa. Each one turns `SigninScreen` and the one-way option on,
327 renders `estilo-signin-screen`, bumps estilo and rastrillo, remembers the
328 federated record in its own `MintHomeSession` hook, and moves its refusal
329 text into the app-problem slot. **Equipo** moves its screen into the door
330 chrome and its Home button (`oficina_id.go`) into the federated slot.
3317. **Later, native:** the kit's sign-in sheet reads the last-used method from
332 the App Group, which already holds the last-used (identity, team).
3336. **Later, native:** the kit's sign-in sheet reads the last-used method from
334 the App Group, which already holds the last-used (identity, team).
335
336Reviews follow the Amadan workflow, with a Fable (or Astra) review before each
337merge. New copy goes through copy review.
338
339## Ruled: the address on id.oficina.works, option (a)
340
341Paul, 2026-11-19, picked **(a)**. Ruling 26 includes this §4 and gate 5
342carve-out. Both are amended in the same commit that lands ruling 26.
343
344Home's design §4 says the credential origin (id.oficina.works) shows **"No
345account-authored string, ever"**, and gate 5 tests it. Today's passkey page
346withholds the address for exactly that reason. "Continue as paul@tito.io" on
347id.* would be the first such string.
348
349- **(a) Allow it, narrowly (recommended).** Amend §4 and gate 5 for exactly one
350 string: an address Home itself sealed. It is shape-checked again on read
351 (`lastsignin.validAddress`), escaped by html/template, and appears only as
352 text and in a hidden `value`. An attacker can't forge the cookie without
353 `HOME_DEK`. Whatever it says is something this browser proved. The `passkey.go`
354 comment changes in the same commit.
355- **(b) Keep §4 absolute.** id.* remembers the **method only**. The email screen
356 shows the field, and the browser's own autofill supplies the address. App
357 doors still show "Continue as {address}"; only id.* doesn't.
358
359## Paul's answers (2026-11-19)
360
361Paul: "Happy with recommendations. Remove now."
362
3631. **Docs shows the door.** `/signin` stops hopping straight to id.oficina.works.
364 It shows the door with Continue with Oficina ID as the one option.
3652. **Forget me on this device** goes on the signed-out page.
3663. **The Colophon link comes off the live doors now**, ahead of this work, in
367 Docs, Slides, Calls, Memoria and Mapa. estilo's `OpenSource` slot is removed
368 later, with the rest of step 2.
369