1import { Just, Nothing } from 'folktale/maybe';
2import React, { useState } from 'react';
4import View from '../../components/View';
5import { PassphraseInput } from '../../components/Inputs';
6import { ForwardButton } from '../../components/Buttons';
8import { EthereumWallet } from '../../lib/wallet';
9import { useWallet } from '../../store/wallet';
11export default function PrivateKey({ loginCompleted }) {
12 const { wallet, setWallet } = useWallet();
14 const [privateKey, setPrivateKey] = useState('');
16 const handlePrivateKeyInput = privateKey => {
17 setPrivateKey(privateKey);
18 constructWallet(privateKey);
21 const constructWallet = privateKey => {
22 if (/^[0-9A-Fa-f]{64}$/g.test(privateKey) === true) {
23 const sec = Buffer.from(privateKey, 'hex');
24 const newWallet = new EthereumWallet(sec);
25 setWallet(Just(newWallet));
33 Please enter your raw Ethereum private key here.
38 initialValue={privateKey}
39 onValue={handlePrivateKeyInput}
45 disabled={Nothing.hasInstance(wallet)}
46 onClick={loginCompleted}>
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