mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Allow custom encryptor to be passed to MetaMaskController and KeyringControllers.
This commit is contained in:
parent
9bd55f4897
commit
e9043f22df
@ -36,7 +36,7 @@ class KeyringController extends EventEmitter {
|
||||
identities: {},
|
||||
})
|
||||
this.ethStore = opts.ethStore
|
||||
this.encryptor = encryptor
|
||||
this.encryptor = opts.encryptor || encryptor
|
||||
this.keyrings = []
|
||||
this.getNetwork = opts.getNetwork
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
initState: initState.KeyringController,
|
||||
ethStore: this.ethStore,
|
||||
getNetwork: this.networkController.getNetworkState.bind(this.networkController),
|
||||
encryptor: opts.encryptor || undefined,
|
||||
})
|
||||
this.keyringController.on('newAccount', (address) => {
|
||||
this.preferencesController.setSelectedAddress(address)
|
||||
@ -674,4 +675,4 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
return Promise.resolve(rpcTarget)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,9 @@ describe('KeyringController', function () {
|
||||
ethStore: {
|
||||
addAccount (acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
|
||||
},
|
||||
encryptor: mockEncryptor,
|
||||
})
|
||||
|
||||
// Stub out the browser crypto for a mock encryptor.
|
||||
// Browser crypto is tested in the integration test suite.
|
||||
keyringController.encryptor = mockEncryptor
|
||||
|
||||
keyringController.createNewVaultAndKeychain(password)
|
||||
.then(function (newState) {
|
||||
newState
|
||||
|
Loading…
Reference in New Issue
Block a user