summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startAssertion.ts
diff options
context:
space:
mode:
authorAntoine Cormouls <contact.antoine.cormouls@gmail.com>2020-12-04 15:01:35 +0100
committerAntoine Cormouls <contact.antoine.cormouls@gmail.com>2020-12-04 15:01:35 +0100
commit5f508216dc3ee38a7f17c038b367e8575ab14929 (patch)
treebf95db1232a6aa8dba52eea31ec6840d3eaca977 /packages/browser/src/methods/startAssertion.ts
parent4f1a0ab1225a34788d3c1f9bf4a9c0b7cc31b17b (diff)
Optional Allow Credential
Diffstat (limited to 'packages/browser/src/methods/startAssertion.ts')
-rw-r--r--packages/browser/src/methods/startAssertion.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/browser/src/methods/startAssertion.ts b/packages/browser/src/methods/startAssertion.ts
index 09e416f..fbc6f59 100644
--- a/packages/browser/src/methods/startAssertion.ts
+++ b/packages/browser/src/methods/startAssertion.ts
@@ -25,7 +25,12 @@ export default async function startAssertion(
const publicKey: PublicKeyCredentialRequestOptions = {
...requestOptionsJSON,
challenge: base64URLStringToBuffer(requestOptionsJSON.challenge),
- allowCredentials: requestOptionsJSON.allowCredentials.map(toPublicKeyCredentialDescriptor),
+ // We need to avoid passing empty array to avoid blocking retrieval
+ // of public key
+ allowCredentials:
+ requestOptionsJSON.allowCredentials?.length === 0
+ ? undefined
+ : requestOptionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor),
};
// Wait for the user to complete assertion