How to use the @zilliqa-js/crypto.schnorr.generatePrivateKey function in @zilliqa-js/crypto

To help you get started, we’ve selected a few @zilliqa-js/crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zilliqa / nucleus-wallet / src / encrypt.worker.ts View on Github external
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 });
  }
};