@sylphx/sdk 0.15.2 → 0.15.3

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.
@@ -2,34 +2,247 @@ import { NextResponse, NextRequest } from 'next/server';
2
2
  import { AuthTokensResponse } from '@sylphx/contract';
3
3
 
4
4
  /**
5
- * Sylphx Unified Middleware — State of the Art
5
+ * Auth Functions
6
6
  *
7
- * ONE middleware function handles EVERYTHING:
8
- * - Auth routes (mounted automatically, zero manual API routes)
9
- * - BaaS routes (same-origin proxy, no browser bearer-token exposure)
10
- * - Token refresh (automatic, every request)
11
- * - Route protection
12
- * - Cookie management
7
+ * Pure functions for authentication - no hidden state.
8
+ * Each function takes config as the first parameter.
13
9
  *
14
- * This follows Auth0 v4 / Clerk / Supabase patterns where middleware
15
- * handles all auth concerns. Apps don't need to create any /api/auth/* routes.
10
+ * Uses REST API at /api/sdk/auth/* for all operations.
11
+ *
12
+ * Types are re-exported from `@sylphx/contract` (ADR-084). The contract is
13
+ * the single source of truth for every wire shape — this module only adds
14
+ * SDK-specific ergonomics (User brand swap, introspection result, invite
15
+ * envelopes, org-token claims).
16
+ */
17
+
18
+ /**
19
+ * Token response — contract's `AuthTokensResponse.user` (optional `AuthUser`)
20
+ * is re-mapped to the SDK's broader `User` type so legacy callers keep the
21
+ * familiar brand. `AuthUser` and `User` are structurally identical, but
22
+ * the SDK surface has wider reach (cookies, middleware, React hooks) and
23
+ * renaming is out of scope for ADR-084 cleanup.
24
+ */
25
+ type TokenResponse = Omit<AuthTokensResponse, 'user'> & {
26
+ user: User;
27
+ };
28
+
29
+ /**
30
+ * SDK-specific types — cross-layer helpers and server-first configuration.
31
+ *
32
+ * Wire-shape types (API request/response envelopes) live in
33
+ * `@sylphx/contract` and are re-exported per namespace from their SDK
34
+ * module (e.g. `Plan` / `Subscription` from `./billing`, `ConsentType`
35
+ * from `./consent`, `TokenResponse` from `./auth`). React-hook wrapper
36
+ * shapes live in `./react/types` (tRPC-like convenience shapes that
37
+ * are not part of the platform wire).
38
+ *
39
+ * History: pre-ADR-084 this file mirrored every wire shape the SDK
40
+ * exposed; those aliases now come directly from `@sylphx/contract`.
41
+ */
42
+
43
+ /** SDK cookie/token shape. Richer authenticated surfaces live in `./react/types` `UserProfile`. */
44
+ interface User {
45
+ id: string;
46
+ email: string;
47
+ name: string | null;
48
+ image?: string | null;
49
+ emailVerified?: boolean;
50
+ role?: string;
51
+ createdAt?: string;
52
+ }
53
+ interface UserCookieData {
54
+ user: User;
55
+ /** Epoch ms when the session expires (client-side expiry check). */
56
+ expiresAt: number;
57
+ }
58
+
59
+ /**
60
+ * Cookie Management for Next.js — Single Source of Truth
61
+ *
62
+ * Architecture: Cookie-Centric Auth (Clerk Pattern)
63
+ * ================================================
64
+ *
65
+ * ALL auth state lives in cookies. Zero localStorage for auth.
66
+ *
67
+ * Cookie Structure:
68
+ * - __sylphx_{namespace}_session — HttpOnly JWT, 5 min (access token)
69
+ * - __sylphx_{namespace}_refresh — HttpOnly, 30 days (refresh token)
70
+ * - __sylphx_{namespace}_user — JS-readable, 5 min (user data for client hydration)
71
+ *
72
+ * Benefits:
73
+ * 1. Single Source of Truth — no server/client state divergence
74
+ * 2. XSS-safe — tokens never accessible to JavaScript
75
+ * 3. Cross-tab sync — cookies shared across tabs automatically
76
+ * 4. SSR works — auth() in Server Components reads cookies directly
77
+ *
78
+ * Security:
79
+ * - Short token lifetime (5 min) like Clerk
80
+ * - Server-side refresh in middleware
81
+ * - SameSite=Lax for CSRF protection
82
+ */
83
+
84
+ /**
85
+ * Get cookie names for a given namespace
86
+ *
87
+ * Namespace is derived from the secret key environment (dev/stg/prod).
88
+ * This prevents cookies from different environments colliding.
16
89
  *
17
90
  * @example
18
- * ```typescript
19
- * // middleware.ts (or proxy.ts for Next.js 16)
20
- * import { createSylphxMiddleware } from '@sylphx/sdk/nextjs'
91
+ * getCookieNames('sylphx_prod')
92
+ * // Returns:
93
+ * // {
94
+ * // SESSION: '__sylphx_prod_session',
95
+ * // REFRESH: '__sylphx_prod_refresh',
96
+ * // USER: '__sylphx_prod_user',
97
+ * // }
98
+ */
99
+ declare function getCookieNames(namespace: string): {
100
+ /** HttpOnly JWT access token (5 min) */
101
+ SESSION: string;
102
+ /** HttpOnly refresh token (30 days) */
103
+ REFRESH: string;
104
+ /** JS-readable user data for client hydration (5 min) */
105
+ USER: string;
106
+ /** HttpOnly active organization ID used to preserve org-scoped sessions */
107
+ ACTIVE_ORG_ID: string;
108
+ /** HttpOnly active organization slug used to preserve org-scoped sessions */
109
+ ACTIVE_ORG_SLUG: string;
110
+ };
111
+ /**
112
+ * Session token lifetime (5 minutes like Clerk)
113
+ */
114
+ declare const SESSION_TOKEN_LIFETIME: number;
115
+ /**
116
+ * Refresh token lifetime (30 days)
117
+ */
118
+ declare const REFRESH_TOKEN_LIFETIME: number;
119
+ /**
120
+ * Active organization context lifetime (30 days).
21
121
  *
22
- * export default createSylphxMiddleware({
23
- * publicRoutes: ['/', '/about', '/pricing'],
24
- * })
122
+ * This matches refresh-token lifetime: the org preference is session-scoped
123
+ * state, not a permanent user preference. Clearing auth clears this too.
124
+ */
125
+ declare const ACTIVE_ORG_LIFETIME: number;
126
+ /**
127
+ * Cookie options for HttpOnly tokens (session, refresh)
25
128
  *
26
- * export const config = {
27
- * matcher: ['/((?!_next|.*\\..*).*)', '/'],
28
- * }
29
- * ```
129
+ * Security features:
130
+ * - httpOnly: true — Not accessible via JavaScript (XSS protection)
131
+ * - secure: true in production — Only sent over HTTPS
132
+ * - sameSite: 'lax' — CSRF protection while allowing navigation
133
+ */
134
+ declare const SECURE_COOKIE_OPTIONS: {
135
+ httpOnly: boolean;
136
+ secure: boolean;
137
+ sameSite: "lax";
138
+ path: string;
139
+ };
140
+ /**
141
+ * Cookie options for JS-readable user cookie
30
142
  *
31
- * That's it. No /api/auth/* routes needed.
143
+ * This cookie contains only user info (no tokens) and enables:
144
+ * - Client-side hydration without loading states
145
+ * - Cross-tab sync via cookie visibility
146
+ */
147
+ declare const USER_COOKIE_OPTIONS: {
148
+ httpOnly: boolean;
149
+ secure: boolean;
150
+ sameSite: "lax";
151
+ path: string;
152
+ };
153
+ /**
154
+ * Cookie options for active organization context.
155
+ *
156
+ * Active org is not a secret, but it controls which org-scoped JWT the SDK
157
+ * restores after refresh. Keep it HttpOnly so browser JavaScript cannot
158
+ * silently steer server-side auth context outside the official switch-org
159
+ * route.
160
+ */
161
+ declare const ACTIVE_ORG_COOKIE_OPTIONS: {
162
+ httpOnly: boolean;
163
+ secure: boolean;
164
+ sameSite: "lax";
165
+ path: string;
166
+ };
167
+ /**
168
+ * Auth cookies data returned by getAuthCookies
169
+ */
170
+ interface AuthCookiesData {
171
+ /** Access token from SESSION cookie (HttpOnly) */
172
+ sessionToken: string | null;
173
+ /** Refresh token from REFRESH cookie (HttpOnly) */
174
+ refreshToken: string | null;
175
+ /** User data from USER cookie (JS-readable) */
176
+ user: User | null;
177
+ /** Expiry timestamp from USER cookie */
178
+ expiresAt: number | null;
179
+ }
180
+ /**
181
+ * Decode a cookie value without throwing on malformed percent-encoding.
32
182
  */
