Skip to content

feat: add system passkey support on macOS via app.configureWebAuthn() - #51563

Merged
VerteDinde merged 12 commits into
electron:mainfrom
CliftonH:integrate-ASAuthorizationController
Aug 6, 2026
Merged

VerteDinde merged 12 commits into
electron:mainfrom
CliftonH:integrate-ASAuthorizationController

Conversation

@CliftonH

@CliftonH CliftonH commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Description of Change

Adds platform passkey support to Electron on macOS via app.configureWebAuthn(). Apps can enable Touch ID (keychain-backed credentials) and/or platform passkeys (served by any Credential Provider Extension - iCloud Keychain, 1Password, etc. - via ASAuthorizationController).

When both authenticators are configured, a new select-webauthn-authenticator session event lets the app choose which to dispatch, preventing the dual-prompt bug where both Touch ID and the Apple passkey sheet appear simultaneously.

API

app.configureWebAuthn({
  touchID: { keychainAccessGroup: "TEAM.com.example.app.webauthn" },
  platformPasskeys: true,
});

session.defaultSession.on(
  "select-webauthn-authenticator",
  (event, callback) => {
    // event.relyingPartyId: string
    // event.authenticators: ['touchID', 'platformPasskeys']
    // event.frame: WebFrameMain | null
    callback("platformPasskeys");
  },
);

Implementation

  • ElectronPlatformPasskeysAuthenticator - implements FidoAuthenticator by driving ASAuthorizationController directly (no intermediate controller abstraction).
  • ElectronPlatformPasskeysDiscovery - plugs into Chromium's FIDO discovery stack, creates the authenticator when macOS 13+ is available.
  • ElectronAuthenticatorRequestClientDelegate - overrides EmbedderControlsAuthenticatorDispatch to intercept auto-dispatch when both authenticators are present. Emits select-webauthn-authenticator on the session; defaults to platformPasskeys if no listener.
  • ElectronWebAuthenticationDelegate - stores static configuration for Touch ID keychain access group and platform passkeys enabled state.

Requirements:

  • macOS only
  • App must be authorized for WebAuthn via com.apple.developer.associated-domains entitlement with webcredentials:<domain> entries and a matching AASA file on the relying party's server

Checklist

Release Notes

Notes: Added app.configureWebAuthn() API to enable iCloud Keychain passkey support on macOS. When enabled, navigator.credentials.create() and .get() present Apple's native passkey UI via ASAuthorizationController.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label May 8, 2026
@jkleinsc jkleinsc added the semver/minor backwards-compatible functionality label May 8, 2026
@jkleinsc

jkleinsc commented May 8, 2026

Copy link
Copy Markdown
Member

@CliftonH can you rebase your PR with the latest from main? Also, looks like linting failed here:
https://github.com/electron/electron/actions/runs/25571522517/job/75070133527?pr=51563#step:10:33.

If you run yarn lint locally it should generate a fix that you can then use git apply to apply.

@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch from 9bc1300 to 1443c2d Compare May 8, 2026 18:39
@CliftonH

CliftonH commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

@CliftonH can you rebase your PR with the latest from main? Also, looks like linting failed here: https://github.com/electron/electron/actions/runs/25571522517/job/75070133527?pr=51563#step:10:33.

If you run yarn lint locally it should generate a fix that you can then use git apply to apply.

Rebased, thanks for the heads-up!

@CliftonH CliftonH changed the title feat: wire iCloud Keychain into Chromium's FIDO discovery stack feat: add iCloud Keychain passkey support via app.configureWebAuthn() May 9, 2026
@CliftonH CliftonH changed the title feat: add iCloud Keychain passkey support via app.configureWebAuthn() feat: add iCloud Keychain passkey support via app.configureWebAuthn() May 9, 2026

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ASAuthorizationController integration itself looks right, and after digging into Chromium's device/fido/mac/icloud_keychain.mm I agree we can't reuse it — their path is gated on ProcessHasEntitlement() checking for com.apple.developer.web-browser.public-key-credential which Electron apps won't have. We should put a comment somewhere saying that though, otherwise the next person to find Chromium's iCloud Keychain code is going to wonder why we wrote our own.

