I have the following code that generates a signature using the node crypto lib:
const crypto = require('crypto');
...
const signature = crypto.sign('sha256', Buffer.from(message), privateKey);
Is there a way to generate the same signature using the node crypto-js lib? I am using a Postman pre-request script which provides a node env with access to the crypto-js lib but not the crypto lib.
Is there a way to generate the same signature using the node crypto-js lib? No. Signing is a part of asymmetric cryptography, which is not supported by CryptoJS.
CryptoJS includes various symmetric algorithms, e.g. AES (no authenticated encryption like GCM, by the way), hashing, HMAC and PBKDF2.