Necesito Programar Más

    generator-secure-data

    1.0.1 • Public • Published

    generator-secure-data

    NPM version Build Status Dependency Status Test Coverage

    Encrypt the secure data and wrap it into the module

    Installation

    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)

    npm install -g yo
    npm install -g generator-secure-data

    Usage

    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 = require('cipher.js')
    cipher('password').then( result => {
      console.log(result.key)
    })
     
    // or with async/await
    console.log(await cipher('password'))

    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.

    License

    MIT © Serguei Okladnikov

    Install

    npm i generator-secure-data

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • oklas