Skip to content

Commit

Permalink
Identify new possible user verification error
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterKale committed Oct 6, 2024
1 parent 9315fbf commit 7952bb8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/browser/src/helpers/identifyRegistrationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export function identifyRegistrationError({
code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',
cause: error,
});
} else if (
// @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
options.mediation === 'conditional' &&
publicKey.authenticatorSelection?.userVerification === 'required'
) {
// https://w3c.github.io/webauthn/#sctn-createCredential (Step 22.4)
return new WebAuthnError({
message:
'User verification was required during automatic registration but it could not be performed',
code: 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',
cause: error,
});
} else if (
publicKey.authenticatorSelection?.userVerification === 'required'
) {
Expand Down
1 change: 1 addition & 0 deletions packages/browser/src/helpers/webAuthnError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ export type WebAuthnErrorCode =
| 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT'
| 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED'
| 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG'
| 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE'
| 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY';

0 comments on commit 7952bb8

Please sign in to comment.