summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startAuthentication.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-12-27 22:02:11 -0800
committerGitHub <noreply@github.com>2022-12-27 22:02:11 -0800
commit76c7a46b60b1093e9e71f38670175bee45512473 (patch)
tree686adb3a370e68f76541400740a0b722350d8705 /packages/browser/src/methods/startAuthentication.ts
parent495c0881367ec3017553f74c3c826fb68cfd407f (diff)
parent08f7f69b221ce33b4bfa6108493fe20d0b7f93b0 (diff)
Merge pull request #320 from MasterKale/feat/webauthn-L3-json-types
feat/webauthn-L3-json-types
Diffstat (limited to 'packages/browser/src/methods/startAuthentication.ts')
-rw-r--r--packages/browser/src/methods/startAuthentication.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts
index 761a96c..cce28e7 100644
--- a/packages/browser/src/methods/startAuthentication.ts
+++ b/packages/browser/src/methods/startAuthentication.ts
@@ -1,7 +1,7 @@
import {
PublicKeyCredentialRequestOptionsJSON,
AuthenticationCredential,
- AuthenticationCredentialJSON,
+ AuthenticationResponseJSON,
} from '@simplewebauthn/typescript-types';
import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString';
@@ -12,18 +12,19 @@ import { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAu
import { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor';
import { identifyAuthenticationError } from '../helpers/identifyAuthenticationError';
import { webauthnAbortService } from '../helpers/webAuthnAbortService';
+import { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment';
/**
* Begin authenticator "login" via WebAuthn assertion
*
- * @param requestOptionsJSON Output from **@simplewebauthn/server**'s generateAssertionOptions(...)
+ * @param requestOptionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`
* @param useBrowserAutofill Initialize conditional UI to enable logging in via browser
* autofill prompts
*/
export async function startAuthentication(
requestOptionsJSON: PublicKeyCredentialRequestOptionsJSON,
useBrowserAutofill = false,
-): Promise<AuthenticationCredentialJSON> {
+): Promise<AuthenticationResponseJSON> {
if (!browserSupportsWebAuthn()) {
throw new Error('WebAuthn is not supported in this browser');
}
@@ -105,6 +106,6 @@ export async function startAuthentication(
},
type,
clientExtensionResults: credential.getClientExtensionResults(),
- authenticatorAttachment: credential.authenticatorAttachment,
+ authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),
};
}