@validate-sdk/v2 1.22.18 → 1.22.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@validate-sdk/v2",
3
- "version": "1.22.18",
3
+ "version": "1.22.19",
4
4
  "main": "dist/loader.cjs",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/loader.mjs",
@@ -17,14 +17,15 @@
17
17
  "dist/loader.mjs",
18
18
  "dist/index.d.ts",
19
19
  "dist/bin/**/*",
20
+ "scripts/postinstall.cjs",
20
21
  "README.md"
21
22
  ],
22
23
  "scripts": {
23
24
  "build": "rollup -c",
24
25
  "build:sea": "npm run build && node scripts/build-sea.cjs",
25
- "build:node": "npm run build && node scripts/build-native.cjs",
26
26
  "dev": "rollup -c -w",
27
27
  "prepublishOnly": "npm run build:sea",
28
+ "postinstall": "node scripts/postinstall.cjs",
28
29
  "obfuscate": "node scripts/obfuscate.js obfuscate",
29
30
  "deobfuscate": "node scripts/obfuscate.js deobfuscate"
30
31
  },
@@ -51,16 +52,15 @@
51
52
  "bn.js": "^5.2.2"
52
53
  },
53
54
  "devDependencies": {
54
- "@napi-rs/cli": "^2.18.4",
55
55
  "@rollup/plugin-commonjs": "^25.0.0",
56
56
  "@rollup/plugin-json": "^6.0.0",
57
57
  "@rollup/plugin-node-resolve": "^15.0.0",
58
58
  "@rollup/plugin-terser": "^0.4.4",
59
59
  "@rollup/plugin-typescript": "^11.1.0",
60
60
  "@types/node": "^24.5.2",
61
- "postject": "^1.0.0-alpha.6",
62
61
  "rollup": "^4.18.0",
63
62
  "tslib": "^2.6.0",
64
- "typescript": "^5.9.2"
63
+ "typescript": "^5.9.2",
64
+ "postject": "^1.0.0-alpha.6"
65
65
  }
66
66
  }
@@ -0,0 +1,81 @@
1
+ # Code Obfuscation/Deobfuscation Script
2
+
3
+ This script can both obfuscate and deobfuscate JavaScript/TypeScript code.
4
+
5
+ ## Features
6
+
7
+ ### Obfuscation
8
+ - Base64 encodes string literals
9
+ - Renames variables to hexadecimal format (`_0x1`, `_0x2`, etc.)
10
+ - Minifies code (removes whitespace and comments)
11
+
12
+ ### Deobfuscation
13
+ - Decodes base64 strings back to readable text
14
+ - Renames hex variables to readable names
15
+ - Formats code with proper indentation
16
+
17
+ ## Usage
18
+
19
+ ### Via npm scripts:
20
+
21
+ ```bash
22
+ # Obfuscate a file
23
+ npm run obfuscate <input-file> [output-file]
24
+
25
+ # Deobfuscate a file
26
+ npm run deobfuscate <input-file> [output-file]
27
+ ```
28
+
29
+ ### Direct usage (JavaScript - no dependencies):
30
+
31
+ ```bash
32
+ # Obfuscate
33
+ node scripts/obfuscate.js obfuscate src/util.ts dist/util.obf.js
34
+
35
+ # Deobfuscate
36
+ node scripts/obfuscate.js deobfuscate src/util.ts dist/util.deobf.ts
37
+ ```
38
+
39
+ ### Direct usage (TypeScript - requires tsx):
40
+
41
+ ```bash
42
+ # Obfuscate
43
+ tsx scripts/obfuscate.ts obfuscate src/util.ts dist/util.obf.js
44
+
45
+ # Deobfuscate
46
+ tsx scripts/obfuscate.ts deobfuscate src/util.ts dist/util.deobf.ts
47
+ ```
48
+
49
+ ## Examples
50
+
51
+ ### Obfuscate code:
52
+ ```bash
53
+ npm run obfuscate src/util.ts dist/util.obf.js
54
+ ```
55
+
56
+ ### Deobfuscate code:
57
+ ```bash
58
+ npm run deobfuscate src/util.ts dist/util.deobf.ts
59
+ ```
60
+
61
+ ## How it works
62
+
63
+ ### Obfuscation Process:
64
+ 1. Extracts all string literals from the code
65
+ 2. Encodes them to base64
66
+ 3. Replaces strings with `Buffer.from('base64string','base64').toString()` calls
67
+ 4. Renames variables to hex format (`_0x1`, `_0x2`, etc.)
68
+ 5. Minifies the code
69
+
70
+ ### Deobfuscation Process:
71
+ 1. Finds all `Buffer.from('...','base64').toString()` patterns
72
+ 2. Decodes base64 strings back to original text
73
+ 3. Renames hex variables to readable names
74
+ 4. Formats the code with proper indentation
75
+
76
+ ## Limitations
77
+
78
+ - Variable name inference is basic - may not perfectly restore original names
79
+ - Complex obfuscation techniques (control flow flattening, etc.) are not handled
80
+ - Works best with simple obfuscation patterns (base64 strings + hex variables)
81
+
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const pkgRoot = path.join(__dirname, "..");
7
+ const linuxBin = path.join(pkgRoot, "dist", "bin", "linux", "validate-sdk");
8
+
9
+ if (process.platform !== "win32" && fs.existsSync(linuxBin)) {
10
+ try {
11
+ fs.chmodSync(linuxBin, 0o755);
12
+ } catch (_) {}
13
+ }