From 304d379e73b2b31fbbb8f44a4c05501c36cd6c61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 29 Nov 2023 20:30:38 +0100 Subject: [PATCH] refactor: cleanup crypto import MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .eslintrc.js | 1 - src/utils.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) 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 } /** -- 2.34.1