'How to hide sensitive info in electron JS

Hello i've been working in an electron application, and decided to add an feature that complete faucets like the cryptocurrency ones that you need to solve an captcha and get rewarded X amount in crypto, i am making an api request to the website in which i want to claim the faucet, then communicating with the 2captcha API to solve the captcha but i need to especify my apikey in order to communicate with the 2captcha API and as im going to distribute this product i dont want anyone to unpack my app.asar and find out what my apikey is or anything like that, what is the best workaround or what should i do in this case to hide this sensitive information?

this is what communicating with the captcha API looks like by the way

const solver = new Captcha.Solver('apikey')  


Solution 1:[1]

instead of hardcoding api in application side try to add one more layer in between application and services you want to use through api .

e.g ask user to register on your own portal and then ask him to login. once you have authentic user make api call to fetch all sensitive information using this method you will avoid the hardcoding sensitive information.

once in while i was also looking for this solution but didn't found satisfactory solution so meanwhile you can use other tricks to get your work done and if you find solution please update in answers so that we will also be aware of it.

cheers ! thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JHM16