From 0b6e351dce55d6f139facf59aca50b9fca62c289 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Tue, 29 May 2018 10:56:47 +1000 Subject: Add visual privacy safeguard for private data --- src/css/app.css | 3 +++ src/index.html | 39 ++++++++++++++++++++++++--------------- src/js/index.js | 13 +++++++++++++ 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/css/app.css b/src/css/app.css index 71109ef..576b7d7 100644 --- a/src/css/app.css +++ b/src/css/app.css @@ -103,3 +103,6 @@ body { overflow-x: scroll; font-family: monospace; } +.visual-privacy .private-data { + display: none; +} diff --git a/src/index.html b/src/index.html index ea667ee..419ada0 100644 --- a/src/index.html +++ b/src/index.html @@ -69,7 +69,7 @@
- + -
+
-
+
-
 
+
 
-
 
+
 
+ Hide all private info + +
+
@@ -160,19 +169,19 @@
- +
- +
- +
@@ -186,7 +195,7 @@
- +
@@ -439,7 +448,7 @@ Account Extended Private Key
- +
@@ -566,7 +575,7 @@ Account Extended Private Key
- +
@@ -598,7 +607,7 @@
- +
@@ -644,7 +653,7 @@ Encrypt private keys using BIP38 and this password: - + Enabling BIP38 means each key will take several minutes to generate.
@@ -909,7 +918,7 @@ - + diff --git a/src/js/index.js b/src/js/index.js index bfaf879..40d15f4 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -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() { -- cgit v1.2.3