← All recipes
Moderne licensed

Replace deprecated new crypto.Hash() and new crypto.Hmac() with factory methods

Recipe IDorg.openrewrite.node.migrate.crypto.replace-hash-constructorArtifact@openrewrite/recipes-nodejs

Replace deprecated new crypto.Hash(algorithm) constructor calls with crypto.createHash(algorithm) and new crypto.Hmac(algorithm, key) with crypto.createHmac(algorithm, key) factory methods.

Single recipeDEP0179DEP0181Proprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.node.migrate.crypto.replace-hash-constructor

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-nodejs