Skip to content

Pocket: name a new passkey by its Hosted account's email - #1907

Open
nedtwigg wants to merge 1 commit into
mainfrom
passkey-email-label
Open

nedtwigg wants to merge 1 commit into
mainfrom
passkey-email-label

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

A phone holding passkeys for two Hosted accounts shows two identical "Dormouse Pocket (relay.dormouse.sh)" entries in its passkey picker, with no way to tell which signs in to which set of computers. #1804 makes that case routine.

  • Hosted's POST /api/setup/begin answers a new optional accountEmail: the minting account's email (remote-lib-common/src/remote/wire.ts, hosted/server/relay-api.ts).
  • Pocket names a passkey it creates <email> (Dormouse.sh) when the field is present, and Dormouse Pocket (<rpId>) as before when it is not (passkeyUserName in lib/src/remote/client/webauthn.ts).

Compatibility. The field is optional both ways. A Pocket that predates it ignores it. A Pocket reading a Relay that sends none (selfhost, or a Hosted deploy older than this) keeps the old name. Existing passkeys keep their names, since WebAuthn cannot rename one and sign-in never reads it. To relabel a phone's existing passkeys, delete them and pair again.

Disclosure. setup/begin answers whoever holds a live setup code, so someone who photographs a QR now also learns the owner's email, as they already learn the account ID and passkey IDs, until the code expires or is spent. docs/specs/hosted.md records it.

Tests: the new tests in webauthn.test.ts, pocket-client.test.ts, and hosted/server/tests/relay.test.ts each fail with their fix line removed. Not yet tried on a real phone.

🤖 Generated with Claude Code

A phone holding passkeys for two Hosted accounts showed two identical
"Dormouse Pocket (relay.dormouse.sh)" entries. Hosted's setup/begin now
answers an optional `accountEmail`, and Pocket names a passkey it creates
"<email> (Dormouse.sh)". Older Pockets ignore the field; a Relay that sends
none (selfhost, or an older Hosted) keeps the old name. Existing passkeys
are untouched, since sign-in never reads the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 348d1e6
Status: ✅  Deploy successful!
Preview URL: https://5f74dc28.mouseterm.pages.dev
Branch Preview URL: https://passkey-email-label.mouseterm.pages.dev

View logs

@dormouse-bot dormouse-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new disclosure is recorded only in docs/specs/hosted.md, but AGENTS.md → "Specs" makes docs/specs/security.md the one place that states each accepted risk ("It alone states each known gap and accepted risk"). Its "What is not defended" bullet for setup QRs (Whoever first redeems a live setup QR adds a passkey to your account and is signed in) still describes only what redeeming grants. Someone who only photographs a live code can now call setup/begin and learn the owner's email, without redeeming it. That is a personal identifier, unlike the opaque account and credential IDs begin already returns, and /security readers never see the hosted.md table cell. Consider adding a clause there and cutting the hosted.md parenthetical down to a pointer. Adding words may need node scripts/spec-lint.mjs --ratchet docs/specs/security.md.

rpId: rpIdOf(c.env),
accountId: minter.userId,
existingCredentialIds: minter.credentialIds,
...(minter.email ? { accountEmail: minter.email } : {}),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better Auth's user.email is NOT NULL, and this query inner-joins "user", so no Hosted row reaches the empty branch. The field can be unconditional, which also lets the row type above say email: string:

Suggested change
...(minter.email ? { accountEmail: minter.email } : {}),
accountEmail: minter.email,

This branch was successfully deployed

1 active deployment
dormouse/preview — 348d1e63 Deployed Nov 28, 2026 by argos-ci[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants