From eb9d473974fe5cf314982539c942b96b795df696 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 22 Mar 2024 18:56:20 +0530 Subject: fix(ext/node): add crypto.getRandomValues (#23028) Alias for `crypto.webcrypto.getRandomValues` --- ext/node/polyfills/crypto.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ext/node') diff --git a/ext/node/polyfills/crypto.ts b/ext/node/polyfills/crypto.ts index 7ea8800a7..db2e5c243 100644 --- a/ext/node/polyfills/crypto.ts +++ b/ext/node/polyfills/crypto.ts @@ -164,6 +164,10 @@ import { crypto as webcrypto } from "ext:deno_crypto/00_crypto.js"; const fipsForced = getOptionValue("--force-fips"); +function getRandomValues(typedArray) { + return webcrypto.getRandomValues(typedArray); +} + function createCipheriv( algorithm: CipherCCMTypes, key: CipherKey, @@ -332,6 +336,7 @@ export default { diffieHellman, DiffieHellmanGroup, ECDH, + getRandomValues, generateKey, generateKeyPair, generateKeyPairSync, @@ -480,6 +485,7 @@ export { getDiffieHellman, getFips, getHashes, + getRandomValues, Hash, hkdf, hkdfSync, -- cgit v1.2.3