!question This function is throwing error "crypto.getRandomValues must be defined" ```exports.wrapCo

!question
This function is throwing error "crypto.getRandomValues must be defined"
exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
/**
 * Secure PRNG. Uses `globalThis.crypto` or node.js crypto module.
 */ function randomBytes(bytesLength = 32) {
    if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
    throw new Error("crypto.getRandomValues must be defined");
}

How can i fix it?
Was this page helpful?