Add button to lock/unload private key, add lock indicator
This commit is contained in:
parent
7c3ba9ecaa
commit
414495a4cb
@ -58,6 +58,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
to make a new one. A new key won't be able to verify older signatures or vice versa.
|
||||
</p>
|
||||
<div class="btn btn-primary m-1" onclick="loadKeyFromLocalStorageWithUserFeedback()"><i class="fas fa-unlock"></i> Create/unlock private key</div>
|
||||
<div class="btn btn-primary m-1" onclick="unloadKey()"><i class="fas fa-lock"></i> Lock private key</div>
|
||||
<div class="btn btn-primary m-1" onclick="exportPublicKey()"><i class="fas fa-file-export"></i> Export public key</div>
|
||||
<br>
|
||||
<div class="btn btn-danger m-1" onclick="exportPrivateKey()"><i class="fas fa-download"></i> Back up private key</div>
|
||||
@ -108,7 +109,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
<div class="btn btn-primary" onclick="openSettingsModal();"><i class="fas fa-cog"></i> Settings</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="statustext" class="d-inline-block"></div>
|
||||
<div class="d-inline-block"><span id="lockstatus" title="Private key locked"><i class="fas fa-lock"></i></span> <span id="statustext"></span></div>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group me-2 mb-2" role="group" aria-label="First group">
|
||||
<div class="btn btn-primary" onclick="pdfZoom('fitheight');"><i class="fas fa-arrows-alt-v"></i> Fit Height</div>
|
||||
|
19
js/crypto.js
19
js/crypto.js
@ -17,6 +17,7 @@ function loadKeyFromLocalStorage(callback) {
|
||||
callback("Key already loaded.", true);
|
||||
return;
|
||||
}
|
||||
$("#lockstatus").css("display", "none");
|
||||
if (!inStorage("signingkey") || getStorage("signingkey") == "undefined") {
|
||||
var pass = prompt("Generating a new signing key (might take a while, be patient). Enter a password to protect it. You'll need to save this password somewhere safe; it cannot be recovered.");
|
||||
generatePrivateKey(getStorage("notary_name") + " <null@null.com>", pass, function (key) {
|
||||
@ -41,6 +42,11 @@ function loadKeyFromLocalStorage(callback) {
|
||||
}
|
||||
}
|
||||
|
||||
function unloadKey() {
|
||||
keymgr = undefined;
|
||||
$("#lockstatus").css("display", "");
|
||||
}
|
||||
|
||||
function loadKeyFromLocalStorageWithUserFeedback() {
|
||||
loadKeyFromLocalStorage(function (msg, ok) {
|
||||
if (ok) {
|
||||
@ -224,3 +230,16 @@ function importPrivateKey() {
|
||||
});
|
||||
}, ".asc");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show visual indicator when private key is not loaded/unlocked.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
setInterval(function () {
|
||||
if (typeof keymgr == "undefined") {
|
||||
$("#lockstatus").css("display", "");
|
||||
} else {
|
||||
$("#lockstatus").css("display", "none");
|
||||
}
|
||||
}, 1000);
|
Loading…
x
Reference in New Issue
Block a user