@motherbase/client 1.5.1 → 2.0.2

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 (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +399 -379
  3. package/dist/auth.d.ts +147 -424
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js +287 -827
  6. package/dist/auth.js.map +1 -1
  7. package/dist/cookie.d.ts.map +1 -1
  8. package/dist/cookie.js +11 -1
  9. package/dist/cookie.js.map +1 -1
  10. package/dist/database.d.ts +2 -0
  11. package/dist/database.d.ts.map +1 -1
  12. package/dist/devices.d.ts +13 -0
  13. package/dist/devices.d.ts.map +1 -0
  14. package/dist/devices.js +13 -0
  15. package/dist/devices.js.map +1 -0
  16. package/dist/http.d.ts +7 -0
  17. package/dist/http.d.ts.map +1 -1
  18. package/dist/http.js +27 -24
  19. package/dist/http.js.map +1 -1
  20. package/dist/index.d.ts +12 -15
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +23 -12
  23. package/dist/index.js.map +1 -1
  24. package/dist/mfa.d.ts +4 -4
  25. package/dist/mfa.d.ts.map +1 -1
  26. package/dist/mfa.js +18 -7
  27. package/dist/mfa.js.map +1 -1
  28. package/dist/pkce.d.ts.map +1 -1
  29. package/dist/pkce.js +27 -4
  30. package/dist/pkce.js.map +1 -1
  31. package/dist/postgrest.d.ts +7 -0
  32. package/dist/postgrest.d.ts.map +1 -1
  33. package/dist/postgrest.js +11 -1
  34. package/dist/postgrest.js.map +1 -1
  35. package/dist/profile.d.ts +16 -0
  36. package/dist/profile.d.ts.map +1 -0
  37. package/dist/profile.js +26 -0
  38. package/dist/profile.js.map +1 -0
  39. package/dist/realtime.d.ts +3 -0
  40. package/dist/realtime.d.ts.map +1 -1
  41. package/dist/realtime.js +20 -3
  42. package/dist/realtime.js.map +1 -1
  43. package/dist/session.d.ts +2 -0
  44. package/dist/session.d.ts.map +1 -1
  45. package/dist/session.js +26 -10
  46. package/dist/session.js.map +1 -1
  47. package/dist/types.d.ts +5 -0
  48. package/dist/types.d.ts.map +1 -1
  49. package/package.json +76 -62
package/dist/auth.d.ts CHANGED
@@ -1,459 +1,182 @@
1
- import { MfaClient } from './mfa.js';
2
- import { AuthAdminClient } from './admin.js';
1
+ import { type AuthClient as BetterAuthClient } from 'better-auth/client';
2
+ import { anonymousClient, emailOTPClient, genericOAuthClient, jwtClient, magicLinkClient, organizationClient, phoneNumberClient, twoFactorClient } from 'better-auth/client/plugins';
3
+ import { passkeyClient } from '@better-auth/passkey/client';
4
+ import { ssoClient } from '@better-auth/sso/client';
5
+ import { apiKeyClient } from '@better-auth/api-key/client';
6
+ import type { BetterFetch, BetterFetchPlugin, BetterFetchResponse } from '@better-fetch/fetch';
7
+ import { AuthAdminClient, type AuthAdminMfaClient } from './admin.js';
3
8
  import { type VerifierStore } from './pkce.js';
4
- import { OrganizationClient } from './organization.js';
5
- import { PasskeyClient } from './passkey.js';
6
- import { SsoClient } from './sso.js';
7
9
  import type { HttpClient } from './http.js';
8
10
  import type { SessionStore } from './session.js';
9
- import type { AuthChangeListener, MotherbaseResponse, Session, User, UserIdentity } from './types.js';
11
+ import type { AuthChangeListener, Session, User } from './types.js';
10
12
  /**
11
- * The CAPTCHA response token from the hCaptcha or Turnstile widget. Required
12
- * by every guarded endpoint once the project turns CAPTCHA protection on
13
- * (Studio → Authentication → Attack Protection), exactly as in supabase-js.
13
+ * `client.auth` IS Better Auth's own client, typed with the plugins the server
14
+ * mounts (auth/instance.ts). Every method in Better Auth's documentation is
15
+ * here under the same name and parameters: `signIn.email`, `listSessions`,
16
+ * `revokeOtherSessions`, `twoFactor.enable`, `organization.create`… and every
17
+ * call resolves to Better Auth's `{ data, error }`.
18
+ *
19
+ * Motherbase adds only what Better Auth's client cannot know about, through one
20
+ * client plugin (`motherbase` below), so the additions are typed and dispatched
21
+ * exactly like Better Auth's own actions:
22
+ *
23
+ * * The session lives in the SDK's `SessionStore`, so `from()`, storage,
24
+ * functions and realtime send the same bearer token the auth calls do.
25
+ * * `onAuthStateChange`, fed by that store.
26
+ * * The OAuth return: `getSessionFromUrl` (the server's `#access_token=`
27
+ * fragment) and `exchangeCodeForSession` (PKCE).
28
+ * * The server's own endpoints: `reauthenticate`, `updateUserCredentials`.
29
+ * * `admin`: user administration with a secret key (Motherbase's API, not
30
+ * Better Auth's admin plugin, which the server does not mount).
31
+ *
32
+ * A plugin turned off in the project settings keeps its methods here, typed,
33
+ * and the server answers them with a 404.
14
34
  */
15
- export interface CaptchaOptions {
16
- captchaToken?: string;
17
- }
18
- export interface SignUpCredentials {
19
- email: string;
20
- password: string;
21
- /** Optional extra profile field supported by the backend. */
22
- username?: string;
23
- options?: CaptchaOptions & {
24
- /** Where the email-verification link sends the user. Must be an allowed redirect URL. */
25
- emailRedirectTo?: string;
26
- };
27
- }
28
- export interface SignInWithPasswordCredentials {
29
- email: string;
30
- password: string;
31
- options?: CaptchaOptions;
32
- }
33
- export interface SignInWithOtpCredentials {
34
- email?: string;
35
- /** E.164 phone number. Routes to the SMS one-time code flow instead. */
36
- phone?: string;
37
- options?: CaptchaOptions;
38
- }
39
- export interface SignInAnonymouslyCredentials {
40
- options?: CaptchaOptions & {
41
- /** Profile fields for the guest, stored like `updateUser({ data })`. */
42
- data?: Record<string, unknown>;
43
- };
44
- }
45
- export interface VerifyOtpParams {
46
- email?: string;
47
- /** E.164 phone number, when the code was sent by SMS. */
48
- phone?: string;
49
- /** The code that was sent. Named `token` for supabase-js parity. */
50
- token: string;
51
- /**
52
- * supabase-js verification type. The channel actually follows the identifier
53
- * you pass; this only disambiguates if both are present. `recovery` and
54
- * `email_change` are not routed: use `resetPassword` for the first, and
55
- * email changes are not supported.
56
- */
57
- type?: 'email' | 'sms' | 'phone_change' | 'recovery' | 'email_change' | 'signup';
58
- }
59
- export interface SignInWithOAuthCredentials {
60
- /** Social provider id, e.g. 'google' or 'apple'. Must be enabled on the backend. */
61
- provider: string;
62
- options?: {
63
- /** Where the provider should send the user back to after auth. */
64
- redirectTo?: string;
65
- /** Space-separated OAuth scopes. */
66
- scopes?: string;
67
- /** Skip the automatic `window.location` redirect and just return the URL. */
68
- skipBrowserRedirect?: boolean;
69
- };
70
- }
71
- export interface DeleteUserAttributes {
72
- /** Required unless the session is already "fresh" (i.e. just re-authenticated). */
73
- password?: string;
74
- /** Deletion-confirmation token, when the backend's delete flow requires an email confirmation step. */
75
- token?: string;
76
- callbackURL?: string;
35
+ export interface AuthClientOptions {
36
+ /** The project URL. Better Auth is mounted under `/api/auth`. */
37
+ url: string;
38
+ fetch: typeof fetch;
39
+ /** Client-level headers (`apikey`, impersonation), sent on every auth call too. */
40
+ headers: Record<string, string>;
41
+ /** `pkce` makes OAuth and SSO redirects come back with `?code=` for `exchangeCodeForSession`. */
42
+ flowType: 'implicit' | 'pkce';
43
+ /** Where the PKCE verifier waits out the redirect. */
44
+ verifiers: VerifierStore;
77
45
  }
78
- export interface UpdateUserAttributes {
79
- /**
80
- * Give an anonymous user an email address, which makes it permanent. The id
81
- * does not change, so everything the guest owned stays owned. A permanent
82
- * user cannot change its address through this call.
83
- */
84
- email?: string;
85
- /**
86
- * New password. Replacing an existing one takes either `currentPassword` or
87
- * the `nonce` that `reauthenticate()` emailed. A user with no password yet
88
- * (a converted guest, a social sign-in) needs neither.
89
- */
90
- password?: string;
91
- currentPassword?: string;
92
- /** The code from `reauthenticate()`. */
93
- nonce?: string;
94
- /** Arbitrary profile fields (name, image, or any custom additional field). */
95
- data?: Record<string, unknown>;
46
+ export interface Subscription {
47
+ unsubscribe(): void;
96
48
  }
97
49
  /**
98
50
  * Read the token an OAuth callback left in the URL fragment and return the URL
99
51
  * with it removed, so a reload or a shared link cannot replay it.
100
52
  *
101
53
  * The provider callback cannot answer the SDK with a JSON body: it is a browser
102
- * redirect. The backend therefore appends `#access_token=…` to the redirect it
103
- * issues, the same implicit flow supabase-js reads. Exported for testing.
54
+ * redirect. The server therefore appends `#access_token=…` to the redirect it
55
+ * issues (auth/oauth-redirect.ts). Exported for testing.
104
56
  */
105
57
  export declare function readAccessTokenFromUrl(href: string): {
106
58
  accessToken: string;
107
59
  cleanedHref: string;
108
60
  } | null;
109
- export interface Subscription {
110
- unsubscribe(): void;
111
- }
112
- export interface AuthClientOptions {
113
- /** `pkce` makes OAuth and SSO redirects come back with `?code=` for `exchangeCodeForSession`. */
114
- flowType?: 'implicit' | 'pkce';
115
- /** Where the PKCE verifier waits out the redirect. Defaults to localStorage, else memory. */
116
- verifiers?: VerifierStore;
117
- }
118
61
  /**
119
- * Supabase-compatible auth client. Maps supabase-js method names onto the
120
- * Motherbase auth endpoints and reuses the existing token/refresh/session-store
121
- * machinery. Returns `{ data, error }` and never throws for expected failures.
62
+ * The session a successful auth response carries, if any.
63
+ *
64
+ * Better Auth answers a sign-in with `{ token, user }` (password, OTP, anonymous,
65
+ * id token, second factor) or `{ session: { token }, user }` (passkey,
66
+ * get-session). A `user` is required alongside: the jwt plugin's `/token`
67
+ * answers `{ token }` with a JWT, which is not a session.
122
68
  */
123
- export declare class AuthClient {
124
- private readonly http;
125
- private readonly store;
126
- /**
127
- * Two-factor, shaped like `supabase.auth.mfa`. The server has shipped TOTP
128
- * from the start; this is the namespace that makes it reachable.
129
- */
130
- readonly mfa: MfaClient;
131
- /**
132
- * User administration for server code holding a secret key. Present on every
133
- * client, because whether the key is secret is a server-side fact: calling
134
- * these with a publishable key is a 401, not a missing method.
135
- */
136
- readonly admin: AuthAdminClient;
137
- /**
138
- * End-user organizations, members, invitations and teams. Not part of
139
- * supabase-js; method names follow Better Auth's organization client.
140
- */
141
- readonly organization: OrganizationClient;
142
- /** The signed-in user's passkeys. Signing in with one is `signInWithPasskey`. */
143
- readonly passkey: PasskeyClient;
144
- /** Identity providers registered at runtime. Signing in through one is `signInWithSSO`. */
145
- readonly sso: SsoClient;
146
- private autoRefreshTimer;
147
- private readonly flowType;
148
- private readonly verifiers;
149
- constructor(http: HttpClient, store: SessionStore, options?: AuthClientOptions);
150
- signUp(credentials: SignUpCredentials): Promise<MotherbaseResponse<{
151
- user: User | null;
152
- session: Session | null;
153
- }>>;
154
- signInWithPassword(credentials: SignInWithPasswordCredentials): Promise<MotherbaseResponse<{
155
- user: User | null;
156
- session: Session | null;
157
- }>>;
158
- /**
159
- * Sign in as a new guest, supabase-js style. The project must allow
160
- * anonymous sign-ins (Studio → Authentication → Sign In / Providers).
161
- *
162
- * The guest is a real user whose `is_anonymous` is true, and RLS sees the
163
- * same flag as the `is_anonymous` claim. Make it permanent without changing
164
- * its id with `updateUser({ email })` or `linkIdentity()`.
165
- */
166
- signInAnonymously(credentials?: SignInAnonymouslyCredentials): Promise<MotherbaseResponse<{
167
- user: User | null;
168
- session: Session | null;
169
- }>>;
170
- /**
171
- * Email the signed-in user a one-time nonce, then pass it to
172
- * `updateUser({ password, nonce })`. GoTrue's "secure password change".
173
- */
174
- reauthenticate(): Promise<MotherbaseResponse<{
175
- user: null;
176
- session: null;
177
- }>>;
178
- /**
179
- * Request a password-reset OTP by email. Always resolves successfully
180
- * (whether or not the email is registered) to avoid leaking account
181
- * existence; check `error` only for transport/server failures.
182
- */
183
- resetPasswordForEmail(email: string, options?: CaptchaOptions): Promise<{
184
- error: MotherbaseResponse<null>['error'];
185
- }>;
186
- /** Complete a password reset using the OTP sent to the user's email. */
187
- resetPassword(args: {
188
- email: string;
189
- otp: string;
190
- password: string;
191
- }): Promise<{
192
- error: MotherbaseResponse<null>['error'];
193
- }>;
194
- /**
195
- * Send a one-time sign-in code, by email or by SMS. Pair with `verifyOtp` to
196
- * complete the sign-in.
197
- *
198
- * `{ phone }` routes to the phone-number plugin, which the project has to
199
- * have enabled with an SMS sender configured; without one the call resolves
200
- * with the backend's error rather than pretending a code was sent.
201
- */
202
- signInWithOtp(credentials: SignInWithOtpCredentials): Promise<{
203
- data: Record<string, never>;
204
- error: MotherbaseResponse<null>['error'];
205
- }>;
206
- /**
207
- * Send the one-time code again, supabase-js style.
208
- *
209
- * supabase-js names the flows `signup` (confirm a new address), `email_change`
210
- * and `recovery`; Better Auth names them `email-verification` and
211
- * `forget-password`. The mapping lives here so ported code keeps working.
212
- * `sms` and `phone_change` re-send an SMS code through the phone-number flow.
213
- */
214
- resend(params: {
215
- type: 'signup' | 'email_change' | 'recovery' | 'sms' | 'phone_change';
216
- email?: string;
217
- phone?: string;
218
- }): Promise<{
219
- data: Record<string, never>;
220
- error: MotherbaseResponse<null>['error'];
221
- }>;
222
- /**
223
- * Complete a `signInWithOtp` sign-in with the code that was sent.
224
- *
225
- * The channel follows the identifier, as in supabase-js: `{ phone }` verifies
226
- * an SMS code, `{ email }` an email one. `type` is accepted for signature
227
- * parity and only disambiguates when both are somehow present.
228
- */
229
- verifyOtp(params: VerifyOtpParams): Promise<MotherbaseResponse<{
230
- user: User | null;
231
- session: Session | null;
232
- }>>;
233
- /**
234
- * Start an OAuth sign-in with a configured social provider. Resolves with the
235
- * provider's authorize URL and, in a browser, redirects to it immediately
236
- * unless `options.skipBrowserRedirect` is set.
237
- */
238
- signInWithOAuth(credentials: SignInWithOAuthCredentials): Promise<MotherbaseResponse<{
239
- provider: string;
240
- url: string | null;
241
- }>>;
242
- /**
243
- * Sign in with a passkey saved on this device or a synced one. Opens the
244
- * browser's passkey prompt; dismissing it resolves with an error, not a throw.
245
- * Needs Auth · Passkey on and a browser (see `auth.passkey`).
246
- */
247
- signInWithPasskey(): Promise<MotherbaseResponse<{
248
- user: User | null;
249
- session: Session | null;
250
- }>>;
69
+ export declare function sessionFromResponse(data: unknown): {
70
+ token: string;
71
+ user: User;
72
+ } | null;
73
+ /**
74
+ * Whether two tokens name the same session. The bearer the server hands out
75
+ * (`set-auth-token`, the OAuth fragment) is the signed cookie value,
76
+ * `<token>.<signature>`, while response bodies carry the bare `<token>`; the
77
+ * bearer plugin accepts either.
78
+ */
79
+ export declare function sameSession(stored: string | undefined, token: string | undefined): boolean;
80
+ /** `auth.admin`: the public methods of `AuthAdminClient`, `mfa` included. */
81
+ export type AuthAdminActions = Omit<AuthAdminClient, 'mfa'> & {
82
+ mfa: Omit<AuthAdminMfaClient, never>;
83
+ };
84
+ export interface SessionResult {
85
+ data: {
86
+ user: User;
87
+ session: Session;
88
+ } | null;
89
+ /** Better Auth's error shape. */
90
+ error: {
91
+ message?: string;
92
+ status?: number;
93
+ statusText?: string;
94
+ } | null;
95
+ }
96
+ /** What Motherbase adds to Better Auth's client. */
97
+ export interface MotherbaseAuthActions {
251
98
  /**
252
- * Start an enterprise SSO sign-in. Identify the provider by the user's email
253
- * domain, by an explicit `domain`, or by `providerId` when you already know
254
- * which one to use.
255
- *
256
- * Resolves with the identity provider's URL and, in a browser, redirects to it
257
- * unless `options.skipBrowserRedirect` is set. The project must have the SSO
258
- * plugin enabled and at least one provider registered (Studio →
259
- * Authentication → Organizations & SSO).
99
+ * Subscribe to session changes. The callback fires once with
100
+ * `INITIAL_SESSION` as soon as the stored session has been read, so an app
101
+ * can leave its loading state for a signed-out visitor too, then on every
102
+ * sign-in, sign-out and user update made through `client.auth`. Delivered
103
+ * asynchronously: unsubscribing synchronously suppresses it.
260
104
  */
261
- signInWithSSO(params: {
262
- domain?: string;
263
- email?: string;
264
- providerId?: string;
265
- organizationSlug?: string;
266
- options?: {
267
- redirectTo?: string;
268
- skipBrowserRedirect?: boolean;
105
+ onAuthStateChange(callback: AuthChangeListener): {
106
+ data: {
107
+ subscription: Subscription;
269
108
  };
270
- }): Promise<MotherbaseResponse<{
271
- url: string | null;
272
- }>>;
273
- /**
274
- * Update the signed-in user's profile fields and/or password. Password
275
- * changes require `currentPassword` (a Better Auth requirement. There is no
276
- * blind password overwrite from an authenticated session).
277
- */
278
- updateUser(attributes: UpdateUserAttributes): Promise<MotherbaseResponse<{
279
- user: User | null;
280
- }>>;
281
- /**
282
- * Permanently delete the signed-in user's account. Not part of the
283
- * supabase-js client surface (there it's admin-only). Kept here because
284
- * self-service account deletion is a real product need. Requires the
285
- * backend's `delete-user` flow to be enabled; clears the local session on
286
- * success.
287
- */
288
- deleteUser(attributes?: DeleteUserAttributes): Promise<{
289
- error: MotherbaseResponse<null>['error'];
290
- }>;
291
- /**
292
- * Adopt an externally-obtained access token as the current session (e.g. one
293
- * captured from an OAuth redirect). Validates it against the server before
294
- * persisting. `refresh_token` is accepted for supabase-js signature parity
295
- * and unused: Better Auth bearer sessions have none.
296
- */
297
- setSession(currentSession: {
298
- access_token: string;
299
- refresh_token?: string;
300
- }): Promise<MotherbaseResponse<{
301
- user: User | null;
302
- session: Session | null;
303
- }>>;
304
- signOut(): Promise<{
305
- error: MotherbaseResponse<null>['error'];
306
- }>;
307
- /**
308
- * Finish an OAuth / SSO sign-in after the provider redirected back.
309
- *
310
- * `signInWithOAuth` only starts the flow; the session is created during the
311
- * redirect the browser makes to the backend callback, so the SDK has to pick
312
- * it up from the URL the browser landed on. Call this once on the page you
313
- * pointed `redirectTo` at (or on app start, which is where supabase-js does
314
- * the equivalent). Without it the user is signed in on the backend and signed
315
- * out in your app.
316
- *
317
- * Resolves with a null session and no error when there is nothing to read, so
318
- * it is safe to call on every page load.
319
- */
320
- getSessionFromUrl(href?: string): Promise<MotherbaseResponse<{
321
- user: User | null;
322
- session: Session | null;
323
- }>>;
324
- /**
325
- * Finish a PKCE sign-in: trade the `?code=` the provider redirect came back
326
- * with for the session. Needs the verifier `signInWithOAuth` stored, so it
327
- * works once, in the browser that started the flow.
328
- */
329
- exchangeCodeForSession(authCode: string): Promise<MotherbaseResponse<{
330
- user: User | null;
331
- session: Session | null;
332
- }>>;
333
- /**
334
- * The redirect a flow should use. Implicit: as given. PKCE: with a fresh
335
- * challenge on it, the verifier stored for `exchangeCodeForSession`; the
336
- * challenge rides on the redirect URL, so PKCE needs one, and in a browser
337
- * the current page stands in when none is given.
338
- */
339
- private redirectForFlow;
340
- /** Fetch the current user from Better Auth (requires a valid session). */
341
- getUser(): Promise<MotherbaseResponse<{
342
- user: User | null;
343
- }>>;
344
- /**
345
- * NEVER USE FOR AN AUTHORIZATION DECISION. Use {@link getUser} instead.
346
- *
347
- * The locally-held session, if any (no network call). It is whatever the
348
- * caller's cookie or storage said, parsed: unsigned JSON the browser sent,
349
- * which anyone can set by hand. `session.user.id`, `.email` and `.role` are
350
- * therefore attacker-controlled, and an admin allowlist checked against
351
- * them is checked against nothing.
352
- *
353
- * Reads and writes through `from()` are unaffected: they carry the access
354
- * token to the backend, which verifies it under RLS. It is the decisions
355
- * your own app takes from `session.user` that are forgeable.
356
- *
357
- * `getUser()` costs one round trip and returns the user the backend
358
- * confirms, in the same `{ data, error }` shape. Prefer it everywhere but a
359
- * cosmetic "am I probably signed in" check.
360
- */
361
- getSession(): Promise<MotherbaseResponse<{
362
- session: Session | null;
363
- }>>;
364
- /**
365
- * Revalidate the current session against the server. Better Auth bearer
366
- * sessions have no refresh token: if the session is still valid the user is
367
- * refreshed; otherwise the local session is cleared.
368
- */
369
- refreshSession(): Promise<MotherbaseResponse<{
370
- user: User | null;
371
- session: Session | null;
372
- }>>;
109
+ };
373
110
  /**
374
- * Subscribe to auth changes, supabase-js style.
375
- *
376
- * The callback fires once with `INITIAL_SESSION` as soon as the stored
377
- * session has been read, before any later event. That first call is not a
378
- * nicety: the standard Supabase bootstrap is
379
- * `if (event === 'INITIAL_SESSION') setLoading(false)`, and without it the
380
- * app renders its loading state forever for a signed-out visitor, who never
381
- * produces any other event.
382
- *
383
- * It is delivered asynchronously (after hydration), so unsubscribing
384
- * synchronously suppresses it, exactly as in supabase-js.
111
+ * Finish a social, SSO or magic-link sign-in on the page the server sent the
112
+ * browser back to: read the `#access_token=` it appended and adopt that
113
+ * session. `createClient` already does this on load unless
114
+ * `auth.detectSessionInUrl` is false. Resolves with `data: null` and no error
115
+ * when the URL carries no token, so it is safe on every page.
385
116
  */
117
+ getSessionFromUrl(href?: string): Promise<SessionResult>;
386
118
  /**
387
- * The providers linked to the signed-in user, in the supabase-js identity
388
- * shape. Backed by Better Auth's `list-accounts`, which is why `email` shows
389
- * up as an identity for a password account: it is a real linked credential,
390
- * exactly as in Supabase.
119
+ * Finish a PKCE sign-in: trade the `?code=` the redirect came back with for
120
+ * the session. Needs the verifier the sign-in stored, so it works once, in
121
+ * the browser that started the flow. `createClient` already does this on load.
391
122
  */
392
- getUserIdentities(): Promise<MotherbaseResponse<{
393
- identities: UserIdentity[];
123
+ exchangeCodeForSession(authCode: string): Promise<SessionResult>;
124
+ /** Email the signed-in user a one-time code to pass as `nonce` to `updateUserCredentials`. */
125
+ reauthenticate(): Promise<BetterFetchResponse<{
126
+ success: boolean;
394
127
  }>>;
395
128
  /**
396
- * Link another provider to the signed-in user. Like `signInWithOAuth`, this
397
- * only starts the flow: the browser is sent to the provider and comes back
398
- * through the callback.
129
+ * Set the signed-in user's email or password where Better Auth's own
130
+ * `changeEmail` / `changePassword` cannot: an anonymous user's first address
131
+ * (which makes it permanent, keeping its id), a first password, or a password
132
+ * replaced with the `nonce` from `reauthenticate()`.
399
133
  */
400
- linkIdentity(credentials: SignInWithOAuthCredentials): Promise<MotherbaseResponse<{
401
- provider: string;
402
- url: string | null;
403
- }>>;
404
- /** Unlink a provider from the signed-in user. */
405
- unlinkIdentity(identity: {
406
- provider: string;
407
- id?: string;
408
- identity_id?: string;
409
- }): Promise<MotherbaseResponse<Record<string, never>>>;
410
- /**
411
- * Native mobile sign-in with a provider id token (Sign in with Apple, Google
412
- * One Tap), routed to Better Auth's social sign-in with an `idToken`.
413
- * The provider must be configured on the backend.
414
- */
415
- signInWithIdToken(params: {
416
- provider: string;
417
- token: string;
418
- access_token?: string;
134
+ updateUserCredentials(params: {
135
+ email?: string;
136
+ password?: string;
419
137
  nonce?: string;
420
- }): Promise<MotherbaseResponse<{
421
- user: User | null;
422
- session: Session | null;
423
- }>>;
424
- /**
425
- * Claims for the current session, as a JWT payload.
426
- *
427
- * supabase-js reads them out of the access token, which is itself a JWT.
428
- * A Better Auth session token is an opaque bearer, so this asks the server's
429
- * jwt plugin to mint one and decodes it. The decode is NOT a verification:
430
- * the token came from the authenticated endpoint over TLS, and a client
431
- * verifying a token it just asked for proves nothing. Verify server side,
432
- * against `/api/auth/jwks`.
433
- */
434
- getClaims(): Promise<MotherbaseResponse<{
435
- claims: Record<string, unknown>;
436
- token: string;
138
+ }): Promise<BetterFetchResponse<{
139
+ user: User;
437
140
  }>>;
438
141
  /**
439
- * Revalidate the session on a timer, the way supabase-js does while the tab
440
- * is focused. Motherbase refreshes on a 401 already, so this is opt-in: it
441
- * exists so a ported app that calls it keeps working, and so a long-lived
442
- * screen notices a revoked session without waiting for its next request.
443
- */
444
- startAutoRefresh(intervalMs?: number): void;
445
- /** Stop the timer started by `startAutoRefresh`. Safe to call when none runs. */
446
- stopAutoRefresh(): void;
447
- onAuthStateChange(callback: AuthChangeListener): {
448
- data: {
449
- subscription: Subscription;
450
- };
451
- };
452
- /**
453
- * Internal: refresh used by the HttpClient's 401 path. Returns true on success.
454
- * Not part of the public Supabase surface.
142
+ * User administration for server code holding a secret key. Present on every
143
+ * client because whether the key is secret is a server-side fact: with a
144
+ * publishable key, these answer 401.
455
145
  */
456
- _refresh(): Promise<boolean>;
457
- private persist;
146
+ admin: AuthAdminActions;
147
+ }
148
+ interface MotherbaseClientPlugin {
149
+ id: 'motherbase';
150
+ fetchPlugins: BetterFetchPlugin[];
151
+ getActions: ($fetch: BetterFetch) => MotherbaseAuthActions;
458
152
  }
153
+ /**
154
+ * The client plugins matching what auth/instance.ts mounts on the server, plus
155
+ * Motherbase's. Spelled out as a type so `client.auth` has a name in the
156
+ * declarations: inferred, it is too large for TypeScript to write down.
157
+ */
158
+ type AuthPlugins = [
159
+ ReturnType<typeof anonymousClient>,
160
+ ReturnType<typeof emailOTPClient>,
161
+ ReturnType<typeof magicLinkClient>,
162
+ ReturnType<typeof phoneNumberClient>,
163
+ ReturnType<typeof twoFactorClient>,
164
+ ReturnType<typeof organizationClient<{
165
+ teams: {
166
+ enabled: true;
167
+ };
168
+ }>>,
169
+ ReturnType<typeof genericOAuthClient>,
170
+ ReturnType<typeof jwtClient>,
171
+ ReturnType<typeof passkeyClient>,
172
+ ReturnType<typeof ssoClient>,
173
+ ReturnType<typeof apiKeyClient>,
174
+ MotherbaseClientPlugin
175
+ ];
176
+ /** `client.auth`: Better Auth's client, with Motherbase's session handling. */
177
+ export type AuthClient = BetterAuthClient<{
178
+ plugins: AuthPlugins;
179
+ }>;
180
+ export declare function createAuthClient(http: HttpClient, store: SessionStore, options: AuthClientOptions): AuthClient;
181
+ export {};
459
182
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAA4E,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACzH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAA2B,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAEV,kBAAkB,EAElB,kBAAkB,EAClB,OAAO,EACP,IAAI,EACJ,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,cAAc,GAAG;QACzB,yFAAyF;QACzF,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC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