diff options
author | Matthew Miller <matthew@millerti.me> | 2022-06-17 23:03:46 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-06-17 23:03:46 -0700 |
commit | 6b1f531754a2816bc4d0a0ea51543a1c6ba54316 (patch) | |
tree | 06d92d992cb01653d436fb1d6999c11cb30ba793 /packages/browser/src/methods/startAuthentication.ts | |
parent | 0c62c20f32514079e904f2925d73bf46d670cf20 (diff) |
Create WebAuthnAbortService for abort signal mgmt
Diffstat (limited to 'packages/browser/src/methods/startAuthentication.ts')
-rw-r--r-- | packages/browser/src/methods/startAuthentication.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts index a12c8fd..6777b45 100644 --- a/packages/browser/src/methods/startAuthentication.ts +++ b/packages/browser/src/methods/startAuthentication.ts @@ -11,6 +11,7 @@ import { browserSupportsWebauthn } from '../helpers/browserSupportsWebauthn'; import { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsConditionalMediation'; import toPublicKeyCredentialDescriptor from '../helpers/toPublicKeyCredentialDescriptor'; import { identifyAuthenticationError } from '../helpers/identifyAuthenticationError'; +import { webauthnAbortService } from '../helpers/webAuthnAbortService'; /** * Begin authenticator "login" via WebAuthn assertion @@ -70,6 +71,8 @@ export default async function startAuthentication( // Wait for the user to complete assertion let credential; try { + // Set up the ability to cancel this request if the user attempts another + options.signal = webauthnAbortService.createNewAbortSignal(); credential = (await navigator.credentials.get(options)) as AuthenticationCredential; } catch (err) { throw identifyAuthenticationError({ error: err as Error, options }); |