mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Instead of creating a RandomBytesJob object, it calls CSPRNG() directly now. Assisted-by: Claude Code Signed-off-by: Mert Can Altin <mertgold60@gmail.com> PR-URL: https://github.com/nodejs/node/pull/66348 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
24 lines
737 B
JavaScript
24 lines
737 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
|
|
// randomFillSync() should be reported by --trace-sync-io when it runs after
|
|
// the first event loop turn.
|
|
|
|
if (process.argv[2] === 'child') {
|
|
setImmediate(() => {
|
|
require('crypto').randomFillSync(Buffer.alloc(16));
|
|
});
|
|
return;
|
|
}
|
|
|
|
const { stderr, status } = spawnSync(process.execPath,
|
|
['--trace-sync-io', __filename, 'child'],
|
|
{ encoding: 'utf8' });
|
|
assert.strictEqual(status, 0);
|
|
assert.match(stderr, /WARNING: Detected use of sync API[\s\S]*randomFillSync/);
|