diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-03-26 06:38:08 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-03-26 06:38:08 +0800 |
commit | f05ad130c5de29f5d1e0188e109112e608aa82bb (patch) | |
tree | bf27ce4deea77149d7410e04aa7046e717ad9444 /app | |
parent | a2c7ccafa6b4cdbd5f1725f7bf40189ad987cffa (diff) | |
download | tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar.gz tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar.bz2 tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar.lz tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar.xz tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.tar.zst tangerine-wallet-browser-f05ad130c5de29f5d1e0188e109112e608aa82bb.zip |
Cleaned up how we pass hdString to Lightwallet
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/idStore.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/scripts/lib/idStore.js b/app/scripts/lib/idStore.js index 1491effcc..2e416c8b7 100644 --- a/app/scripts/lib/idStore.js +++ b/app/scripts/lib/idStore.js @@ -218,7 +218,7 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){ var serializedKeystore = window.localStorage['lightwallet'] if (seed) { - keyStore = this._restoreFromSeed(seed, derivedKey) + keyStore = this._restoreFromSeed(password, seed, derivedKey) // returning user, recovering from localStorage } else if (serializedKeystore) { @@ -235,15 +235,19 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){ this._idmgmt = new IdManagement({ keyStore: keyStore, derivedKey: derivedKey, + hdPathSTring: this.hdPathString, }) cb() }) } -IdentityStore.prototype._restoreFromSeed = function(seed, derivedKey) { +IdentityStore.prototype._restoreFromSeed = function(password, seed, derivedKey) { var keyStore = new LightwalletKeyStore(seed, derivedKey, this.hdPathString) - keyStore.generateNewAddress(derivedKey, 3, this.hdPathString) + keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'}); + keyStore.setDefaultHdDerivationPath(this.hdPathString) + + keyStore.generateNewAddress(derivedKey, 3) window.localStorage['lightwallet'] = keyStore.serialize() console.log('restored from seed. saved to keystore localStorage') return keyStore @@ -256,7 +260,10 @@ IdentityStore.prototype._loadFromLocalStorage = function(serializedKeystore, der IdentityStore.prototype._createFirstWallet = function(entropy, derivedKey) { var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy) var keyStore = new LightwalletKeyStore(secretSeed, derivedKey, this.hdPathString) - keyStore.generateNewAddress(derivedKey, 3, this.hdPathString) + keyStore.addHdDerivationPath(this.hdPathString, derivedKey, {curve: 'secp256k1', purpose: 'sign'}); + keyStore.setDefaultHdDerivationPath(this.hdPathString) + + keyStore.generateNewAddress(derivedKey, 3) window.localStorage['lightwallet'] = keyStore.serialize() console.log('saved to keystore localStorage') return keyStore |