From: Jérôme Benoit Date: Wed, 29 Nov 2023 19:30:38 +0000 (+0100) Subject: refactor: cleanup crypto import X-Git-Tag: v3.0.10~14 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=304d379e73b2b31fbbb8f44a4c05501c36cd6c61;hp=52bd3e1633b293968f2255c2c71761ff962b98fb;p=poolifier.git refactor: cleanup crypto import Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc.js b/.eslintrc.js index 9d0d7ce4..8af594df 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -97,7 +97,6 @@ module.exports = defineConfig({ 'unlink', 'unref', 'utf8', - 'webcrypto', 'workerpool', 'ws', 'wss', diff --git a/src/utils.ts b/src/utils.ts index a0a9e530..5a685439 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import * as os from 'node:os' -import { webcrypto } from 'node:crypto' +import { getRandomValues } from 'node:crypto' import { Worker as ClusterWorker } from 'node:cluster' import { Worker as ThreadWorker } from 'node:worker_threads' import type { @@ -226,7 +226,7 @@ export const isAsyncFunction = ( * @internal */ export const secureRandom = (): number => { - return webcrypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return getRandomValues(new Uint32Array(1))[0] / 0x100000000 } /**