aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2018-04-12 11:46:44 +1000
committerIan Coleman <ian@iancoleman.io>2018-04-12 12:08:52 +1000
commit85c906727a24ab97a3c2908c72ad37ad988ecb01 (patch)
treea2481ff3c2c8965c2086c0cbf317ead5d988f6d3 /src
parentd1b4c8c579b34924fbce919c423f3c9baab81083 (diff)
downloadBIP39-85c906727a24ab97a3c2908c72ad37ad988ecb01.tar.gz
BIP39-85c906727a24ab97a3c2908c72ad37ad988ecb01.tar.zst
BIP39-85c906727a24ab97a3c2908c72ad37ad988ecb01.zip
Warn when generating low entropy mnemonics
Diffstat (limited to 'src')
-rw-r--r--src/index.html7
-rw-r--r--src/js/index.js12
2 files changed, 18 insertions, 1 deletions
diff --git a/src/index.html b/src/index.html
index 2ee79c0..df5bf67 100644
--- a/src/index.html
+++ b/src/index.html
@@ -48,7 +48,12 @@
48 <option value="21">21</option> 48 <option value="21">21</option>
49 <option value="24">24</option> 49 <option value="24">24</option>
50 </select> 50 </select>
51 <span>words</span> 51 <span>words</span>.
52 <p class="warning help-block hidden">
53 <span class="text-danger">
54 Mnemonics with less than 12 words have low entropy and may be guessed by an attacker.
55 </span>
56 </p>
52 </div> 57 </div>
53 </div> 58 </div>
54 </div> 59 </div>
diff --git a/src/js/index.js b/src/js/index.js
index ee47509..0a2d362 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -88,6 +88,7 @@
88 DOM.bip141path = $("#bip141-path"); 88 DOM.bip141path = $("#bip141-path");
89 DOM.bip141semantics = $(".bip141-semantics"); 89 DOM.bip141semantics = $(".bip141-semantics");
90 DOM.generatedStrength = $(".generate-container .strength"); 90 DOM.generatedStrength = $(".generate-container .strength");
91 DOM.generatedStrengthWarning = $(".generate-container .warning");
91 DOM.hardenedAddresses = $(".hardened-addresses"); 92 DOM.hardenedAddresses = $(".hardened-addresses");
92 DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container"); 93 DOM.useBitpayAddressesContainer = $(".use-bitpay-addresses-container");
93 DOM.useBitpayAddresses = $(".use-bitpay-addresses"); 94 DOM.useBitpayAddresses = $(".use-bitpay-addresses");
@@ -114,6 +115,7 @@
114 115
115 function init() { 116 function init() {
116 // Events 117 // Events
118 DOM.generatedStrength.on("change", generatedStrengthChanged);
117 DOM.network.on("change", networkChanged); 119 DOM.network.on("change", networkChanged);
118 DOM.bip32Client.on("change", bip32ClientChanged); 120 DOM.bip32Client.on("change", bip32ClientChanged);
119 DOM.useEntropy.on("change", setEntropyVisibility); 121 DOM.useEntropy.on("change", setEntropyVisibility);
@@ -155,6 +157,16 @@
155 157
156 // Event handlers 158 // Event handlers
157 159
160 function generatedStrengthChanged() {
161 var strength = parseInt(DOM.generatedStrength.val());
162 if (strength < 12) {
163 DOM.generatedStrengthWarning.removeClass("hidden");
164 }
165 else {
166 DOM.generatedStrengthWarning.addClass("hidden");
167 }
168 }
169
158 function networkChanged(e) { 170 function networkChanged(e) {
159 clearDerivedKeys(); 171 clearDerivedKeys();
160 clearAddressesList(); 172 clearAddressesList();