1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Add tolerance for hex prefixed private keys to simple keychain

This commit is contained in:
Dan Finlay 2017-01-02 13:55:43 -08:00
parent 5e8a344f97
commit edc5f9e821

View File

@ -19,9 +19,10 @@ class SimpleKeyring extends EventEmitter {
return Promise.resolve(this.wallets.map(w => w.getPrivateKey().toString('hex')))
}
deserialize (wallets = []) {
this.wallets = wallets.map((w) => {
var b = new Buffer(w, 'hex')
deserialize (privateKeys = []) {
this.wallets = privateKeys.map((w) => {
const stripped = ethUtil.stripHexPrefix(w)
const b = new Buffer(stripped, 'hex')
const wallet = Wallet.fromPrivateKey(b)
return wallet
})