|
|
@ -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"); |
|
|
|