diff options
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/scripts/account-import-strategies/index.js')
-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 }, |