diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-03-22 18:56:20 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 18:56:20 +0530 |
commit | eb9d473974fe5cf314982539c942b96b795df696 (patch) | |
tree | 5946e778e251f55f78d86a5c7453c8dfb2fc47a2 | |
parent | f96f167dc8cc733b43d67801f568b2d546bc2fb9 (diff) |
fix(ext/node): add crypto.getRandomValues (#23028)
Alias for `crypto.webcrypto.getRandomValues`
-rw-r--r-- | ext/node/polyfills/crypto.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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, |