diff options
author | Tobias Nießen <tniessen@tnie.de> | 2018-08-25 12:04:35 +0200 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2018-08-30 17:19:51 +0200 |
commit | 221df2286d079a741e844ef50da3e945a1dccb69 (patch) | |
tree | b407ccdceee130eee8eb9b526f156a00f2ec75b2 /lib/crypto.js | |
parent | f417ea1eae47a9ef04a82f58eb3f24db45cfdc27 (diff) | |
download | android-node-v8-221df2286d079a741e844ef50da3e945a1dccb69.tar.gz android-node-v8-221df2286d079a741e844ef50da3e945a1dccb69.tar.bz2 android-node-v8-221df2286d079a741e844ef50da3e945a1dccb69.zip |
crypto: deprecate aliases for randomBytes
PR-URL: https://github.com/nodejs/node/pull/22519
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/crypto.js')
-rw-r--r-- | lib/crypto.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/crypto.js b/lib/crypto.js index c2d3eb38cf..ecf0c4d10b 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -155,14 +155,11 @@ module.exports = exports = { pbkdf2Sync, privateDecrypt, privateEncrypt, - prng: randomBytes, - pseudoRandomBytes: randomBytes, publicDecrypt, publicEncrypt, randomBytes, randomFill, randomFillSync, - rng: randomBytes, scrypt, scryptSync, setEngine, @@ -234,5 +231,22 @@ Object.defineProperties(exports, { configurable: false, enumerable: true, value: constants + }, + + // Aliases for randomBytes are deprecated. + // The ecosystem needs those to exist for backwards compatibility with + // ancient Node.js runtimes (0.10, 0.12). + prng: { + enumerable: false, + value: deprecate(randomBytes, 'crypto.prng is deprecated.', 'DEP0115') + }, + pseudoRandomBytes: { + enumerable: false, + value: deprecate(randomBytes, + 'crypto.pseudoRandomBytes is deprecated.', 'DEP0115') + }, + rng: { + enumerable: false, + value: deprecate(randomBytes, 'crypto.rng is deprecated.', 'DEP0115') } }); |