summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/helpers/identifyAuthenticationError.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-08-18 13:59:11 -0700
committerMatthew Miller <matthew@millerti.me>2023-08-18 13:59:11 -0700
commita59634a1a9b0393622fb121fbe229132c01a2624 (patch)
treecb4eb3fdf778dfc88d6d389b609b1cef6ebb4b4d /packages/browser/src/helpers/identifyAuthenticationError.ts
parente0d32bd2a3a60b4b2fd96a2874eae3ad976483df (diff)
Use single-quotes and increase line width
Diffstat (limited to 'packages/browser/src/helpers/identifyAuthenticationError.ts')
-rw-r--r--packages/browser/src/helpers/identifyAuthenticationError.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/browser/src/helpers/identifyAuthenticationError.ts b/packages/browser/src/helpers/identifyAuthenticationError.ts
index 3d84ce2..78732b2 100644
--- a/packages/browser/src/helpers/identifyAuthenticationError.ts
+++ b/packages/browser/src/helpers/identifyAuthenticationError.ts
@@ -1,5 +1,5 @@
-import { isValidDomain } from "./isValidDomain";
-import { WebAuthnError } from "./webAuthnError";
+import { isValidDomain } from './isValidDomain';
+import { WebAuthnError } from './webAuthnError';
/**
* Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`
@@ -14,52 +14,52 @@ export function identifyAuthenticationError({
const { publicKey } = options;
if (!publicKey) {
- throw Error("options was missing required publicKey property");
+ throw Error('options was missing required publicKey property');
}
- if (error.name === "AbortError") {
+ if (error.name === 'AbortError') {
if (options.signal instanceof AbortSignal) {
// https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)
return new WebAuthnError({
- message: "Authentication ceremony was sent an abort signal",
- code: "ERROR_CEREMONY_ABORTED",
+ message: 'Authentication ceremony was sent an abort signal',
+ code: 'ERROR_CEREMONY_ABORTED',
cause: error,
});
}
- } else if (error.name === "NotAllowedError") {
+ } else if (error.name === 'NotAllowedError') {
/**
* Pass the error directly through. Platforms are overloading this error beyond what the spec
* defines and we don't want to overwrite potentially useful error messages.
*/
return new WebAuthnError({
message: error.message,
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
+ code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',
cause: error,
});
- } else if (error.name === "SecurityError") {
+ } else if (error.name === 'SecurityError') {
const effectiveDomain = window.location.hostname;
if (!isValidDomain(effectiveDomain)) {
// https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 5)
return new WebAuthnError({
message: `${window.location.hostname} is an invalid domain`,
- code: "ERROR_INVALID_DOMAIN",
+ code: 'ERROR_INVALID_DOMAIN',
cause: error,
});
} else if (publicKey.rpId !== effectiveDomain) {
// https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 6)
return new WebAuthnError({
message: `The RP ID "${publicKey.rpId}" is invalid for this domain`,
- code: "ERROR_INVALID_RP_ID",
+ code: 'ERROR_INVALID_RP_ID',
cause: error,
});
}
- } else if (error.name === "UnknownError") {
+ } else if (error.name === 'UnknownError') {
// https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 1)
// https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 12)
return new WebAuthnError({
message:
- "The authenticator was unable to process the specified options, or could not create a new assertion signature",
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
+ 'The authenticator was unable to process the specified options, or could not create a new assertion signature',
+ code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',
cause: error,
});
}