Get your own Node server
// Import the crypto module
const crypto = require('crypto');

// Create an ECDH instance with a specific curve
const ecdh = crypto.createECDH('prime256v1'); // Also known as P-256 or secp256r1

// Generate keys
ecdh.generateKeys();

// Output the public key in hex format
console.log('Public key (hex):', ecdh.getPublicKey('hex'));

              
Public key (hex): 04b8e9b9f3d3c1a5e4d7c6b2a8f0e1d9c7b5a4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0