More WebAuthn/FIDO2 server fixes.

Ylian Saint-Hilaire committed Mar 24, 2019 at 22:48 UTC d63639fc62d23c791560476e7fd99d667ecc0074
1 file changed +4 -2
meshuser.js
+4 -2
@@ -2022,8 +2022,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
2022 clientAttestationResponse.response.clientDataJSON = new Uint8Array(Buffer.from(clientAttestationResponse.response.clientDataJSON, 'base64')).buffer;
2023
2024 parent.f2l.attestationResult(clientAttestationResponse, attestationExpectations).then(function (regResult) {
2025 - // If we register a WebAuthn/FIDO2 key, remove all U2F keys.
2026 - // TODO
2025 + // Since we are registering a WebAuthn/FIDO2 key, remove all U2F keys (Type 1).
2026 + var otphkeys2 = [];
2027 + for (var i = 0; i < user.otphkeys.length; i++) { if (user.otphkeys[i].type != 1) { otphkeys2.push(user.otphkeys[i]); } }
2028 + user.otphkeys = otphkeys2;
2029
2030 // Add the new WebAuthn/FIDO2 keys
2031 var keyIndex = parent.crypto.randomBytes(4).readUInt32BE(0);