mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
15 lines
466 B
JavaScript
15 lines
466 B
JavaScript
const { AsyncLocalStorage } = require("async_hooks");
|
|
const crypto = require("crypto");
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({ test: "crypto.generateKey" }, () => {
|
|
crypto.generateKey("hmac", { length: 64 }, (err, key) => {
|
|
if (asyncLocalStorage.getStore()?.test !== "crypto.generateKey") {
|
|
console.error("FAIL: crypto.generateKey callback lost context");
|
|
process.exit(1);
|
|
}
|
|
process.exit(0);
|
|
});
|
|
});
|