@delmaredigital/payload-better-auth 0.3.8 → 0.3.10

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 (206) hide show
  1. package/dist/adapter/collections.d.ts +0 -1
  2. package/dist/adapter/collections.js +0 -2
  3. package/dist/adapter/index.d.ts +0 -1
  4. package/dist/adapter/index.js +0 -2
  5. package/dist/components/BeforeLogin.d.ts +0 -1
  6. package/dist/components/BeforeLogin.js +0 -2
  7. package/dist/components/LoginView.d.ts +0 -1
  8. package/dist/components/LoginView.js +0 -2
  9. package/dist/components/LoginViewWrapper.d.ts +0 -1
  10. package/dist/components/LoginViewWrapper.js +0 -2
  11. package/dist/components/LogoutButton.d.ts +0 -1
  12. package/dist/components/LogoutButton.js +0 -2
  13. package/dist/components/PasskeyRegisterButton.d.ts +0 -1
  14. package/dist/components/PasskeyRegisterButton.js +0 -2
  15. package/dist/components/PasskeySignInButton.d.ts +0 -1
  16. package/dist/components/PasskeySignInButton.js +0 -2
  17. package/dist/components/auth/ForgotPasswordView.d.ts +0 -1
  18. package/dist/components/auth/ForgotPasswordView.js +0 -2
  19. package/dist/components/auth/ResetPasswordView.d.ts +0 -1
  20. package/dist/components/auth/ResetPasswordView.js +0 -2
  21. package/dist/components/auth/index.d.ts +0 -1
  22. package/dist/components/auth/index.js +0 -2
  23. package/dist/components/management/ApiKeysManagementClient.d.ts +0 -1
  24. package/dist/components/management/ApiKeysManagementClient.js +0 -2
  25. package/dist/components/management/PasskeysManagementClient.d.ts +0 -1
  26. package/dist/components/management/PasskeysManagementClient.js +0 -2
  27. package/dist/components/management/SecurityNavLinks.d.ts +0 -1
  28. package/dist/components/management/SecurityNavLinks.js +0 -2
  29. package/dist/components/management/TwoFactorManagementClient.d.ts +0 -1
  30. package/dist/components/management/TwoFactorManagementClient.js +0 -2
  31. package/dist/components/management/index.d.ts +0 -1
  32. package/dist/components/management/index.js +0 -2
  33. package/dist/components/management/views/ApiKeysView.d.ts +0 -1
  34. package/dist/components/management/views/ApiKeysView.js +0 -2
  35. package/dist/components/management/views/PasskeysView.d.ts +0 -1
  36. package/dist/components/management/views/PasskeysView.js +0 -2
  37. package/dist/components/management/views/TwoFactorView.d.ts +0 -1
  38. package/dist/components/management/views/TwoFactorView.js +0 -2
  39. package/dist/components/management/views/index.d.ts +0 -1
  40. package/dist/components/management/views/index.js +0 -2
  41. package/dist/components/twoFactor/TwoFactorSetupView.d.ts +0 -1
  42. package/dist/components/twoFactor/TwoFactorSetupView.js +0 -2
  43. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts +0 -1
  44. package/dist/components/twoFactor/TwoFactorVerifyView.js +0 -2
  45. package/dist/components/twoFactor/index.d.ts +0 -1
  46. package/dist/components/twoFactor/index.js +0 -2
  47. package/dist/exports/client.d.ts +0 -1
  48. package/dist/exports/client.js +0 -2
  49. package/dist/exports/components.d.ts +0 -1
  50. package/dist/exports/components.js +0 -2
  51. package/dist/exports/management.d.ts +0 -1
  52. package/dist/exports/management.js +0 -2
  53. package/dist/exports/rsc.d.ts +0 -1
  54. package/dist/exports/rsc.js +0 -2
  55. package/dist/generated-types.d.ts +0 -1
  56. package/dist/generated-types.js +0 -2
  57. package/dist/index.d.ts +0 -1
  58. package/dist/index.js +0 -2
  59. package/dist/plugin/index.d.ts +0 -1
  60. package/dist/plugin/index.js +0 -2
  61. package/dist/scripts/generate-types.d.ts +0 -1
  62. package/dist/scripts/generate-types.js +0 -2
  63. package/dist/types/apiKey.d.ts +0 -1
  64. package/dist/types/apiKey.js +0 -2
  65. package/dist/types/betterAuth.d.ts +0 -1
  66. package/dist/types/betterAuth.js +0 -2
  67. package/dist/utils/access.d.ts +0 -1
  68. package/dist/utils/access.js +0 -2
  69. package/dist/utils/apiKeyAccess.d.ts +0 -1
  70. package/dist/utils/apiKeyAccess.js +0 -2
  71. package/dist/utils/betterAuthDefaults.d.ts +0 -1
  72. package/dist/utils/betterAuthDefaults.js +0 -2
  73. package/dist/utils/detectAuthConfig.d.ts +0 -1
  74. package/dist/utils/detectAuthConfig.js +0 -2
  75. package/dist/utils/detectEnabledPlugins.d.ts +0 -1
  76. package/dist/utils/detectEnabledPlugins.js +0 -2
  77. package/dist/utils/firstUserAdmin.d.ts +0 -1
  78. package/dist/utils/firstUserAdmin.js +0 -2
  79. package/dist/utils/generateScopes.d.ts +0 -1
  80. package/dist/utils/generateScopes.js +0 -2
  81. package/dist/utils/session.d.ts +0 -1
  82. package/dist/utils/session.js +0 -2
  83. package/package.json +34 -91
  84. package/dist/adapter/collections.d.ts.map +0 -1
  85. package/dist/adapter/collections.js.map +0 -1
  86. package/dist/adapter/index.d.ts.map +0 -1
  87. package/dist/adapter/index.js.map +0 -1
  88. package/dist/components/BeforeLogin.d.ts.map +0 -1
  89. package/dist/components/BeforeLogin.js.map +0 -1
  90. package/dist/components/LoginView.d.ts.map +0 -1
  91. package/dist/components/LoginView.js.map +0 -1
  92. package/dist/components/LoginViewWrapper.d.ts.map +0 -1
  93. package/dist/components/LoginViewWrapper.js.map +0 -1
  94. package/dist/components/LogoutButton.d.ts.map +0 -1
  95. package/dist/components/LogoutButton.js.map +0 -1
  96. package/dist/components/PasskeyRegisterButton.d.ts.map +0 -1
  97. package/dist/components/PasskeyRegisterButton.js.map +0 -1
  98. package/dist/components/PasskeySignInButton.d.ts.map +0 -1
  99. package/dist/components/PasskeySignInButton.js.map +0 -1
  100. package/dist/components/auth/ForgotPasswordView.d.ts.map +0 -1
  101. package/dist/components/auth/ForgotPasswordView.js.map +0 -1
  102. package/dist/components/auth/ResetPasswordView.d.ts.map +0 -1
  103. package/dist/components/auth/ResetPasswordView.js.map +0 -1
  104. package/dist/components/auth/index.d.ts.map +0 -1
  105. package/dist/components/auth/index.js.map +0 -1
  106. package/dist/components/management/ApiKeysManagementClient.d.ts.map +0 -1
  107. package/dist/components/management/ApiKeysManagementClient.js.map +0 -1
  108. package/dist/components/management/PasskeysManagementClient.d.ts.map +0 -1
  109. package/dist/components/management/PasskeysManagementClient.js.map +0 -1
  110. package/dist/components/management/SecurityNavLinks.d.ts.map +0 -1
  111. package/dist/components/management/SecurityNavLinks.js.map +0 -1
  112. package/dist/components/management/TwoFactorManagementClient.d.ts.map +0 -1
  113. package/dist/components/management/TwoFactorManagementClient.js.map +0 -1
  114. package/dist/components/management/index.d.ts.map +0 -1
  115. package/dist/components/management/index.js.map +0 -1
  116. package/dist/components/management/views/ApiKeysView.d.ts.map +0 -1
  117. package/dist/components/management/views/ApiKeysView.js.map +0 -1
  118. package/dist/components/management/views/PasskeysView.d.ts.map +0 -1
  119. package/dist/components/management/views/PasskeysView.js.map +0 -1
  120. package/dist/components/management/views/TwoFactorView.d.ts.map +0 -1
  121. package/dist/components/management/views/TwoFactorView.js.map +0 -1
  122. package/dist/components/management/views/index.d.ts.map +0 -1
  123. package/dist/components/management/views/index.js.map +0 -1
  124. package/dist/components/twoFactor/TwoFactorSetupView.d.ts.map +0 -1
  125. package/dist/components/twoFactor/TwoFactorSetupView.js.map +0 -1
  126. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts.map +0 -1
  127. package/dist/components/twoFactor/TwoFactorVerifyView.js.map +0 -1
  128. package/dist/components/twoFactor/index.d.ts.map +0 -1
  129. package/dist/components/twoFactor/index.js.map +0 -1
  130. package/dist/exports/client.d.ts.map +0 -1
  131. package/dist/exports/client.js.map +0 -1
  132. package/dist/exports/components.d.ts.map +0 -1
  133. package/dist/exports/components.js.map +0 -1
  134. package/dist/exports/management.d.ts.map +0 -1
  135. package/dist/exports/management.js.map +0 -1
  136. package/dist/exports/rsc.d.ts.map +0 -1
  137. package/dist/exports/rsc.js.map +0 -1
  138. package/dist/generated-types.d.ts.map +0 -1
  139. package/dist/generated-types.js.map +0 -1
  140. package/dist/index.d.ts.map +0 -1
  141. package/dist/index.js.map +0 -1
  142. package/dist/plugin/index.d.ts.map +0 -1
  143. package/dist/plugin/index.js.map +0 -1
  144. package/dist/scripts/generate-types.d.ts.map +0 -1
  145. package/dist/scripts/generate-types.js.map +0 -1
  146. package/dist/types/apiKey.d.ts.map +0 -1
  147. package/dist/types/apiKey.js.map +0 -1
  148. package/dist/types/betterAuth.d.ts.map +0 -1
  149. package/dist/types/betterAuth.js.map +0 -1
  150. package/dist/utils/access.d.ts.map +0 -1
  151. package/dist/utils/access.js.map +0 -1
  152. package/dist/utils/apiKeyAccess.d.ts.map +0 -1
  153. package/dist/utils/apiKeyAccess.js.map +0 -1
  154. package/dist/utils/betterAuthDefaults.d.ts.map +0 -1
  155. package/dist/utils/betterAuthDefaults.js.map +0 -1
  156. package/dist/utils/detectAuthConfig.d.ts.map +0 -1
  157. package/dist/utils/detectAuthConfig.js.map +0 -1
  158. package/dist/utils/detectEnabledPlugins.d.ts.map +0 -1
  159. package/dist/utils/detectEnabledPlugins.js.map +0 -1
  160. package/dist/utils/firstUserAdmin.d.ts.map +0 -1
  161. package/dist/utils/firstUserAdmin.js.map +0 -1
  162. package/dist/utils/generateScopes.d.ts.map +0 -1
  163. package/dist/utils/generateScopes.js.map +0 -1
  164. package/dist/utils/session.d.ts.map +0 -1
  165. package/dist/utils/session.js.map +0 -1
  166. package/src/adapter/collections.ts +0 -621
  167. package/src/adapter/index.ts +0 -712
  168. package/src/components/BeforeLogin.tsx +0 -39
  169. package/src/components/LoginView.tsx +0 -1516
  170. package/src/components/LoginViewWrapper.tsx +0 -35
  171. package/src/components/LogoutButton.tsx +0 -58
  172. package/src/components/PasskeyRegisterButton.tsx +0 -105
  173. package/src/components/PasskeySignInButton.tsx +0 -96
  174. package/src/components/auth/ForgotPasswordView.tsx +0 -274
  175. package/src/components/auth/ResetPasswordView.tsx +0 -331
  176. package/src/components/auth/index.ts +0 -8
  177. package/src/components/management/ApiKeysManagementClient.tsx +0 -988
  178. package/src/components/management/PasskeysManagementClient.tsx +0 -409
  179. package/src/components/management/SecurityNavLinks.tsx +0 -117
  180. package/src/components/management/TwoFactorManagementClient.tsx +0 -560
  181. package/src/components/management/index.ts +0 -20
  182. package/src/components/management/views/ApiKeysView.tsx +0 -57
  183. package/src/components/management/views/PasskeysView.tsx +0 -42
  184. package/src/components/management/views/TwoFactorView.tsx +0 -42
  185. package/src/components/management/views/index.ts +0 -10
  186. package/src/components/twoFactor/TwoFactorSetupView.tsx +0 -515
  187. package/src/components/twoFactor/TwoFactorVerifyView.tsx +0 -238
  188. package/src/components/twoFactor/index.ts +0 -8
  189. package/src/exports/client.ts +0 -77
  190. package/src/exports/components.ts +0 -30
  191. package/src/exports/management.ts +0 -25
  192. package/src/exports/rsc.ts +0 -11
  193. package/src/generated-types.ts +0 -269
  194. package/src/index.ts +0 -135
  195. package/src/plugin/index.ts +0 -834
  196. package/src/scripts/generate-types.ts +0 -269
  197. package/src/types/apiKey.ts +0 -63
  198. package/src/types/betterAuth.ts +0 -253
  199. package/src/utils/access.ts +0 -410
  200. package/src/utils/apiKeyAccess.ts +0 -443
  201. package/src/utils/betterAuthDefaults.ts +0 -102
  202. package/src/utils/detectAuthConfig.ts +0 -47
  203. package/src/utils/detectEnabledPlugins.ts +0 -69
  204. package/src/utils/firstUserAdmin.ts +0 -164
  205. package/src/utils/generateScopes.ts +0 -150
  206. package/src/utils/session.ts +0 -91
@@ -1,238 +0,0 @@
1
- 'use client'
2
-
3
- import { useState, type FormEvent } from 'react'
4
- import { useRouter } from 'next/navigation.js'
5
-
6
- export type TwoFactorVerifyViewProps = {
7
- /** Custom logo element */
8
- logo?: React.ReactNode
9
- /** Page title. Default: 'Two-Factor Authentication' */
10
- title?: string
11
- /** Path to redirect after successful verification. Default: '/admin' */
12
- afterVerifyPath?: string
13
- /** Callback after successful verification */
14
- onVerifyComplete?: () => void
15
- }
16
-
17
- /**
18
- * Two-factor authentication verification component.
19
- * Used during login flow when 2FA is enabled on the account.
20
- * Uses Better Auth's twoFactor plugin endpoints.
21
- */
22
- export function TwoFactorVerifyView({
23
- logo,
24
- title = 'Two-Factor Authentication',
25
- afterVerifyPath = '/admin',
26
- onVerifyComplete,
27
- }: TwoFactorVerifyViewProps) {
28
- const router = useRouter()
29
- const [code, setCode] = useState('')
30
- const [error, setError] = useState<string | null>(null)
31
- const [loading, setLoading] = useState(false)
32
- const [useBackupCode, setUseBackupCode] = useState(false)
33
-
34
- async function handleSubmit(e: FormEvent) {
35
- e.preventDefault()
36
- setLoading(true)
37
- setError(null)
38
-
39
- try {
40
- const endpoint = useBackupCode
41
- ? '/api/auth/two-factor/verify-backup-code'
42
- : '/api/auth/two-factor/verify-totp'
43
-
44
- const response = await fetch(endpoint, {
45
- method: 'POST',
46
- headers: { 'Content-Type': 'application/json' },
47
- credentials: 'include',
48
- body: JSON.stringify({ code }),
49
- })
50
-
51
- if (response.ok) {
52
- onVerifyComplete?.()
53
- router.push(afterVerifyPath)
54
- router.refresh()
55
- } else {
56
- const data = await response.json().catch(() => ({}))
57
- setError(data.message || 'Invalid code. Please try again.')
58
- }
59
- } catch {
60
- setError('An error occurred. Please try again.')
61
- } finally {
62
- setLoading(false)
63
- }
64
- }
65
-
66
- return (
67
- <div
68
- style={{
69
- minHeight: '100vh',
70
- display: 'flex',
71
- alignItems: 'center',
72
- justifyContent: 'center',
73
- background: 'var(--theme-bg)',
74
- padding: 'var(--base)',
75
- }}
76
- >
77
- <div
78
- style={{
79
- background: 'var(--theme-elevation-50)',
80
- padding: 'calc(var(--base) * 2)',
81
- borderRadius: 'var(--style-radius-m)',
82
- boxShadow: '0 2px 20px rgba(0, 0, 0, 0.1)',
83
- width: '100%',
84
- maxWidth: '400px',
85
- }}
86
- >
87
- {logo && (
88
- <div
89
- style={{
90
- textAlign: 'center',
91
- marginBottom: 'calc(var(--base) * 1.5)',
92
- }}
93
- >
94
- {logo}
95
- </div>
96
- )}
97
-
98
- <h1
99
- style={{
100
- color: 'var(--theme-text)',
101
- fontSize: 'var(--font-size-h3)',
102
- fontWeight: 600,
103
- margin: '0 0 calc(var(--base) * 0.5) 0',
104
- textAlign: 'center',
105
- }}
106
- >
107
- {title}
108
- </h1>
109
-
110
- <p
111
- style={{
112
- color: 'var(--theme-text)',
113
- opacity: 0.7,
114
- fontSize: 'var(--font-size-small)',
115
- textAlign: 'center',
116
- marginBottom: 'calc(var(--base) * 1.5)',
117
- }}
118
- >
119
- {useBackupCode
120
- ? 'Enter one of your backup codes.'
121
- : 'Enter the code from your authenticator app.'}
122
- </p>
123
-
124
- <form onSubmit={handleSubmit}>
125
- <div style={{ marginBottom: 'calc(var(--base) * 1.5)' }}>
126
- <label
127
- htmlFor="code"
128
- style={{
129
- display: 'block',
130
- color: 'var(--theme-text)',
131
- marginBottom: 'calc(var(--base) * 0.5)',
132
- fontSize: 'var(--font-size-small)',
133
- fontWeight: 500,
134
- }}
135
- >
136
- {useBackupCode ? 'Backup Code' : 'Verification Code'}
137
- </label>
138
- <input
139
- id="code"
140
- type="text"
141
- inputMode={useBackupCode ? 'text' : 'numeric'}
142
- pattern={useBackupCode ? undefined : '[0-9]*'}
143
- autoComplete="one-time-code"
144
- value={code}
145
- onChange={(e) => {
146
- if (useBackupCode) {
147
- setCode(e.target.value)
148
- } else {
149
- setCode(e.target.value.replace(/\D/g, '').slice(0, 6))
150
- }
151
- }}
152
- required
153
- placeholder={useBackupCode ? 'xxxxxxxx' : '000000'}
154
- style={{
155
- width: '100%',
156
- padding: 'calc(var(--base) * 0.75)',
157
- background: 'var(--theme-input-bg)',
158
- border: '1px solid var(--theme-elevation-150)',
159
- borderRadius: 'var(--style-radius-s)',
160
- color: 'var(--theme-text)',
161
- fontSize: 'var(--font-size-h4)',
162
- fontFamily: 'monospace',
163
- textAlign: 'center',
164
- letterSpacing: useBackupCode ? '0.2em' : '0.5em',
165
- outline: 'none',
166
- boxSizing: 'border-box',
167
- }}
168
- />
169
- </div>
170
-
171
- {error && (
172
- <div
173
- style={{
174
- color: 'var(--theme-error-500)',
175
- marginBottom: 'var(--base)',
176
- fontSize: 'var(--font-size-small)',
177
- padding: 'calc(var(--base) * 0.5)',
178
- background: 'var(--theme-error-50)',
179
- borderRadius: 'var(--style-radius-s)',
180
- border: '1px solid var(--theme-error-200)',
181
- }}
182
- >
183
- {error}
184
- </div>
185
- )}
186
-
187
- <button
188
- type="submit"
189
- disabled={loading || (!useBackupCode && code.length !== 6)}
190
- style={{
191
- width: '100%',
192
- padding: 'calc(var(--base) * 0.75)',
193
- background: 'var(--theme-elevation-800)',
194
- border: 'none',
195
- borderRadius: 'var(--style-radius-s)',
196
- color: 'var(--theme-elevation-50)',
197
- fontSize: 'var(--font-size-base)',
198
- fontWeight: 500,
199
- cursor: loading || (!useBackupCode && code.length !== 6) ? 'not-allowed' : 'pointer',
200
- opacity: loading || (!useBackupCode && code.length !== 6) ? 0.7 : 1,
201
- transition: 'opacity 150ms ease',
202
- marginBottom: 'var(--base)',
203
- }}
204
- >
205
- {loading ? 'Verifying...' : 'Verify'}
206
- </button>
207
-
208
- <div style={{ textAlign: 'center' }}>
209
- <button
210
- type="button"
211
- onClick={() => {
212
- setUseBackupCode(!useBackupCode)
213
- setCode('')
214
- setError(null)
215
- }}
216
- style={{
217
- background: 'none',
218
- border: 'none',
219
- color: 'var(--theme-text)',
220
- opacity: 0.7,
221
- fontSize: 'var(--font-size-small)',
222
- textDecoration: 'underline',
223
- cursor: 'pointer',
224
- padding: 0,
225
- }}
226
- >
227
- {useBackupCode
228
- ? 'Use authenticator app instead'
229
- : 'Use a backup code instead'}
230
- </button>
231
- </div>
232
- </form>
233
- </div>
234
- </div>
235
- )
236
- }
237
-
238
- export default TwoFactorVerifyView
@@ -1,8 +0,0 @@
1
- /**
2
- * Two-factor authentication UI components
3
- *
4
- * @packageDocumentation
5
- */
6
-
7
- export { TwoFactorSetupView, type TwoFactorSetupViewProps } from './TwoFactorSetupView.js'
8
- export { TwoFactorVerifyView, type TwoFactorVerifyViewProps } from './TwoFactorVerifyView.js'
@@ -1,77 +0,0 @@
1
- /**
2
- * Client-side auth utilities
3
- * Re-exports createAuthClient from better-auth/react and common plugins
4
- */
5
-
6
- import { createAuthClient } from 'better-auth/react'
7
- import { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins'
8
- import { passkeyClient } from '@better-auth/passkey/client'
9
-
10
- // Re-export createAuthClient and common plugins
11
- export { createAuthClient } from 'better-auth/react'
12
- export { twoFactorClient, apiKeyClient } from 'better-auth/client/plugins'
13
- export { passkeyClient } from '@better-auth/passkey/client'
14
-
15
- /**
16
- * Default plugins included with Payload Better Auth.
17
- * Use this with createAuthClient when you need custom plugins with full type safety.
18
- *
19
- * @example With custom plugins (full type safety)
20
- * ```typescript
21
- * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
22
- * import { stripeClient } from '@better-auth/stripe/client'
23
- *
24
- * export const authClient = createAuthClient({
25
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
26
- * })
27
- *
28
- * // authClient.subscription is fully typed!
29
- * ```
30
- */
31
- export const payloadAuthPlugins = [
32
- twoFactorClient(),
33
- apiKeyClient(),
34
- passkeyClient(),
35
- ] as const
36
-
37
- export interface PayloadAuthClientOptions {
38
- /** Base URL for auth endpoints (defaults to window.location.origin) */
39
- baseURL?: string
40
- }
41
-
42
- /**
43
- * Create a pre-configured auth client with default plugins (twoFactor, apiKey, passkey).
44
- *
45
- * This is a convenience wrapper for simple setups. For custom plugins with full type
46
- * safety, use `createAuthClient` with `payloadAuthPlugins` instead.
47
- *
48
- * @param options - Optional configuration
49
- * @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
50
- *
51
- * @example Basic usage (no custom plugins)
52
- * ```typescript
53
- * import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
54
- *
55
- * export const authClient = createPayloadAuthClient()
56
- * ```
57
- *
58
- * @example With custom plugins (use createAuthClient for full type safety)
59
- * ```typescript
60
- * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
61
- * import { stripeClient } from '@better-auth/stripe/client'
62
- *
63
- * export const authClient = createAuthClient({
64
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
65
- * })
66
- * ```
67
- */
68
- export function createPayloadAuthClient(options?: PayloadAuthClientOptions) {
69
- return createAuthClient({
70
- baseURL:
71
- options?.baseURL ??
72
- (typeof window !== 'undefined' ? window.location.origin : ''),
73
- plugins: [...payloadAuthPlugins],
74
- })
75
- }
76
-
77
- export type PayloadAuthClient = ReturnType<typeof createPayloadAuthClient>
@@ -1,30 +0,0 @@
1
- /**
2
- * Admin Components for Better Auth
3
- *
4
- * These components are auto-injected when disableLocalStrategy is detected.
5
- * They can also be used standalone or customized.
6
- */
7
-
8
- export { LogoutButton } from '../components/LogoutButton.js'
9
- export type { BeforeLoginProps } from '../components/BeforeLogin.js'
10
- export { BeforeLogin } from '../components/BeforeLogin.js'
11
- export type { LoginViewProps } from '../components/LoginView.js'
12
- export { LoginView } from '../components/LoginView.js'
13
-
14
- // Password reset components
15
- export type { ForgotPasswordViewProps } from '../components/auth/ForgotPasswordView.js'
16
- export { ForgotPasswordView } from '../components/auth/ForgotPasswordView.js'
17
- export type { ResetPasswordViewProps } from '../components/auth/ResetPasswordView.js'
18
- export { ResetPasswordView } from '../components/auth/ResetPasswordView.js'
19
-
20
- // Two-factor authentication components
21
- export type { TwoFactorSetupViewProps } from '../components/twoFactor/TwoFactorSetupView.js'
22
- export { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.js'
23
- export type { TwoFactorVerifyViewProps } from '../components/twoFactor/TwoFactorVerifyView.js'
24
- export { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js'
25
-
26
- // Passkey authentication
27
- export type { PasskeySignInButtonProps } from '../components/PasskeySignInButton.js'
28
- export { PasskeySignInButton } from '../components/PasskeySignInButton.js'
29
- export type { PasskeyRegisterButtonProps } from '../components/PasskeyRegisterButton.js'
30
- export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js'
@@ -1,25 +0,0 @@
1
- /**
2
- * Management UI Components Export
3
- *
4
- * Client components for managing security features in the Payload admin panel.
5
- * For server component views, use the './rsc' export.
6
- */
7
-
8
- // Client components
9
- export {
10
- SecurityNavLinks,
11
- TwoFactorManagementClient,
12
- ApiKeysManagementClient,
13
- PasskeysManagementClient,
14
- } from '../components/management/index.js'
15
-
16
- export type {
17
- SecurityNavLinksProps,
18
- TwoFactorManagementClientProps,
19
- ApiKeysManagementClientProps,
20
- PasskeysManagementClientProps,
21
- } from '../components/management/index.js'
22
-
23
- // Re-export plugin detection utility
24
- export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js'
25
- export type { EnabledPluginsResult } from '../utils/detectEnabledPlugins.js'
@@ -1,11 +0,0 @@
1
- /**
2
- * React Server Component Views for Better Auth
3
- *
4
- * These async server components use DefaultTemplate for proper
5
- * integration with Payload's admin panel layout.
6
- */
7
-
8
- export { LoginViewWrapper } from '../components/LoginViewWrapper.js'
9
- export { TwoFactorView } from '../components/management/views/TwoFactorView.js'
10
- export { ApiKeysView } from '../components/management/views/ApiKeysView.js'
11
- export { PasskeysView } from '../components/management/views/PasskeysView.js'
@@ -1,269 +0,0 @@
1
- /**
2
- * Auto-generated Better Auth types.
3
- * DO NOT EDIT - Run `pnpm generate:types` to regenerate.
4
- *
5
- * Generated from Better Auth schema introspection.
6
- * Contains types for all supported plugins and their field additions.
7
- */
8
-
9
- export type BaseUserFields = {
10
- name: string
11
- email: string
12
- emailVerified: boolean
13
- image?: string
14
- createdAt: Date
15
- updatedAt: Date
16
- role?: string
17
- }
18
-
19
- export type UserPluginFields = {
20
- "username": {
21
- username?: string
22
- displayUsername?: string
23
- }
24
- "admin": {
25
- banned?: boolean
26
- banReason?: string
27
- banExpires?: Date
28
- }
29
- "phone-number": {
30
- phoneNumber?: string
31
- phoneNumberVerified?: boolean
32
- }
33
- "anonymous": {
34
- isAnonymous?: boolean
35
- }
36
- "two-factor": {
37
- twoFactorEnabled?: boolean
38
- }
39
- }
40
-
41
- export type User = BaseUserFields & UserPluginFields["username"] & UserPluginFields["admin"] & UserPluginFields["phone-number"] & UserPluginFields["anonymous"] & UserPluginFields["two-factor"]
42
-
43
- export type BaseSessionFields = {
44
- expiresAt: Date
45
- token: string
46
- createdAt: Date
47
- updatedAt: Date
48
- ipAddress?: string
49
- userAgent?: string
50
- userId: string
51
- }
52
-
53
- export type SessionPluginFields = {
54
- "admin": {
55
- impersonatedBy?: string
56
- }
57
- "organization": {
58
- activeOrganizationId?: string
59
- activeTeamId?: string
60
- }
61
- }
62
-
63
- export type Session = BaseSessionFields & SessionPluginFields["admin"] & SessionPluginFields["organization"]
64
-
65
- export type BaseAccountFields = {
66
- accountId: string
67
- providerId: string
68
- userId: string
69
- accessToken?: string
70
- refreshToken?: string
71
- idToken?: string
72
- accessTokenExpiresAt?: Date
73
- refreshTokenExpiresAt?: Date
74
- scope?: string
75
- password?: string
76
- createdAt: Date
77
- updatedAt: Date
78
- }
79
-
80
- export type Account = BaseAccountFields
81
-
82
- export type BaseVerificationFields = {
83
- identifier: string
84
- value: string
85
- expiresAt: Date
86
- createdAt: Date
87
- updatedAt: Date
88
- }
89
-
90
- export type Verification = BaseVerificationFields
91
-
92
- export type ApikeyFields = {
93
- name?: string
94
- start?: string
95
- prefix?: string
96
- key: string
97
- userId: string
98
- refillInterval?: number
99
- refillAmount?: number
100
- lastRefillAt?: Date
101
- enabled?: boolean
102
- rateLimitEnabled?: boolean
103
- rateLimitTimeWindow?: number
104
- rateLimitMax?: number
105
- requestCount?: number
106
- remaining?: number
107
- lastRequest?: Date
108
- expiresAt?: Date
109
- createdAt: Date
110
- updatedAt: Date
111
- permissions?: string
112
- metadata?: string
113
- }
114
-
115
- export type Apikey = ApikeyFields
116
-
117
- export type PasskeyFields = {
118
- name?: string
119
- publicKey: string
120
- userId: string
121
- credentialID: string
122
- counter: number
123
- deviceType: string
124
- backedUp: boolean
125
- transports?: string
126
- createdAt?: Date
127
- aaguid?: string
128
- }
129
-
130
- export type Passkey = PasskeyFields
131
-
132
- export type OauthApplicationFields = {
133
- name?: string
134
- icon?: string
135
- metadata?: string
136
- clientId?: string
137
- clientSecret?: string
138
- redirectUrls?: string
139
- type?: string
140
- disabled?: boolean
141
- userId?: string
142
- createdAt?: Date
143
- updatedAt?: Date
144
- }
145
-
146
- export type OauthApplication = OauthApplicationFields
147
-
148
- export type OauthAccessTokenFields = {
149
- accessToken?: string
150
- refreshToken?: string
151
- accessTokenExpiresAt?: Date
152
- refreshTokenExpiresAt?: Date
153
- clientId?: string
154
- userId?: string
155
- scopes?: string
156
- createdAt?: Date
157
- updatedAt?: Date
158
- }
159
-
160
- export type OauthAccessToken = OauthAccessTokenFields
161
-
162
- export type OauthConsentFields = {
163
- clientId?: string
164
- userId?: string
165
- scopes?: string
166
- createdAt?: Date
167
- updatedAt?: Date
168
- consentGiven?: boolean
169
- }
170
-
171
- export type OauthConsent = OauthConsentFields
172
-
173
- export type OrganizationFields = {
174
- name: string
175
- slug: string
176
- logo?: string
177
- createdAt: Date
178
- metadata?: string
179
- }
180
-
181
- export type Organization = OrganizationFields
182
-
183
- export type TeamFields = {
184
- name: string
185
- organizationId: string
186
- createdAt: Date
187
- updatedAt?: Date
188
- }
189
-
190
- export type Team = TeamFields
191
-
192
- export type TeamMemberFields = {
193
- teamId: string
194
- userId: string
195
- createdAt?: Date
196
- }
197
-
198
- export type TeamMember = TeamMemberFields
199
-
200
- export type MemberFields = {
201
- organizationId: string
202
- userId: string
203
- role: string
204
- createdAt: Date
205
- }
206
-
207
- export type Member = MemberFields
208
-
209
- export type InvitationFields = {
210
- organizationId: string
211
- email: string
212
- role?: string
213
- teamId?: string
214
- status: string
215
- expiresAt: Date
216
- createdAt: Date
217
- inviterId: string
218
- }
219
-
220
- export type Invitation = InvitationFields
221
-
222
- export type JwksFields = {
223
- publicKey: string
224
- privateKey: string
225
- createdAt: Date
226
- expiresAt?: Date
227
- }
228
-
229
- export type Jwks = JwksFields
230
-
231
- export type TwoFactorFields = {
232
- secret: string
233
- backupCodes: string
234
- userId: string
235
- }
236
-
237
- export type TwoFactor = TwoFactorFields
238
-
239
- /**
240
- * Union of all supported plugin identifiers.
241
- */
242
- export type PluginId = "username" | "admin" | "api-key" | "passkey" | "bearer" | "email-otp" | "magic-link" | "phone-number" | "one-tap" | "anonymous" | "multi-session" | "one-time-token" | "oidc" | "generic-oauth" | "open-api" | "organization" | "jwt" | "two-factor"
243
-
244
- /**
245
- * Complete schema mapping of all models to their types.
246
- */
247
- export type BetterAuthFullSchema = {
248
- "user": User
249
- "session": Session
250
- "account": Account
251
- "verification": Verification
252
- "apikey": Apikey
253
- "passkey": Passkey
254
- "oauthApplication": OauthApplication
255
- "oauthAccessToken": OauthAccessToken
256
- "oauthConsent": OauthConsent
257
- "organization": Organization
258
- "team": Team
259
- "teamMember": TeamMember
260
- "member": Member
261
- "invitation": Invitation
262
- "jwks": Jwks
263
- "twoFactor": TwoFactor
264
- }
265
-
266
- /**
267
- * Union of all model names in the schema.
268
- */
269
- export type ModelKey = keyof BetterAuthFullSchema