Reputation: 175
I am building an electron app which will be bundled with lot of content (images/HTML/videos/audios) of ~800MB. I will be rendering this content in my app. Is there any way to secure(encrypt) this content so user would not be able to access it directly (or indirectly) without launching an app?
I might have to store passwords and some other info which can be secured with node-keytar but to secure my 800MB content seems difficult with keytar. Any suggestion/help is appreciated. Thanks!
Upvotes: 2
Views: 1509
Reputation: 1376
Instead of using a third party tool, why not use the encryption tools built into the OS? Cipher is built into windows, and OpenSSL for MAC can be used to do this.
I would create an npm
script to run the encryption on the files/folders before I package them. So, the npm scripts block might look like this:
"scripts": {
"encryptWindows": " cipher commands...",
"encryptMac": "OpenSSL commands...",
"buildWin": "...",
"buildMac": "..."
"build_encrypt_win": "encryptWindows && buildWin"
}
Another option: This stack overflow post might fit the bill, as the user is encrypting 1GB of files. It uses the built in Crypto feature in Node.
Make sure you take note of the password/key you use so it can be used again later to decrypt.
Please note - I haven't tried either solution, so there may be an issue with Electron trying to run and access those files when the application is built/packaged and those files are encrypted.
Upvotes: 1