183
+ declare function decodeCookieValue(value: string): string;
184
+ /**
185
+ * Read the last value for a cookie name from a raw Cookie header.
186
+ *
187
+ * Browsers can legitimately send duplicate cookie names when an application
188
+ * has migrated between host-only and domain-scoped cookies. RFC 6265 orders
189
+ * same-path duplicates by creation time, so the most recently set cookie is the
190
+ * right value for auth session recovery.
191
+ */
192
+ declare function readCookieValueFromHeader(cookieHeader: string | null | undefined, name: string): string | null;
193
+ /**
194
+ * Get auth cookies from the request
195
+ *
196
+ * Used by auth() to read current auth state.
197
+ */
198
+ declare function getAuthCookies(namespace: string): Promise<AuthCookiesData>;
199
+ /**
200
+ * Set auth cookies from token response
201
+ *
202
+ * Sets all three cookies:
203
+ * - SESSION: HttpOnly access token (5 min)
204
+ * - REFRESH: HttpOnly refresh token (30 days)
205
+ * - USER: JS-readable user data (5 min)
206
+ *
207
+ * @param namespace - Cookie namespace (e.g., 'sylphx_prod')
208
+ * @param response - Token response from auth endpoint
209
+ * @param options - Optional: custom expiresIn override
210
+ */
211
+ declare function setAuthCookies(namespace: string, response: TokenResponse, options?: {
212
+ sessionLifetime?: number;
213
+ }): Promise<void>;
214
+ /**
215
+ * Clear all auth cookies
216
+ *
217
+ * Call on sign out to remove all auth state.
218
+ */
219
+ declare function clearAuthCookies(namespace: string): Promise<void>;
220
+ /**
221
+ * Check if session is expired
222
+ *
223
+ * Uses a 30 second buffer to account for network latency.
224
+ */
225
+ declare function isSessionExpired(namespace: string): Promise<boolean>;
226
+ /**
227
+ * Check if we have a refresh token (can potentially refresh)
228
+ */
229
+ declare function hasRefreshToken(namespace: string): Promise<boolean>;
230
+
231
+ /**
232
+ * Set auth cookies on a NextResponse (for middleware use)
233
+ *
234
+ * Unlike setAuthCookies() which uses next/headers, this works with NextResponse.
235
+ * Use this in middleware where you need to modify cookies on the response.
236
+ */
237
+ declare function setAuthCookiesMiddleware(response: NextResponse, namespace: string, tokens: TokenResponse): void;
238
+ /**
239
+ * Clear auth cookies on a NextResponse (for middleware use)
240
+ */
241
+ declare function clearAuthCookiesMiddleware(response: NextResponse, namespace: string): void;
242
+ /**
243
+ * Parse user cookie value (for client-side use)
244
+ */
245
+ declare function parseUserCookie(value: string): UserCookieData | null;
33
246
 
