mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Cleaned up how we pass hdString to Lightwallet
This commit is contained in:
parent
a2c7ccafa6
commit
f05ad130c5
@ -218,7 +218,7 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){
|
|||||||
var serializedKeystore = window.localStorage['lightwallet']
|
var serializedKeystore = window.localStorage['lightwallet']
|
||||||
|
|
||||||
if (seed) {
|
if (seed) {
|
||||||
keyStore = this._restoreFromSeed(seed, derivedKey)
|
keyStore = this._restoreFromSeed(password, seed, derivedKey)
|
||||||
|
|
||||||
// returning user, recovering from localStorage
|
// returning user, recovering from localStorage
|
||||||
} else if (serializedKeystore) {
|
} else if (serializedKeystore) {
|
||||||
@ -235,15 +235,19 @@ IdentityStore.prototype._createIdmgmt = function(password, seed, entropy, cb){
|
|||||||
this._idmgmt = new IdManagement({
|
this._idmgmt = new IdManagement({
|
||||||
keyStore: keyStore,
|
keyStore: keyStore,
|
||||||
derivedKey: derivedKey,
|
derivedKey: derivedKey,
|
||||||
|
hdPathSTring: this.hdPathString,
|
||||||
})
|
})
|
||||||
|
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityStore.prototype._restoreFromSeed = function(seed, derivedKey) {
|
IdentityStore.prototype._restoreFromSeed = function(password, seed, derivedKey) {
|
||||||
var keyStore = new LightwalletKeyStore(seed, derivedKey, this.hdPathString)
|
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()
|
window.localStorage['lightwallet'] = keyStore.serialize()
|
||||||
console.log('restored from seed. saved to keystore localStorage')
|
console.log('restored from seed. saved to keystore localStorage')
|
||||||
return keyStore
|
return keyStore
|
||||||
@ -256,7 +260,10 @@ IdentityStore.prototype._loadFromLocalStorage = function(serializedKeystore, der
|
|||||||
IdentityStore.prototype._createFirstWallet = function(entropy, derivedKey) {
|
IdentityStore.prototype._createFirstWallet = function(entropy, derivedKey) {
|
||||||
var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy)
|
var secretSeed = LightwalletKeyStore.generateRandomSeed(entropy)
|
||||||
var keyStore = new LightwalletKeyStore(secretSeed, derivedKey, this.hdPathString)
|
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()
|
window.localStorage['lightwallet'] = keyStore.serialize()
|
||||||
console.log('saved to keystore localStorage')
|
console.log('saved to keystore localStorage')
|
||||||
return keyStore
|
return keyStore
|
||||||
|
Loading…
Reference in New Issue
Block a user