@absolutejs/auth 0.64.0 → 0.65.0

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
@@ -14,6 +14,7 @@ export type { SetupCapability, SetupSession, SetupSessionStore } from './portal/
14
14
  export { createSetupSession } from './portal/operations';
15
15
  export { createPostgresSetupSessionStore } from './portal/postgresSetupSessionStore';
16
16
  export { protectRoutePlugin } from './routes/protectRoute';
17
+ export { readSessionCookie } from './session/cookieReader';
17
18
  export { requireAuthPlugin } from './routes/requireAuth';
18
19
  export type { ScimConfig } from './scim/config';
19
20
  export type { ScimFilter, ScimGroup, ScimGroupInput, ScimTokenStore, ScimUser, ScimUserInput } from './scim/types';
package/dist/server.js CHANGED
@@ -25661,6 +25661,23 @@ var decodeSessionUserRecord = (value) => {
25661
25661
  throw new TypeError("Persisted session user must be an object");
25662
25662
  return value;
25663
25663
  };
25664
+ // src/session/cookieReader.ts
25665
+ var SESSION_COOKIE_NAME = "user_session_id";
25666
+ var SESSION_COOKIE_PATTERN = new RegExp(`(?:^|;\\s*)${SESSION_COOKIE_NAME}=([^;]*)`);
25667
+ var readSessionCookie = (request) => {
25668
+ const header = request.headers.get("cookie");
25669
+ if (header === null)
25670
+ return null;
25671
+ const match = header.match(SESSION_COOKIE_PATTERN);
25672
+ const value = match?.[1];
25673
+ if (value === undefined)
25674
+ return null;
25675
+ try {
25676
+ return decodeURIComponent(value);
25677
+ } catch {
25678
+ return value;
25679
+ }
25680
+ };
25664
25681
  // src/session/inMemoryStore.ts
25665
25682
  var cloneSessionData = (value) => ({
25666
25683
  ...value
@@ -38777,6 +38794,7 @@ var auth2 = auth;
38777
38794
  export {
38778
38795
  userSessionIdTypebox,
38779
38796
  requireAuthPlugin,
38797
+ readSessionCookie,
38780
38798
  providers,
38781
38799
  protectRoutePlugin,
38782
38800
  isValidProviderOption,
@@ -38793,5 +38811,5 @@ export {
38793
38811
  VerificationProviderError
38794
38812
  };
38795
38813
 
38796
- //# debugId=10D4FD2D81745E4B64756E2164756E21
38814
+ //# debugId=59EA26D2A962869F64756E2164756E21
38797
38815
  //# sourceMappingURL=server.js.map