pidCrypt in Node red

There is a JavaScript function below: How do I import the javascript library into node red?

var key = encryptionKey();
var asn, tree;
rsa = new pidCrypt.RSA();
decodedKey = pidCryptUtil.decodeBase64(ekey);

asn = pidCrypt.ASN1.decode(pidCryptUtil.toByteArray(decodedKey));
tree = asn.toHexTree();

rsa.setPublicKeyFromASN(tree);

console.log= pidCryptUtil.encodeBase64(pidCryptUtil.convertFromHex(rsa.encrypt(passw += '|' + etime)));

As this is a question and you aren't actually sharing a project, it should be in the general category please. You will be much more likely to get a useful response then.

Function-node-use-of-npm-modules

actually, it is a section of the code where I can't replace using node-red

Found some source code in npm.
How to convert them to Node in node red?

This is covered in the docs. You can use node.js modules in Node-RED in a few ways depending on what you are trying to do.

  1. Load into global using settings.js
  2. Load into a function node
  3. Wrap the module in a custom node.

also note there are some more node.js type libraries that may help https://labs.ig.com/sample-apps

The aim is to use create some dashboards on node-red.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.