34
247
  interface SylphxMiddlewareConfig {
35
248
  /**
@@ -64,19 +277,19 @@ interface SylphxMiddlewareConfig {
64
277
  afterSignInUrl?: string;
65
278
  /**
66
279
  * Auth routes prefix. Routes are mounted at:
67
- * - {prefix}/register email/password registration handler
68
- * - {prefix}/login credentials login handler
69
- * - {prefix}/verify-email email verification handler
70
- * - {prefix}/oauth-providers enabled social login providers
71
- * - {prefix}/oauth/authorize social login start handler
72
- * - {prefix}/callback OAuth callback handler
73
- * - {prefix}/passkey/options passkey login challenge handler
74
- * - {prefix}/passkey/authenticate passkey login verification handler
75
- * - {prefix}/verify-2fa TOTP/backup-code verification handler
76
- * - {prefix}/forgot-password password reset email handler
77
- * - {prefix}/reset-password password reset verification handler
78
- * - {prefix}/session safe session metadata handler
79
- * - {prefix}/signout Sign out handler
280
+ * - {prefix}/register - email/password registration handler
281
+ * - {prefix}/login - credentials login handler
282
+ * - {prefix}/verify-email - email verification handler
283
+ * - {prefix}/oauth-providers - enabled social login providers
284
+ * - {prefix}/oauth/authorize - social login start handler
285
+ * - {prefix}/callback - OAuth callback handler
286
+ * - {prefix}/passkey/options - passkey login challenge handler
287
+ * - {prefix}/passkey/authenticate - passkey login verification handler
288
+ * - {prefix}/verify-2fa - TOTP/backup-code verification handler
289
+ * - {prefix}/forgot-password - password reset email handler
290
+ * - {prefix}/reset-password - password reset verification handler
291
+ * - {prefix}/session - safe session metadata handler
292
+ * - {prefix}/signout - Sign out handler
80
293
  *
81
294
  * @default '/auth'
82
295
  */
@@ -217,6 +430,37 @@ interface SylphxOrganizationContextConfig {
217
430
  */
218
431
  additionalOrgSlugCookies?: readonly string[];
219
432
  }
433
+
434
+ /**
435
+ * Sylphx Unified Middleware — State of the Art
436
+ *
437
+ * ONE middleware function handles EVERYTHING:
438
+ * - Auth routes (mounted automatically, zero manual API routes)
439
+ * - BaaS routes (same-origin proxy, no browser bearer-token exposure)
440
+ * - Token refresh (automatic, every request)
441
+ * - Route protection
442
+ * - Cookie management
443
+ *
444
+ * This follows Auth0 v4 / Clerk / Supabase patterns where middleware
445
+ * handles all auth concerns. Apps don't need to create any /api/auth/* routes.
446
+ *
447
+ * @example
448
+ * ```typescript
449
+ * // middleware.ts (or proxy.ts for Next.js 16)
450
+ * import { createSylphxMiddleware } from '@sylphx/sdk/nextjs'
451
+ *
452
+ * export default createSylphxMiddleware({
453
+ * publicRoutes: ['/', '/about', '/pricing'],
454
+ * })
455
+ *
456
+ * export const config = {
457
+ * matcher: ['/((?!_next|.*\\..*).*)', '/'],
458
+ * }
459
+ * ```
460
+ *
461
+ * That's it. No /api/auth/* routes needed.
462
+ */
463
+
220
464
  /**
221
465
  * Create Sylphx middleware — State of the Art
222
466
  *
@@ -253,61 +497,6 @@ declare function createMatcher(): {
253
497
  */
254
498
  declare function getNamespace(secretKey: string): string;
255
499
 
256
- /**
257
- * Auth Functions
258
- *
259
- * Pure functions for authentication - no hidden state.
260
- * Each function takes config as the first parameter.
261
- *
262
- * Uses REST API at /api/sdk/auth/* for all operations.
263
- *
264
- * Types are re-exported from `@sylphx/contract` (ADR-084). The contract is
265
- * the single source of truth for every wire shape — this module only adds
266
- * SDK-specific ergonomics (User brand swap, introspection result, invite
267
- * envelopes, org-token claims).
268
- */
269
-
270
- /**
271
- * Token response — contract's `AuthTokensResponse.user` (optional `AuthUser`)
272
- * is re-mapped to the SDK's broader `User` type so legacy callers keep the
273
- * familiar brand. `AuthUser` and `User` are structurally identical, but
274
- * the SDK surface has wider reach (cookies, middleware, React hooks) and
275
- * renaming is out of scope for ADR-084 cleanup.
276
- */
277
- type TokenResponse = Omit<AuthTokensResponse, 'user'> & {
278
- user: User;
279
- };
280
-
281
- /**
282
- * SDK-specific types — cross-layer helpers and server-first configuration.
283
- *
284
- * Wire-shape types (API request/response envelopes) live in
285
- * `@sylphx/contract` and are re-exported per namespace from their SDK
286
- * module (e.g. `Plan` / `Subscription` from `./billing`, `ConsentType`
287
- * from `./consent`, `TokenResponse` from `./auth`). React-hook wrapper
288
- * shapes live in `./react/types` (tRPC-like convenience shapes that
289
- * are not part of the platform wire).
290
- *
291
- * History: pre-ADR-084 this file mirrored every wire shape the SDK
292
- * exposed; those aliases now come directly from `@sylphx/contract`.
293
- */
294
-
295
- /** SDK cookie/token shape. Richer authenticated surfaces live in `./react/types` `UserProfile`. */
296
- interface User {
297
- id: string;
298
- email: string;
299
- name: string | null;
300
- image?: string | null;
301
- emailVerified?: boolean;
302
- role?: string;
303
- createdAt?: string;
304
- }
305
- interface UserCookieData {
306
- user: User;
307
- /** Epoch ms when the session expires (client-side expiry check). */
308
- expiresAt: number;
309
- }
310
-
311
500
  /**
312
501
  * Server-side Auth Helpers for Next.js
313
502
  *
@@ -528,192 +717,4 @@ declare function encodeUserId(uuid: string): string;
528
717
  */
529
718
  declare function decodeUserId(prefixedId: string): string | null;
530
719
 
531
- /**
532
- * Cookie Management for Next.js — Single Source of Truth
533
- *
534
- * Architecture: Cookie-Centric Auth (Clerk Pattern)
535
- * ================================================
536
- *
537
- * ALL auth state lives in cookies. Zero localStorage for auth.
538
- *
539
- * Cookie Structure:
540
- * - __sylphx_{namespace}_session — HttpOnly JWT, 5 min (access token)
541
- * - __sylphx_{namespace}_refresh — HttpOnly, 30 days (refresh token)
542
- * - __sylphx_{namespace}_user — JS-readable, 5 min (user data for client hydration)
543
- *
544
- * Benefits:
545
- * 1. Single Source of Truth — no server/client state divergence
546
- * 2. XSS-safe — tokens never accessible to JavaScript
547
- * 3. Cross-tab sync — cookies shared across tabs automatically
548
- * 4. SSR works — auth() in Server Components reads cookies directly
549
- *
550
- * Security:
551
- * - Short token lifetime (5 min) like Clerk
552
- * - Server-side refresh in middleware
553
- * - SameSite=Lax for CSRF protection
554
- */
555
-
556
- /**
557
- * Get cookie names for a given namespace
558
- *
559
- * Namespace is derived from the secret key environment (dev/stg/prod).
560
- * This prevents cookies from different environments colliding.
561
- *
562
- * @example
563
- * getCookieNames('sylphx_prod')
564
- * // Returns:
565
- * // {
566
- * // SESSION: '__sylphx_prod_session',
567
- * // REFRESH: '__sylphx_prod_refresh',
568
- * // USER: '__sylphx_prod_user',
569
- * // }
570
- */
571
- declare function getCookieNames(namespace: string): {
572
- /** HttpOnly JWT access token (5 min) */
573
- SESSION: string;
574
- /** HttpOnly refresh token (30 days) */
575
- REFRESH: string;
576
- /** JS-readable user data for client hydration (5 min) */
577
- USER: string;
578
- /** HttpOnly active organization ID used to preserve org-scoped sessions */
579
- ACTIVE_ORG_ID: string;
580
- /** HttpOnly active organization slug used to preserve org-scoped sessions */
581
- ACTIVE_ORG_SLUG: string;
582
- };
583
- /**
584
- * Session token lifetime (5 minutes like Clerk)
585
- */
586
- declare const SESSION_TOKEN_LIFETIME: number;
587
- /**
588
- * Refresh token lifetime (30 days)
589
- */
590
- declare const REFRESH_TOKEN_LIFETIME: number;
591
- /**
592
- * Active organization context lifetime (30 days).
593
- *
594
- * This matches refresh-token lifetime: the org preference is session-scoped
595
- * state, not a permanent user preference. Clearing auth clears this too.
596
- */
597
- declare const ACTIVE_ORG_LIFETIME: number;
598
- /**
599
- * Cookie options for HttpOnly tokens (session, refresh)
600
- *
601
- * Security features:
602
- * - httpOnly: true — Not accessible via JavaScript (XSS protection)
603
- * - secure: true in production — Only sent over HTTPS
604
- * - sameSite: 'lax' — CSRF protection while allowing navigation
605
- */
606
- declare const SECURE_COOKIE_OPTIONS: {
607
- httpOnly: boolean;
608
- secure: boolean;
609
- sameSite: "lax";
610
- path: string;
611
- };
612
- /**
613
- * Cookie options for JS-readable user cookie
614
- *
615
- * This cookie contains only user info (no tokens) and enables:
616
- * - Client-side hydration without loading states
617
- * - Cross-tab sync via cookie visibility
618
- */
619
- declare const USER_COOKIE_OPTIONS: {
620
- httpOnly: boolean;
621
- secure: boolean;
622
- sameSite: "lax";
623
- path: string;
624
- };
625
- /**
626
- * Cookie options for active organization context.
627
- *
628
- * Active org is not a secret, but it controls which org-scoped JWT the SDK
629
- * restores after refresh. Keep it HttpOnly so browser JavaScript cannot
630
- * silently steer server-side auth context outside the official switch-org
631
- * route.
632
- */
633
- declare const ACTIVE_ORG_COOKIE_OPTIONS: {
634
- httpOnly: boolean;
635
- secure: boolean;
636
- sameSite: "lax";
637
- path: string;
638
- };
639
- /**
640
- * Auth cookies data returned by getAuthCookies
641
- */
642
- interface AuthCookiesData {
643
- /** Access token from SESSION cookie (HttpOnly) */
644
- sessionToken: string | null;
645
- /** Refresh token from REFRESH cookie (HttpOnly) */
646
- refreshToken: string | null;
647
- /** User data from USER cookie (JS-readable) */
648
- user: User | null;
649
- /** Expiry timestamp from USER cookie */
650
- expiresAt: number | null;
651
- }
652
- /**
653
- * Decode a cookie value without throwing on malformed percent-encoding.
654
- */
655
- declare function decodeCookieValue(value: string): string;
656
- /**
657
- * Read the last value for a cookie name from a raw Cookie header.
658
- *
659
- * Browsers can legitimately send duplicate cookie names when an application
660
- * has migrated between host-only and domain-scoped cookies. RFC 6265 orders
661
- * same-path duplicates by creation time, so the most recently set cookie is the
662
- * right value for auth session recovery.
663
- */
664
- declare function readCookieValueFromHeader(cookieHeader: string | null | undefined, name: string): string | null;
665
- /**
666
- * Get auth cookies from the request
667
- *
668
- * Used by auth() to read current auth state.
669
- */
670
- declare function getAuthCookies(namespace: string): Promise<AuthCookiesData>;
671
- /**
672
- * Set auth cookies from token response
673
- *
674
- * Sets all three cookies:
675
- * - SESSION: HttpOnly access token (5 min)
676
- * - REFRESH: HttpOnly refresh token (30 days)
677
- * - USER: JS-readable user data (5 min)
678
- *
679
- * @param namespace - Cookie namespace (e.g., 'sylphx_prod')
680
- * @param response - Token response from auth endpoint
681
- * @param options - Optional: custom expiresIn override
682
- */
683
- declare function setAuthCookies(namespace: string, response: TokenResponse, options?: {
684
- sessionLifetime?: number;
685
- }): Promise<void>;
686
- /**
687
- * Clear all auth cookies
688
- *
689
- * Call on sign out to remove all auth state.
690
- */
691
- declare function clearAuthCookies(namespace: string): Promise<void>;
692
- /**
693
- * Check if session is expired
694
- *
695
- * Uses a 30 second buffer to account for network latency.
696
- */
697
- declare function isSessionExpired(namespace: string): Promise<boolean>;
698
- /**
699
- * Check if we have a refresh token (can potentially refresh)
700
- */
701
- declare function hasRefreshToken(namespace: string): Promise<boolean>;
702
-
703
- /**
704
- * Set auth cookies on a NextResponse (for middleware use)
705
- *
706
- * Unlike setAuthCookies() which uses next/headers, this works with NextResponse.
707
- * Use this in middleware where you need to modify cookies on the response.
708
- */
709
- declare function setAuthCookiesMiddleware(response: NextResponse, namespace: string, tokens: TokenResponse): void;
710
- /**
711
- * Clear auth cookies on a NextResponse (for middleware use)
712
- */
713
- declare function clearAuthCookiesMiddleware(response: NextResponse, namespace: string): void;
714
- /**
715
- * Parse user cookie value (for client-side use)
716
- */
717
- declare function parseUserCookie(value: string): UserCookieData | null;
718
-
719
720
  export { ACTIVE_ORG_COOKIE_OPTIONS, ACTIVE_ORG_LIFETIME, type AuthCookiesData, type AuthResult, REFRESH_TOKEN_LIFETIME, SECURE_COOKIE_OPTIONS, SESSION_TOKEN_LIFETIME, SESSION_TOKEN_LIFETIME_MS, type SylphxMiddlewareConfig, type SylphxOrganizationContextConfig, TOKEN_EXPIRY_BUFFER_MS, USER_COOKIE_OPTIONS, type UserCookieData, auth, clearAuthCookies, clearAuthCookiesMiddleware, configureServer, createMatcher, createSylphxMiddleware, currentUser, currentUserId, decodeCookieValue, decodeUserId, encodeUserId, getAuthCookies, getAuthorizationUrl, getCookieNames, getNamespace, getSessionToken, handleCallback, hasRefreshToken, isSessionExpired, parseUserCookie, readCookieValueFromHeader, setAuthCookies, setAuthCookiesMiddleware, signOut, sylphxMiddleware, syncAuthToCookies };