Files
bun.sh/test/js/node/async_hooks/async-context/async-context-crypto-generateKeyPair.js
Jarred Sumner e1505b7143 Use JSC::Integrity:: auditCellFully in bindings (#22538)
### What does this PR do?

### How did you verify your code works?
2025-09-10 00:31:54 -07:00

22 lines
594 B
JavaScript

process.exitCode = 1;
const { AsyncLocalStorage } = require("async_hooks");
const crypto = require("crypto");
const asyncLocalStorage = new AsyncLocalStorage();
asyncLocalStorage.run({ test: "crypto.generateKeyPair" }, () => {
crypto.generateKeyPair(
"rsa",
{
modulusLength: 512, // Small for faster test
},
(err, publicKey, privateKey) => {
if (asyncLocalStorage.getStore()?.test !== "crypto.generateKeyPair") {
console.error("FAIL: crypto.generateKeyPair callback lost context");
process.exit(1);
}
process.exit(0);
},
);
});