summaryrefslogtreecommitdiff
path: root/lib/crypto.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-09-22 11:45:42 +0200
committerAnna Henningsen <anna@addaleax.net>2018-09-27 08:43:05 -0400
commit709b3b1e1c75afe6b5dd9d7859d0142dd4d20e5c (patch)
tree70cd237b1f9f8ca4a2d5f02cb84f2dc046947041 /lib/crypto.js
parenteccc65919a6dc9a05936e070181a16604ba346e6 (diff)
downloadandroid-node-v8-709b3b1e1c75afe6b5dd9d7859d0142dd4d20e5c.tar.gz
android-node-v8-709b3b1e1c75afe6b5dd9d7859d0142dd4d20e5c.tar.bz2
android-node-v8-709b3b1e1c75afe6b5dd9d7859d0142dd4d20e5c.zip
crypto: downgrade DEP0115 to `--pending-deprecation` only
Aliases are very cheap to maintain, so an unconditional runtime deprecation that affects existing ecosystem code is not a good idea. This commit turns the runtime deprecation into a `--pending-deprecation` one. Fixes: https://github.com/nodejs/node/issues/23013 PR-URL: https://github.com/nodejs/node/pull/23017 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/crypto.js')
-rw-r--r--lib/crypto.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/crypto.js b/lib/crypto.js
index 12f5bd4bd9..ed902272de 100644
--- a/lib/crypto.js
+++ b/lib/crypto.js
@@ -36,6 +36,7 @@ const {
ERR_CRYPTO_FIPS_UNAVAILABLE
} = require('internal/errors').codes;
const constants = process.binding('constants').crypto;
+const { pendingDeprecation } = process.binding('config');
const {
fipsMode,
fipsForced
@@ -243,19 +244,24 @@ Object.defineProperties(exports, {
},
// Aliases for randomBytes are deprecated.
- // The ecosystem needs those to exist for backwards compatibility with
- // ancient Node.js runtimes (0.10, 0.12).
+ // The ecosystem needs those to exist for backwards compatibility.
prng: {
enumerable: false,
- value: deprecate(randomBytes, 'crypto.prng is deprecated.', 'DEP0115')
+ value: pendingDeprecation ?
+ deprecate(randomBytes, 'crypto.prng is deprecated.', 'DEP0115') :
+ randomBytes
},
pseudoRandomBytes: {
enumerable: false,
- value: deprecate(randomBytes,
- 'crypto.pseudoRandomBytes is deprecated.', 'DEP0115')
+ value: pendingDeprecation ?
+ deprecate(randomBytes,
+ 'crypto.pseudoRandomBytes is deprecated.', 'DEP0115') :
+ randomBytes
},
rng: {
enumerable: false,
- value: deprecate(randomBytes, 'crypto.rng is deprecated.', 'DEP0115')
+ value: pendingDeprecation ?
+ deprecate(randomBytes, 'crypto.rng is deprecated.', 'DEP0115') :
+ randomBytes
}
});