@giakki/encrypt-webpack-plugin
v0.0.1
Published
Webpack plugin to encrypt sources
Downloads
1
Readme
Encrypt Webpack Plugin
Not sure why you'd want this, but here it is...
Installation
npm i @giakki/encrypt-webpack-plugin
Simple usage
{
entry: {
privateCss: path.resolve(__dirname, 'src/index.css'),
privateJs: path.resolve(__dirname, 'src/index.js'),
},
plugins: [
encryptPlugin({ assets: ['privateCss.css', 'privateJs.js'], key: process.env.SECRET_KEY }),
]
}
Options
The simplest way to use the plugin is to specify the assets and the secret key to use, as show above.
If used this way, the plugin wil derive a key using 100000
passes of pbkdf2
using a random salt, and then encrypt
the assets using aes-256-cbc
.
The output will be the base-64 concatenation of [salt, iv, cyphertext]
.
The key
argument also accepts configurable pbkdf2
options, as such:
{
assets: [...],
key: {
digest: 'sha512',
iterations: 100000,
password: SECRET,
salt: crypto.randomBytes(16),
}
}
Where password
and salt
can either be String
s or Buffer
s.