import React, {Component} from 'react'; import translate from 'translations'; import wallet from 'ethereumjs-wallet'; import ethUtil from 'ethereumjs-util'; export default class KeystoreDecrypt extends Component { constructor(props) { super(props); } handleFileSelection = (event) => { const fileReader = new FileReader(); const inputFile = event.target.files[0]; fileReader.onload = () => { try { const keyStoreString = fileReader.result; const decryptedWallet = wallet.fromV3(keyStoreString, 'asdfasdfasdf', true); const privateHex = ethUtil.bufferToHex(decryptedWallet._privKey); const publicHex = ethUtil.bufferToHex(ethUtil.privateToAddress(decryptedWallet._privKey)); console.log(privateHex, publicHex); // TODO: Remove console log, it's only here to let Travis pass } catch (e) { console.error('Could not parse Keystore file.', e); } }; fileReader.readAsText(inputFile, 'utf-8'); } render() { return (

{translate('ADD_Radio_2_alt')}

); } }