-
-
Notifications
You must be signed in to change notification settings - Fork 19
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Description
This codemod should migrate crypto.fips property usage to crypto.getFips() and crypto.setFips(). It's useful to migrate code that uses the deprecated crypto.fips
property which has been replaced with dedicated functions.
It should replace property reads with crypto.getFips()
calls. It should replace property assignments with crypto.setFips()
calls. It should handle both CommonJS and ESM imports. It should preserve FIPS mode configuration logic.
Examples
Case 1
Before:
const crypto = require("node:crypto");
if (crypto.fips) {
console.log("FIPS mode is enabled");
}
After:
const crypto = require("node:crypto");
if (crypto.getFips()) {
console.log("FIPS mode is enabled");
}
Case 2
Before:
const crypto = require("node:crypto");
crypto.fips = true;
After:
const crypto = require("node:crypto");
crypto.setFips(true);
Case 3
Before:
const crypto = require("node:crypto");
if (process.env.ENABLE_FIPS === "true") {
crypto.fips = true;
}
console.log("FIPS enabled:", crypto.fips);
After:
const crypto = require("node:crypto");
if (process.env.ENABLE_FIPS === "true") {
crypto.setFips(true);
}
console.log("FIPS enabled:", crypto.getFips());
Case 4
Before:
import crypto from "node:crypto";
const fipsStatus = crypto.fips;
crypto.fips = !fipsStatus;
After:
import crypto from "node:crypto";
const fipsStatus = crypto.getFips();
crypto.setFips(!fipsStatus);
REFS
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Type
Projects
Status
🏗 In progress