demo · v131

Use getClientCapabilities to gate conditional UI

The motivating use case for the new method: a sign-in form decides whether to show the autofill-style "Sign in with passkey" affordance in the username field. That requires conditionalCreate AND conditionalGet. Pre-131 you had to call isConditionalMediationAvailable() separately for each; post-131 one call returns the whole capability map.

capability map

capabilityvalue

rendered sign-in form

conditional ui available

autofill passkey

fallback

explicit button

the api

// before 131 - three separate awaits
const a = await PublicKeyCredential.isConditionalMediationAvailable();
const b = await PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();
const c = await PublicKeyCredential.isExternalCTAP2SecurityKeySupported?.();

// 131 - one call
const caps = await PublicKeyCredential.getClientCapabilities();
// { conditionalGet: true, conditionalCreate: true, hybridTransport: true,
//   userVerifyingPlatformAuthenticator: true, ... }

see also