test ecdsa support, spaces for whitespace

This commit is contained in:
AJ ONeal 2018-11-09 21:21:40 -07:00
parent cda26c98b5
commit c66f92d506
1 changed files with 56 additions and 30 deletions

View File

@ -14,6 +14,32 @@
var PromiseA = window.Promise;
var crypto = window.crypto;
function testEcdsaSupport() {
var opts = {
type: 'ECDSA'
, bitlength: '256'
};
return BACME.accounts.generateKeypair(opts).then(function (jwk) {
return crypto.subtle.importKey(
"jwk"
, jwk
, { name: "ECDSA", namedCurve: "P-256" }
, true
, ["sign"]
).then(function (privateKey) {
return window.crypto.subtle.exportKey("pkcs8", privateKey);
});
});
}
testEcdsaSupport().then(function () {
console.log("supports ECDSA");
BROWSER_SUPPORTS_ECDSA = true;
}).catch(function () {
console.log("DOES NOT supports ECDSA");
BROWSER_SUPPORTS_ECDSA = false;
});
// TODO test RSA support
var apiUrl = 'https://acme-{{env}}.api.letsencrypt.org/directory';
function updateApiType() {
console.log("type updated");