summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/identifyRegistrationError.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/browser/src/helpers/identifyRegistrationError.ts')
-rw-r--r--packages/browser/src/helpers/identifyRegistrationError.ts20
1 files changed, 9 insertions, 11 deletions
diff --git a/packages/browser/src/helpers/identifyRegistrationError.ts b/packages/browser/src/helpers/identifyRegistrationError.ts
index 45e34d7..faa7a1e 100644
--- a/packages/browser/src/helpers/identifyRegistrationError.ts
+++ b/packages/browser/src/helpers/identifyRegistrationError.ts
@@ -19,24 +19,22 @@ export function identifyRegistrationError({ error, options }: {
if (publicKey.authenticatorSelection?.requireResidentKey === true) {
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 4)
return new WebAuthnError(
- 'Discoverable credentials were required but no available authenticator supported it',
+ 'Discoverable credentials were required but no available authenticator supported it (ConstraintError)',
);
} else if (publicKey.authenticatorSelection?.userVerification === 'required') {
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 5)
return new WebAuthnError(
- 'User verification was required but no available authenticator supported it',
+ 'User verification was required but no available authenticator supported it (ConstraintError)',
);
}
} else if (error.name === 'InvalidStateError') {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 3)
- return new WebAuthnError(
- 'The authenticator was previously registered',
- );
+ return new WebAuthnError('The authenticator was previously registered (InvalidStateError)');
} else if (error.name === 'NotAllowedError') {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 21)
- return new WebAuthnError('User clicked cancel, or the registration ceremony timed out');
+ return new WebAuthnError('User clicked cancel, or the registration ceremony timed out (NotAllowedError)');
} else if (error.name === 'NotSupportedError') {
const validPubKeyCredParams = publicKey.pubKeyCredParams.filter(
(param) => param.type === 'public-key',
@@ -44,21 +42,21 @@ export function identifyRegistrationError({ error, options }: {
if (validPubKeyCredParams.length === 0) {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 10)
- return new WebAuthnError('No entry in pubKeyCredParams was of type "public-key"');
+ return new WebAuthnError('No entry in pubKeyCredParams was of type "public-key" (NotSupportedError)');
}
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 2)
return new WebAuthnError(
- 'No available authenticator supported any of the specified pubKeyCredParams algorithms',
+ 'No available authenticator supported any of the specified pubKeyCredParams algorithms (NotSupportedError)',
);
} else if (error.name === 'SecurityError') {
const effectiveDomain = window.location.hostname;
if (!isValidDomain(effectiveDomain)) {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 7)
- return new WebAuthnError(`${window.location.hostname} is an invalid domain`);
+ return new WebAuthnError(`${window.location.hostname} is an invalid domain (SecurityError)`);
} else if (publicKey.rp.id !== effectiveDomain) {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 8)
- return new WebAuthnError(`The RP ID "${publicKey.rp.id}" is invalid for this domain`);
+ return new WebAuthnError(`The RP ID "${publicKey.rp.id}" is invalid for this domain (SecurityError)`);
}
} else if (error.name === 'TypeError') {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 5)
@@ -67,7 +65,7 @@ export function identifyRegistrationError({ error, options }: {
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 1)
// https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 8)
return new WebAuthnError(
- 'The authenticator was unable to process the specified options, or could not create a new credential'
+ 'The authenticator was unable to process the specified options, or could not create a new credential (UnknownError)'
);
}