title: Using Node 'require' inside Hyperledger Composer smart contract
body: <p>Using node's require inside Hyperledger Composer smart contract</p>
  
  <p>I want to know whether it is possible to use npm / node packages inside Hyperledger Composer's business network application's logic.</p>
  
  <p>My requirement is, I am having a encrypted string value coming from the client side during the transaction invocation.</p>
  
  <p>I tried using basic node crypto package as follows within the BNA,</p>
  
  <pre><code>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
  }
  </code></pre>
  
  <p>But once I deploy this, I am getting following error in the peer log,</p>
  
  <pre><code>Calling chaincode Invoke() returned error response [ReferenceError: require is not defined]. Sending ERROR message back to peer 
  </code></pre>
  
  <p>As for the : <a href="https://github.com/hyperledger/composer/issues/3854" rel="nofollow noreferrer">https://github.com/hyperledger/composer/issues/3854</a> 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.</p>
  
  <p>Composer Version : v0.20.4</p>
  
  <p>Hyperledger Version : 1.2.1</p>