Don't ask user for private key backup password, because it won't be used
This commit is contained in:
parent
8efb4dd8fe
commit
f114febad3
@ -202,46 +202,28 @@ 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) {
|
||||
loadKeyFromLocalStorage(function (message, ok) {
|
||||
if (!ok) {
|
||||
showAlert("Error: " + message);
|
||||
return;
|
||||
}
|
||||
openSaveFileDialog(function (path) {
|
||||
key.export_pgp_private({
|
||||
passphrase: pass2
|
||||
}, function (err, pgp_private) {
|
||||
keymgr.export_pgp_private({}, function (err, pgp_private) {
|
||||
if (err) {
|
||||
showAlert("Something went wrong.");
|
||||
} else {
|
||||
writeToFile(path, pgp_private);
|
||||
showAlert("Private key backup saved.");
|
||||
}
|
||||
});
|
||||
}, "private-key.asc", ".asc");
|
||||
});
|
||||
}
|
||||
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.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("Loaded private key w/o passphrase");
|
||||
savepriv(key);
|
||||
}
|
||||
} else {
|
||||
showAlert("Could not unlock key: " + err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function importPrivateKey() {
|
||||
|
@ -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…
x
Reference in New Issue
Block a user