aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/account-import-strategies/index.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-06-12 05:58:05 +0800
committerDan Finlay <dan@danfinlay.com>2018-06-12 05:58:05 +0800
commitb24efcb1cd9092dfe131af47639ac75ed9209a4c (patch)
treec83aaae1b38a501e2b72fc397acf61222d47e6fa /app/scripts/account-import-strategies/index.js
parent385927a1b991eb96cf1db1e42d5f6d989e4a5a16 (diff)
downloadtangerine-wallet-browser-b24efcb1cd9092dfe131af47639ac75ed9209a4c.tar.gz
tangerine-wallet-browser-b24efcb1cd9092dfe131af47639ac75ed9209a4c.tar.zst
tangerine-wallet-browser-b24efcb1cd9092dfe131af47639ac75ed9209a4c.zip
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.
Diffstat (limited to 'app/scripts/account-import-strategies/index.js')
-rw-r--r--app/scripts/account-import-strategies/index.js7
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) => {