From 41f7d867aa407c1a9a528e298542719860cab65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Wed, 8 Apr 2026 13:20:44 +0200 Subject: [PATCH] Handle the lack of userHandle better in demo Previously, if the key was not resident, userHandle wouldn't be null, and an empty string userHandle would be passed. This would later crash in the controller. --- Demo/wwwroot/js/usernameless.login.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demo/wwwroot/js/usernameless.login.js b/Demo/wwwroot/js/usernameless.login.js index 341e999b..d9b7905f 100644 --- a/Demo/wwwroot/js/usernameless.login.js +++ b/Demo/wwwroot/js/usernameless.login.js @@ -78,7 +78,7 @@ async function verifyAssertionWithServer(assertedCredential) { let clientDataJSON = new Uint8Array(assertedCredential.response.clientDataJSON); let rawId = new Uint8Array(assertedCredential.rawId); let sig = new Uint8Array(assertedCredential.response.signature); - let userHandle = new Uint8Array(assertedCredential.response.userHandle) + let userHandle = assertedCredential.response.userHandle ? new Uint8Array(assertedCredential.response.userHandle) : null; const data = { id: assertedCredential.id, rawId: coerceToBase64Url(rawId), @@ -87,7 +87,7 @@ async function verifyAssertionWithServer(assertedCredential) { response: { authenticatorData: coerceToBase64Url(authData), clientDataJSON: coerceToBase64Url(clientDataJSON), - userHandle: userHandle !== null ? coerceToBase64Url(userHandle): null, + userHandle: userHandle ? coerceToBase64Url(userHandle): null, signature: coerceToBase64Url(sig) } };