Skip to content

Commit

Permalink
account-import-strategies - ensure privateKey is prefixed before conv…
Browse files Browse the repository at this point in the history
…erting to buffer
  • Loading branch information
kumavis committed Jun 14, 2018
1 parent 7a00144 commit 691ac5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/scripts/account-import-strategies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 691ac5d

Please sign in to comment.