I am trying to create node server in TLS and create a TLS client in electron, to distribute as desktop application to users. I can add certificates to my TLS server and run it.
But how do I create the client which requires me to insert key and cert in options to create client.
tls.connect(8000, {
key: fs.readFileSync('client-key.pem'),
cert: fs.readFileSync('client-cert.pem')
})
Where do I store the key and cert files? Should it be bundled along with the downloaded electron app?
If the key and cert can be read unpacking the application, doesnt it makes security compromised?
If the key and cert are stored in electron bundle, its going to be same key and cert for every one downloading the application, doesnt it makes security compromised?
If the key and cert are stored in electron bundle, how do I update the certificate(when changed in the server) after user downloads the application?
I worked based on this link https://github.com/nodejs/help/issues/253
It would be great if someone can point me in the right direction.
We are facing websocket blocked for some users, so we are trying to use TLS duplex socket.