require.extensions handler for requiring encrypted files (e.g. .js, .json)
npm install encext
|8||downloads in the last month|
|Version||0.1.3 last updated a year ago|
|Keywords||extension, crypto, encrypt, decrypt|
|Dependencies||efs, optimist, prompt|
require.extensions handler for requiring encrypted files (e.g. .js, .json).
$ npm install encext
First, we encrypt some files with the included script.
$ encext -r lib/ Password:
Once the encryption password is entered, the above command will
recursively encrypt all
.json files in the
and it's subdirectories. Run
encext --help for details on the
Now that we have some encrypted source files, we need to delete the originals prior to deployment. You will need at least one unencrypted source file to bootstrap the process. It will include code something like this
That one line of code will setup the encrypted extension loaders
and initialize the cipher with the given algorithm and password. This
obviously has to match the one you used when encrypting the files with
encext command line tool.
encext module with the given encryption algorithm and
derives the encryption key from the given password.
- algorithm - the encryption algorithm to use. It is dependent on the
available algorithms supported by the version of OpenSSL on the platform.
Examples are 'aes-128-cbc', 'aes192', etc. On recent releases,
openssl list-cipher-algorithmswill display the available ciphers.
- password - the password used to derive the encryption/decryption key
(The MIT License)
Copyright (c) 2012 Jeff Kunkle
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.