From 323f3c589eb68d452730709d9fafaa2e3582c226 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Wed, 23 Jul 2025 21:56:34 -0700 Subject: [PATCH] Make user handle a non-zero value The specification says: > The user handle MUST NOT be empty, though it MAY be null. Source: https://www.w3.org/TR/webauthn-2/#dom-publickeycredentialuserentity-id Some authenticators (e.g., Windows Hello) consider `new ArrayBuffer(0)` to be invalid, others (e.g., 1Password) consider it to be valid. Setting `id` to a non-zero value enables wider compatibility. --- script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.js b/script.js index 75c442c..b2cc09e 100644 --- a/script.js +++ b/script.js @@ -8,7 +8,7 @@ async function createPrf() { return navigator.credentials.create({ publicKey: { rp: { name: '' }, - user: { id: new ArrayBuffer(0), name: '', displayName: '' }, + user: { id: new ArrayBuffer(1), name: '', displayName: '' }, pubKeyCredParams: [{ type: 'public-key', alg: -8 }, { type: 'public-key', alg: -7 }, { type: 'public-key', alg: -257 }], extensions: { prf: { eval: { first: new ArrayBuffer(0) } } }, challenge: new ArrayBuffer(0) -- 2.47.3