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,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() {
|
function exportPrivateKey() {
|
||||||
showPasswordPrompt("Enter password for private key:", function (pass) {
|
loadKeyFromLocalStorage(function (message, ok) {
|
||||||
const savepriv = function (key) {
|
if (!ok) {
|
||||||
showPasswordPrompt("Enter a password to protect the key backup:", function (pass2) {
|
showAlert("Error: " + message);
|
||||||
openSaveFileDialog(function (path) {
|
return;
|
||||||
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");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
kbpgp.KeyManager.import_from_armored_pgp({
|
openSaveFileDialog(function (path) {
|
||||||
armored: getStorage("signingkey")
|
keymgr.export_pgp_private({}, function (err, pgp_private) {
|
||||||
}, function (err, key) {
|
if (err) {
|
||||||
if (!err) {
|
showAlert("Something went wrong.");
|
||||||
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 {
|
} else {
|
||||||
console.log("Loaded private key w/o passphrase");
|
writeToFile(path, pgp_private);
|
||||||
savepriv(key);
|
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();
|
$("#passwordModalInput").focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".modal").on("keydown", function (e) {
|
$(".modal.show").on("keydown", function (e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
$(this).find(".btn-default").first().click();
|
$(this).find(".btn-default").first().click();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user