From b24efcb1cd9092dfe131af47639ac75ed9209a4c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 11 Jun 2018 14:58:05 -0700 Subject: Make account import tests much more specific However, they no longer seem to work. I'm unclear why this test is failing. The private key being provided should be valid. --- app/scripts/account-import-strategies/index.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/scripts/account-import-strategies') 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) => { -- cgit