mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-28 05:10:41 +00:00
Add visual privacy safeguard for private data
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
var generationProcesses = [];
|
||||
|
||||
var DOM = {};
|
||||
DOM.privacyScreenToggle = $(".privacy-screen-toggle");
|
||||
DOM.network = $(".network");
|
||||
DOM.bip32Client = $("#bip32-client");
|
||||
DOM.phraseNetwork = $("#network-phrase");
|
||||
@@ -118,6 +119,7 @@
|
||||
|
||||
function init() {
|
||||
// Events
|
||||
DOM.privacyScreenToggle.on("change", privacyScreenToggled);
|
||||
DOM.generatedStrength.on("change", generatedStrengthChanged);
|
||||
DOM.network.on("change", networkChanged);
|
||||
DOM.bip32Client.on("change", bip32ClientChanged);
|
||||
@@ -447,6 +449,17 @@
|
||||
$("td.privkey span").toggleClass("invisible");
|
||||
}
|
||||
|
||||
function privacyScreenToggled() {
|
||||
// private-data contains elements added to DOM at runtime
|
||||
// so catch all by adding visual privacy class to the root of the DOM
|
||||
if (DOM.privacyScreenToggle.prop("checked")) {
|
||||
$("body").addClass("visual-privacy");
|
||||
}
|
||||
else {
|
||||
$("body").removeClass("visual-privacy");
|
||||
}
|
||||
}
|
||||
|
||||
// Private methods
|
||||
|
||||
function generateRandomPhrase() {
|
||||
|
||||
Reference in New Issue
Block a user