summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startRegistration.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-09-27 22:42:59 -0700
committerGitHub <noreply@github.com>2023-09-27 22:42:59 -0700
commit75fb63dc3de2cb9dede7e31c88f5ec29d3db1a29 (patch)
treeb5ceff5d86dfd51bf483eac3d0505463cfcc4af8 /packages/browser/src/methods/startRegistration.ts
parent631ffb451525b33a2a4bc1f85a14a6105fb3ba47 (diff)
parentdc9965a4653cf8cd9662fab0f638a68c8463ec21 (diff)
Merge pull request #443 from MasterKale/fix/438-handle-bad-publickey-getters
fix/438-handle-bad-publickey-getters
Diffstat (limited to 'packages/browser/src/methods/startRegistration.ts')
-rw-r--r--packages/browser/src/methods/startRegistration.ts26
1 files changed, 19 insertions, 7 deletions
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index 74da7fd..9f4a104 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -67,23 +67,35 @@ export async function startRegistration(
// L3 says this is required, but browser and webview support are still not guaranteed.
let responsePublicKeyAlgorithm: number | undefined = undefined;
if (typeof response.getPublicKeyAlgorithm === 'function') {
- responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
+ try {
+ responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
+ } catch (error) {
+ // pass
+ }
}
let responsePublicKey: string | undefined = undefined;
if (typeof response.getPublicKey === 'function') {
- const _publicKey = response.getPublicKey();
- if (_publicKey !== null) {
- responsePublicKey = bufferToBase64URLString(_publicKey);
+ try {
+ const _publicKey = response.getPublicKey();
+ if (_publicKey !== null) {
+ responsePublicKey = bufferToBase64URLString(_publicKey);
+ }
+ } catch (error) {
+ // pass
}
}
// L3 says this is required, but browser and webview support are still not guaranteed.
let responseAuthenticatorData: string | undefined;
if (typeof response.getAuthenticatorData === 'function') {
- responseAuthenticatorData = bufferToBase64URLString(
- response.getAuthenticatorData(),
- );
+ try {
+ responseAuthenticatorData = bufferToBase64URLString(
+ response.getAuthenticatorData(),
+ );
+ } catch (error) {
+ // pass
+ }
}
return {