Issue 1316
feat: See and remove your passkeys on the account page
Back to our planDone
enhancementfrontendauthpriority: low
Problem
A resident who loses a phone, or no longer wants a passkey, can't see which passkeys their account has or remove one.
Proposed fix
- Use case
use-cases/removePasskey.ts: list the session account's passkeys; remove one by its id only if it belongs to the session account. Removing the last one is allowed: email and password stay. - Screen: the "Passkeys" card on
/accountlists each passkey with its label, when it was added and when it was last used, and a "Remove passkey" button that asks to confirm in aDialog. An empty list says how to add one. - Messages (catalog, brand voice), drafts:
- Empty: "No passkeys yet."
- Confirm: "Remove this passkey? You can still sign in with your email and password."
- Buttons: "Remove passkey", "Keep it"
- Done: "Passkey removed."
- Email: a short note that a passkey was removed, with what to do if it wasn't them.
- Lost device: the accounts note and the card say plainly that forgot password gets anyone back in, and from there they remove the lost passkey.
Existing work compared
- Searched: issues for passkey, account page, lost device and delete account (#310 deletes the
whole account, and #1313 already removes passkeys with it);
/accounttoday. - Native: nothing in Payload or Next.js lists or removes passkeys for a resident.
- Official and community plugins: none fit. Better Auth's passkey plugin had a fixed advisory that let any signed-in user delete another person's passkey; that case is a test here.
- Our code: reuses #1313's data layer, the UI kit's
Card,Button,Dialog,MetaListandAlert, and the email sender. New work.
Acceptance criteria
Tests first.
- Not done: Use-case tests: removing another account's passkey is refused (and leaves it in place); no session is refused; removing the last passkey works and email sign-in still works.
- Not done: Action tests: the account comes only from the session; the passkey id is parsed again.
- Not done: Component tests with axe: the list, the empty state, the confirm dialog (focus moves in and back), the messages announced.
- Not done: Lost device, by hand: forgot password, sign in, remove the passkey, then that passkey no longer signs in.
- Not done:
/accountat 320, 430, 768, 1024, 1280 and 1920 px, light and dark: rows line up, long labels don't push the button out of line, nothing overflows. - Not done: The removal email names the passkey's label and the time, and carries no sign-in link.
- Not done: An admin delete in
/adminskips the use case: decide a hook that sends the removal email, or deliberately none, and say which in the PR. - Not done: The accounts note in the same PR.
Files likely touched
src/modules/accounts/use-cases/removePasskey.ts(+ test)src/modules/accounts/actions.ts(+ test),server.tssrc/modules/accounts/ui/PasskeyList.client.tsx(+ test),ui/passkeyMessages.tssrc/platform/lib/messages/accounts.tssrc/app/(frontend)/account/page.tsx(+ test)src/modules/accounts/README.md
Must not touch
src/app/(frontend)/login/**,src/modules/accounts/data/session.tssrc/platform/ui/**unless a missing variant is needed (thenshared-component)
Open questions
- For the owner: ask for a recent sign-in before a remove too, as large providers do? The owner decided the step only for adding (record 0021 leaves this open).
Area
auth, frontend
Priority
low
Generated by Claude Code, opens in a new tab