mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 11:05:47 +00:00
174dea8a29
* 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.
20 lines
615 B
TypeScript
20 lines
615 B
TypeScript
import { generate } from 'ethereumjs-wallet';
|
|
import { toChecksumAddress } from 'ethereumjs-util';
|
|
|
|
const worker: Worker = self as any;
|
|
|
|
interface GenerateParameters {
|
|
password: string;
|
|
N_FACTOR: number;
|
|
}
|
|
|
|
worker.onmessage = (event: MessageEvent) => {
|
|
const info: GenerateParameters = event.data;
|
|
const wallet = generate();
|
|
const filename = wallet.getV3Filename();
|
|
const privateKey = wallet.getPrivateKeyString();
|
|
const keystore = wallet.toV3(info.password, { n: info.N_FACTOR });
|
|
keystore.address = toChecksumAddress(keystore.address);
|
|
worker.postMessage({ keystore, filename, privateKey });
|
|
};
|