Now uses RSA keys for firefox browser.

This commit is contained in:
John Shaver 2018-11-09 13:57:59 -08:00
parent bddf85dfe6
commit 6f188cefb8
1 changed files with 20 additions and 8 deletions

View File

@ -1,6 +1,7 @@
(function () {
'use strict';
var BROWSER_SUPPORTS_ECDSA = navigator.userAgent.toLowerCase().indexOf('firefox') === -1;
var $qs = function (s) { return window.document.querySelector(s); };
var $qsa = function (s) { return window.document.querySelectorAll(s); };
var info = {};
@ -321,7 +322,7 @@
});
}).catch(function (err) {
console.error('Step \'' + i + '\' Error:');
console.error(err);
console.error(err, err.stack);
});
};
@ -423,10 +424,21 @@
var p;
function createKeypair() {
return BACME.accounts.generateKeypair({
let opts;
if(BROWSER_SUPPORTS_ECDSA) {
opts = {
type: 'ECDSA'
, bitlength: '256'
}).then(function (serverJwk) {
};
} else {
opts = {
type: 'RSA'
, bitlength: '2048'
};
}
return BACME.accounts.generateKeypair(opts).then(function (serverJwk) {
localStorage.setItem('server:' + key, JSON.stringify(serverJwk));
return serverJwk;
})
@ -540,7 +552,7 @@
"data:text/octet-stream;base64," + window.btoa(pem);
steps[i]();
}).catch(function(err){
console.error(err);
console.error(err.toString());
});
});
});