feat: add passkey plugin#8
Open
ibxbit wants to merge 1 commit into
Open
Conversation
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.
Adds a WebAuthn / passkey plugin (
plugins/passkey) modeledon better-auth's passkey plugin, powered by
go-webauthn/weba uthn.Endpoints
GET /passkey/generate-register-options+POST /passkey/verify-registration(protected)GET /passkey/generate-authenticate-options+POST /passkey/verify-authentication(public, creates session)GET /passkey/list,POST /passkey/delete,POST /passkey/update(protected, ownership-enforced)Programmatic API via
passkey.Use(auth).Highlights
the user from the assertion's
userHandleverifications, indexed by asigned cookie; single-use, ceremony-kind-scoped
(registration cookie can't be replayed against the auth
endpoint)
ResidentKey: preferred,UserVerification: preferred, RPID derived fromBaseURL,rate-limited 10–20/min per endpoint
passkeystable with FK cascade tousersTests
17 unit tests covering init defaults, endpoint guard paths,
ownership enforcement, and challenge state round-trip.
go test -race -count=1passes.Tested end-to-end
Verified in Chrome with DevTools' virtual authenticator +
Windows Hello against a Neon Postgres. The included
examples/passkey/ships a minimal HTML/JS client coveringsign-up → register passkey → sign-out → discoverable sign-in →
list.
Notes for the reviewer
plugins/passkey/go.modcarriesreplace ... => ../..forlocal dev. Remove and bump to the next
limentag beforerelease.
ALTER TABLE verifications ALTER COLUMN value TYPE TEXT;— WebAuthnSessionDataJSONexceeds
VARCHAR(255). New deployments get the right columnfrom the generated migration.
.gitignoreadditions overlap with the email-otp PR —whichever merges second will see them as a clean no-op.