Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@giakki/encrypt-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giakki/encrypt-webpack-plugin

Webpack plugin to encrypt sources

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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.

Keywords

webpack

FAQs

Package last updated on 31 Jan 2023

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