@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.
@@ -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
- const response = await axios.post('https://api.lanonasis.com/auth/verify', { token }, { timeout: 5000 });
505
- const isValid = response.data.valid === true;
506
- this.authCheckCache = { isValid, timestamp: Date.now() };
507
- return isValid;
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 check fails, fall back to local validation
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "3.2.14",
3
+ "version": "3.3.15",
4
4
  "description": "LanOnasis Enterprise CLI - Memory as a Service, API Key Management, and Infrastructure Orchestration",
5
5
  "main": "dist/index-simple.js",
6
6
  "bin": {