How to store private key or secure information / data with Electron

Viewed 13808

I am developing standalone app for cross platform using electron.

I want store private data like private key, private data for some execution in app. Execution like encrypt / decrypt data.

Or

I want store some secured information like user password, proprietary data on app

Are any possible way to store these kind of secure information and app user unable to get any way?

4 Answers

Avoid storing private or server-side details like a private key in an electron app. Electron app's data and file can be accessed from the app.asar file and electron do not protect the content at all. There is no such mechanism of code protection in electron. However NW.js supports source code protection, You can read it here. So according to me, it's not safe to store private accreditations like signing a certificate or private key in electron source code.

As another way, you can store these data using node-keytar in the keychain for mac, the credential manager in windows and Gnom Keyring in Linux using native api. But still, these credentials are accessible to the user and does not make sense to storing private tokens (i.e. Token for GitHub private repository having administrative rights). It depends upon the user, If he/she is sophisticated enough to understand what did you stored in Keychain, Credential Manager or Keyring, they can misuse it or can use against you. So the final answer is,

Do not store Credentials/Private key or Administrative Tokens in electron source or using node-keytar.

Related