diff options
author | Ian Coleman <ian@iancoleman.io> | 2018-05-29 10:56:47 +1000 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2018-05-29 11:30:48 +1000 |
commit | 0b6e351dce55d6f139facf59aca50b9fca62c289 (patch) | |
tree | 16c4d6ad0e84aaf5cd3424ca70a4bcd9b2029bf6 /src | |
parent | 6f7fa3539e4f2cf3be19ebfbd4a914bf0992ca88 (diff) | |
download | BIP39-0b6e351dce55d6f139facf59aca50b9fca62c289.tar.gz BIP39-0b6e351dce55d6f139facf59aca50b9fca62c289.tar.zst BIP39-0b6e351dce55d6f139facf59aca50b9fca62c289.zip |
Add visual privacy safeguard for private data
Diffstat (limited to 'src')
-rw-r--r-- | src/css/app.css | 3 | ||||
-rw-r--r-- | src/index.html | 39 | ||||
-rw-r--r-- | 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 { | |||
103 | overflow-x: scroll; | 103 | overflow-x: scroll; |
104 | font-family: monospace; | 104 | font-family: monospace; |
105 | } | 105 | } |
106 | .visual-privacy .private-data { | ||
107 | display: none; | ||
108 | } | ||
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 @@ | |||
69 | <div class="form-group"> | 69 | <div class="form-group"> |
70 | <label for="entropy" class="col-sm-2 control-label">Entropy</label> | 70 | <label for="entropy" class="col-sm-2 control-label">Entropy</label> |
71 | <div class="col-sm-7"> | 71 | <div class="col-sm-7"> |
72 | <textarea id="entropy" rows="2" class="entropy form-control" placeholder="Accepts either binary, base 6, 6-sided dice, base 10, hexadecimal or cards"></textarea> | 72 | <textarea id="entropy" rows="2" class="entropy private-data form-control" placeholder="Accepts either binary, base 6, 6-sided dice, base 10, hexadecimal or cards"></textarea> |
73 | <div class="row filter-warning text-danger hidden"> | 73 | <div class="row filter-warning text-danger hidden"> |
74 | <p class="col-sm-12"> | 74 | <p class="col-sm-12"> |
75 | <strong> | 75 | <strong> |
@@ -96,13 +96,13 @@ | |||
96 | <div class="bits col-sm-3 form-control-static"></div> | 96 | <div class="bits col-sm-3 form-control-static"></div> |
97 | </div> | 97 | </div> |
98 | <label class="col-sm-3 control-label">Filtered Entropy</label> | 98 | <label class="col-sm-3 control-label">Filtered Entropy</label> |
99 | <div class="filtered col-sm-9 form-control-static"></div> | 99 | <div class="filtered private-data col-sm-9 form-control-static"></div> |
100 | <label class="col-sm-3 control-label">Raw Binary</label> | 100 | <label class="col-sm-3 control-label">Raw Binary</label> |
101 | <div class="binary col-sm-9 form-control-static"></div> | 101 | <div class="binary private-data col-sm-9 form-control-static"></div> |
102 | <label class="col-sm-3 control-label">Binary Checksum</label> | 102 | <label class="col-sm-3 control-label">Binary Checksum</label> |
103 | <div class="checksum col-sm-9 form-control-static"> </div> | 103 | <div class="checksum private-data col-sm-9 form-control-static"> </div> |
104 | <label class="col-sm-3 control-label">Word Indexes</label> | 104 | <label class="col-sm-3 control-label">Word Indexes</label> |
105 | <div class="word-indexes col-sm-9 form-control-static"> </div> | 105 | <div class="word-indexes private-data col-sm-9 form-control-static"> </div> |
106 | <label class="col-sm-3 control-label">Mnemonic Length</label> | 106 | <label class="col-sm-3 control-label">Mnemonic Length</label> |
107 | <div class="col-sm-9"> | 107 | <div class="col-sm-9"> |
108 | <select class="mnemonic-length form-control"> | 108 | <select class="mnemonic-length form-control"> |
@@ -143,6 +143,15 @@ | |||
143 | </div> | 143 | </div> |
144 | </div> | 144 | </div> |
145 | <div class="form-group"> | 145 | <div class="form-group"> |
146 | <div class="col-sm-2"></div> | ||
147 | <div class="col-sm-10 checkbox"> | ||
148 | <label> | ||
149 | <input type="checkbox" class="privacy-screen-toggle"> | ||
150 | <span>Hide all private info</span> | ||
151 | </label> | ||
152 | </div> | ||
153 | </div> | ||
154 | <div class="form-group"> | ||
146 | <label class="col-sm-2 control-label">Mnemonic Language</label> | 155 | <label class="col-sm-2 control-label">Mnemonic Language</label> |
147 | <div class="col-sm-10 languages"> | 156 | <div class="col-sm-10 languages"> |
148 | <div class="form-control no-border"> | 157 | <div class="form-control no-border"> |
@@ -160,19 +169,19 @@ | |||
160 | <div class="form-group"> | 169 | <div class="form-group"> |
161 | <label for="phrase" class="col-sm-2 control-label">BIP39 Mnemonic</label> | 170 | <label for="phrase" class="col-sm-2 control-label">BIP39 Mnemonic</label> |
162 | <div class="col-sm-10"> | 171 | <div class="col-sm-10"> |
163 | <textarea id="phrase" class="phrase form-control" data-show-qr></textarea> | 172 | <textarea id="phrase" class="phrase private-data form-control" data-show-qr></textarea> |
164 | </div> | 173 | </div> |
165 | </div> | 174 | </div> |
166 | <div class="form-group"> | 175 | <div class="form-group"> |
167 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> | 176 | <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> |
168 | <div class="col-sm-10"> | 177 | <div class="col-sm-10"> |
169 | <textarea id="passphrase" class="passphrase form-control"></textarea> | 178 | <textarea id="passphrase" class="passphrase private-data form-control"></textarea> |
170 | </div> | 179 | </div> |
171 | </div> | 180 | </div> |
172 | <div class="form-group"> | 181 | <div class="form-group"> |
173 | <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label> | 182 | <label for="seed" class="col-sm-2 control-label">BIP39 Seed</label> |
174 | <div class="col-sm-10"> | 183 | <div class="col-sm-10"> |
175 | <textarea id="seed" class="seed form-control" readonly="readonly" data-show-qr></textarea> | 184 | <textarea id="seed" class="seed private-data form-control" readonly="readonly" data-show-qr></textarea> |
176 | </div> | 185 | </div> |
177 | </div> | 186 | </div> |
178 | <div class="form-group"> | 187 | <div class="form-group"> |
@@ -186,7 +195,7 @@ | |||
186 | <div class="form-group"> | 195 | <div class="form-group"> |
187 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> | 196 | <label for="root-key" class="col-sm-2 control-label">BIP32 Root Key</label> |
188 | <div class="col-sm-10"> | 197 | <div class="col-sm-10"> |
189 | <textarea id="root-key" class="root-key form-control" data-show-qr></textarea> | 198 | <textarea id="root-key" class="root-key private-data form-control" data-show-qr></textarea> |
190 | </div> | 199 | </div> |
191 | </div> | 200 | </div> |
192 | <div class="form-group litecoin-ltub-container hidden"> | 201 | <div class="form-group litecoin-ltub-container hidden"> |
@@ -279,7 +288,7 @@ | |||
279 | <span>Account Extended Private Key</span> | 288 | <span>Account Extended Private Key</span> |
280 | </label> | 289 | </label> |
281 | <div class="col-sm-10"> | 290 | <div class="col-sm-10"> |
282 | <textarea id="account-xprv" type="text" class="account-xprv form-control" readonly data-show-qr></textarea> | 291 | <textarea id="account-xprv" type="text" class="account-xprv private-data form-control" readonly data-show-qr></textarea> |
283 | </div> | 292 | </div> |
284 | </div> | 293 | </div> |
285 | <div class="form-group"> | 294 | <div class="form-group"> |
@@ -439,7 +448,7 @@ | |||
439 | <span>Account Extended Private Key</span> | 448 | <span>Account Extended Private Key</span> |
440 | </label> | 449 | </label> |
441 | <div class="col-sm-10"> | 450 | <div class="col-sm-10"> |
442 | <textarea id="account-xprv" type="text" class="account-xprv form-control" readonly data-show-qr></textarea> | 451 | <textarea id="account-xprv" type="text" class="account-xprv private-data form-control" readonly data-show-qr></textarea> |
443 | </div> | 452 | </div> |
444 | </div> | 453 | </div> |
445 | <div class="form-group"> | 454 | <div class="form-group"> |
@@ -566,7 +575,7 @@ | |||
566 | <span>Account Extended Private Key</span> | 575 | <span>Account Extended Private Key</span> |
567 | </label> | 576 | </label> |
568 | <div class="col-sm-10"> | 577 | <div class="col-sm-10"> |
569 | <textarea id="account-xprv" type="text" class="account-xprv form-control" readonly data-show-qr></textarea> | 578 | <textarea id="account-xprv" type="text" class="account-xprv private-data form-control" readonly data-show-qr></textarea> |
570 | </div> | 579 | </div> |
571 | </div> | 580 | </div> |
572 | <div class="form-group"> | 581 | <div class="form-group"> |
@@ -598,7 +607,7 @@ | |||
598 | <div class="form-group"> | 607 | <div class="form-group"> |
599 | <label for="extended-priv-key" class="col-sm-2 control-label">BIP32 Extended Private Key</label> | 608 | <label for="extended-priv-key" class="col-sm-2 control-label">BIP32 Extended Private Key</label> |
600 | <div class="col-sm-10"> | 609 | <div class="col-sm-10"> |
601 | <textarea id="extended-priv-key" class="extended-priv-key form-control" readonly="readonly" data-show-qr></textarea> | 610 | <textarea id="extended-priv-key" class="extended-priv-key private-data form-control" readonly="readonly" data-show-qr></textarea> |
602 | </div> | 611 | </div> |
603 | </div> | 612 | </div> |
604 | <div class="form-group"> | 613 | <div class="form-group"> |
@@ -644,7 +653,7 @@ | |||
644 | <input type="checkbox" class="use-bip38"> | 653 | <input type="checkbox" class="use-bip38"> |
645 | <span>Encrypt private keys using BIP38 and this password:</span> | 654 | <span>Encrypt private keys using BIP38 and this password:</span> |
646 | </label> | 655 | </label> |
647 | <input class="bip38-password"> | 656 | <input class="bip38-password private-data"> |
648 | <span>Enabling BIP38 means each key will take several minutes to generate.</span> | 657 | <span>Enabling BIP38 means each key will take several minutes to generate.</span> |
649 | </div> | 658 | </div> |
650 | </div> | 659 | </div> |
@@ -909,7 +918,7 @@ | |||
909 | <td class="index"><span></span></td> | 918 | <td class="index"><span></span></td> |
910 | <td class="address"><span data-show-qr></span></td> | 919 | <td class="address"><span data-show-qr></span></td> |
911 | <td class="pubkey"><span data-show-qr></span></td> | 920 | <td class="pubkey"><span data-show-qr></span></td> |
912 | <td class="privkey"><span data-show-qr></span></td> | 921 | <td class="privkey private-data"><span data-show-qr></span></td> |
913 | </tr> | 922 | </tr> |
914 | </script> | 923 | </script> |
915 | <script src="js/polyfill.es6.js"></script> | 924 | <script src="js/polyfill.es6.js"></script> |
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 @@ | |||
23 | var generationProcesses = []; | 23 | var generationProcesses = []; |
24 | 24 | ||
25 | var DOM = {}; | 25 | var DOM = {}; |
26 | DOM.privacyScreenToggle = $(".privacy-screen-toggle"); | ||
26 | DOM.network = $(".network"); | 27 | DOM.network = $(".network"); |
27 | DOM.bip32Client = $("#bip32-client"); | 28 | DOM.bip32Client = $("#bip32-client"); |
28 | DOM.phraseNetwork = $("#network-phrase"); | 29 | DOM.phraseNetwork = $("#network-phrase"); |
@@ -118,6 +119,7 @@ | |||
118 | 119 | ||
119 | function init() { | 120 | function init() { |
120 | // Events | 121 | // Events |
122 | DOM.privacyScreenToggle.on("change", privacyScreenToggled); | ||
121 | DOM.generatedStrength.on("change", generatedStrengthChanged); | 123 | DOM.generatedStrength.on("change", generatedStrengthChanged); |
122 | DOM.network.on("change", networkChanged); | 124 | DOM.network.on("change", networkChanged); |
123 | DOM.bip32Client.on("change", bip32ClientChanged); | 125 | DOM.bip32Client.on("change", bip32ClientChanged); |
@@ -447,6 +449,17 @@ | |||
447 | $("td.privkey span").toggleClass("invisible"); | 449 | $("td.privkey span").toggleClass("invisible"); |
448 | } | 450 | } |
449 | 451 | ||
452 | function privacyScreenToggled() { | ||
453 | // private-data contains elements added to DOM at runtime | ||
454 | // so catch all by adding visual privacy class to the root of the DOM | ||
455 | if (DOM.privacyScreenToggle.prop("checked")) { | ||
456 | $("body").addClass("visual-privacy"); | ||
457 | } | ||
458 | else { | ||
459 | $("body").removeClass("visual-privacy"); | ||
460 | } | ||
461 | } | ||
462 | |||
450 | // Private methods | 463 | // Private methods |
451 | 464 | ||
452 | function generateRandomPhrase() { | 465 | function generateRandomPhrase() { |