Using node's require inside Hyperledger Composer smart contract
I want to know whether it is possible to use npm / node packages inside Hyperledger Composer's business network application's logic.
My requirement is, I am having a encrypted string value coming from the client side during the transaction invocation.
I tried using basic node crypto package as follows within the BNA,
lib/script.js
/**
* @param{com.abc.farm.CreateNewFarmData} farmData
* @transaction
*/
const crypto = require('crypto');
function createFarmData(farmData) {
const algorithm = 'aes-256-cbc';
const key = crypto.randomBytes(32);
// other decryption releted codes
}
But once I deploy this, I am getting following error in the peer log,
Calling chaincode Invoke() returned error response [ReferenceError: require is not defined]. Sending ERROR message back to peer
As for the : https://github.com/hyperledger/composer/issues/3854 we cannot use require inside business logic. If that is the case, I would like to know my options of decrypting the messages I am getting.
Composer Version : v0.20.4
Hyperledger Version : 1.2.1