Repository navigation
Server, Admin: Add passkey authentication - #340
Merged
Merged
Conversation
lehni
added this pull request to stack #341
October 16, 2026 23:05
lehni
force-pushed
the
feature/passkeys
branch
from
October 16, 2026 23:26
fd47a47 to
9433494
Compare
lehni
force-pushed
the
feature/passkeys
branch
2 times, most recently
from
October 17, 2026 01:25
c497585 to
aebc9ec
Compare
- Add CredentialMixin and CredentialModel, one table for the credentials of all user models, deleted with their users - Configure credentials and passkeys in app.auth, checked on setup, with sessions stored on the server - Add passkey login, the user's own passkeys named after their providers, and 'post password' to UsersController, passkeys only routed with them, through the optional peer @simplewebauthn/server - Add login.passkeys to the admin: a passkey login and a Security dialog in the account menu that changes the password and manages passkeys, with context.reload(), the list option empty, dialogs that validate on submit, and lists in dialogs that keep their query to themselves - Test with a software authenticator on PGlite and SQLite, and with a virtual authenticator in e2e
lehni
force-pushed
the
feature/passkeys
branch
from
October 17, 2026 21:24
aebc9ec to
41999b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #326. Users of any
UserMixinmodel can log in with passkeys (WebAuthn), in Dito.js' admin and in any other frontend through the same endpoints.Server:
CredentialMixin/CredentialModel: one table for the credentials of all user models (passkeys now, later TOTP and backup codes), referring to users by model name and id. Credentials are deleted along with their users.app.auth: { credentials: { modelClass }, passkeys: { name, id, origins } }. Passkeys need sessions stored on the server, so old cookies can't replay challenges, and challenges expire after 5 minutes.UsersControlleractions, only routed withapp.auth.passkeys:post passkey-login-options,post passkey-login, and for the logged-in userget passkeys,post passkey-options,post passkeys,delete passkeys/:id. Controllers with acollection.allowlist have to list them.@simplewebauthn/serveris an optional peer, imported once inUsersController.setup(), which is now asynchronous.Controller.setup()is internal, likeModel.setup().Admin:
login: { passkeys: true }adds a "Sign In with Passkey" button to the login dialog and a Security dialog to the account menu, built from Dito.js schema components: a Password row with a placeholder and a "Change" button, which opens the dialog to change the password (post password, which checks the current password), and a list of the user's passkeys (named after their provider throughaaguids, e.g. "1Password", or "Passkey"; created, last used; deletable) with an "Add Passkey" button.context.reload(), which reloads the nearest list or object, e.g. after a button's action.empty, a text shown when the list has no items.@simplewebauthn/browseris a required peer, since optional peers break app builds.Tests: the server tests use a software P-256 authenticator on PGlite and SQLite, covering challenge replay and expiry, other user models, duplicates and deletion. An e2e test uses Chrome's virtual authenticator.