Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const values in generateRandomPhrase prevent vulnerabilities #633

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,16 @@
return;
}
// get the amount of entropy to use
var numWords = parseInt(DOM.generatedStrength.val());
var strength = numWords / 3 * 32;
var buffer = new Uint8Array(strength / 8);
const numWords = parseInt(DOM.generatedStrength.val());
const strength = numWords / 3 * 32;
const buffer = new Uint8Array(strength / 8);
// create secure entropy
var data = crypto.getRandomValues(buffer);
const data = crypto.getRandomValues(buffer);
// show the words
var words = mnemonic.toMnemonic(data);
const words = mnemonic.toMnemonic(data);
DOM.phrase.val(words);
// show the entropy
var entropyHex = uint8ArrayToHex(data);
const entropyHex = uint8ArrayToHex(data);
DOM.entropy.val(entropyHex);
// ensure entropy fields are consistent with what is being displayed
DOM.entropyMnemonicLength.val("raw");
Expand Down