test key support BEFORE creating keys

This commit is contained in:
AJ ONeal 2018-11-10 18:50:05 +00:00
parent 268f83b49e
commit 95e807be73
1 changed files with 23 additions and 18 deletions

View File

@ -48,7 +48,8 @@
});
});
}
testEcdsaSupport().then(function () {
function testKeypairSupport() {
return testEcdsaSupport().then(function () {
console.info("[crypto] ECDSA is supported");
BROWSER_SUPPORTS_ECDSA = true;
localStorage.setItem('version', '1');
@ -60,20 +61,24 @@
// fix previous firefox browsers
if (!localStorage.getItem('version')) {
localStorage.clear();
localStorage.getItem('version', '1');
localStorage.setItem('version', '1');
}
// DO NOT RETURN HERE
testRsaSupport().then(function () {
return false;
});
}
testKeypairSupport().then(function (ecdsaSupport) {
if (ecdsaSupport) {
return true;
}
return testRsaSupport().then(function () {
console.info('[crypto] RSA is supported');
}).catch(function (err) {
console.error('[crypto] could not use either EC nor RSA.');
console.error(err);
window.alert("Your browser is cryptography support (neither RSA or EC is usable). Please use Chrome, Firefox, or Safari.");
});
// RETURN HERE
return false;
});
var apiUrl = 'https://acme-{{env}}.api.letsencrypt.org/directory';
@ -238,7 +243,7 @@
if (jwk) {
p = PromiseA.resolve(jwk);
} else {
p = createKeypair();
p = testKeypairSupport().then(createKeypair);
}
function createAccount(jwk) {