summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-09-28 08:23:38 -0700
committerGitHub <noreply@github.com>2023-09-28 08:23:38 -0700
commit58d508e9534b0c640faecbba704b5deb1b53d6d5 (patch)
treec9e448b0bf60d4896706edd15104d9ea67151750 /packages/browser/src
parenta71c6b34e65c82b17a562bf207eac28523f9ee1a (diff)
parentbddfabb5c5331f5c172ead16851f0611997b12b6 (diff)
Merge pull request #447 from MasterKale/feat/good-webauthn-stewardship
feat/good-webauthn-stewardship
Diffstat (limited to 'packages/browser/src')
-rw-r--r--packages/browser/src/methods/startRegistration.ts17
-rw-r--r--packages/browser/src/setupTests.ts1
2 files changed, 15 insertions, 3 deletions
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index 9f4a104..2ad3089 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -70,7 +70,7 @@ export async function startRegistration(
try {
responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
} catch (error) {
- // pass
+ warnOnBrokenImplementation('getPublicKeyAlgorithm()', error as Error);
}
}
@@ -82,7 +82,7 @@ export async function startRegistration(
responsePublicKey = bufferToBase64URLString(_publicKey);
}
} catch (error) {
- // pass
+ warnOnBrokenImplementation('getPublicKey()', error as Error);
}
}
@@ -94,7 +94,7 @@ export async function startRegistration(
response.getAuthenticatorData(),
);
} catch (error) {
- // pass
+ warnOnBrokenImplementation('getAuthenticatorData()', error as Error);
}
}
@@ -116,3 +116,14 @@ export async function startRegistration(
),
};
}
+
+/**
+ * Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API
+ * calls
+ */
+function warnOnBrokenImplementation(methodName: string, cause: Error): void {
+ console.warn(
+ `The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\n`,
+ cause,
+ );
+}
diff --git a/packages/browser/src/setupTests.ts b/packages/browser/src/setupTests.ts
index 2ac528a..db41d57 100644
--- a/packages/browser/src/setupTests.ts
+++ b/packages/browser/src/setupTests.ts
@@ -2,6 +2,7 @@
// jest.spyOn(console, 'log').mockImplementation();
// jest.spyOn(console, 'debug').mockImplementation();
// jest.spyOn(console, 'error').mockImplementation();
+jest.spyOn(console, 'warn').mockImplementation();
/**
* JSDom doesn't seem to support `credentials`, so let's define them here so we can mock their