summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startRegistration.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-06-20 11:12:07 -0700
committerMatthew Miller <matthew@millerti.me>2022-06-20 11:12:16 -0700
commitf6f23e7207c79b2eefd7c003a20f55963b50cd7a (patch)
tree5a6303f03b07f15bef53e4fa1a0df98a5863154d /packages/browser/src/methods/startRegistration.ts
parent379ff5c35c7578aed1ff2b78263ab3c2dd2f4873 (diff)
Rearrange `options` for easier typing
Diffstat (limited to 'packages/browser/src/methods/startRegistration.ts')
-rw-r--r--packages/browser/src/methods/startRegistration.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index 237744f..f7149d7 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -35,13 +35,14 @@ export async function startRegistration(
excludeCredentials: creationOptionsJSON.excludeCredentials.map(toPublicKeyCredentialDescriptor),
};
+ // Finalize options
const options: CredentialCreationOptions = { publicKey };
+ // Set up the ability to cancel this request if the user attempts another
+ options.signal = webauthnAbortService.createNewAbortSignal();
// Wait for the user to complete attestation
let credential;
try {
- // Set up the ability to cancel this request if the user attempts another
- options.signal = webauthnAbortService.createNewAbortSignal();
credential = (await navigator.credentials.create(options)) as RegistrationCredential;
} catch (err) {
throw identifyRegistrationError({ error: err as Error, options });