Commit Graph

6 Commits

Author SHA1 Message Date
kumavis 691ac5d288 account-import-strategies - ensure privateKey is prefixed before converting to buffer 2018-06-13 21:06:33 -07:00
Dan Finlay b24efcb1cd Make account import tests much more specific
However, they no longer seem to work. I'm unclear why this test is
failing. The private key being provided should be valid.
2018-06-11 14:58:05 -07:00
Dan Finlay d61c979de6 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.
2018-06-05 13:44:03 -07:00
Thomas Huang 6bdb4c8728 Fix linting warnings 2017-04-26 21:05:45 -07:00
Dan Finlay 5d8a3dd99b Add ability to import v3 JSON wallets
There is now a menu item labeled "JSON File" for importing, and it can digest either:
- v1 MyEtherWallet JSON files
- v3 Account files (used by Geth, Mist, and MyEtherWallet).

Fixes #715
2017-01-18 16:45:39 -08:00
Dan Finlay b52346388b Added new modular private key import system
Now any strategy for importing a private key that can be described as a pure function can be very easily turned into a MetaMask import strategy.

I've created a generic and reusable UI action called `importNewAccount(strategy, args)`.

The `strategy` is a unique identifier defined in `app/scripts/account-import-strategies`, and the `args` will be passed to the member of the `strategies` array whose key matches the strategy string.

Strategies return private key hex strings, and are used by the metamask-controller to create a new keyring, and select that new account, before calling back.

This also implements @frankiebee's idea of showing the imported account when it's been imported (my oversight!).

This commit only moves us to this architecture, keeping feature parity for private key import, but has some untested code for importing geth-style JSON files as well!
2017-01-18 15:20:48 -08:00