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.
feature/default_network_editable
Dan Finlay 7 years ago
parent 3b6e96bac9
commit d61c979de6
  1. 3
      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
},

Loading…
Cancel
Save