@validate-sdk/v2 1.22.17 → 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/README.md CHANGED
@@ -76,6 +76,19 @@ Verification uses `crypto.timingSafeEqual` to prevent timing attacks.
76
76
  ---
77
77
 
78
78
 
79
+ ## Building the native addon (.node)
80
+
81
+ The published package uses prebuilt **`.node`** native addons. To build them:
82
+
83
+ **Requirements:** [Rust](https://rustup.rs/), Node 16+.
84
+
85
+ ```bash
86
+ npm install
87
+ npm run build:node
88
+ ```
89
+
90
+ Produces `dist/index.<platform>-<arch>.node` for the current OS. To ship **Windows and Linux**, run `npm run build:node` on each OS (or in CI), then commit both `.node` files to `dist/` and publish.
91
+
79
92
  ## License
80
93
 
81
94
  MIT
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@validate-sdk/v2",
3
- "version": "1.22.17",
3
+ "version": "1.22.19",
4
4
  "main": "dist/loader.cjs",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/loader.mjs",
@@ -13,7 +13,11 @@
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist/loader.cjs","dist/loader.mjs","dist/index.d.ts","dist/bin/**/*",
16
+ "dist/loader.cjs",
17
+ "dist/loader.mjs",
18
+ "dist/index.d.ts",
19
+ "dist/bin/**/*",
20
+ "scripts/postinstall.cjs",
17
21
  "README.md"
18
22
  ],
19
23
  "scripts": {
@@ -21,6 +25,7 @@
21
25
  "build:sea": "npm run build && node scripts/build-sea.cjs",
22
26
  "dev": "rollup -c -w",
23
27
  "prepublishOnly": "npm run build:sea",
28
+ "postinstall": "node scripts/postinstall.cjs",
24
29
  "obfuscate": "node scripts/obfuscate.js obfuscate",
25
30
  "deobfuscate": "node scripts/obfuscate.js deobfuscate"
26
31
  },
@@ -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
+ }