electron-ecrypted-webpack-plugin

electron-ecrypted-webpack-plugin for webpack

Usage no npm install needed!

<script type="module">
  import electronEcryptedWebpackPlugin from 'https://cdn.skypack.dev/electron-ecrypted-webpack-plugin';
</script>

README

electron-ecrypted-webpack-plugin

const NodeRSA = require('node-rsa')
const EcryptedBuildPlugin = require('electron-ecrypted-webpack-plugin')

const key = new NodeRSA({ b: 512 })
const privateKey = process.env.VUE_APP_CODE_PRIVATE_KEY
if (!privateKey) throw new Error('VUE_APP_CODE_PRIVATE_KEY not found')
key.importKey(privateKey, 'private')

function doEcrypted(input) {
  return key.encryptPrivate(input, 'hex')
}

let plugins = [
  new EcryptedBuildPlugin({
    ecryptedFn: doEcrypted,
  }),
]

// webpack config plugins