diff options
Diffstat (limited to 'app/scripts/account-import-strategies/index.js')
-rw-r--r-- | app/scripts/account-import-strategies/index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/scripts/account-import-strategies/index.js b/app/scripts/account-import-strategies/index.js index 9f2703571..5972cb345 100644 --- a/app/scripts/account-import-strategies/index.js +++ b/app/scripts/account-import-strategies/index.js @@ -19,7 +19,14 @@ const accountImporter = { if (!privateKey) { throw new Error('Cannot import an empty key.') } + const stripped = ethUtil.stripHexPrefix(privateKey) + const buffer = ethUtil.toBuffer(stripped) + + if (!ethUtil.isValidPrivate(buffer)) { + throw new Error('Cannot import invalid private key.') + } + return stripped }, 'JSON File': (input, password) => { |