diff options
author | Dan Finlay <dan@danfinlay.com> | 2018-06-06 04:44:03 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2018-06-06 04:44:03 +0800 |
commit | d61c979de68934f9d2315261fdaa35fa601d7969 (patch) | |
tree | 7f6e2323ba11763abb1f4e19298b62e96dd191fd /app | |
parent | 3b6e96bac918925c4edc674e26dba8cc5feb1324 (diff) | |
download | tangerine-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.js | 3 |
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 }, |