1import Maybe from 'folktale/maybe'
2import React from 'react'
3import * as keythereum from 'keythereum'
4import { Button } from '../components/Base'
5import { Input, InnerLabel, InputCaption } from '../components/Base'
6import { Row, Col, H1, Form } from '../components/Base'
8import { ROUTE_NAMES } from '../lib/router'
9import { EthereumWallet } from '../lib/wallet'
11class Keystore extends React.Component {
21 this.handleKeystoreInput = this.handleKeystoreInput.bind(this)
22 this.handlePasswordInput = this.handlePasswordInput.bind(this)
23 this.constructWallet = this.constructWallet.bind(this)
26 handleKeystoreInput(keystore) {
27 this.setState({ keystore })
30 handlePasswordInput(password) {
31 this.setState({ password })
35 const { setWallet } = this.props
36 const { keystore, password } = this.state
39 const json = JSON.parse(keystore)
40 const privateKey = keythereum.recover(password, json)
41 const wallet = new EthereumWallet(privateKey)
42 setWallet(Maybe.Just(wallet))
44 setWallet(Maybe.Nothing())
49 const { pushRoute, popRoute, wallet } = this.props
50 const { keystore, password } = this.state
54 <Col className={'measure-md'}>
55 <H1 className={'mb-4'}>{ 'Enter Your Keystore File' }</H1>
58 { `Please paste in your Ethereum keystore file. If your keystore
59 file is encrypted with a password, you'll also need to enter
66 prop-format='innerLabel'
69 onChange={ this.handleKeystoreInput }
73 <InnerLabel>{'Keystore File'}</InnerLabel>
79 prop-format='innerLabel'
82 onChange={ this.handlePasswordInput }
86 <InnerLabel>{'Password'}</InnerLabel>
91 prop-size={ 'wide lg' }
92 disabled={ keystore === '' }
93 onClick={ this.constructWallet }
100 prop-size={ 'wide lg' }
101 disabled={ Maybe.Nothing.hasInstance(wallet) }
104 pushRoute(ROUTE_NAMES.SHIPS)
120export default Keystore
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list