vantuz 3.5.2 → 3.5.4
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/cli.js +4 -1
- package/core/license.js +17 -10
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -152,8 +152,11 @@ async function runTUI() {
|
|
|
152
152
|
console.log(c('red', `\n🛑 ERİŞİM ENGELLENDİ: ${license.message}`));
|
|
153
153
|
console.log(c('yellow', 'Lütfen geçerli bir lisans anahtarı girin.'));
|
|
154
154
|
|
|
155
|
-
const key = await promptInput(c('cyan', 'Lisans
|
|
155
|
+
const key = await promptInput(c('cyan', 'Lisans Anahtarı: '));
|
|
156
|
+
console.log('[CLI] Key length:', key.length);
|
|
157
|
+
console.log('[CLI] Key prefix:', key.substring(0, 50));
|
|
156
158
|
const result = licenseManager.activate(key);
|
|
159
|
+
console.log('[CLI] Result:', JSON.stringify(result));
|
|
157
160
|
|
|
158
161
|
if (!result.success) {
|
|
159
162
|
console.log(c('red', `Hata: ${result.message}`));
|
package/core/license.js
CHANGED
|
@@ -42,50 +42,57 @@ export class LicenseManager {
|
|
|
42
42
|
* Format: BASE64_PAYLOAD.BASE64_SIGNATURE
|
|
43
43
|
*/
|
|
44
44
|
activate(licenseString) {
|
|
45
|
+
const debugFile = '/tmp/vantuz-license-debug.log';
|
|
46
|
+
|
|
45
47
|
try {
|
|
48
|
+
fs.writeFileSync(debugFile, `=== License Debug ${new Date().toISOString()} ===\n`);
|
|
49
|
+
fs.appendFileSync(debugFile, `Input key length: ${licenseString.length}\n`);
|
|
50
|
+
fs.appendFileSync(debugFile, `Input key: ${licenseString.substring(0, 100)}...\n`);
|
|
51
|
+
|
|
46
52
|
const [payloadB64, signatureB64] = licenseString.split('.');
|
|
47
53
|
if (!payloadB64 || !signatureB64) {
|
|
54
|
+
fs.appendFileSync(debugFile, `ERROR: No dot found in key\n`);
|
|
48
55
|
return { success: false, message: 'Geçersiz lisans formatı.' };
|
|
49
56
|
}
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
fs.appendFileSync(debugFile, `Payload length: ${payloadB64.length}\n`);
|
|
59
|
+
fs.appendFileSync(debugFile, `Signature length: ${signatureB64.length}\n`);
|
|
60
|
+
fs.appendFileSync(debugFile, `Public Key length: ${PUBLIC_KEY.length}\n`);
|
|
53
61
|
|
|
54
62
|
// 1. İmzayı Doğrula
|
|
55
63
|
const verify = crypto.createVerify('SHA256');
|
|
56
64
|
verify.update(payloadB64);
|
|
57
65
|
verify.end();
|
|
58
66
|
|
|
59
|
-
// Debug: Try both RSA methods
|
|
60
67
|
let isValid = false;
|
|
61
68
|
try {
|
|
62
69
|
isValid = verify.verify(PUBLIC_KEY, signatureB64, 'base64');
|
|
70
|
+
fs.appendFileSync(debugFile, `Verify result: ${isValid}\n`);
|
|
63
71
|
} catch(e) {
|
|
64
|
-
|
|
72
|
+
fs.appendFileSync(debugFile, `Verify error: ${e.message}\n`);
|
|
65
73
|
}
|
|
66
|
-
|
|
67
|
-
console.log('[DEBUG] Verification result:', isValid);
|
|
68
74
|
|
|
69
75
|
if (!isValid) {
|
|
70
|
-
|
|
76
|
+
fs.appendFileSync(debugFile, `Trying RSA-SHA256...\n`);
|
|
71
77
|
try {
|
|
72
78
|
const verify2 = crypto.createVerify('RSA-SHA256');
|
|
73
79
|
verify2.update(payloadB64);
|
|
74
80
|
verify2.end();
|
|
75
81
|
isValid = verify2.verify(PUBLIC_KEY, signatureB64, 'base64');
|
|
76
|
-
|
|
82
|
+
fs.appendFileSync(debugFile, `RSA-SHA256 result: ${isValid}\n`);
|
|
77
83
|
} catch(e) {
|
|
78
|
-
|
|
84
|
+
fs.appendFileSync(debugFile, `RSA-SHA256 error: ${e.message}\n`);
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
if (!isValid) {
|
|
88
|
+
fs.appendFileSync(debugFile, `ERROR: Invalid signature\n`);
|
|
82
89
|
return { success: false, message: '❌ SAHTE LİSANS! İmza doğrulanamadı.' };
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
// 2. İçeriği Çöz
|
|
87
94
|
const payload = JSON.parse(Buffer.from(payloadB64, 'base64').toString('utf-8'));
|
|
88
|
-
|
|
95
|
+
fs.appendFileSync(debugFile, `Payload: ${JSON.stringify(payload)}\n`);
|
|
89
96
|
|
|
90
97
|
// 3. Son Kullanma Tarihini Kontrol Et (Payload içinden gelir)
|
|
91
98
|
// Payload: { type: 'ANNUAL', expires: '2027-01-01', user: '...' }
|