diff options
Diffstat (limited to 'packages/browser/src')
-rw-r--r-- | packages/browser/src/methods/startRegistration.ts | 17 | ||||
-rw-r--r-- | packages/browser/src/setupTests.ts | 1 |
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 |