@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.
@@ -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 { getBetterAuthHandler } = await import('../auth/better-auth');
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
- // Force handler init which caches the instance, then use the API
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: true,
92
+ mfaVerified: idpTokens?.mfaVerified ?? false,
102
93
  oauthProvider: 'google',
103
94
  };
104
95