This commit is contained in:
unknown
2018-11-12 16:05:49 +00:00
parent a8885e5360
commit c5b3c7f274
2 changed files with 12 additions and 4 deletions

View File

@@ -32,8 +32,13 @@
}
openpgp.decrypt(options).then(plaintext => {
if (plaintext.data) {
document.getElementById("result").value = plaintext.data;
document.getElementById("progressbar").className = "progress-bar bg-success";
} else {
document.getElementById("result").value = 'Error decrypting message.';
document.getElementById("progressbar").className = "progress-bar bg-danger";
}
})
}
</script>

View File

@@ -24,12 +24,15 @@
publicKeys: (await openpgp.key.readArmored(pubkey)).keys, // for encryption
}
console.log(options);
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";
if (encrypted) {
document.getElementById("result").value = encrypted;
document.getElementById("progressbar").className = "progress-bar bg-success";
} else {
document.getElementById("result").value = 'Encryption failed.';
document.getElementById("progressbar").className = "progress-bar bg-danger";
}
})
}
</script>