Encrypt the secure data and wrap it into the module
(node v8 and above required for
npm install -g yonpm install -g generator-secure-data
It is well known that keeping passwords in plain text is bad. When application is require to integrate secure data, for example API keys, passwords, etc - it is same things. Application itself is a plain data. And secure data in it must be crypted.
This generator require file with secure data and generate module which contain that secure data in packed crypted form:
secure-data.json --> [yo secure-data] --> cipher.js
To generate your secure data module (args available):
$ yo secure-data
So you just need to import function from this module and call it with a password and receive result (wrapped in promise):
const cipher =// or with async/awaitconsole
Command line args
Command line args is available for each propmt. If command line argument is provided then appropriate prompt is skipped.
yo secure-data [options] [<data>] [<module>] [<password>]
Options: -h, --help # Print the generator's options and usage --skip-cache # Do not remember prompt answers (false) --skip-install # Do not automatically install dependencies (false) --json # Parse json after decrypt (incompatible with --raw) --raw # Return raw data after decrypt (incompat with --json) --remove # Remove destination module path before output Arguments: data # Input data file path Type: String Required: false module # Output module to generate Type: String Required: false password # Password used to encrypt Type: String Required: false
Getting To Know Yeoman
- Yeoman has a heart of gold.
- Yeoman is a person with feelings and opinions, but is very easy to work with.
- Yeoman can be too opinionated at times but is easily convinced not to be.
- Feel free to learn more about Yeoman.
MIT © Serguei Okladnikov