@payez/next-mvp 4.1.10 → 4.1.20

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.
Files changed (181) hide show
  1. package/dist/api-handlers/account/profile.d.ts +38 -0
  2. package/dist/api-handlers/account/profile.js +73 -45
  3. package/dist/api-handlers/account/recovery/send-code.d.ts +33 -0
  4. package/dist/api-handlers/account/recovery/send-code.js +52 -18
  5. package/dist/api-handlers/account/recovery/verify-code.d.ts +33 -0
  6. package/dist/api-handlers/account/recovery/verify-code.js +52 -18
  7. package/dist/api-handlers/account/verify-email.js +15 -1
  8. package/dist/api-handlers/account/verify-sms.js +15 -1
  9. package/dist/api-handlers/auth/passkey-signin.d.ts +29 -0
  10. package/dist/api-handlers/auth/passkey-signin.js +97 -0
  11. package/dist/api-handlers/mfa/backup-code-verify.d.ts +73 -0
  12. package/dist/api-handlers/mfa/backup-code-verify.js +153 -0
  13. package/dist/api-handlers/mfa/backup-codes.d.ts +7 -0
  14. package/dist/api-handlers/mfa/backup-codes.js +40 -0
  15. package/dist/api-handlers/mfa/methods.d.ts +3 -0
  16. package/dist/api-handlers/mfa/methods.js +41 -0
  17. package/dist/api-handlers/mfa/totp-confirm.d.ts +8 -0
  18. package/dist/api-handlers/mfa/totp-confirm.js +41 -0
  19. package/dist/api-handlers/mfa/totp-enroll.d.ts +8 -0
  20. package/dist/api-handlers/mfa/totp-enroll.js +41 -0
  21. package/dist/api-handlers/mfa/totp-verify.d.ts +47 -0
  22. package/dist/api-handlers/mfa/totp-verify.js +134 -0
  23. package/dist/api-handlers/passkeys/list.d.ts +7 -0
  24. package/dist/api-handlers/passkeys/list.js +29 -0
  25. package/dist/api-handlers/passkeys/manage.d.ts +3 -0
  26. package/dist/api-handlers/passkeys/manage.js +54 -0
  27. package/dist/api-handlers/passkeys/register-options.d.ts +8 -0
  28. package/dist/api-handlers/passkeys/register-options.js +41 -0
  29. package/dist/api-handlers/passkeys/register-verify.d.ts +7 -0
  30. package/dist/api-handlers/passkeys/register-verify.js +40 -0
  31. package/dist/api-handlers/session/viability.js +19 -0
  32. package/dist/auth/better-auth.d.ts +68 -5
  33. package/dist/auth/better-auth.js +271 -45
  34. package/dist/auth/utils/idp-client.d.ts +13 -22
  35. package/dist/auth/utils/idp-client.js +12 -82
  36. package/dist/client/better-auth-client.d.ts +14 -2
  37. package/dist/lib/ensure-fresh-access-token.js +13 -2
  38. package/dist/lib/session-store.js +28 -21
  39. package/dist/lib/startup-init.js +19 -19
  40. package/dist/lib/token-lifecycle.d.ts +2 -0
  41. package/dist/lib/token-lifecycle.js +61 -7
  42. package/dist/models/SessionModel.d.ts +17 -0
  43. package/dist/pages/login/page.d.ts +10 -1
  44. package/dist/pages/login/page.js +69 -80
  45. package/dist/pages/verify-code/page.d.ts +10 -1
  46. package/dist/pages/verify-code/page.js +72 -4
  47. package/dist/routes/auth/passkey-signin.d.ts +13 -0
  48. package/dist/routes/auth/passkey-signin.js +18 -0
  49. package/dist/routes/auth/viability.d.ts +2 -0
  50. package/dist/routes/auth/viability.js +88 -0
  51. package/dist/routes/mfa/backup-code-verify.d.ts +1 -0
  52. package/dist/routes/mfa/backup-code-verify.js +5 -0
  53. package/dist/routes/mfa/backup-codes.d.ts +10 -0
  54. package/dist/routes/mfa/backup-codes.js +14 -0
  55. package/dist/routes/mfa/methods.d.ts +21 -0
  56. package/dist/routes/mfa/methods.js +10 -0
  57. package/dist/routes/mfa/totp-confirm.d.ts +10 -0
  58. package/dist/routes/mfa/totp-confirm.js +14 -0
  59. package/dist/routes/mfa/totp-enroll.d.ts +10 -0
  60. package/dist/routes/mfa/totp-enroll.js +14 -0
  61. package/dist/routes/mfa/totp-verify.d.ts +14 -0
  62. package/dist/routes/mfa/totp-verify.js +18 -0
  63. package/dist/routes/passkeys/list.d.ts +10 -0
  64. package/dist/routes/passkeys/list.js +14 -0
  65. package/dist/routes/passkeys/manage.d.ts +18 -0
  66. package/dist/routes/passkeys/manage.js +13 -0
  67. package/dist/routes/passkeys/register-options.d.ts +10 -0
  68. package/dist/routes/passkeys/register-options.js +14 -0
  69. package/dist/routes/passkeys/register-verify.d.ts +10 -0
  70. package/dist/routes/passkeys/register-verify.js +14 -0
  71. package/dist/server/auth.d.ts +2 -2
  72. package/dist/server/decode-session.js +37 -3
  73. package/package.json +958 -893
  74. package/scripts/check-internal-url-usage.sh +73 -73
  75. package/src/api/index.ts +17 -17
  76. package/src/api-handlers/account/masked-info.ts +45 -45
  77. package/src/api-handlers/account/profile.ts +99 -80
  78. package/src/api-handlers/account/recovery/initiate.ts +23 -23
  79. package/src/api-handlers/account/recovery/send-code.ts +73 -25
  80. package/src/api-handlers/account/recovery/verify-code.ts +73 -25
  81. package/src/api-handlers/account/reset-password.ts +23 -23
  82. package/src/api-handlers/account/send-code.ts +76 -76
  83. package/src/api-handlers/account/validate-password.ts +118 -118
  84. package/src/api-handlers/account/verify-email.ts +15 -1
  85. package/src/api-handlers/account/verify-sms.ts +15 -1
  86. package/src/api-handlers/admin/stats.ts +249 -249
  87. package/src/api-handlers/anon/preferences.ts +123 -123
  88. package/src/api-handlers/auth/jwks.ts +20 -20
  89. package/src/api-handlers/auth/login.ts +240 -240
  90. package/src/api-handlers/auth/passkey-signin.ts +98 -0
  91. package/src/api-handlers/auth/validate.ts +43 -43
  92. package/src/api-handlers/mfa/backup-code-verify.ts +175 -0
  93. package/src/api-handlers/mfa/backup-codes.ts +41 -0
  94. package/src/api-handlers/mfa/methods.ts +46 -0
  95. package/src/api-handlers/mfa/totp-confirm.ts +42 -0
  96. package/src/api-handlers/mfa/totp-enroll.ts +42 -0
  97. package/src/api-handlers/mfa/totp-verify.ts +156 -0
  98. package/src/api-handlers/passkeys/list.ts +31 -0
  99. package/src/api-handlers/passkeys/manage.ts +54 -0
  100. package/src/api-handlers/passkeys/register-options.ts +42 -0
  101. package/src/api-handlers/passkeys/register-verify.ts +41 -0
  102. package/src/api-handlers/session/viability.ts +161 -142
  103. package/src/auth/better-auth.ts +708 -455
  104. package/src/auth/unauthenticated-routes.ts +2 -2
  105. package/src/auth/utils/idp-client.ts +13 -95
  106. package/src/client/better-auth-client.ts +70 -70
  107. package/src/client/fetchWithSession.ts +21 -21
  108. package/src/client/index.ts +13 -13
  109. package/src/client/useAnonSession.ts +131 -131
  110. package/src/components/admin/VibeAdminContext.tsx +87 -87
  111. package/src/config/logging-config.ts +82 -82
  112. package/src/config/unauthenticated-routes.ts +19 -19
  113. package/src/edge/internal-api-url.ts +65 -65
  114. package/src/edge/middleware.ts +42 -42
  115. package/src/hooks/useProfile.ts +75 -75
  116. package/src/lib/anon-session.ts +213 -213
  117. package/src/lib/auth-secret.ts +137 -137
  118. package/src/lib/demo-mode.ts +17 -17
  119. package/src/lib/ensure-fresh-access-token.ts +13 -2
  120. package/src/lib/idp-client-config.ts +559 -559
  121. package/src/lib/idp-fetch.ts +126 -126
  122. package/src/lib/internal-api.ts +171 -171
  123. package/src/lib/jwt-decode-client.ts +45 -45
  124. package/src/lib/rate-limit-service.ts +9 -9
  125. package/src/lib/redis.ts +26 -26
  126. package/src/lib/refresh-token-validator.ts +64 -64
  127. package/src/lib/secret-validation.ts +8 -8
  128. package/src/lib/session-store.ts +702 -695
  129. package/src/lib/session.ts +34 -34
  130. package/src/lib/startup-init.ts +251 -251
  131. package/src/lib/token-expiry.ts +40 -40
  132. package/src/lib/token-lifecycle.ts +533 -470
  133. package/src/lib/types/api-responses.ts +336 -336
  134. package/src/middleware/auth-decision.ts +43 -43
  135. package/src/models/DecodedAccessToken.ts +16 -16
  136. package/src/models/SessionModel.ts +282 -264
  137. package/src/pages/admin-roles/index.ts +9 -9
  138. package/src/pages/login/page.tsx +123 -228
  139. package/src/pages/security/EnhancedSecurityPage.tsx +9 -9
  140. package/src/pages/verify-code/page.tsx +71 -5
  141. package/src/routes/account/index.ts +31 -31
  142. package/src/routes/account/masked-info.ts +36 -36
  143. package/src/routes/account/send-code.ts +39 -39
  144. package/src/routes/account/verify-email.ts +40 -40
  145. package/src/routes/account/verify-sms.ts +40 -40
  146. package/src/routes/auth/index.ts +22 -22
  147. package/src/routes/auth/passkey-signin.ts +13 -0
  148. package/src/routes/auth/refresh.ts +48 -48
  149. package/src/routes/auth/session.ts +166 -166
  150. package/src/routes/auth/viability.ts +89 -0
  151. package/src/routes/index.ts +17 -17
  152. package/src/routes/mfa/backup-code-verify.ts +1 -0
  153. package/src/routes/mfa/backup-codes.ts +10 -0
  154. package/src/routes/mfa/methods.ts +22 -0
  155. package/src/routes/mfa/totp-confirm.ts +10 -0
  156. package/src/routes/mfa/totp-enroll.ts +10 -0
  157. package/src/routes/mfa/totp-verify.ts +14 -0
  158. package/src/routes/passkeys/list.ts +10 -0
  159. package/src/routes/passkeys/manage.ts +23 -0
  160. package/src/routes/passkeys/register-options.ts +10 -0
  161. package/src/routes/passkeys/register-verify.ts +10 -0
  162. package/src/routes/session/index.ts +7 -7
  163. package/src/routes/session/refresh-viability.ts +17 -17
  164. package/src/server/auth.ts +373 -373
  165. package/src/server/decode-session.ts +235 -202
  166. package/src/services/signalrActivityService.ts +258 -258
  167. package/src/theme/ThemeProvider.tsx +39 -39
  168. package/src/theme/default.ts +33 -33
  169. package/src/theme/index.ts +31 -31
  170. package/src/theme/types.ts +69 -69
  171. package/src/theme/useTheme.ts +57 -57
  172. package/src/theme/utils.ts +40 -40
  173. package/src/types/api.ts +12 -12
  174. package/src/types/auth.d.ts +23 -23
  175. package/src/types/auth.ts +22 -22
  176. package/src/types/logging.ts +11 -11
  177. package/src/types/recovery.ts +54 -54
  178. package/src/utils/api.ts +353 -353
  179. package/src/utils/circuitBreaker.ts +40 -40
  180. package/src/utils/error-message.ts +108 -108
  181. package/src/utils/layout/reservedSpace.ts +124 -124
@@ -1,37 +1,37 @@
1
- /**
2
- * Ready-to-Use Masked Info Route
3
- *
4
- * Provides a pre-configured handler for fetching masked contact information
5
- * during 2FA flow. Can be imported directly into your app's API routes with
6
- * zero configuration.
7
- *
8
- * @example
9
- * ```typescript
10
- * // app/api/account/masked-info/route.ts
11
- * export { POST } from '@payez/next-mvp/routes/account/masked-info';
12
- * ```
13
- *
14
- * @version 2.3.0
15
- * @since auth-ready-v2
16
- */
17
-
18
- // Re-export the POST handler from api-handlers
19
- // Note: IDP uses POST for masked-info endpoint
20
- export { POST } from '../../api-handlers/account/masked-info';
21
-
22
- /**
23
- * Pre-configured POST handler for masked contact information
24
- *
25
- * This endpoint is typically called during the 2FA flow to display masked
26
- * email/phone options to the user.
27
- *
28
- * Environment variables used:
29
- * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
30
- * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
31
- * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
32
- *
33
- * Returns:
34
- * - Masked email addresses
35
- * - Masked phone numbers
36
- * - Contact method preferences
1
+ /**
2
+ * Ready-to-Use Masked Info Route
3
+ *
4
+ * Provides a pre-configured handler for fetching masked contact information
5
+ * during 2FA flow. Can be imported directly into your app's API routes with
6
+ * zero configuration.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // app/api/account/masked-info/route.ts
11
+ * export { POST } from '@payez/next-mvp/routes/account/masked-info';
12
+ * ```
13
+ *
14
+ * @version 2.3.0
15
+ * @since auth-ready-v2
16
+ */
17
+
18
+ // Re-export the POST handler from api-handlers
19
+ // Note: IDP uses POST for masked-info endpoint
20
+ export { POST } from '../../api-handlers/account/masked-info';
21
+
22
+ /**
23
+ * Pre-configured POST handler for masked contact information
24
+ *
25
+ * This endpoint is typically called during the 2FA flow to display masked
26
+ * email/phone options to the user.
27
+ *
28
+ * Environment variables used:
29
+ * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
30
+ * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
31
+ * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
32
+ *
33
+ * Returns:
34
+ * - Masked email addresses
35
+ * - Masked phone numbers
36
+ * - Contact method preferences
37
37
  */
@@ -1,40 +1,40 @@
1
- /**
2
- * Ready-to-Use Send Code Route
3
- *
4
- * Provides a pre-configured handler for sending 2FA verification codes
5
- * to the user's registered contact methods. Can be imported directly
6
- * into your app's API routes with zero configuration.
7
- *
8
- * @example
9
- * ```typescript
10
- * // app/api/account/send-code/route.ts
11
- * export { POST } from '@payez/next-mvp/routes/account/send-code';
12
- * ```
13
- *
14
- * @version 2.3.0
15
- * @since auth-ready-v2
16
- */
17
-
18
- // Re-export the POST handler from api-handlers
19
- export { POST } from '../../api-handlers/account/send-code';
20
-
21
- /**
22
- * Pre-configured POST handler for sending verification codes
23
- *
24
- * This endpoint triggers the IDP to send a verification code to the
25
- * user's selected contact method (email or SMS).
26
- *
27
- * Request body:
28
- * - method: 'email' | 'sms' - The contact method to use
29
- * - contactId: string - ID of the masked contact to send to
30
- *
31
- * Environment variables used:
32
- * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
33
- * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
34
- * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
35
- *
36
- * Returns:
37
- * - Success status
38
- * - Rate limit information
39
- * - Cooldown timer if applicable
1
+ /**
2
+ * Ready-to-Use Send Code Route
3
+ *
4
+ * Provides a pre-configured handler for sending 2FA verification codes
5
+ * to the user's registered contact methods. Can be imported directly
6
+ * into your app's API routes with zero configuration.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // app/api/account/send-code/route.ts
11
+ * export { POST } from '@payez/next-mvp/routes/account/send-code';
12
+ * ```
13
+ *
14
+ * @version 2.3.0
15
+ * @since auth-ready-v2
16
+ */
17
+
18
+ // Re-export the POST handler from api-handlers
19
+ export { POST } from '../../api-handlers/account/send-code';
20
+
21
+ /**
22
+ * Pre-configured POST handler for sending verification codes
23
+ *
24
+ * This endpoint triggers the IDP to send a verification code to the
25
+ * user's selected contact method (email or SMS).
26
+ *
27
+ * Request body:
28
+ * - method: 'email' | 'sms' - The contact method to use
29
+ * - contactId: string - ID of the masked contact to send to
30
+ *
31
+ * Environment variables used:
32
+ * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
33
+ * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
34
+ * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
35
+ *
36
+ * Returns:
37
+ * - Success status
38
+ * - Rate limit information
39
+ * - Cooldown timer if applicable
40
40
  */
