ethereumjs/keythereum

Import Key dependency on NodeJS

Closed this issue · 2 comments

Just wondering why key import only runs on Node? I was hoping to be able to upload a key file or at least paste in the json into a text box and have keythereum import it.

It only runs on Node because the full code to import a file in the browser would use the HTML5 File API, which I felt would be out-of-place in keythereum and should be handled by the client. (e.g. https://github.com/AugurProject/augur/blob/develop/app/components/Register.jsx#L231-L248)

If you want to let users paste in their json as plain text, that's much easier. If myPastedJson is the plain text json, just do:

keythereum.recover(password, JSON.parse(myPastedJson), function (privateKey) {
   /* now the treasure is mine!!! */
});

(I could add a special "importFromPlainText" method for this, but I feel like that might be overkill, since it would really just be calling JSON.parse under the hood!)

Thanks, I should be able to use that recover example.