Encrypt the secure data and wrap it into the module
npm install generator-secure-data[![NPM version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![Test Coverage][coverage-image]][coverage-url]
> Encrypt the secure data and wrap it into the module
First, install Yeoman and generator-secure-data
using npm (we assume you have pre-installed
node.js).
(node v8 and above required for generator-secure-data)
``sh`
npm install -g yo
npm 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):
`sh`
$ 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):
`js
const cipher = require('cipher.js')
cipher('password').then( result => {
console.log(result.key)
})
// or with async/await
console.log(await cipher('password'))
`
Command line args is available for each propmt. If command line argument
is provided then appropriate prompt is skipped.
`sh`
yo secure-data [options] [] [
`
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
``
* 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
[npm-image]: https://badge.fury.io/js/generator-secure-data.svg
[npm-url]: https://npmjs.org/package/generator-secure-data
[travis-image]: https://travis-ci.org/oklas/generator-secure-data.svg?branch=master
[travis-url]: https://travis-ci.org/oklas/generator-secure-data
[daviddm-image]: https://david-dm.org/oklas/generator-secure-data.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/oklas/generator-secure-data
[coveralls-image]: https://coveralls.io/repos/oklas/generator-secure-data/badge.svg
[coveralls-url]: https://coveralls.io/r/oklas/generator-secure-data
[coverage-image]: https://img.shields.io/codecov/c/github/oklas/generator-secure-data.svg
[coverage-url]: https://codecov.io/gh/oklas/generator-secure-data