Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const encrypt = async (event) => {
try {
const { passphrase } = event.data;
const privateKey = schnorr.generatePrivateKey();
const keystoreJSON = await encryptPrivateKey('pbkdf2', privateKey, passphrase);
// @ts-ignore
self.postMessage({ keystoreJSON, privateKey });
} catch (error) {
console.log(error);
// @ts-ignore
self.postMessage({ keystoreJSON: undefined, privateKey: undefined });
}
};