diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-09-20 10:31:28 +1000 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-09-20 11:25:21 +1000 |
commit | ee0981f1ecc4c6e78831f538ef77396c1e4fbe91 (patch) | |
tree | 9abba5e09307c9dc62c52b371576d73e369672dd /src/js | |
parent | 6024e655a8b6d3c35ef189013f8cd2de605171fa (diff) | |
download | BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.tar.gz BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.tar.zst BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.zip |
Detect and warn of filtered entropy
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js index 9bd77b9..6a2fea6 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -38,6 +38,7 @@ | |||
38 | DOM.entropyWordCount = DOM.entropyContainer.find(".word-count"); | 38 | DOM.entropyWordCount = DOM.entropyContainer.find(".word-count"); |
39 | DOM.entropyBinary = DOM.entropyContainer.find(".binary"); | 39 | DOM.entropyBinary = DOM.entropyContainer.find(".binary"); |
40 | DOM.entropyMnemonicLength = DOM.entropyContainer.find(".mnemonic-length"); | 40 | DOM.entropyMnemonicLength = DOM.entropyContainer.find(".mnemonic-length"); |
41 | DOM.entropyFilterWarning = DOM.entropyContainer.find(".filter-warning"); | ||
41 | DOM.phrase = $(".phrase"); | 42 | DOM.phrase = $(".phrase"); |
42 | DOM.passphrase = $(".passphrase"); | 43 | DOM.passphrase = $(".passphrase"); |
43 | DOM.generateContainer = $(".generate-container"); | 44 | DOM.generateContainer = $(".generate-container"); |
@@ -1061,6 +1062,16 @@ | |||
1061 | DOM.entropyWordCount.text(wordCount); | 1062 | DOM.entropyWordCount.text(wordCount); |
1062 | DOM.entropyBinary.text(entropy.binaryStr); | 1063 | DOM.entropyBinary.text(entropy.binaryStr); |
1063 | DOM.entropyBitsPerEvent.text(bitsPerEvent); | 1064 | DOM.entropyBitsPerEvent.text(bitsPerEvent); |
1065 | // detect and warn of filtering | ||
1066 | var rawNoSpaces = DOM.entropy.val().replace(/\s/g, ""); | ||
1067 | var cleanNoSpaces = entropy.cleanStr.replace(/\s/g, ""); | ||
1068 | var isFiltered = rawNoSpaces.length != cleanNoSpaces.length; | ||
1069 | if (isFiltered) { | ||
1070 | DOM.entropyFilterWarning.removeClass('hidden'); | ||
1071 | } | ||
1072 | else { | ||
1073 | DOM.entropyFilterWarning.addClass('hidden'); | ||
1074 | } | ||
1064 | } | 1075 | } |
1065 | 1076 | ||
1066 | function getEntropyTypeStr(entropy) { | 1077 | function getEntropyTypeStr(entropy) { |