Fixed FIDO WebAuthn with FireFox.

Ylian Saint-Hilaire committed May 23, 2022 at 17:38 UTC fd0e349854224f8a788f8a7ec1e5b72a85c4611b
1 file changed +9 -12
views/default.handlebars
+9 -12
@@ -2881,18 +2881,15 @@
2881 var publicKey = message.request;
2882 message.request.challenge = Uint8Array.from(atob(message.request.challenge), function (c) { return c.charCodeAt(0) })
2883 message.request.user.id = Uint8Array.from(atob(message.request.user.id), function (c) { return c.charCodeAt(0) })
2884 - setTimeout(function() {
2885 - navigator.credentials.create({ publicKey: publicKey })
2886 - .then(function(newCredentialInfo) {
2887 - // Public key credential
2888 - 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 };
2889 - meshserver.send({ action: 'webauthn-endregister', response: r });
2890 - setDialogMode(0);
2891 - }, function(error) {
2892 - // Error
2893 - setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error);
2894 - });
2895 - }, 100);
2884 + navigator.credentials.create({ publicKey: publicKey }).then(function(newCredentialInfo) {
2885 + // Public key credential
2886 + 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 };
2887 + meshserver.send({ action: 'webauthn-endregister', response: r });
2888 + setDialogMode(0);
2889 + }, function(error) {
2890 + // Error
2891 + setDialogMode(2, "Add Security Key", 1, null, "ERROR: " + error);
2892 + });
2893 break;
2894 }
2895 case 'verifyPhone': {