Don't ask user for private key backup password, because it won't be used

master
Skylar Ittner 3 years ago
parent 8efb4dd8fe
commit f114febad3

@ -202,45 +202,27 @@ function exportPublicKey() {
});
}
/**
* This should be modified to prompt the user for a backup password,
* but that doesn't work. https://github.com/keybase/kbpgp/issues/211
* @returns {undefined}
*/
function exportPrivateKey() {
showPasswordPrompt("Enter password for private key:", function (pass) {
const savepriv = function (key) {
showPasswordPrompt("Enter a password to protect the key backup:", function (pass2) {
openSaveFileDialog(function (path) {
key.export_pgp_private({
passphrase: pass2
}, function (err, pgp_private) {
if (err) {
showAlert("Something went wrong.");
} else {
writeToFile(path, pgp_private);
}
});
}, "private-key.asc", ".asc");
});
loadKeyFromLocalStorage(function (message, ok) {
if (!ok) {
showAlert("Error: " + message);
return;
}
kbpgp.KeyManager.import_from_armored_pgp({
armored: getStorage("signingkey")
}, function (err, key) {
if (!err) {
if (key.is_pgp_locked()) {
key.unlock_pgp({
passphrase: pass
}, function (err) {
if (!err) {
savepriv(key);
} else {
showAlert("Could not unlock key. Password is probably incorrect.");
}
});
openSaveFileDialog(function (path) {
keymgr.export_pgp_private({}, function (err, pgp_private) {
if (err) {
showAlert("Something went wrong.");
} else {
console.log("Loaded private key w/o passphrase");
savepriv(key);
writeToFile(path, pgp_private);
showAlert("Private key backup saved.");
}
} else {
showAlert("Could not unlock key: " + err);
}
});
});
}, "private-key.asc", ".asc");
});
}

@ -255,7 +255,7 @@ $("#passwordModal").on("shown.bs.modal", function () {
$("#passwordModalInput").focus();
});
$(".modal").on("keydown", function (e) {
$(".modal.show").on("keydown", function (e) {
if (e.keyCode == 13) {
$(this).find(".btn-default").first().click();
}

Loading…
Cancel
Save