Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error message if authenticator does not support PRF #122

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

emlun
Copy link
Member

@emlun emlun commented Nov 24, 2023

Adds an error message in case the browser is PRF compatible but the authenticator (security key) is not, as described in #81 (comment) .

screenshot-2023-11-24T12:27:06+01:00

The "learn more" link leads to the PRF compatibility documentation.

Testing

To test this, you'll either need an authenticator that supports passkeys but not the hmac-secret extension (so an iPhone would probably work?), or to run this snippet in the developer console before clicking the "Sign up with passkey" button:

origCreate = navigator.credentials.create;
navigator.credentials.create = async function(options) {
  options.publicKey.authenticatorSelection.residentKey = "discouraged";
  options.publicKey.authenticatorSelection.userVerification = "discouraged";
  const pkc = await origCreate.call(this, options);
  return {
    authenticatorAttachment: pkc.authenticatorAttachment,
    id: pkc.id,
    rawId: pkc.rawId,
    response: pkc.response,
    type: pkc.type,
    getClientExtensionResults: () => ({ prf: { enabled: false } }),
  };
}

This snippet simulates the incompatibility by overriding the PRF extension output with what it would look like if the browser supports PRF but the authenticator does not.

Alternatively, if you have a pre-FIDO2 (U2F) security key (for example a YubiKey NEO), you can use this snippet instead:

origCreate = navigator.credentials.create;
navigator.credentials.create = function(options) {
  options.publicKey.authenticatorSelection.residentKey = "discouraged";
  options.publicKey.authenticatorSelection.userVerification = "discouraged";
  return origCreate.call(this, options);
}

This instead disables the requirement that the security key must support passkeys (PIN and discoverable keys), which results in a PublicKeyCredential result that genuinely reflects what happens if the browser supports PRF but the security key does not support the hmac-secret CTAP extension.

@pstamatop pstamatop merged commit 9d5cbc3 into master Nov 29, 2023
@emlun emlun deleted the authenticator-prf-incompat branch December 1, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants