How to use public SSL certificate to encrypt and d...
# 🤝help
l
Can I use public SSL certificates to send encrypted API payload and receive encrypted webhook? I am going to integrate with a payment gateway that will only send and receive data in encrypted. Bank will provide me with their public SSL key to encrypt the API payload and will use my public SSL key to encrypt the webhook response. What is the best advice here to get a public SSL cert?
@User @famous-jewelry-85388
q
I don't know if this is exactly what you need, but I have used this free tool for many years https://letsencrypt.org/docs/ "Let’s Encrypt is a global Certificate Authority (CA). We let people and organizations around the world obtain, renew, and manage SSL/TLS certificates. Our certificates can be used by websites to enable secure HTTPS connections." For example with my text-to-speech chatbots, Botpress cannot receive audio files (from URL) using Axios if the API fetch address is http://, it has to be secure https:// so I built SSL certificate into my server/website with Let's Encrypt.
b
@limited-pencil-78283 I have also used what @quick-musician-29561 suggests
l
I too am using Let's Encrypt, however for Let's Encrypt to issue me a cert, I need to validate the domain and in my case of Botpress, I have none.
q
Yes, that's worth mentioning! I bought a cheap domain for that purpose
l
The bank is insisting on a public certificate rather than a self signed one. I have many public certificates from Let's Encrypt including a wildcard for my home setup. Let me give it a shot
Thank you for the inputs 🤗
Here is what I am trying to achieve - const crypto = require('crypto') // Replace the placeholder with your actual certificate strings const publicKey =
Copy code
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
// JSON payload to encrypt const jsonPayload = '{"key": "value"}' // Encrypt the payload const encryptedBuffer = crypto.publicEncrypt( { key: publicKey, padding: crypto.constants.RSA_PKCS1_OAEP_PADDING, oaepHash: 'sha256' }, Buffer.from(jsonPayload) ) // Send data to Botpress webhook await axios .post('https://webhook.botpress.cloud/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx', encryptedBuffer) .then((response) => { console.log('Webhook response:', response.data) }) .catch((error) => { console.error('Error sending webhook:', error) })
This should send the JSON payload in an encrypted format to the webhook. But I cannot define const crypto = require('crypto')
Need help here
q
Is this code inside Botpress execute code card?
If it is, since it uses NodeJS crypto module, in Botpress or web browser we have to use something else
for example Web Crypto API, which provides cryptographic functionality that can be used in a secure and consistent manner across different platforms.
I have not tried those in Botpress, but I can also test and try to find a solution for this ⚡
normally I would send the signal from Botpress to my server which has NodeJS and the needed built-in crypto module other option is try to do it in your website with JavaScript
l
Thanks Devmik, working on it
c
@limited-pencil-78283 , I have not yet started dabbling here but I have been using another tool to scrape the daily BTC EtH and other Cryptos I plan to incorporate them into a table and try to find analytical trends eventually but i only have around 3 days of data. completely unrelated but very cool
l
@crooked-ram-87124 Nice - Share some code if you can. In the meanwhile, I wrote a Python flask script, as a docker container. just testing it
c
I absolutely will as soon as i have some thing worth sharing lol. Supporting people the past few days has delayed my own exploratory bot working but soon enough and on my word I will share.
f
Is my input still needed?
l
No, thank you @famous-jewelry-85388
3 Views