diff --git a/decrypt.html b/decrypt.html index a2b537e..6cef2ad 100644 --- a/decrypt.html +++ b/decrypt.html @@ -2,7 +2,7 @@ browserPGP | Decrypt - + @@ -16,6 +16,7 @@ openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path const encryptDecryptFunction = async() => { + document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated"; // put keys in backtick (``) to avoid errors caused by spaces or tabs const privkey = document.getElementById("privKey").value const passphrase = document.getElementById("pass").value @@ -32,8 +33,8 @@ } openpgp.decrypt(options).then(plaintext => { - console.log(plaintext.data) document.getElementById("result").value = plaintext.data; + document.getElementById("progressbar").className = "progress-bar bg-success"; }) } @@ -91,12 +92,15 @@ +
+
+
- +
diff --git a/encrypt.html b/encrypt.html index 84011e8..cf071d6 100644 --- a/encrypt.html +++ b/encrypt.html @@ -2,7 +2,7 @@ browserPGP | Encrypt - + @@ -16,6 +16,7 @@ openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path const encryptDecryptFunction = async() => { + document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated"; // put keys in backtick (``) to avoid errors caused by spaces or tabs const pubkey = document.getElementById("pubKey").value @@ -29,6 +30,7 @@ openpgp.encrypt(options).then(ciphertext => { encrypted = ciphertext.data // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----' document.getElementById("result").value = encrypted; + document.getElementById("progressbar").className = "progress-bar bg-success"; }) } @@ -80,7 +82,7 @@
- +
diff --git a/gen.html b/gen.html index 81df982..56a1303 100644 --- a/gen.html +++ b/gen.html @@ -2,7 +2,7 @@ browserPGP | Key Gen - + @@ -93,6 +93,9 @@ This may take some time and cause browser lag.
+
+
+
diff --git a/index.html b/index.html index 7cf5ada..5632281 100644 --- a/index.html +++ b/index.html @@ -3,9 +3,9 @@ browserPGP - + - + diff --git a/sign.html b/sign.html index 99c83fa..bff9132 100644 --- a/sign.html +++ b/sign.html @@ -12,12 +12,14 @@ openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path const encryptDecryptFunction = async() => { + document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated"; // put keys in backtick (``) to avoid errors caused by spaces or tabs const privkey = document.getElementById("privKey").value const passphrase = document.getElementById("pass").value const msg = document.getElementById("msg").value const privKeyObj = (await openpgp.key.readArmored(privkey)).keys[0] + if (passphrase) { await privKeyObj.decrypt(passphrase) } @@ -28,8 +30,14 @@ }; openpgp.sign(options).then(function(signed) { + if (signed.data) { cleartext = signed.data; // '-----BEGIN PGP SIGNED MESSAGE ... END PGP SIGNATURE-----' document.getElementById("result").value = cleartext; + document.getElementById("progressbar").className = "progress-bar bg-success"; + } else { + document.getElementById("result").value = 'Signing failed.'; + document.getElementById("progressbar").className = "progress-bar bg-danger"; + } }); } @@ -75,7 +83,7 @@
- +
@@ -87,12 +95,15 @@
- +
+
+
+
- +
diff --git a/verify.html b/verify.html index e78f31a..5fb3885 100644 --- a/verify.html +++ b/verify.html @@ -11,6 +11,7 @@ openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path const encryptDecryptFunction = async() => { + document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated"; // put keys in backtick (``) to avoid errors caused by spaces or tabs const pubkey = document.getElementById("pubKey").value const cleartext = document.getElementById("signMsg").value @@ -23,8 +24,12 @@ openpgp.verify(options).then(function(verified) { validity = verified.signatures[0].valid; // true if (validity) { - document.getElementById("result").value('signed by key id ' + verified.signatures[0].keyid.toHex()); - } + document.getElementById("result").value = 'Signed by key id ' + verified.signatures[0].keyid.toHex(); + document.getElementById("progressbar").className = "progress-bar bg-success"; + } else { + document.getElementById("progressbar").className = "progress-bar bg-danger"; + document.getElementById("result").value = 'Verification wrong or failed. DO NOT TRUST.'; + } }); } @@ -76,14 +81,17 @@
- +
- +
+
+
+
- +