Eddie Wang 818ad9fef5 Add Private key to V3 keystore functionality (#336)
* setup components, reducers, actions, and added routes

* removed redux, using local state and ethereumjs-wallet

* added validation and state reset

* added visibility options and changed btn colors

* updated isValidPrivKey and updated some components to stateless functional comp

* componentize input and add placeholder message

* removed cn from KeystoreDetails

* adds isValidPrivate to buffer check and min pw length to 0

* remove packagelock to fix merge conflict

* added utilities tab removed keystore tab

* adds fixpkey in validators and uses it across two components

* added checksum removal and btn css fixes

* Fixed en.json formatting - also removed fixedPkey

* Added unit tests for isValidPrivKey

* add runtime checks and rename stripHexPrefix to strippedPrivateKey

* switch back to stripHexPrefix

* Add constant for n-factor

* enforce 9 char minimum
2017-11-30 14:16:30 -06:00

44 lines
853 B
TypeScript

import React from 'react';
import classnames from 'classnames';
interface Props {
isValid: boolean;
isVisible: boolean;
name: string;
value: string;
placeholder: string;
handleInput(e: React.FormEvent<HTMLInputElement>): void;
handleToggle(): void;
}
const KeystoreInput: React.SFC<Props> = ({
isValid,
isVisible,
handleInput,
name,
value,
placeholder,
handleToggle
}) => (
<div className="input-group">
<input
className={classnames(
'form-control',
isValid ? 'is-valid' : 'is-invalid'
)}
type={isVisible ? 'text' : 'password'}
name={name}
placeholder={placeholder}
value={value}
onChange={handleInput}
/>
<span
onClick={handleToggle}
role="button"
className="input-group-addon eye"
/>
</div>
);
export default KeystoreInput;