@yobytechautomation/config-lib 0.4.1 → 0.4.2
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.
|
@@ -60,7 +60,6 @@ export interface BaseConfigService {
|
|
|
60
60
|
export declare abstract class BaseConfigServiceImpl implements BaseConfigService {
|
|
61
61
|
protected env: Record<string, any>;
|
|
62
62
|
constructor();
|
|
63
|
-
private checkIntegrity;
|
|
64
63
|
startLicenseHeartbeat(): void;
|
|
65
64
|
getDatabaseConfig(): TypeOrmModuleOptions;
|
|
66
65
|
getPort(): number;
|
|
@@ -42,13 +42,9 @@ 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
|
-
}
|
|
48
45
|
class BaseConfigServiceImpl {
|
|
49
46
|
constructor() {
|
|
50
47
|
this.env = process.env;
|
|
51
|
-
this.checkIntegrity();
|
|
52
48
|
const deasync = require('deasync');
|
|
53
49
|
let done = false;
|
|
54
50
|
let error = null;
|
|
@@ -67,19 +63,6 @@ class BaseConfigServiceImpl {
|
|
|
67
63
|
process.exit(1);
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
|
-
checkIntegrity() {
|
|
71
|
-
const fileContent = fs.readFileSync(__filename, "utf-8");
|
|
72
|
-
const currentHash = crypto
|
|
73
|
-
.createHash('sha256')
|
|
74
|
-
.update(fileContent)
|
|
75
|
-
.digest('hex');
|
|
76
|
-
// 🔥 STEP: replace later
|
|
77
|
-
const ORIGINAL_HASH = "d8f1400946e8cae10d498441130c7f526339603621b3d7e568ec054bc09a5d66";
|
|
78
|
-
if (currentHash !== ORIGINAL_HASH) {
|
|
79
|
-
console.error("💀 Code tampered! License system hacked");
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
66
|
startLicenseHeartbeat() {
|
|
84
67
|
setInterval(async () => {
|
|
85
68
|
try {
|