diff options
Diffstat (limited to 'packages/browser/src')
-rw-r--r-- | packages/browser/src/helpers/webAuthnAbortService.ts | 4 | ||||
-rw-r--r-- | packages/browser/src/methods/startAuthentication.ts | 2 | ||||
-rw-r--r-- | packages/browser/src/methods/startRegistration.ts | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/packages/browser/src/helpers/webAuthnAbortService.ts b/packages/browser/src/helpers/webAuthnAbortService.ts index 35e2f29..2107a5b 100644 --- a/packages/browser/src/helpers/webAuthnAbortService.ts +++ b/packages/browser/src/helpers/webAuthnAbortService.ts @@ -18,6 +18,10 @@ class WebAuthnAbortService { this.controller = new AbortController(); return this.controller.signal; } + + reset() { + this.controller = undefined; + } } export const webauthnAbortService = new WebAuthnAbortService(); diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts index 0ab7e6b..f4c3bb5 100644 --- a/packages/browser/src/methods/startAuthentication.ts +++ b/packages/browser/src/methods/startAuthentication.ts @@ -82,6 +82,8 @@ export async function startAuthentication( credential = (await navigator.credentials.get(options)) as AuthenticationCredential; } catch (err) { throw identifyAuthenticationError({ error: err as Error, options }); + } finally { + webauthnAbortService.reset(); } if (!credential) { diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts index f7149d7..80fbe31 100644 --- a/packages/browser/src/methods/startRegistration.ts +++ b/packages/browser/src/methods/startRegistration.ts @@ -46,6 +46,8 @@ export async function startRegistration( credential = (await navigator.credentials.create(options)) as RegistrationCredential; } catch (err) { throw identifyRegistrationError({ error: err as Error, options }); + } finally { + webauthnAbortService.reset(); } if (!credential) { |