summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/browser/src')
-rw-r--r--packages/browser/src/methods/startAuthentication.test.ts17
-rw-r--r--packages/browser/src/methods/startAuthentication.ts1
-rw-r--r--packages/browser/src/methods/startRegistration.test.ts17
-rw-r--r--packages/browser/src/methods/startRegistration.ts1
4 files changed, 36 insertions, 0 deletions
diff --git a/packages/browser/src/methods/startAuthentication.test.ts b/packages/browser/src/methods/startAuthentication.test.ts
index 6f1b87b..b246cb0 100644
--- a/packages/browser/src/methods/startAuthentication.test.ts
+++ b/packages/browser/src/methods/startAuthentication.test.ts
@@ -287,6 +287,23 @@ test('should throw error if no acceptable <input> is found', async () => {
rejected.toThrow(/no <input>/i);
});
+test('should return authenticatorAttachment if present', async () => {
+ // Mock extension return values from authenticator
+ mockNavigatorGet.mockImplementation((): Promise<any> => {
+ return new Promise(resolve => {
+ resolve({
+ response: {},
+ getClientExtensionResults: () => {},
+ authenticatorAttachment: 'cross-platform',
+ });
+ });
+ });
+
+ const response = await startAuthentication(goodOpts1);
+
+ expect(response.authenticatorAttachment).toEqual('cross-platform');
+});
+
describe('WebAuthnError', () => {
describe('AbortError', () => {
const AbortError = generateCustomError('AbortError');
diff --git a/packages/browser/src/methods/startAuthentication.ts b/packages/browser/src/methods/startAuthentication.ts
index 7887228..e99629c 100644
--- a/packages/browser/src/methods/startAuthentication.ts
+++ b/packages/browser/src/methods/startAuthentication.ts
@@ -107,5 +107,6 @@ export async function startAuthentication(
},
type,
clientExtensionResults: credential.getClientExtensionResults(),
+ authenticatorAttachment: credential.authenticatorAttachment,
};
}
diff --git a/packages/browser/src/methods/startRegistration.test.ts b/packages/browser/src/methods/startRegistration.test.ts
index 93400c4..ddc2d6a 100644
--- a/packages/browser/src/methods/startRegistration.test.ts
+++ b/packages/browser/src/methods/startRegistration.test.ts
@@ -223,6 +223,23 @@ test('should cancel an existing call when executed again', async () => {
expect(abortSpy).toHaveBeenCalledTimes(1);
});
+test('should return authenticatorAttachment if present', async () => {
+ // Mock extension return values from authenticator
+ mockNavigatorCreate.mockImplementation((): Promise<any> => {
+ return new Promise(resolve => {
+ resolve({
+ response: {},
+ getClientExtensionResults: () => {},
+ authenticatorAttachment: 'cross-platform',
+ });
+ });
+ });
+
+ const response = await startRegistration(goodOpts1);
+
+ expect(response.authenticatorAttachment).toEqual('cross-platform');
+});
+
describe('WebAuthnError', () => {
describe('AbortError', () => {
const AbortError = generateCustomError('AbortError');
diff --git a/packages/browser/src/methods/startRegistration.ts b/packages/browser/src/methods/startRegistration.ts
index 80fbe31..c9749b1 100644
--- a/packages/browser/src/methods/startRegistration.ts
+++ b/packages/browser/src/methods/startRegistration.ts
@@ -66,6 +66,7 @@ export async function startRegistration(
},
type,
clientExtensionResults: credential.getClientExtensionResults(),
+ authenticatorAttachment: credential.authenticatorAttachment,
};
/**