From fd0e349854224f8a788f8a7ec1e5b72a85c4611b Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 23 May 2022 17:38:38 -0700 Subject: [PATCH] Fixed FIDO WebAuthn with FireFox. --- views/default.handlebars | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/views/default.handlebars b/views/default.handlebars index a84a6359..d991f361 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2881,18 +2881,15 @@ var publicKey = message.request; message.request.challenge = Uint8Array.from(atob(message.request.challenge), function (c) { return c.charCodeAt(0) }) message.request.user.id = Uint8Array.from(atob(message.request.user.id), function (c) { return c.charCodeAt(0) }) - setTimeout(function() { - navigator.credentials.create({ publicKey: publicKey }) - .then(function(newCredentialInfo) { - // Public key credential - var r = { rawId: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.rawId))), response: { attestationObject: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.attestationObject))), clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.clientDataJSON))) }, type: newCredentialInfo.type }; - meshserver.send({ action: 'webauthn-endregister', response: r }); - setDialogMode(0); - }, function(error) { - // Error - setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error); - }); - }, 100); + navigator.credentials.create({ publicKey: publicKey }).then(function(newCredentialInfo) { + // Public key credential + var r = { rawId: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.rawId))), response: { attestationObject: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.attestationObject))), clientDataJSON: btoa(String.fromCharCode.apply(null, new Uint8Array(newCredentialInfo.response.clientDataJSON))) }, type: newCredentialInfo.type }; + meshserver.send({ action: 'webauthn-endregister', response: r }); + setDialogMode(0); + }, function(error) { + // Error + setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error); + }); break; } case 'verifyPhone': {