@payez/next-mvp 4.0.19 → 4.0.21
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/api-handlers/session/viability.js +9 -1
- package/dist/auth/better-auth.js +2 -0
- package/dist/lib/session-store.d.ts +9 -0
- package/dist/lib/session-store.js +65 -21
- package/dist/server/decode-session.js +3 -11
- package/package.json +1 -1
- package/src/api-handlers/session/viability.ts +136 -128
- package/src/auth/better-auth.ts +2 -0
- package/src/lib/session-store.ts +689 -645
- package/src/server/decode-session.ts +3 -12
|
@@ -26,20 +26,11 @@ async function tryBetterAuthSession(
|
|
|
26
26
|
requestCookies?: { get: (name: string) => { value: string } | undefined }
|
|
27
27
|
): Promise<DecodedSession | null> {
|
|
28
28
|
try {
|
|
29
|
-
const {
|
|
30
|
-
// getBetterAuthHandler initializes the instance; we need the raw instance
|
|
31
|
-
const { default: getBetterAuthInstanceFn } = await import('../auth/better-auth')
|
|
32
|
-
.then(m => ({ default: (m as any).getBetterAuthInstance || null }))
|
|
33
|
-
.catch(() => ({ default: null }));
|
|
29
|
+
const { getBetterAuthInstance } = await import('../auth/better-auth');
|
|
34
30
|
|
|
35
|
-
// Access the cached instance via the module's internal getter
|
|
36
31
|
let auth: any = null;
|
|
37
32
|
try {
|
|
38
|
-
|
|
39
|
-
await getBetterAuthHandler();
|
|
40
|
-
// The instance is cached in the module — re-import to access it
|
|
41
|
-
const mod = await import('../auth/better-auth');
|
|
42
|
-
auth = (mod as any).__betterAuthInstance;
|
|
33
|
+
auth = await getBetterAuthInstance();
|
|
43
34
|
} catch {
|
|
44
35
|
return null;
|
|
45
36
|
}
|
|
@@ -98,7 +89,7 @@ async function tryBetterAuthSession(
|
|
|
98
89
|
idpRefreshToken: idpTokens?.idpRefreshToken,
|
|
99
90
|
idpAccessTokenExpires: idpTokens?.idpAccessTokenExpires
|
|
100
91
|
|| (result.session.expiresAt ? new Date(result.session.expiresAt).getTime() : Date.now() + 24 * 60 * 60 * 1000),
|
|
101
|
-
mfaVerified:
|
|
92
|
+
mfaVerified: idpTokens?.mfaVerified ?? false,
|
|
102
93
|
oauthProvider: 'google',
|
|
103
94
|
};
|
|
104
95
|
|