From 56ea99c2ba591a9797a21e317d666b0f8bce8a66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 25 Aug 2023 19:45:01 +0200 Subject: [PATCH] fix: workaround node 16 issue with crypto named export MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 6178d8f1..33ec019d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import * as os from 'node:os' -import { getRandomValues } from 'node:crypto' +import * as crypto from 'node:crypto' import type { MeasurementStatisticsRequirements, WorkerChoiceStrategyOptions @@ -254,5 +254,5 @@ export const once = ( * @returns A number in the [0,1[ range */ export const secureRandom = (): number => { - return getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 } -- 2.34.1