diff options
author | kumavis <aaron@kumavis.me> | 2018-06-14 12:06:33 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-06-14 12:06:33 +0800 |
commit | 691ac5d288963f376e34c1711e23bbd58432396f (patch) | |
tree | 9e22a6c53b370b3a55684b4c955968b72bc8c598 /app | |
parent | 7a001447a83e80cedde1f1094b86e8dbcb9d3b90 (diff) | |
download | tangerine-wallet-browser-691ac5d288963f376e34c1711e23bbd58432396f.tar.gz tangerine-wallet-browser-691ac5d288963f376e34c1711e23bbd58432396f.tar.zst tangerine-wallet-browser-691ac5d288963f376e34c1711e23bbd58432396f.zip |
account-import-strategies - ensure privateKey is prefixed before converting to buffer
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/account-import-strategies/index.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/scripts/account-import-strategies/index.js b/app/scripts/account-import-strategies/index.js index 5972cb345..16ae224ea 100644 --- a/app/scripts/account-import-strategies/index.js +++ b/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) => { |