@tsenta/electron-vite-obfuscator
v2.0.1
Published
Obfuscation extension for electron-vite's V8 Bytecode plugin using javascript-obfuscator
Maintainers
Readme
@tsenta/electron-vite-obfuscator
An obfuscation extension for electron-vite's V8 Bytecode plugin using javascript-obfuscator.
Fork of electron-vite-obfuscator with updated dependencies and Vite 7 support.
Features
- ✅ V8 bytecode compilation for source protection
- ✅ JavaScript obfuscation (control flow flattening, dead code injection, string encryption)
- ✅ Protected strings support
- ✅ Compatible with electron-vite 5.x and Vite 7.x
Install
pnpm add -D @tsenta/electron-vite-obfuscatorUsage
import { defineConfig } from 'electron-vite'
import { bytecodePlugin } from '@tsenta/electron-vite-obfuscator'
export default defineConfig({
main: {
plugins: [bytecodePlugin()]
},
preload: {
plugins: [bytecodePlugin()]
}
})Configuration
Pass obfuscation options to enable javascript-obfuscator:
bytecodePlugin({
// Bytecode options
transformArrowFunctions: true,
removeBundleJS: true,
protectedStrings: ['secret-key', 'api-token'],
// JavaScript obfuscator options
obfuscationOptions: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
stringArray: true,
stringArrayEncoding: ['rc4'],
stringArrayThreshold: 0.75
}
})See javascript-obfuscator docs for all available options.
Note:
selfDefendinganddebugProtectionare enforced tofalseas they don't work with V8 bytecode.
Development
# Install dependencies
pnpm install
# Build
pnpm build
# Watch mode
pnpm dev
# Lint & format check
pnpm check
# Auto-fix lint & format
pnpm fixLicense
MIT
