aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-06-06 04:44:03 +0800
committerDan Finlay <dan@danfinlay.com>2018-06-06 04:44:03 +0800
commitd61c979de68934f9d2315261fdaa35fa601d7969 (patch)
tree7f6e2323ba11763abb1f4e19298b62e96dd191fd /app
parent3b6e96bac918925c4edc674e26dba8cc5feb1324 (diff)
downloadtangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar.gz
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar.bz2
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar.lz
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar.xz
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.tar.zst
tangerine-wallet-browser-d61c979de68934f9d2315261fdaa35fa601d7969.zip
Add validation for importing empty private key
Previously importing an empty string would result in a new empty Keyring object to be constructed, with no notification to the user. Now we render a clear error explaining the mistake.
Diffstat (limited to 'app')
-rw-r--r--app/scripts/account-import-strategies/index.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/scripts/account-import-strategies/index.js b/app/scripts/account-import-strategies/index.js
index 96e2b5912..9f2703571 100644
--- a/app/scripts/account-import-strategies/index.js
+++ b/app/scripts/account-import-strategies/index.js
@@ -16,6 +16,9 @@ const accountImporter = {
strategies: {
'Private Key': (privateKey) => {
+ if (!privateKey) {
+ throw new Error('Cannot import an empty key.')
+ }
const stripped = ethUtil.stripHexPrefix(privateKey)
return stripped
},