feat: add passkey support#6375
Open
DeDiamondPro wants to merge 3 commits into
Open
Conversation
Member
|
Note This changelog has been merged into the changelog for #5790 Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
Author
|
I tried to fix the merge conflicts but I'm getting hydration failures (or at least I think that's what is going on), I'll try to fix it and push the merge either tonight or tomorrow. |
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.
This pull request adds support for logging in with passkeys, and managing passkeys.
I based this PR on #5790 since that is the PR IMB11 told me to look at, and to reduce unnecessary merge conflicts later.
Labrinth
The backend is implemented using the
webauthn-rslibrary. The new routes are added in theroutes/internal/flow.rsfile since the other authentication routes also seemed to be implemented there. I tried to be as consistent as possible with the other code, if anything needs updating please do tell me.New routes:
Register:
POST /auth/passkey/register/start: generates options and challengePOST /auth/passkey/register/finish: verifies and stores new credentialLogin:
POST /auth/passkey/start: generates options and challengePOST /auth/passkey/finish: looks up and verifies attestation for credentialManage:
GET /auth/passkey: lists passkeysPATCH /auth/passkey/[id]: rename passkeyDELETE /auth/passkey/[id]: delete passkeyWebsite
The sign in button was implemented by re-using the styles of the oauth cards, I hope this is okay, but this made sense to me since the button is styled exactly the same.
For the settings page I made a separate component since quite a few modals are needed, and the account page was growing quite a bit when I had it there, if this should be moved somewhere else or back to the account page please do tell me. For the manage modal I tried to match the style of the PAT page, since almost the same properties are displayed for both.
Flow
The flow for registering a passkey is:
The flow for authentication with a passkey is:
What this does not do
This does not implement a 2FA flow for passkeys/security keys. This is for a couple of reasons:
If you want I can implement this but then I'd like some more info about what the preferred way to implement it would be.
Small demo
2026-06-12.11-18-10.mp4