diff --git a/index.html b/index.html index 63c5814..54dedda 100644 --- a/index.html +++ b/index.html @@ -6,9 +6,11 @@ - + + +

js-keygen

Generate a keypair to be used with openSSH, this replicate ssh-keygen function in javascript in the browser, using the webcrypto api and a bit of glue.
@@ -38,17 +40,20 @@
-
- - - Private Key or
- +
Made with by Patrick Roumanoff Fork me on GitHub +
\ No newline at end of file diff --git a/js-keygen-ui.js b/js-keygen-ui.js index ac5c213..9c651da 100644 --- a/js-keygen-ui.js +++ b/js-keygen-ui.js @@ -31,6 +31,9 @@ document.addEventListener("DOMContentLoaded", function(event) { document.querySelector('#generate').addEventListener('click', function(event) { var name = document.querySelector('#name').value || "name"; + document.querySelector('a#private').setAttribute("download", name + "_rsa"); + document.querySelector('a#public').setAttribute("download", name + "_rsa.pub"); + var alg = document.querySelector('#alg').value || "RSASSA-PKCS1-v1_5"; var size = parseInt(document.querySelector('#size').value || "2048"); generateKeyPair(alg, size, name).then(function (keys) { @@ -38,6 +41,7 @@ document.addEventListener("DOMContentLoaded", function(event) { document.querySelector('#public').setAttribute("href", buildHref(keys[1])); document.querySelector('#privateKey').textContent = keys[0]; document.querySelector('#publicKey').textContent = keys[1]; + document.querySelector('#result').style.display = "block"; }).catch(function(err){ console.error(err); }); diff --git a/js-keygen.css b/js-keygen.css index eada212..a562df0 100644 --- a/js-keygen.css +++ b/js-keygen.css @@ -1,3 +1,30 @@ +body { + background-color: #cccccc; + font: 16px Arial, Tahoma, Helvetica, FreeSans, sans-serif; +} + +button#generate { + background-color: rgb(60,200,30); + padding: 10px; + margin-top: 5px; + color: white; + font-weight: bold; + font-size: 1.1em; + border-radius: 8px; + border-width: 0px; + margin-right: 20px; + margin-left: 20px; + min-width: 120px; +} + +div#content { + background-color: #f0f0f0; + border-radius: 8px; + width: 780px; + margin: auto; + padding: 20px; +} + label { display: inline-block; width: 80px; diff --git a/key.png b/key.png new file mode 100644 index 0000000..4266217 Binary files /dev/null and b/key.png differ