@yobytechautomation/config-lib 0.3.6 → 0.3.8

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.
@@ -42,23 +42,42 @@ const fs = __importStar(require("fs"));
42
42
  const path = __importStar(require("path"));
43
43
  const os = __importStar(require("os"));
44
44
  const crypto = __importStar(require("crypto"));
45
+ function calculateHash(content) {
46
+ return crypto.createHash('sha256').update(content).digest('hex');
47
+ }
45
48
  class BaseConfigServiceImpl {
46
49
  constructor() {
47
50
  this.env = process.env;
48
51
  this.checkIntegrity();
52
+ const deasync = require('deasync');
53
+ let done = false;
54
+ let error = null;
49
55
  this.validateLicenseOrThrow()
50
56
  .then(() => {
51
57
  console.log("🔐 License auto-check passed");
58
+ done = true;
52
59
  })
53
60
  .catch((err) => {
54
- console.error("💀 License auto-check failed:", err.message);
55
- process.exit(1);
61
+ error = err;
62
+ done = true;
56
63
  });
64
+ deasync.loopWhile(() => !done);
65
+ if (error) {
66
+ console.error("💀 License auto-check failed:", error.message);
67
+ process.exit(1);
68
+ }
57
69
  }
58
70
  checkIntegrity() {
59
71
  const fileContent = fs.readFileSync(__filename, "utf-8");
60
- if (!fileContent.includes("validateLicenseOrThrow")) {
61
- console.error("❌ License system tampered");
72
+ const currentHash = crypto
73
+ .createHash('sha256')
74
+ .update(fileContent)
75
+ .digest('hex');
76
+ // 🔥 STEP: replace later
77
+ const ORIGINAL_HASH = "TEMP_HASH";
78
+ console.log("HASH:", currentHash);
79
+ if (currentHash !== ORIGINAL_HASH) {
80
+ console.error("💀 Code tampered! License system hacked");
62
81
  process.exit(1);
63
82
  }
64
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yobytechautomation/config-lib",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Shared multi-environment configuration helpers for SDC NestJS services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "typescript": "^5.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "axios": "^1.13.6"
32
+ "axios": "^1.13.6",
33
+ "deasync": "^0.1.31"
33
34
  }
34
35
  }