New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

grunt-encrypt

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-encrypt

Encrypt your files with Grunt

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

grunt-encrypt Build Status

Encrypt your files with Grunt

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-encrypt --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-encrypt');

The "encrypt" task

Overview

In your project's Gruntfile, add a section named encrypt to the data object passed into grunt.initConfig().

grunt.initConfig({
  encrypt: {
    options: {
      key: 'superSecretKey',
      dest: 'output/encrypted/'
    },
    files: {
        'someFiles': ['path/to/files']
    }
  },
});

Options

options.key

Type: String Default value: null

A string value used to encrypt a file

options.dest

Type: String

A string to the output directory, defaults to the source file path

options.ext

Type: String Default value: null

A string to set the file extension for the encrypted file.

files

Type: Object

An object containing a map of files. See below for examples.

Usage Examples

Encrypt options

In this example we are encrypting some configuration files and outputing to the same directory. You can set the output directory by passing the dest option, you can assign the encryption key by passing the key option. By passing the ext option the input files become ftppass.json.encrypted and sshKey.encrypted

grunt.initConfig({
  encrypt: {
    encryptConfigFiles: {
        options: {
            key: process.env.encryptionKey,
            dest: './',
            ext: 'encrypted'
        },
        files: {
            'configFiles': ['./ftppass.json', './sshKey'],
        }
    }
  }
});

Decrypt Options

In this example we are decrypting some configuration files, we are providing the key through environment variables. You can decrypt files by passing the decrypt option to the task, If the dest option is a directory it will generate the new file with the existing name.

The decrypt option removes the last extension in the filename, for example if you encrypt a file with the filename as passwords.json and you don't provide the ext option, .json will be removed.

grunt.initConfig({
  encrypt: {
    decryptConfigFiles: {
        options: {
            key: process.env.encryptionKey,
            dest: './',
            decrypt: true
        },
        files: {
            'configFiles': ['./ftppass.encrypted', './sshKey.encrypted'],
        }
    }
  }
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2014-08-06 v0.1.0 Initial release

Keywords

gruntplugin

FAQs

Package last updated on 12 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts