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

19 lines
503 B
TypeScript

import { fromV3, IFullWallet } from 'ethereumjs-wallet';
const worker: Worker = self as any;
interface DecryptionParameters {
keystore: string;
password: string;
nonStrict: boolean;
}
worker.onmessage = (event: MessageEvent) => {
const info: DecryptionParameters = event.data;
try {
const rawKeystore: IFullWallet = fromV3(info.keystore, info.password, info.nonStrict);
worker.postMessage(rawKeystore.getPrivateKeyString());
} catch (e) {
worker.postMessage(e.message);
}
};