Two bigger things before this lands tho:

  1. The ElectronPasskeyController abstraction layer doesn't buy us anything — single impl, the "other platforms" the header mentions don't exist (it's only built on mac), and it adds a translation hop in each direction plus 4 mirror structs that just shadow the FIDO types. Can we have ElectronICloudKeychainAuthenticator drive ASAuthorizationController directly and delete the controller files? Drops ~300 lines and 2 files.

  2. We don't override EmbedderControlsAuthenticatorDispatch so when both touchID and iCloudKeychain are configured (the docs example does exactly this 😅), FidoRequestHandlerBase::AuthenticatorAdded dispatches to both immediately and the user gets the Touch ID prompt and the Apple sheet at the same time. The preference option is supposed to fix this but GetPasskeyPreference() is never read anywhere — so right now it's dead API. We should either wire it up or drop it.


On the API shape itself — I think we should rethink the iCloudKeychain option before this lands.

iCloudKeychain: { enabled: boolean } should just be iCloudKeychain: boolean. There's only one knob inside the object once preference moves out (see below), and a single-property object whose only property is enabled is just a boolean with extra steps. We didn't do touchID: { enabled: true, keychainAccessGroup: ... } either — touchID is { keychainAccessGroup } because the access group is the only thing it needs. Same logic.

app.configureWebAuthn({
  touchID: { keychainAccessGroup: 'A1B2C3D4E5.com.example.app.webauthn' },
  iCloudKeychain: true
})

preference doesn't belong inside iCloudKeychain at all — it's a cross-cutting concern about which authenticator handles a given request, not a property of iCloud Keychain itself. As a static string it also can't express anything dynamic (e.g. "iCloud Keychain for create() so it syncs, but Touch ID for get() if a Touch ID credential already exists for this RP", or "ask the user"). And right now it's a no-op anyway since GetPasskeyPreference() is never read.

We should make this event-driven, same shape as select-webauthn-account. Something like a select-webauthn-authenticator event on session:

win.webContents.session.on('select-webauthn-authenticator', (event, details, callback) => {
  // details: { relyingPartyId, requestType: 'create' | 'get',
  //            authenticators: ('touchID' | 'iCloudKeychain')[], frame }
  if (details.requestType === 'create') {
    callback('iCloudKeychain') // sync new credentials
  } else {
    callback(details.authenticators[0]) // first available
  }
})

If no listener is registered we pick a sensible default (probably iCloudKeychain if available, falling back to touchID, since synced is the better UX) — that keeps the zero-config path working. Calling callback() with no args cancels the request, same as select-webauthn-account.

The event also fixes the current bug where configuring both touchID and iCloudKeychain makes both prompts appear simultaneously, because we'd actually be overriding EmbedderControlsAuthenticatorDispatch and only dispatching to the one the app picks.

Comment thread shell/browser/api/electron_api_app.cc Resolved
Comment thread docs/api/app.md Resolved
Comment thread docs/api/app.md Resolved

@MarshallOfSound MarshallOfSound left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking on above review

@MarshallOfSound

Copy link
Copy Markdown
Member

Realised something else digging into the Apple docs — ASAuthorizationPlatformPublicKeyCredentialProvider isn't actually iCloud Keychain specific. On macOS 14+ any password manager with a Credential Provider Extension that supports passkeys (1Password, Bitwarden, Dashlane, Proton Pass, etc.) can fulfill these requests if the user has it enabled in System Settings → Passwords → Password Options. iCloud Keychain is just the default. So app.configureWebAuthn({ iCloudKeychain: true }) on a machine where the user has 1Password as their passkey manager would show the 1Password sheet — the option says iCloud Keychain but iCloud Keychain isn't even involved 😅

We should rename this before it ships. Apple's own API is "Platform Public Key Credential Provider", not "iCloud Keychain Provider", for exactly this reason. Chromium calls their version icloud_keychain but that's legacy naming we shouldn't copy into a public API.

Something like platformPasskeys or systemPasskeys:

app.configureWebAuthn({
  touchID: { keychainAccessGroup: 'A1B2C3D4E5.com.example.app.webauthn' },
  platformPasskeys: true
})

This also makes the select-webauthn-authenticator event from my other comment cleaner — authenticators: ['touchID', 'platform'] doesn't lie about what's behind the system one. The real distinction the app cares about is "Electron's device-bound Secure Enclave authenticator" vs "whatever the user's configured system passkey provider is", not "Touch ID vs iCloud Keychain".

Same goes for the file names / class names (ElectronICloudKeychain*) — we should rename those too so the next person doesn't assume it's iCloud-only. (We probably also still want to keep device::AuthenticatorType::kICloudKeychain as the GetType() return since that's an upstream enum, just worth a comment explaining the mismatch.)

@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch from caf9e90 to fab4e55 Compare May 11, 2026 22:25
@CliftonH
CliftonH requested a review from MarshallOfSound May 11, 2026 22:37
@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch from 1b45e35 to aa2781f Compare May 12, 2026 19:50
@CliftonH CliftonH changed the title feat: add iCloud Keychain passkey support via app.configureWebAuthn() feat: add system passkey support on macOS via app.configureWebAuthn() May 13, 2026
@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch 2 times, most recently from 0d2e3fa to 004e0b0 Compare May 13, 2026 19:47
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label May 15, 2026

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@samuelmaddock samuelmaddock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a few minor comments, but looks great overall!

Comment thread docs/api/session.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR contains unsigned commits. This repository enforces commit signatures
for all incoming PRs. To get your PR merged, please sign those commits
(git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch
(git push --force-with-lease)

For more information on signing commits, see GitHub's documentation on Telling Git about your signing key.

@github-actions github-actions Bot added the needs-signed-commits Currently some or all of the commits in this PR are not signed label Jun 23, 2026
@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch from 243aa32 to 40ba515 Compare June 24, 2026 14:34
@github-actions github-actions Bot removed the needs-signed-commits Currently some or all of the commits in this PR are not signed label Jun 24, 2026

@samuelmaddock samuelmaddock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

CliftonH and others added 3 commits July 29, 2026 14:22
- Reject requests whose clientDataJSON challenge can't be parsed instead of
  falling back to client_data_hash (which Apple re-hashes, breaking RP
  verification). Same in MakeCredential and GetAssertion.
- Reject cross-origin (iframe) ceremonies rather than presenting them to the
  RP as same-origin, since the public API can't carry the frame origin — Apple
  always builds a top-level origin: https://<rpId> clientDataJSON.
- Fail the ceremony when Apple's returned clientDataJSON doesn't validate,
  instead of forwarding Chromium's JSON and stranding a keychain credential
  that can never verify RP-side.
- Reset objc_storage_ at the start of each operation so stale expected
  challenge/origin/type can't bleed across requests.
- Log an actionable DevTools message on ASAuthorizationError 1004, and document
  the signing / provisioning-profile / associated-domain (AASA) requirements
  plus the origin: https://<rpId> expectedOrigin note in app.md.

Co-Authored-By: Claude <[email protected]>
…check

- Map excluded-credential rejections on every supported macOS version: macOS
  13.5-14 surfaces them as WKErrorDomain code 8, macOS 15+ as
  ASAuthorizationErrorMatchedExcludedCredential (1006). Previously only 1006 was
  handled, so create() with a matching excludeCredentials entry returned
  NotAllowedError instead of the spec-required InvalidStateError on 13.5-14.
  Capture the error domain as a string (not a bool) to distinguish the two.
- Correct the stale "1006 was added in macOS 14" comment — it is macOS 15.
- Add a defense-in-depth check that the credential ID in the attested
  authenticator data matches ASAuthorization...Registration.credentialID,
  failing kAuthenticatorResponseInvalid on mismatch. Mirrors Chromium's
  device/fido/mac/icloud_keychain.mm.
- Clarify that the isUVPAA override reports capability, not configuration: a
  misconfigured (unsigned / no embedded profile / no AASA) app still gets true
  and then fails the ceremony with error 1004.

Co-Authored-By: Claude <[email protected]>
Collapse a wrapped executeJavaScript() call onto one line to match oxfmt.

Co-Authored-By: Claude <[email protected]>
@CliftonH
CliftonH force-pushed the integrate-ASAuthorizationController branch from 7bb200a to 4fa2d23 Compare July 29, 2026 21:23

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of #51967 macOS 12 is no longer supported, so we no longer need doc notes for macOS 13+ behavior.

Comment thread docs/api/app.md Resolved
Comment thread docs/api/app.md Resolved
Comment thread docs/api/app.md Resolved
macOS 12 is no longer supported (electron#51967), so macOS 13 is the minimum
deployment target and the "requires macOS 13" caveats are redundant. Remove
them and the now-unreachable "below 13.0 fallback" note. Addresses review
feedback from jkleinsc.

Co-Authored-By: Claude <[email protected]>
@CliftonH
CliftonH requested a review from jkleinsc August 1, 2026 19:24
@VerteDinde
VerteDinde merged commit 050567d into electron:main Aug 6, 2026
72 checks passed
@welcome

welcome Bot commented Aug 6, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk

release-clerk Bot commented Aug 6, 2026

Copy link
Copy Markdown

Release Notes Persisted

Added app.configureWebAuthn() API to enable iCloud Keychain passkey support on macOS. When enabled, navigator.credentials.create() and .get() present Apple's native passkey UI via ASAuthorizationController.

@github-actions github-actions Bot added the 45-x-y label Aug 6, 2026
@CliftonH
CliftonH deleted the integrate-ASAuthorizationController branch September 1, 2026 17:15
@0xdevalias 0xdevalias mentioned this pull request Nov 27, 2026
3 tasks done
leechenghsiu pushed a commit to leechenghsiu/nuphos that referenced this pull request Nov 29, 2026
## Summary

Bumps the Desktop app from Electron 44.10.0 to 45.4.1. Only
`apps/desktop/package.json` and the lockfile change; there are no app
code changes.

Electron 45 ships the macOS system passkey authenticator
(`app.configureWebAuthn({ platformPasskeys: true })`,
electron/electron#51563), which follow-up work on in-app browser
passkeys builds on. This PR doesn't enable it.

45.4.1 is the newest 45.x release that meets the 7-day
`minimum-release-age` policy in `apps/desktop/.npmrc`. 45.5.0 will
follow in a separate PR once it qualifies.

Part of nuphos#4902

## Breaking changes reviewed (Electron 45.0)

- **Sandboxed preloads lose `Buffer`, `setImmediate` and the
`events`/`timers`/`url` shims.** Not affected. The only window preload
belongs to the main window, which is `sandbox: false`. The guest frame
preload (`browser-preload.ts`) imports only `contextBridge`, and the
`electron-chrome-extensions` preload requires only `electron`.
- **Screen capture is reported as `display-capture` instead of
`media`.** No behavior change. The default session handler only inspects
`media`, the microphone, and grants everything else as before. The
in-app browser session still denies everything except clipboard writes.
- **`window.open()` children of unsandboxed windows get their own
process.** Not affected. The main window denies `window.open` and opens
the URL externally.
- **Workers in subframes, DevTools extension preloads, `contentTracing`,
`requestStorageAccessFor`, ASAR file descriptors, and `safeStorage`
deprecations.** Not used.

## Lockfile

The lockfile resolves `[email protected]`. Electron's own dependencies are
unchanged, but re-resolving its subtree points a few entries at
`[email protected]` and `[email protected]`, which were already in the
lockfile. No packages are added.

`node-abi` moves from 4.33.0 to 4.43.0, within `@electron/rebuild`'s
`^4.2.0` range. 4.33.0 has no ABI entry for Electron 45, so rebuilding
`node-pty` failed during packaging.

## Testing

- `tsc -b --noEmit` passes against the Electron 45 types.
- CI, including Desktop against a real backend.
- Manual smoke test on macOS (launch, in-app browser, microphone,
auto-update, helpers) against a non-production backend with a test
account. Results will be posted here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Yuanlin Lin <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

6 participants