
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
grunt-encrypt
Advanced tools

Encrypt your files with Grunt
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');
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']
}
},
});
Type: String
Default value: null
A string value used to encrypt a file
Type: String
A string to the output directory, defaults to the source file path
Type: String
Default value: null
A string to set the file extension for the encrypted file.
Type: Object
An object containing a map of files. See below for examples.
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'],
}
}
}
});
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'],
}
}
}
});
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.
FAQs
Encrypt your files with Grunt
The npm package grunt-encrypt receives a total of 4 weekly downloads. As such, grunt-encrypt popularity was classified as not popular.
We found that grunt-encrypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.