@vritti/api-sdk 0.1.5 → 0.1.6

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/index.d.cts CHANGED
@@ -582,6 +582,12 @@ interface CookieConfig {
582
582
  * @default 'strict'
583
583
  */
584
584
  refreshCookieSameSite: 'strict' | 'lax' | 'none';
585
+ /**
586
+ * Cookie domain (e.g., 'localhost' for dev, '.vritti.cloud' for prod)
587
+ * Required for cross-subdomain auth (e.g., cloud.localhost accessing localhost API)
588
+ * @default undefined (uses request domain)
589
+ */
590
+ refreshCookieDomain?: string;
585
591
  }
586
592
  /**
587
593
  * JWT token configuration options
@@ -674,13 +680,7 @@ declare function resetConfig(): void;
674
680
  /**
675
681
  * Get refresh cookie options (convenience method)
676
682
  */
677
- declare function getRefreshCookieOptions(): {
678
- httpOnly: boolean;
679
- secure: boolean;
680
- sameSite: "strict" | "lax" | "none";
681
- path: string;
682
- maxAge: number;
683
- };
683
+ declare function getRefreshCookieOptions(): Record<string, unknown>;
684
684
  /**
685
685
  * Get JWT expiry settings (convenience method)
686
686
  */
package/dist/index.d.ts CHANGED
@@ -582,6 +582,12 @@ interface CookieConfig {
582
582
  * @default 'strict'
583
583
  */
584
584
  refreshCookieSameSite: 'strict' | 'lax' | 'none';
585
+ /**
586
+ * Cookie domain (e.g., 'localhost' for dev, '.vritti.cloud' for prod)
587
+ * Required for cross-subdomain auth (e.g., cloud.localhost accessing localhost API)
588
+ * @default undefined (uses request domain)
589
+ */
590
+ refreshCookieDomain?: string;
585
591
  }
586
592
  /**
587
593
  * JWT token configuration options
@@ -674,13 +680,7 @@ declare function resetConfig(): void;
674
680
  /**
675
681
  * Get refresh cookie options (convenience method)
676
682
  */
677
- declare function getRefreshCookieOptions(): {
678
- httpOnly: boolean;
679
- secure: boolean;
680
- sameSite: "strict" | "lax" | "none";
681
- path: string;
682
- maxAge: number;
683
- };
683
+ declare function getRefreshCookieOptions(): Record<string, unknown>;
684
684
  /**
685
685
  * Get JWT expiry settings (convenience method)
686
686
  */
package/dist/index.js CHANGED
@@ -21,7 +21,8 @@ var defaultConfig = {
21
21
  refreshCookieMaxAge: 30 * 24 * 60 * 60 * 1e3,
22
22
  refreshCookiePath: "/",
23
23
  refreshCookieSecure: process.env.NODE_ENV === "production",
24
- refreshCookieSameSite: "strict"
24
+ refreshCookieSameSite: "strict",
25
+ refreshCookieDomain: "localhost"
25
26
  },
26
27
  jwt: {
27
28
  accessTokenExpiry: "15m",
@@ -70,13 +71,17 @@ function resetConfig() {
70
71
  }
71
72
  __name(resetConfig, "resetConfig");
72
73
  function getRefreshCookieOptions() {
73
- return {
74
+ const options = {
74
75
  httpOnly: true,
75
76
  secure: currentConfig.cookie.refreshCookieSecure,
76
77
  sameSite: currentConfig.cookie.refreshCookieSameSite,
77
78
  path: currentConfig.cookie.refreshCookiePath,
78
79
  maxAge: currentConfig.cookie.refreshCookieMaxAge
79
80
  };
81
+ if (currentConfig.cookie.refreshCookieDomain) {
82
+ options.domain = currentConfig.cookie.refreshCookieDomain;
83
+ }
84
+ return options;
80
85
  }
81
86
  __name(getRefreshCookieOptions, "getRefreshCookieOptions");
82
87
  function getJwtExpiry() {