account-import-strategies - ensure privateKey is prefixed before converting to buffer

feature/default_network_editable
kumavis 7 years ago
parent 7a001447a8
commit 691ac5d288
  1. 5
      app/scripts/account-import-strategies/index.js

@ -20,13 +20,14 @@ const accountImporter = {
throw new Error('Cannot import an empty key.')
}
const stripped = ethUtil.stripHexPrefix(privateKey)
const buffer = ethUtil.toBuffer(stripped)
const prefixed = ethUtil.addHexPrefix(privateKey)
const buffer = ethUtil.toBuffer(prefixed)
if (!ethUtil.isValidPrivate(buffer)) {
throw new Error('Cannot import invalid private key.')
}
const stripped = ethUtil.stripHexPrefix(prefixed)
return stripped
},
'JSON File': (input, password) => {

Loading…
Cancel
Save