diff options
author | Matthew Miller <matthew@millerti.me> | 2023-08-22 10:13:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 10:13:03 -0700 |
commit | fefc95e4535e6ecf903f647124a492fba3fd11d6 (patch) | |
tree | 4c924d43d32fb12a780533302eaf5dee08875d75 /packages/browser/src/methods/startAuthentication.ts | |
parent | 443c341bc2163f07b93a3ef84a43294d10b826f8 (diff) | |
parent | 2935857c76d458c26701842e500f8d97d17499c5 (diff) |
Merge pull request #425 from MasterKale/feat/server-esm-take-2-dnt
feat/server-esm-take-2-dnt
Diffstat (limited to 'packages/browser/src/methods/startAuthentication.ts')
-rw-r--r-- | packages/browser/src/methods/startAuthentication.ts | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts index cce28e7..f6782ab 100644 --- a/packages/browser/src/methods/startAuthentication.ts +++ b/packages/browser/src/methods/startAuthentication.ts @@ -1,7 +1,7 @@ import { - PublicKeyCredentialRequestOptionsJSON, AuthenticationCredential, AuthenticationResponseJSON, + PublicKeyCredentialRequestOptionsJSON, } from '@simplewebauthn/typescript-types'; import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString'; @@ -33,7 +33,9 @@ export async function startAuthentication( // of public key let allowCredentials; if (requestOptionsJSON.allowCredentials?.length !== 0) { - allowCredentials = requestOptionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor); + allowCredentials = requestOptionsJSON.allowCredentials?.map( + toPublicKeyCredentialDescriptor, + ); } // We need to convert some values to Uint8Arrays before passing the credentials to the navigator @@ -56,11 +58,15 @@ export async function startAuthentication( } // Check for an <input> with "webauthn" in its `autocomplete` attribute - const eligibleInputs = document.querySelectorAll("input[autocomplete*='webauthn']"); + const eligibleInputs = document.querySelectorAll( + 'input[autocomplete*=\'webauthn\']', + ); // WebAuthn autofill requires at least one valid input if (eligibleInputs.length < 1) { - throw Error('No <input> with `"webauthn"` in its `autocomplete` attribute was detected'); + throw Error( + 'No <input> with `"webauthn"` in its `autocomplete` attribute was detected', + ); } // `CredentialMediationRequirement` doesn't know about "conditional" yet as of @@ -106,6 +112,8 @@ export async function startAuthentication( }, type, clientExtensionResults: credential.getClientExtensionResults(), - authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment), + authenticatorAttachment: toAuthenticatorAttachment( + credential.authenticatorAttachment, + ), }; } |