How to generate Diffie Hellman key pair in Node.JS
Super easy using crypto library. You can create a file called DiffieHellmanKeyPairGeneration.js for example and paste this code inside:
console.log('\n- --- ( Diffie Hellman Key Pair Generator ) --- -');
var crypto = require('crypto');
var bitSize = 2048;
var dh = crypto.createDiffieHellman(bitSize);
dh.generateKeys();
console.log('Private Key: