William O'Beirne 174dea8a29 MEW-01-004 - Stronger Keystores (#981)
* Add better password checking, confirm password, feedback, and up the minimum to 12.

* Move wallet generation off to a web worker, and bump up the n value to 8192. Refactor workers a wee bit.

* tscheck cleanup

* Make keystore password a form. Replace text with spinner on load.

* Center align again.

* Hard code n factor of test wallet, fix some misspelled type definitions for IV3Wallet.
2018-02-02 00:01:30 -06:00

31 lines
1.0 KiB
TypeScript

import { fromPrivateKey, fromEthSale } from 'ethereumjs-wallet';
import { fromEtherWallet } from 'ethereumjs-wallet/thirdparty';
import { signWrapper } from './helpers';
import { decryptPrivKey } from 'libs/decrypt';
import { fromV3 } from 'libs/web-workers';
import Web3Wallet from './web3';
import AddressOnlyWallet from './address';
const EncryptedPrivateKeyWallet = (encryptedPrivateKey: string, password: string) =>
signWrapper(fromPrivateKey(decryptPrivKey(encryptedPrivateKey, password)));
const PresaleWallet = (keystore: string, password: string) =>
signWrapper(fromEthSale(keystore, password));
const MewV1Wallet = (keystore: string, password: string) =>
signWrapper(fromEtherWallet(keystore, password));
const PrivKeyWallet = (privkey: Buffer) => signWrapper(fromPrivateKey(privkey));
const UtcWallet = (keystore: string, password: string) => fromV3(keystore, password, true);
export {
EncryptedPrivateKeyWallet,
PresaleWallet,
MewV1Wallet,
PrivKeyWallet,
UtcWallet,
Web3Wallet,
AddressOnlyWallet
};