aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2016-12-12 10:50:09 +1100
committerIan Coleman <coleman.ian@gmail.com>2016-12-12 10:50:09 +1100
commit5eaa6877bca7f220bc2364be96c8fcb7526dedbb (patch)
tree65ca0ad70c839650be209ccf951230e49a99c80f /src
parente00964ccf7a556895784ed05f0fdec954f5558d5 (diff)
downloadBIP39-5eaa6877bca7f220bc2364be96c8fcb7526dedbb.tar.gz
BIP39-5eaa6877bca7f220bc2364be96c8fcb7526dedbb.tar.zst
BIP39-5eaa6877bca7f220bc2364be96c8fcb7526dedbb.zip
Extended Key calculation does not use global var
Diffstat (limited to 'src')
-rw-r--r--src/js/index.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/js/index.js b/src/js/index.js
index 5f688f0..1e66dd8 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -238,7 +238,7 @@
238 showValidationError(errorText); 238 showValidationError(errorText);
239 return; 239 return;
240 } 240 }
241 calcBip32ExtendedKey(derivationPath); 241 bip32ExtendedKey = calcBip32ExtendedKey(derivationPath);
242 displayBip32Info(); 242 displayBip32Info();
243 hidePending(); 243 hidePending();
244 } 244 }
@@ -318,7 +318,7 @@
318 } 318 }
319 319
320 function calcBip32ExtendedKey(path) { 320 function calcBip32ExtendedKey(path) {
321 bip32ExtendedKey = bip32RootKey; 321 var extendedKey = bip32RootKey;
322 // Derive the key from the path 322 // Derive the key from the path
323 var pathBits = path.split("/"); 323 var pathBits = path.split("/");
324 for (var i=0; i<pathBits.length; i++) { 324 for (var i=0; i<pathBits.length; i++) {
@@ -329,12 +329,13 @@
329 } 329 }
330 var hardened = bit[bit.length-1] == "'"; 330 var hardened = bit[bit.length-1] == "'";
331 if (hardened) { 331 if (hardened) {
332 bip32ExtendedKey = bip32ExtendedKey.deriveHardened(index); 332 extendedKey = extendedKey.deriveHardened(index);
333 } 333 }
334 else { 334 else {
335 bip32ExtendedKey = bip32ExtendedKey.derive(index); 335 extendedKey = extendedKey.derive(index);
336 } 336 }
337 } 337 }
338 return extendedKey
338 } 339 }
339 340
340 function showValidationError(errorText) { 341 function showValidationError(errorText) {