Skip to content

feat: support WebAuthn Touch ID platform authenticator on macOS - #51412

Merged
jkleinsc merged 8 commits into
41-x-yfrom
trop/41-x-y-bp-feat-support-webauthn-touch-id-platform-authenticator-on-macos-1777567211898
May 1, 2026
Merged

jkleinsc merged 8 commits into
41-x-yfrom
trop/41-x-y-bp-feat-support-webauthn-touch-id-platform-authenticator-on-macos-1777567211898

Conversation

@trop

@trop trop Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Backport of #51255

See that PR for details.

Notes: Added app.configureWebAuthn() to enable the Touch ID platform authenticator for WebAuthn on macOS, and a select-webauthn-account session event for choosing between multiple discoverable credentials.

trop Bot and others added 7 commits April 30, 2026 16:40
Adds `app.configureWebAuthn({ touchID: { keychainAccessGroup } })` to enable
the Secure Enclave platform authenticator for `navigator.credentials`.
Credentials are stored under the app-supplied keychain access group with a
per-session metadata secret that is generated on first use and persisted in
prefs.

Also introduces `ElectronAuthenticatorRequestClientDelegate` and wires it via
`ContentBrowserClient::GetWebAuthenticationRequestDelegate()` so that
discoverable-credential `get()` calls with multiple matches emit a new
`select-webauthn-account` session event instead of DCHECK-failing in the base
delegate. If no listener is registered (or the callback is invoked with no
credential), the request is cancelled with NotAllowedError rather than
silently auto-selecting.

Tests use the DevTools virtual authenticator so the account-selection flow is
exercised in CI without entitlements or real hardware.

Co-authored-by: Samuel Attard <[email protected]>
The base AuthenticatorRequestClientDelegate::StartObserving() is a no-op, so
observer() on the request handler stayed null. MakeCredentialRequestHandler::
SpecializeRequestForAuthenticator dereferences observer()->SupportsPIN() when
residentKey is 'preferred', crashing with SEGV when a real FIDO2 HID key is
dispatched.

Override StartObserving/StopObserving to register via a ScopedObservation like
ChromeAuthenticatorRequestDelegate does. Added a virtual-authenticator
regression test for create() with residentKey: 'preferred'.

Co-authored-by: Samuel Attard <[email protected]>
- Encode credentialId and userHandle as URL-safe base64 without padding so
  the values match PublicKeyCredential.id from navigator.credentials.get()
  byte-for-byte; tests now assert the equality rather than transcoding.
- Cancel the pending request when the listener invokes the callback with a
  credentialId that does not match any account, instead of leaving the
  request hanging while the listener retries. The TypeError still surfaces
  so the misuse remains visible to the developer.
- DCHECK that the Touch ID config helpers run on the UI thread, encoding
  the threading invariant the read-then-write metadata-secret pref relies
  on.

Co-authored-by: Samuel Attard <[email protected]>
Throwing back into the listener bubbles up as an unhandled exception in
the main process. Match the no-args branch exactly so the listener sees a
single consistent failure mode (cancel + NotAllowedError) whether it
declines deliberately or by mistake.

Co-authored-by: Samuel Attard <[email protected]>
@trop
trop Bot requested a review from MarshallOfSound April 30, 2026 16:40
@trop trop Bot added 41-x-y backport This is a backport PR backport/requested 🗳 semver/minor backwards-compatible functionality labels Apr 30, 2026
@nikwen

nikwen commented May 1, 2026

Copy link
Copy Markdown
Member

Backport approved by @electron/wg-releases in #wg-releases-backport-requests.

@jkleinsc
jkleinsc merged commit f6ec0df into 41-x-y May 1, 2026
107 of 111 checks passed
@jkleinsc
jkleinsc deleted the trop/41-x-y-bp-feat-support-webauthn-touch-id-platform-authenticator-on-macos-1777567211898 branch May 1, 2026 15:15
@release-clerk

release-clerk Bot commented May 1, 2026

Copy link
Copy Markdown

Release Notes Persisted

Added app.configureWebAuthn() to enable the Touch ID platform authenticator for WebAuthn on macOS, and a select-webauthn-account session event for choosing between multiple discoverable credentials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport/approved ✅ backport This is a backport PR semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants