mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
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.
This commit is contained in:
parent
3b6e96bac9
commit
d61c979de6
@ -16,6 +16,9 @@ const accountImporter = {
|
|||||||
|
|
||||||
strategies: {
|
strategies: {
|
||||||
'Private Key': (privateKey) => {
|
'Private Key': (privateKey) => {
|
||||||
|
if (!privateKey) {
|
||||||
|
throw new Error('Cannot import an empty key.')
|
||||||
|
}
|
||||||
const stripped = ethUtil.stripHexPrefix(privateKey)
|
const stripped = ethUtil.stripHexPrefix(privateKey)
|
||||||
return stripped
|
return stripped
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user