mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +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.
24 lines
657 B
TypeScript
24 lines
657 B
TypeScript
import { IFullWallet, fromPrivateKey } from 'ethereumjs-wallet';
|
|
import { toBuffer } from 'ethereumjs-util';
|
|
import Worker from 'worker-loader!./workers/fromV3.worker.ts';
|
|
|
|
export default function fromV3(
|
|
keystore: string,
|
|
password: string,
|
|
nonStrict: boolean
|
|
): Promise<IFullWallet> {
|
|
return new Promise((resolve, reject) => {
|
|
const worker = new Worker();
|
|
worker.postMessage({ keystore, password, nonStrict });
|
|
worker.onmessage = (ev: MessageEvent) => {
|
|
const data = ev.data;
|
|
try {
|
|
const wallet = fromPrivateKey(toBuffer(data));
|
|
resolve(wallet);
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
});
|
|
}
|