summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorGerhard Stoebich <deb2001-github@yahoo.de>2018-11-05 17:07:48 +0100
committerRich Trott <rtrott@gmail.com>2018-11-24 18:26:17 -0800
commitf85d63609cbba3b8af769884d860799c96583a3c (patch)
treeb1955509fa07d72bb607b4716cbb5703eb587c66 /lib/crypto.js
parent895fe2f574cc09eaadb8e9157c46751d9cdf7e51 (diff)
downloadandroid-node-v8-f85d63609cbba3b8af769884d860799c96583a3c.tar.gz
android-node-v8-f85d63609cbba3b8af769884d860799c96583a3c.tar.bz2
android-node-v8-f85d63609cbba3b8af769884d860799c96583a3c.zip
crypto: allow monkey patching of pseudoRandomBytes
Make `pseudoRandomBytes` and it's aliases `prng` and `rng` configurable to allow monkey patching. PR-URL: https://github.com/nodejs/node/pull/24108 Refs: https://github.com/nodejs/node/pull/22519 Refs: https://github.com/nodejs/node/pull/23017 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 2645e78e5e..a3865ab7e4 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -247,12 +247,16 @@ Object.defineProperties(exports, {
// The ecosystem needs those to exist for backwards compatibility.
prng: {
enumerable: false,
+ configurable: true,
+ writable: true,
value: pendingDeprecation ?
deprecate(randomBytes, 'crypto.prng is deprecated.', 'DEP0115') :
randomBytes
},
pseudoRandomBytes: {
enumerable: false,
+ configurable: true,
+ writable: true,
value: pendingDeprecation ?
deprecate(randomBytes,
'crypto.pseudoRandomBytes is deprecated.', 'DEP0115') :
@@ -260,6 +264,8 @@ Object.defineProperties(exports, {
},
rng: {
enumerable: false,
+ configurable: true,
+ writable: true,
value: pendingDeprecation ?
deprecate(randomBytes, 'crypto.rng is deprecated.', 'DEP0115') :
randomBytes