@yobytechautomation/config-lib 0.3.7 → 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,9 +42,13 @@ 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;
51
+ this.checkIntegrity();
48
52
  const deasync = require('deasync');
49
53
  let done = false;
50
54
  let error = null;
@@ -65,8 +69,15 @@ class BaseConfigServiceImpl {
65
69
  }
66
70
  checkIntegrity() {
67
71
  const fileContent = fs.readFileSync(__filename, "utf-8");
68
- if (!fileContent.includes("validateLicenseOrThrow")) {
69
- 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");
70
81
  process.exit(1);
71
82
  }
72
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yobytechautomation/config-lib",
3
- "version": "0.3.7",
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",