Nnodejs

nodejs/crypto-rsa-pss-update

Handle DEP0154 via transforming deprecated RSA-PSS crypto options `hash` to `hashAlgorithm` and `mgf1Hash` to `mgf1HashAlgorithm`

transformationmigrationcryptorsa-pss
Public
0 downloads
1 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

crypto-rsa-pss-update

Codemod to handle Node.js crypto deprecation DEP0154 by transforming deprecated RSA-PSS key generation options.

What it does

This codemod transforms deprecated RSA-PSS crypto options in crypto.generateKeyPair() and crypto.generateKeyPairSync() calls:

  • hashhashAlgorithm
  • mgf1Hashmgf1HashAlgorithm

The transformation only applies to calls with 'rsa-pss' as the key type.

Examples

Before

js

After

js

Usage

bash

Supports

  • Both crypto.generateKeyPair() and crypto.generateKeyPairSync()
  • Destructured imports: const { generateKeyPair } = require('crypto')
  • Variable references: const options = { hash: 'sha256' }
  • Function calls: getKeyOptions() returning crypto options
  • This property patterns: this.options = { hash: 'sha256' }
  • Only transforms 'rsa-pss' key type calls
  • Preserves all other options and call structure

Ready to contribute?

Build your own codemod and share it with the community.