@@ -1,41 +1,41 @@
1
- /**
2
- * Ready-to-Use Verify Email Route
3
- *
4
- * Provides a pre-configured handler for verifying email-based 2FA codes.
5
- * Can be imported directly into your app's API routes with zero configuration.
6
- *
7
- * @example
8
- * ```typescript
9
- * // app/api/account/verify-email/route.ts
10
- * export { POST } from '@payez/next-mvp/routes/account/verify-email';
11
- * ```
12
- *
13
- * @version 2.3.0
14
- * @since auth-ready-v2
15
- */
16
-
17
- // Re-export the POST handler from api-handlers
18
- export { POST } from '../../api-handlers/account/verify-email';
19
-
20
- /**
21
- * Pre-configured POST handler for verifying email 2FA codes
22
- *
23
- * This endpoint verifies the code sent to the user's email address
24
- * and upgrades the provisional session to a full session.
25
- *
26
- * Request body:
27
- * - code: string - The 6-digit verification code
28
- * - emailId: string - ID of the email address used
29
- *
30
- * Environment variables used:
31
- * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
32
- * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
33
- * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
34
- *
35
- * Returns:
36
- * - Upgraded access token with MFA claim
37
- * - New refresh token
38
- * - Session upgrade status
39
- * - AMR (Authentication Methods Reference) array
40
- * - ACR (Authentication Context Class) level
1
+ /**
2
+ * Ready-to-Use Verify Email Route
3
+ *
4
+ * Provides a pre-configured handler for verifying email-based 2FA codes.
5
+ * Can be imported directly into your app's API routes with zero configuration.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // app/api/account/verify-email/route.ts
10
+ * export { POST } from '@payez/next-mvp/routes/account/verify-email';
11
+ * ```
12
+ *
13
+ * @version 2.3.0
14
+ * @since auth-ready-v2
15
+ */
16
+
17
+ // Re-export the POST handler from api-handlers
18
+ export { POST } from '../../api-handlers/account/verify-email';
19
+
20
+ /**
21
+ * Pre-configured POST handler for verifying email 2FA codes
22
+ *
23
+ * This endpoint verifies the code sent to the user's email address
24
+ * and upgrades the provisional session to a full session.
25
+ *
26
+ * Request body:
27
+ * - code: string - The 6-digit verification code
28
+ * - emailId: string - ID of the email address used
29
+ *
30
+ * Environment variables used:
31
+ * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
32
+ * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
33
+ * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
34
+ *
35
+ * Returns:
36
+ * - Upgraded access token with MFA claim
37
+ * - New refresh token
38
+ * - Session upgrade status
39
+ * - AMR (Authentication Methods Reference) array
40
+ * - ACR (Authentication Context Class) level
41
41
  */
@@ -1,41 +1,41 @@
1
- /**
2
- * Ready-to-Use Verify SMS Route
3
- *
4
- * Provides a pre-configured handler for verifying SMS-based 2FA codes.
5
- * Can be imported directly into your app's API routes with zero configuration.
6
- *
7
- * @example
8
- * ```typescript
9
- * // app/api/account/verify-sms/route.ts
10
- * export { POST } from '@payez/next-mvp/routes/account/verify-sms';
11
- * ```
12
- *
13
- * @version 2.3.0
14
- * @since auth-ready-v2
15
- */
16
-
17
- // Re-export the POST handler from api-handlers
18
- export { POST } from '../../api-handlers/account/verify-sms';
19
-
20
- /**
21
- * Pre-configured POST handler for verifying SMS 2FA codes
22
- *
23
- * This endpoint verifies the code sent to the user's phone number
24
- * and upgrades the provisional session to a full session.
25
- *
26
- * Request body:
27
- * - code: string - The 6-digit verification code
28
- * - phoneId: string - ID of the phone number used
29
- *
30
- * Environment variables used:
31
- * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
32
- * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
33
- * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
34
- *
35
- * Returns:
36
- * - Upgraded access token with MFA claim
37
- * - New refresh token
38
- * - Session upgrade status
39
- * - AMR (Authentication Methods Reference) array
40
- * - ACR (Authentication Context Class) level
1
+ /**
2
+ * Ready-to-Use Verify SMS Route
3
+ *
4
+ * Provides a pre-configured handler for verifying SMS-based 2FA codes.
5
+ * Can be imported directly into your app's API routes with zero configuration.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // app/api/account/verify-sms/route.ts
10
+ * export { POST } from '@payez/next-mvp/routes/account/verify-sms';
11
+ * ```
12
+ *
13
+ * @version 2.3.0
14
+ * @since auth-ready-v2
15
+ */
16
+
17
+ // Re-export the POST handler from api-handlers
18
+ export { POST } from '../../api-handlers/account/verify-sms';
19
+
20
+ /**
21
+ * Pre-configured POST handler for verifying SMS 2FA codes
22
+ *
23
+ * This endpoint verifies the code sent to the user's phone number
24
+ * and upgrades the provisional session to a full session.
25
+ *
26
+ * Request body:
27
+ * - code: string - The 6-digit verification code
28
+ * - phoneId: string - ID of the phone number used
29
+ *
30
+ * Environment variables used:
31
+ * - IDP_URL or NEXT_PUBLIC_IDP_URL (default: http://localhost:32785)
32
+ * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
33
+ * - BETTER_AUTH_SECRET (required — fetched from IDP at startup)
34
+ *
35
+ * Returns:
36
+ * - Upgraded access token with MFA claim
37
+ * - New refresh token
38
+ * - Session upgrade status
39
+ * - AMR (Authentication Methods Reference) array
40
+ * - ACR (Authentication Context Class) level
41
41
  */
@@ -1,23 +1,23 @@
1
- /**
2
- * @payez/next-mvp Ready-to-Use Route Exports
3
- *
4
- * Pre-configured route handlers that can be imported directly
5
- * into your Next.js app with zero configuration.
6
- *
7
- * @version 2.0.0
8
- * @since auth-ready-v2
9
- */
10
-
11
- // Export individual route handlers
12
- export { POST as refreshPOST } from './refresh';
13
- export { GET as sessionGET, POST as sessionPOST } from './session';
14
- export { POST as logoutPOST } from './logout';
15
- export { GET as viabilityGET } from './viability';
16
- export { GET as nextAuthGET, POST as nextAuthPOST } from './nextauth';
17
-
18
- // Also export as namespaced objects for cleaner imports
19
- export * as refresh from './refresh';
20
- export * as session from './session';
21
- export * as logout from './logout';
22
- export * as viability from './viability';
1
+ /**
2
+ * @payez/next-mvp Ready-to-Use Route Exports
3
+ *
4
+ * Pre-configured route handlers that can be imported directly
5
+ * into your Next.js app with zero configuration.
6
+ *
7
+ * @version 2.0.0
8
+ * @since auth-ready-v2
9
+ */
10
+
11
+ // Export individual route handlers
12
+ export { POST as refreshPOST } from './refresh';
13
+ export { GET as sessionGET, POST as sessionPOST } from './session';
14
+ export { POST as logoutPOST } from './logout';
15
+ export { GET as viabilityGET } from './viability';
16
+ export { GET as nextAuthGET, POST as nextAuthPOST } from './nextauth';
17
+
18
+ // Also export as namespaced objects for cleaner imports
19
+ export * as refresh from './refresh';
20
+ export * as session from './session';
21
+ export * as logout from './logout';
22
+ export * as viability from './viability';
23
23
  export * as nextauth from './nextauth';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Ready-to-Use Passkey Sign-In Route (ANONYMOUS ceremony)
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * // app/api/passkey/sign-in/options/route.ts
7
+ * export { POST } from '@payez/next-mvp/routes/auth/passkey-signin';
8
+ * // (optionsPOST is exported as POST; mount verify at its own path:)
9
+ * // app/api/passkey/sign-in/verify/route.ts
10
+ * export { verifyPOST as POST } from '@payez/next-mvp/routes/auth/passkey-signin';
11
+ * ```
12
+ */
13
+ export { optionsPOST, verifyPOST } from '../../api-handlers/auth/passkey-signin';
@@ -1,49 +1,49 @@
1
- /**
2
- * Ready-to-Use Refresh Token Route
3
- *
4
- * Provides a pre-configured refresh handler that can be imported directly
5
- * into your app's API routes with zero configuration.
6
- *
7
- * @example
8
- * ```typescript
9
- * // app/api/auth/refresh/route.ts
10
- * export { POST } from '@payez/next-mvp/routes/auth/refresh';
11
- * ```
12
- *
13
- * @version 2.0.0
14
- * @since auth-ready-v2
15
- */
16
-
17
- import { createRefreshHandler } from '../../api-handlers/auth/refresh';
18
-
19
- // Configuration is read at runtime from environment.
20
- function getConfig() {
21
- const idpBaseUrl = process.env.IDP_URL;
22
- if (!idpBaseUrl) {
23
- throw new Error('[IDP_URL] FATAL: IDP_URL environment variable is REQUIRED.');
24
- }
25
- return {
26
- idpBaseUrl,
27
- clientId: process.env.CLIENT_ID || process.env.NEXT_PUBLIC_IDP_CLIENT_ID || '',
28
- refreshEndpoint: process.env.REFRESH_ENDPOINT || '/api/ExternalAuth/refresh',
29
- };
30
- }
31
-
32
- /**
33
- * Pre-configured POST handler for token refresh
34
- *
35
- * Environment variables used:
36
- * - IDP_URL (REQUIRED)
37
- * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
38
- * - REFRESH_ENDPOINT (default: /api/ExternalAuth/refresh)
39
- */
40
- let _handler: ReturnType<typeof createRefreshHandler> | null = null;
41
-
42
- import { NextRequest } from 'next/server';
43
-
44
- export async function POST(req: NextRequest) {
45
- if (!_handler) {
46
- _handler = createRefreshHandler(getConfig());
47
- }
48
- return _handler(req);
1
+ /**
2
+ * Ready-to-Use Refresh Token Route
3
+ *
4
+ * Provides a pre-configured refresh handler that can be imported directly
5
+ * into your app's API routes with zero configuration.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // app/api/auth/refresh/route.ts
10
+ * export { POST } from '@payez/next-mvp/routes/auth/refresh';
11
+ * ```
12
+ *
13
+ * @version 2.0.0
14
+ * @since auth-ready-v2
15
+ */
16
+
17
+ import { createRefreshHandler } from '../../api-handlers/auth/refresh';
18
+
19
+ // Configuration is read at runtime from environment.
20
+ function getConfig() {
21
+ const idpBaseUrl = process.env.IDP_URL;
22
+ if (!idpBaseUrl) {
23
+ throw new Error('[IDP_URL] FATAL: IDP_URL environment variable is REQUIRED.');
24
+ }
25
+ return {
26
+ idpBaseUrl,
27
+ clientId: process.env.CLIENT_ID || process.env.NEXT_PUBLIC_IDP_CLIENT_ID || '',
28
+ refreshEndpoint: process.env.REFRESH_ENDPOINT || '/api/ExternalAuth/refresh',
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Pre-configured POST handler for token refresh
34
+ *
35
+ * Environment variables used:
36
+ * - IDP_URL (REQUIRED)
37
+ * - CLIENT_ID or NEXT_PUBLIC_IDP_CLIENT_ID (required)
38
+ * - REFRESH_ENDPOINT (default: /api/ExternalAuth/refresh)
39
+ */
40
+ let _handler: ReturnType<typeof createRefreshHandler> | null = null;
41
+
42
+ import { NextRequest } from 'next/server';
43
+
44
+ export async function POST(req: NextRequest) {
45
+ if (!_handler) {
46
+ _handler = createRefreshHandler(getConfig());
47
+ }
48
+ return _handler(req);
49
49
  }