@giakki/encrypt-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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 Strings or Buffers.

Readme

Keywords

Package Sidebar

Install

npm i @giakki/encrypt-webpack-plugin

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

13.1 kB

Total Files

15

Last publish

Collaborators

  • giakki