import { obfuscateFile } from "@skylvi/veyl";
const stats = await obfuscateFile({
input: "./src/index.ts",
output: "./dist/index.obfuscated.js",
config: {
obfuscate: {
strings: { enabled: false },
numbers: { enabled: true },
booleans: { enabled: true },
},
features: {
randomized_unique_identifiers: true,
functionify: true,
evalify: false,
node_vm: false,
encryption: {
public_key: null,
private_key: null,
},
},
},
});
console.log(stats.output, stats.outputBytes);
import { obfuscateCode } from "@skylvi/veyl";
const result = obfuscateCode("const answer = 42; console.log(answer);", {
obfuscate: {
strings: { enabled: false },
numbers: { enabled: true },
booleans: { enabled: true },
},
features: {
randomized_unique_identifiers: true,
functionify: false,
evalify: false,
node_vm: false,
encryption: {
public_key: null,
private_key: null,
},
},
});
console.log(result.code);
obfuscateFile(opts): bundles an input TS/JS file, obfuscates it, writes output, and returns ObfuscationStats.
obfuscateCode(input, config?): obfuscates an already-bundled JavaScript string and returns ObfuscateCodeResult.
resolveConfig(config?): fills a partial config with Veyl defaults.
mergeConfig(base, override): merges config file values with overrides.
loadConfigFile(path): reads a config JSON file.
loadDefaultConfigFile(cwd): reads veyl_config.json from a directory when present.
DEFAULT_CONFIG_FILE and DEFAULT_OBFUSCATION_CONFIG.
- Types:
ObfuscationConfigInput, ObfuscationConfig, ObfuscationStats, ObfuscateFileOptions, ObfuscateCodeResult, LogLevel, NumberObfuscationMethod, BooleanObfuscationMethod, and NumberObfuscationOperator.