@lanonasis/cli 3.2.14 → 3.3.15
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/dist/utils/config.js +26 -5
- package/package.json +1 -1
package/dist/utils/config.js
CHANGED
|
@@ -501,13 +501,34 @@ export class CLIConfig {
|
|
|
501
501
|
// Verify with server (security check)
|
|
502
502
|
try {
|
|
503
503
|
const axios = (await import('axios')).default;
|
|
504
|
-
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
504
|
+
// Try auth-gateway first (port 4000), then fall back to Netlify function
|
|
505
|
+
const endpoints = [
|
|
506
|
+
'http://localhost:4000/v1/auth/verify-token',
|
|
507
|
+
'https://auth.lanonasis.com/v1/auth/verify-token',
|
|
508
|
+
'https://api.lanonasis.com/auth/verify'
|
|
509
|
+
];
|
|
510
|
+
let response = null;
|
|
511
|
+
for (const endpoint of endpoints) {
|
|
512
|
+
try {
|
|
513
|
+
response = await axios.post(endpoint, { token }, { timeout: 3000 });
|
|
514
|
+
if (response.data.valid === true) {
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
catch (err) {
|
|
519
|
+
// Try next endpoint
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (!response || response.data.valid !== true) {
|
|
524
|
+
this.authCheckCache = { isValid: false, timestamp: Date.now() };
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
this.authCheckCache = { isValid: true, timestamp: Date.now() };
|
|
528
|
+
return true;
|
|
508
529
|
}
|
|
509
530
|
catch (error) {
|
|
510
|
-
// If server
|
|
531
|
+
// If all server checks fail, fall back to local validation
|
|
511
532
|
// This allows offline usage but is less secure
|
|
512
533
|
console.warn('⚠️ Unable to verify token with server, using local validation');
|
|
513
534
|
this.authCheckCache = { isValid: locallyValid, timestamp: Date.now() };
|
package/package.json
CHANGED