What It Does
The codemod transforms RSA-PSS crypto options:hash→hashAlgorithmmgf1Hash→mgf1HashAlgorithm
crypto.generateKeyPair()callscrypto.generateKeyPairSync()calls- Only when key type is
'rsa-pss'
Usage
Examples
Async Key Generation
Before
After
Sync Key Generation
Before
After
Supported Patterns
The codemod handles various code patterns:Destructured Imports
Variable References
Object Properties
Function Returns
What is RSA-PSS?
RSA-PSS (Probabilistic Signature Scheme) is a signature scheme with enhanced security properties:- More secure than traditional RSA signatures
- Includes randomized padding
- Recommended for new applications requiring RSA signatures
Why Migrate?
The new names:- Explicitly indicate they specify algorithms, not hash values
- Reduce confusion with other crypto APIs
- Align with cryptographic standards terminology
- Improve code clarity
Scope and Limitations
Only RSA-PSS
The transformation only applies to'rsa-pss' key type. Other key types are not affected:
Preserved Structure
- All other options remain unchanged
- Callback functions are preserved
- Code formatting is maintained
- Comments are retained
Valid Hash Algorithms
Common hash algorithms used with RSA-PSS:'sha256'(recommended for most use cases)'sha384''sha512''sha1'(legacy, not recommended)