@spfn/auth 0.2.0-beta.50 → 0.2.0-beta.51

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/server.d.ts CHANGED
@@ -5159,14 +5159,17 @@ declare function shouldRefreshSession(jwt: string, thresholdHours?: number): Pro
5159
5159
  */
5160
5160
  /**
5161
5161
  * Cookie names used by SPFN Auth
5162
+ *
5163
+ * Names include a port-based suffix so that multiple dev instances
5164
+ * on different ports don't overwrite each other's cookies.
5162
5165
  */
5163
5166
  declare const COOKIE_NAMES: {
5164
5167
  /** Encrypted session data (userId, privateKey, keyId, algorithm) */
5165
- readonly SESSION: "spfn_session";
5168
+ readonly SESSION: string;
5166
5169
  /** Current key ID (for key rotation) */
5167
- readonly SESSION_KEY_ID: "spfn_session_key_id";
5170
+ readonly SESSION_KEY_ID: string;
5168
5171
  /** Pending OAuth session (privateKey, keyId, algorithm) - temporary during OAuth flow */
5169
- readonly OAUTH_PENDING: "spfn_oauth_pending";
5172
+ readonly OAUTH_PENDING: string;
5170
5173
  };
5171
5174
  /**
5172
5175
  * Parse duration string to seconds
package/dist/server.js CHANGED
@@ -7420,13 +7420,23 @@ import { createHash } from "crypto";
7420
7420
 
7421
7421
  // src/server/lib/config.ts
7422
7422
  import { env as env5 } from "@spfn/auth/config";
7423
+ function getCookieSuffix() {
7424
+ const port = process.env.PORT;
7425
+ return port ? `_${port}` : "";
7426
+ }
7423
7427
  var COOKIE_NAMES = {
7424
7428
  /** Encrypted session data (userId, privateKey, keyId, algorithm) */
7425
- SESSION: "spfn_session",
7429
+ get SESSION() {
7430
+ return `spfn_session${getCookieSuffix()}`;
7431
+ },
7426
7432
  /** Current key ID (for key rotation) */
7427
- SESSION_KEY_ID: "spfn_session_key_id",
7433
+ get SESSION_KEY_ID() {
7434
+ return `spfn_session_key_id${getCookieSuffix()}`;
7435
+ },
7428
7436
  /** Pending OAuth session (privateKey, keyId, algorithm) - temporary during OAuth flow */
7429
- OAUTH_PENDING: "spfn_oauth_pending"
7437
+ get OAUTH_PENDING() {
7438
+ return `spfn_oauth_pending${getCookieSuffix()}`;
7439
+ }
7430
7440
  };
7431
7441
  function parseDuration(duration) {
7432
7442
  if (typeof duration === "number") {