From afe56aa58b65ece898109e8c9396f7067d667b0f Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Wed, 25 Sep 2024 18:31:03 -0400 Subject: [PATCH] crypto: runtime deprecate crypto.fips PR-URL: https://github.com/nodejs/node/pull/55019 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Richard Lau --- doc/api/deprecations.md | 5 ++++- lib/crypto.js | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 6d3bcf75aa6..45fa6733cc8 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2030,12 +2030,15 @@ or `module.exports` instead. -Type: Documentation-only +Type: Runtime The [`crypto.fips`][] property is deprecated. Please use `crypto.setFips()` and `crypto.getFips()` instead. diff --git a/lib/crypto.js b/lib/crypto.js index 73c2525e082..943f7e49741 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -330,11 +330,12 @@ function getRandomBytesAlias(key) { } ObjectDefineProperties(module.exports, { - // crypto.fips is deprecated. DEP0093. Use crypto.getFips()/crypto.setFips() fips: { __proto__: null, - get: getFips, - set: setFips, + get: deprecate(getFips, 'The crypto.fips is deprecated. ' + + 'Please use crypto.getFips()', 'DEP0093'), + set: deprecate(setFips, 'The crypto.fips is deprecated. ' + + 'Please use crypto.setFips()', 'DEP0093'), }, constants: { __proto__: null,