Be responsive when generating private key

This commit is contained in:
Skylar Ittner 2021-07-02 02:48:20 -06:00
parent 4609cc114f
commit 7c3ba9ecaa

View File

@ -112,6 +112,9 @@ function signMessage(text, key, callback) {
* @returns {undefined} * @returns {undefined}
*/ */
function generatePrivateKey(userid, passphrase, callback) { function generatePrivateKey(userid, passphrase, callback) {
var statustextEl = $("#statustext");
statustextEl.html("<i class='fas fa-spin fa-spinner'></i> Generating cryptographic key...");
setTimeout(function () {
var F = kbpgp["const"].openpgp; var F = kbpgp["const"].openpgp;
var opts = { var opts = {
@ -130,11 +133,16 @@ function generatePrivateKey(userid, passphrase, callback) {
alice.export_pgp_private({ alice.export_pgp_private({
passphrase: passphrase passphrase: passphrase
}, function (err, pgp_private) { }, function (err, pgp_private) {
statustextEl.html("<i class='fas fa-check'></i> Key generated!");
setTimeout(function () {
statustextEl.html("");
}, 5000);
callback(alice); callback(alice);
}); });
}); });
} }
}); });
}, 100);
} }
function exportPublicKey() { function exportPublicKey() {