@meistrari/auth-core 3.3.0 → 3.5.0

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/index.d.ts CHANGED
@@ -2,14 +2,14 @@ import * as better_auth_plugins from 'better-auth/plugins';
2
2
  import * as better_auth from 'better-auth';
3
3
  import { JWTPayload as JWTPayload$1 } from 'better-auth';
4
4
  export { APIError } from 'better-auth';
5
- import * as zod from 'zod';
6
- import zod__default, { z } from 'zod';
5
+ import * as z from 'zod';
6
+ import z__default, { z as z$1 } from 'zod';
7
7
  import * as better_auth_client from 'better-auth/client';
8
8
  import { BetterFetchOption } from 'better-auth/client';
9
+ import * as zod_v4_core from 'zod/v4/core';
9
10
  import * as _better_auth_api_key from '@better-auth/api-key';
10
11
  import { ApiKey as ApiKey$1 } from '@better-auth/api-key';
11
12
  import * as jose from 'jose';
12
- import * as zod_v4_core from 'zod/v4/core';
13
13
  import * as _better_auth_sso from '@better-auth/sso';
14
14
 
15
15
  declare const AMRBrand: unique symbol;
@@ -17,34 +17,34 @@ declare const AALBrand: unique symbol;
17
17
  declare const ACRBrand: unique symbol;
18
18
  declare const AuthMethodBrand: unique symbol;
19
19
  declare const AMRs: {
20
- readonly Pwd: ("sso" & zod__default.core.$brand<typeof AMRBrand>) | ("saml" & zod__default.core.$brand<typeof AMRBrand>) | ("otp" & zod__default.core.$brand<typeof AMRBrand>) | ("pwd" & zod__default.core.$brand<typeof AMRBrand>) | ("oauth" & zod__default.core.$brand<typeof AMRBrand>);
21
- readonly Otp: ("sso" & zod__default.core.$brand<typeof AMRBrand>) | ("saml" & zod__default.core.$brand<typeof AMRBrand>) | ("otp" & zod__default.core.$brand<typeof AMRBrand>) | ("pwd" & zod__default.core.$brand<typeof AMRBrand>) | ("oauth" & zod__default.core.$brand<typeof AMRBrand>);
22
- readonly Oauth: ("sso" & zod__default.core.$brand<typeof AMRBrand>) | ("saml" & zod__default.core.$brand<typeof AMRBrand>) | ("otp" & zod__default.core.$brand<typeof AMRBrand>) | ("pwd" & zod__default.core.$brand<typeof AMRBrand>) | ("oauth" & zod__default.core.$brand<typeof AMRBrand>);
23
- readonly Sso: ("sso" & zod__default.core.$brand<typeof AMRBrand>) | ("saml" & zod__default.core.$brand<typeof AMRBrand>) | ("otp" & zod__default.core.$brand<typeof AMRBrand>) | ("pwd" & zod__default.core.$brand<typeof AMRBrand>) | ("oauth" & zod__default.core.$brand<typeof AMRBrand>);
24
- readonly Saml: ("sso" & zod__default.core.$brand<typeof AMRBrand>) | ("saml" & zod__default.core.$brand<typeof AMRBrand>) | ("otp" & zod__default.core.$brand<typeof AMRBrand>) | ("pwd" & zod__default.core.$brand<typeof AMRBrand>) | ("oauth" & zod__default.core.$brand<typeof AMRBrand>);
20
+ readonly Pwd: ("sso" & z__default.core.$brand<typeof AMRBrand>) | ("otp" & z__default.core.$brand<typeof AMRBrand>) | ("saml" & z__default.core.$brand<typeof AMRBrand>) | ("pwd" & z__default.core.$brand<typeof AMRBrand>) | ("oauth" & z__default.core.$brand<typeof AMRBrand>);
21
+ readonly Otp: ("sso" & z__default.core.$brand<typeof AMRBrand>) | ("otp" & z__default.core.$brand<typeof AMRBrand>) | ("saml" & z__default.core.$brand<typeof AMRBrand>) | ("pwd" & z__default.core.$brand<typeof AMRBrand>) | ("oauth" & z__default.core.$brand<typeof AMRBrand>);
22
+ readonly Oauth: ("sso" & z__default.core.$brand<typeof AMRBrand>) | ("otp" & z__default.core.$brand<typeof AMRBrand>) | ("saml" & z__default.core.$brand<typeof AMRBrand>) | ("pwd" & z__default.core.$brand<typeof AMRBrand>) | ("oauth" & z__default.core.$brand<typeof AMRBrand>);
23
+ readonly Sso: ("sso" & z__default.core.$brand<typeof AMRBrand>) | ("otp" & z__default.core.$brand<typeof AMRBrand>) | ("saml" & z__default.core.$brand<typeof AMRBrand>) | ("pwd" & z__default.core.$brand<typeof AMRBrand>) | ("oauth" & z__default.core.$brand<typeof AMRBrand>);
24
+ readonly Saml: ("sso" & z__default.core.$brand<typeof AMRBrand>) | ("otp" & z__default.core.$brand<typeof AMRBrand>) | ("saml" & z__default.core.$brand<typeof AMRBrand>) | ("pwd" & z__default.core.$brand<typeof AMRBrand>) | ("oauth" & z__default.core.$brand<typeof AMRBrand>);
25
25
  };
26
26
  declare const AALs: {
27
- readonly Aal1: ("aal1" & zod__default.core.$brand<typeof AALBrand>) | ("aal2" & zod__default.core.$brand<typeof AALBrand>) | ("aal3" & zod__default.core.$brand<typeof AALBrand>);
28
- readonly Aal2: ("aal1" & zod__default.core.$brand<typeof AALBrand>) | ("aal2" & zod__default.core.$brand<typeof AALBrand>) | ("aal3" & zod__default.core.$brand<typeof AALBrand>);
29
- readonly Aal3: ("aal1" & zod__default.core.$brand<typeof AALBrand>) | ("aal2" & zod__default.core.$brand<typeof AALBrand>) | ("aal3" & zod__default.core.$brand<typeof AALBrand>);
27
+ readonly Aal1: ("aal1" & z__default.core.$brand<typeof AALBrand>) | ("aal2" & z__default.core.$brand<typeof AALBrand>) | ("aal3" & z__default.core.$brand<typeof AALBrand>);
28
+ readonly Aal2: ("aal1" & z__default.core.$brand<typeof AALBrand>) | ("aal2" & z__default.core.$brand<typeof AALBrand>) | ("aal3" & z__default.core.$brand<typeof AALBrand>);
29
+ readonly Aal3: ("aal1" & z__default.core.$brand<typeof AALBrand>) | ("aal2" & z__default.core.$brand<typeof AALBrand>) | ("aal3" & z__default.core.$brand<typeof AALBrand>);
30
30
  };
31
31
  declare const ACRs: {
32
- readonly Unspecified: "urn:tela:auth:unspecified" & zod__default.core.$brand<typeof ACRBrand>;
32
+ readonly Unspecified: "urn:tela:auth:unspecified" & z__default.core.$brand<typeof ACRBrand>;
33
33
  };
34
34
  declare const AuthMethods: {
35
- readonly Password: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
36
- readonly EmailOTP: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
37
- readonly OAuth: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
38
- readonly SSO: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
39
- readonly SAML: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
40
- readonly Unknown: ("sso" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("password" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & zod__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & zod__default.core.$brand<typeof AuthMethodBrand>);
35
+ readonly Password: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
36
+ readonly EmailOTP: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
37
+ readonly OAuth: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
38
+ readonly SSO: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
39
+ readonly SAML: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
40
+ readonly Unknown: ("sso" & z__default.core.$brand<typeof AuthMethodBrand>) | ("unknown" & z__default.core.$brand<typeof AuthMethodBrand>) | ("password" & z__default.core.$brand<typeof AuthMethodBrand>) | ("saml" & z__default.core.$brand<typeof AuthMethodBrand>) | ("oauth" & z__default.core.$brand<typeof AuthMethodBrand>) | ("email_otp" & z__default.core.$brand<typeof AuthMethodBrand>);
41
41
  };
42
42
  /**
43
43
  * Reads the legacy `saml` AMR as `sso`, so sessions and application policies
44
44
  * created before SAML and OIDC were unified keep matching each other.
45
45
  */
46
46
  declare function normalizeAmr(amr: AMR): AMR;
47
- declare const AMR: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
47
+ declare const AMR: z__default.core.$ZodBranded<z__default.ZodEnum<{
48
48
  readonly Pwd: "pwd";
49
49
  readonly Otp: "otp";
50
50
  readonly Oauth: "oauth";
@@ -56,18 +56,18 @@ declare const AMR: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
56
56
  */
57
57
  readonly Saml: "saml";
58
58
  }>, typeof AMRBrand, "out">;
59
- type AMR = zod__default.infer<typeof AMR>;
60
- declare const AAL: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
59
+ type AMR = z__default.infer<typeof AMR>;
60
+ declare const AAL: z__default.core.$ZodBranded<z__default.ZodEnum<{
61
61
  readonly Aal1: "aal1";
62
62
  readonly Aal2: "aal2";
63
63
  readonly Aal3: "aal3";
64
64
  }>, typeof AALBrand, "out">;
65
- type AAL = zod__default.infer<typeof AAL>;
66
- declare const ACR: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
65
+ type AAL = z__default.infer<typeof AAL>;
66
+ declare const ACR: z__default.core.$ZodBranded<z__default.ZodEnum<{
67
67
  readonly Unspecified: "urn:tela:auth:unspecified";
68
68
  }>, typeof ACRBrand, "out">;
69
- type ACR = zod__default.infer<typeof ACR>;
70
- declare const AuthMethod: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
69
+ type ACR = z__default.infer<typeof ACR>;
70
+ declare const AuthMethod: z__default.core.$ZodBranded<z__default.ZodEnum<{
71
71
  readonly Password: "password";
72
72
  readonly EmailOTP: "email_otp";
73
73
  readonly OAuth: "oauth";
@@ -79,7 +79,7 @@ declare const AuthMethod: zod__default.core.$ZodBranded<zod__default.ZodEnum<{
79
79
  readonly SAML: "saml";
80
80
  readonly Unknown: "unknown";
81
81
  }>, typeof AuthMethodBrand, "out">;
82
- type AuthMethod = zod__default.infer<typeof AuthMethod>;
82
+ type AuthMethod = z__default.infer<typeof AuthMethod>;
83
83
  declare const assuranceFields: {
84
84
  authMethod: {
85
85
  type: "string";
@@ -285,21 +285,21 @@ declare const invitationAdditionalFields: {
285
285
  /**
286
286
  * Zod schema and type for the `user` claim within a JWT payload.
287
287
  */
288
- declare const JWTPayloadUser: z.ZodObject<{
289
- id: z.ZodString;
290
- name: z.ZodString;
291
- image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
292
- role: z.ZodNullable<z.ZodString>;
293
- }, z.core.$strip>;
294
- type JWTPayloadUser = z.infer<typeof JWTPayloadUser>;
288
+ declare const JWTPayloadUser: z$1.ZodObject<{
289
+ id: z$1.ZodString;
290
+ name: z$1.ZodString;
291
+ image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
292
+ role: z$1.ZodNullable<z$1.ZodString>;
293
+ }, z$1.core.$strip>;
294
+ type JWTPayloadUser = z$1.infer<typeof JWTPayloadUser>;
295
295
  /**
296
296
  * Zod schema and type for the `workspace` claim within a JWT payload.
297
297
  */
298
- declare const JWTPayloadWorkspace: z.ZodObject<{
299
- id: z.ZodString;
300
- title: z.ZodString;
301
- }, z.core.$strip>;
302
- type JWTPayloadWorkspace = z.infer<typeof JWTPayloadWorkspace>;
298
+ declare const JWTPayloadWorkspace: z$1.ZodObject<{
299
+ id: z$1.ZodString;
300
+ title: z$1.ZodString;
301
+ }, z$1.core.$strip>;
302
+ type JWTPayloadWorkspace = z$1.infer<typeof JWTPayloadWorkspace>;
303
303
  type JWTPayloadAssurance = {
304
304
  authMethod: AuthMethod;
305
305
  amr: AMR[];
@@ -307,7 +307,7 @@ type JWTPayloadAssurance = {
307
307
  acr: ACR;
308
308
  assuredAt: string;
309
309
  };
310
- declare const JWTPayloadAssurance: z.ZodType<JWTPayloadAssurance>;
310
+ declare const JWTPayloadAssurance: z$1.ZodType<JWTPayloadAssurance>;
311
311
  declare const DEFAULT_JWT_ASSURANCE: JWTPayloadAssurance;
312
312
  type JWTPayloadData = {
313
313
  email: string;
@@ -322,7 +322,7 @@ type JWTPayloadData = {
322
322
  * Includes `email`, `user`, `workspace`, and `sessionKey` claims
323
323
  * on top of the standard Better Auth JWT fields (`sub`, `iss`, `exp`, etc.).
324
324
  */
325
- declare const JWTPayload: z.ZodType<JWTPayloadData>;
325
+ declare const JWTPayload: z$1.ZodType<JWTPayloadData>;
326
326
  type JWTPayload = JWTPayload$1 & JWTPayloadData;
327
327
 
328
328
  /**
@@ -349,11 +349,11 @@ type JWTPayload = JWTPayload$1 & JWTPayloadData;
349
349
  */
350
350
  declare function isTokenExpired(token: string, expiresInMs?: number): boolean;
351
351
 
352
- declare const OAuthStepUpProvider: zod__default.ZodEnum<{
352
+ declare const OAuthStepUpProvider: z__default.ZodEnum<{
353
353
  google: "google";
354
354
  microsoft: "microsoft";
355
355
  }>;
356
- type OAuthStepUpProvider = zod__default.infer<typeof OAuthStepUpProvider>;
356
+ type OAuthStepUpProvider = z__default.infer<typeof OAuthStepUpProvider>;
357
357
  type StepUpOption = {
358
358
  method: typeof AMRs.Pwd;
359
359
  } | {
@@ -362,12 +362,12 @@ type StepUpOption = {
362
362
  method: typeof AMRs.Oauth;
363
363
  providers: OAuthStepUpProvider[];
364
364
  };
365
- declare const StepUpOption: zod__default.ZodType<StepUpOption>;
365
+ declare const StepUpOption: z__default.ZodType<StepUpOption>;
366
366
  type SessionAssurancePolicy = {
367
367
  minAal: typeof AALs.Aal1 | typeof AALs.Aal2 | typeof AALs.Aal3;
368
368
  acceptedAmr: AMR[];
369
369
  };
370
- declare const SessionAssurancePolicy: zod__default.ZodType<SessionAssurancePolicy>;
370
+ declare const SessionAssurancePolicy: z__default.ZodType<SessionAssurancePolicy>;
371
371
  declare const SENSITIVE_ACTION_ASSURANCE_POLICY: SessionAssurancePolicy;
372
372
  /**
373
373
  * Maximum age of an elevated (stepped-up) assurance, in seconds. Enforced by
@@ -399,16 +399,16 @@ declare class BaseError extends Error {
399
399
  constructor(code: string, message: string, options?: ErrorOptions);
400
400
  }
401
401
 
402
- declare const SessionAssuranceRequiredPayload: zod__default.ZodObject<{
403
- code: zod__default.ZodEnum<{
402
+ declare const SessionAssuranceRequiredPayload: z__default.ZodObject<{
403
+ code: z__default.ZodEnum<{
404
404
  session_assurance_required: "session_assurance_required";
405
405
  application_session_assurance_not_met: "application_session_assurance_not_met";
406
406
  }>;
407
- currentAssurance: zod__default.ZodPipe<zod__default.ZodTransform<unknown, unknown>, zod__default.ZodType<JWTPayloadAssurance, unknown, zod__default.core.$ZodTypeInternals<JWTPayloadAssurance, unknown>>>;
408
- requiredAssurance: zod__default.ZodType<SessionAssurancePolicy, unknown, zod__default.core.$ZodTypeInternals<SessionAssurancePolicy, unknown>>;
409
- validStepUps: zod__default.ZodArray<zod__default.ZodType<StepUpOption, unknown, zod__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
410
- }, zod__default.core.$strip>;
411
- type SessionAssuranceRequiredPayload = zod__default.infer<typeof SessionAssuranceRequiredPayload>;
407
+ currentAssurance: z__default.ZodPreprocess<z__default.ZodType<JWTPayloadAssurance, unknown, z__default.core.$ZodTypeInternals<JWTPayloadAssurance, unknown>>, unknown>;
408
+ requiredAssurance: z__default.ZodType<SessionAssurancePolicy, unknown, z__default.core.$ZodTypeInternals<SessionAssurancePolicy, unknown>>;
409
+ validStepUps: z__default.ZodArray<z__default.ZodType<StepUpOption, unknown, z__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
410
+ }, z__default.core.$strip>;
411
+ type SessionAssuranceRequiredPayload = z__default.infer<typeof SessionAssuranceRequiredPayload>;
412
412
  declare function parseSessionAssuranceRequiredPayload(error: unknown): {
413
413
  code: "session_assurance_required" | "application_session_assurance_not_met";
414
414
  currentAssurance: JWTPayloadAssurance;
@@ -511,26 +511,26 @@ type BeginOAuthStepUpParams = {
511
511
  provider: OAuthStepUpProvider;
512
512
  returnUrl?: string;
513
513
  };
514
- declare const SessionAssuranceResponse: zod__default.ZodObject<{
515
- assurance: zod__default.ZodType<AssuranceFields, unknown, zod__default.core.$ZodTypeInternals<AssuranceFields, unknown>>;
516
- validStepUps: zod__default.ZodArray<zod__default.ZodType<StepUpOption, unknown, zod__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
517
- }, zod__default.core.$strip>;
518
- type SessionAssuranceResponse = zod__default.infer<typeof SessionAssuranceResponse>;
519
- declare const OAuthBeginStepUpResponse: zod__default.ZodObject<{
520
- stepUpToken: zod__default.ZodString;
521
- callbackURL: zod__default.ZodString;
522
- }, zod__default.core.$strip>;
523
- type OAuthBeginStepUpResponse = zod__default.infer<typeof OAuthBeginStepUpResponse>;
524
- declare const OAuthCompleteStepUpResponse: zod__default.ZodObject<{
525
- assurance: zod__default.ZodType<AssuranceFields, unknown, zod__default.core.$ZodTypeInternals<AssuranceFields, unknown>>;
526
- validStepUps: zod__default.ZodArray<zod__default.ZodType<StepUpOption, unknown, zod__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
527
- returnPath: zod__default.ZodString;
528
- }, zod__default.core.$strip>;
529
- type OAuthCompleteStepUpResponse = zod__default.infer<typeof OAuthCompleteStepUpResponse>;
530
- declare const SendOtpResponse: zod__default.ZodObject<{
531
- success: zod__default.ZodBoolean;
532
- }, zod__default.core.$strip>;
533
- type SendOtpResponse = zod__default.infer<typeof SendOtpResponse>;
514
+ declare const SessionAssuranceResponse: z__default.ZodObject<{
515
+ assurance: z__default.ZodType<AssuranceFields, unknown, z__default.core.$ZodTypeInternals<AssuranceFields, unknown>>;
516
+ validStepUps: z__default.ZodArray<z__default.ZodType<StepUpOption, unknown, z__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
517
+ }, z__default.core.$strip>;
518
+ type SessionAssuranceResponse = z__default.infer<typeof SessionAssuranceResponse>;
519
+ declare const OAuthBeginStepUpResponse: z__default.ZodObject<{
520
+ stepUpToken: z__default.ZodString;
521
+ callbackURL: z__default.ZodString;
522
+ }, z__default.core.$strip>;
523
+ type OAuthBeginStepUpResponse = z__default.infer<typeof OAuthBeginStepUpResponse>;
524
+ declare const OAuthCompleteStepUpResponse: z__default.ZodObject<{
525
+ assurance: z__default.ZodType<AssuranceFields, unknown, z__default.core.$ZodTypeInternals<AssuranceFields, unknown>>;
526
+ validStepUps: z__default.ZodArray<z__default.ZodType<StepUpOption, unknown, z__default.core.$ZodTypeInternals<StepUpOption, unknown>>>;
527
+ returnPath: z__default.ZodString;
528
+ }, z__default.core.$strip>;
529
+ type OAuthCompleteStepUpResponse = z__default.infer<typeof OAuthCompleteStepUpResponse>;
530
+ declare const SendOtpResponse: z__default.ZodObject<{
531
+ success: z__default.ZodBoolean;
532
+ }, z__default.core.$strip>;
533
+ type SendOtpResponse = z__default.infer<typeof SendOtpResponse>;
534
534
  declare class SessionAssuranceService {
535
535
  private readonly client;
536
536
  constructor(client: APIClient);
@@ -601,12 +601,12 @@ type ApplicationSessionAssuranceConfig = {
601
601
  acceptedAmr: AMR[];
602
602
  minAal: AAL;
603
603
  };
604
- declare const ApplicationSessionAssuranceConfig: zod__default.ZodType<ApplicationSessionAssuranceConfig>;
604
+ declare const ApplicationSessionAssuranceConfig: z__default.ZodType<ApplicationSessionAssuranceConfig>;
605
605
  type ApplicationConfig = {
606
606
  version: 1;
607
607
  sessionAssurance: ApplicationSessionAssuranceConfig;
608
608
  };
609
- declare const ApplicationConfig: zod__default.ZodType<ApplicationConfig>;
609
+ declare const ApplicationConfig: z__default.ZodType<ApplicationConfig>;
610
610
  /**
611
611
  * Keys of the organization's related collections that can be optionally
612
612
  * included in the "who am I" response.
@@ -1106,24 +1106,24 @@ declare class ApplicationService {
1106
1106
  listRoles(): Promise<ApplicationRole[]>;
1107
1107
  }
1108
1108
 
1109
- declare const ApiKeyMetadata: zod__default.ZodObject<{
1110
- user: zod__default.ZodObject<{
1111
- id: zod__default.ZodString;
1112
- email: zod__default.ZodString;
1113
- }, zod__default.core.$strip>;
1114
- workspace: zod__default.ZodObject<{
1115
- id: zod__default.ZodString;
1116
- title: zod__default.ZodString;
1117
- }, zod__default.core.$strip>;
1118
- application: zod__default.ZodNullable<zod__default.ZodOptional<zod__default.ZodObject<{
1119
- id: zod__default.ZodString;
1120
- name: zod__default.ZodString;
1121
- }, zod__default.core.$strip>>>;
1122
- }, zod__default.core.$strip>;
1109
+ declare const ApiKeyMetadata: z__default.ZodObject<{
1110
+ user: z__default.ZodObject<{
1111
+ id: z__default.ZodString;
1112
+ email: z__default.ZodString;
1113
+ }, z__default.core.$strip>;
1114
+ workspace: z__default.ZodObject<{
1115
+ id: z__default.ZodString;
1116
+ title: z__default.ZodString;
1117
+ }, z__default.core.$strip>;
1118
+ application: z__default.ZodNullable<z__default.ZodOptional<z__default.ZodObject<{
1119
+ id: z__default.ZodString;
1120
+ name: z__default.ZodString;
1121
+ }, z__default.core.$strip>>>;
1122
+ }, z__default.core.$strip>;
1123
1123
  /**
1124
1124
  * Metadata attached to an API key, identifying the owning user and workspace.
1125
1125
  */
1126
- type ApiKeyMetadata = zod__default.infer<typeof ApiKeyMetadata> & Record<string, unknown>;
1126
+ type ApiKeyMetadata = z__default.infer<typeof ApiKeyMetadata> & Record<string, unknown>;
1127
1127
  /**
1128
1128
  * A full API key including the secret key value.
1129
1129
  *
@@ -1530,6 +1530,13 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1530
1530
  domainVerification: {
1531
1531
  enabled: false;
1532
1532
  };
1533
+ schema: {
1534
+ ssoProvider?: {
1535
+ additionalFields?: {
1536
+ [key: string]: better_auth.DBFieldAttribute;
1537
+ };
1538
+ };
1539
+ } | undefined;
1533
1540
  }>;
1534
1541
  pathMethods: {
1535
1542
  "/sso/providers": "GET";
@@ -1538,22 +1545,173 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1538
1545
  } | {
1539
1546
  id: "two-factor";
1540
1547
  version: string;
1541
- $InferServerPlugin: ReturnType<(<O extends better_auth_plugins.TwoFactorOptions>(options?: O) => {
1542
- id: "two-factor";
1548
+ $InferServerPlugin: ReturnType<typeof better_auth_plugins.twoFactor>;
1549
+ atomListeners: {
1550
+ matcher: (path: string) => boolean;
1551
+ signal: "$sessionSignal";
1552
+ }[];
1553
+ pathMethods: {
1554
+ "/two-factor/disable": "POST";
1555
+ "/two-factor/enable": "POST";
1556
+ "/two-factor/send-otp": "POST";
1557
+ "/two-factor/generate-backup-codes": "POST";
1558
+ "/two-factor/get-totp-uri": "POST";
1559
+ "/two-factor/verify-totp": "POST";
1560
+ "/two-factor/verify-otp": "POST";
1561
+ "/two-factor/verify-backup-code": "POST";
1562
+ };
1563
+ fetchPlugins: {
1564
+ id: string;
1565
+ name: string;
1566
+ hooks: {
1567
+ onSuccess(context: better_auth_client.SuccessContext<any>): Promise<void>;
1568
+ };
1569
+ }[];
1570
+ $ERROR_CODES: {
1571
+ OTP_NOT_ENABLED: better_auth.RawError<"OTP_NOT_ENABLED">;
1572
+ OTP_NOT_CONFIGURED: better_auth.RawError<"OTP_NOT_CONFIGURED">;
1573
+ OTP_HAS_EXPIRED: better_auth.RawError<"OTP_HAS_EXPIRED">;
1574
+ TOTP_NOT_ENABLED: better_auth.RawError<"TOTP_NOT_ENABLED">;
1575
+ TOTP_ALREADY_ENABLED: better_auth.RawError<"TOTP_ALREADY_ENABLED">;
1576
+ TOTP_NOT_CONFIGURED: better_auth.RawError<"TOTP_NOT_CONFIGURED">;
1577
+ TWO_FACTOR_NOT_ENABLED: better_auth.RawError<"TWO_FACTOR_NOT_ENABLED">;
1578
+ BACKUP_CODES_NOT_ENABLED: better_auth.RawError<"BACKUP_CODES_NOT_ENABLED">;
1579
+ INVALID_BACKUP_CODE: better_auth.RawError<"INVALID_BACKUP_CODE">;
1580
+ INVALID_CODE: better_auth.RawError<"INVALID_CODE">;
1581
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: better_auth.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
1582
+ ACCOUNT_TEMPORARILY_LOCKED: better_auth.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
1583
+ INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
1584
+ };
1585
+ } | {
1586
+ id: "better-auth-client";
1587
+ version: string;
1588
+ $InferServerPlugin: ReturnType<typeof better_auth_plugins.jwt>;
1589
+ pathMethods: {
1590
+ [x: string]: "GET";
1591
+ };
1592
+ getActions: ($fetch: better_auth_client.BetterFetch, _$store: better_auth.ClientStore, _options: better_auth.BetterAuthClientOptions | undefined) => {
1593
+ jwks: (fetchOptions?: better_auth.ClientFetchOption) => Promise<{
1594
+ data: null;
1595
+ error: {
1596
+ message?: string | undefined;
1597
+ status: number;
1598
+ statusText: string;
1599
+ };
1600
+ } | {
1601
+ data: jose.JSONWebKeySet;
1602
+ error: null;
1603
+ }>;
1604
+ };
1605
+ } | {
1606
+ id: "api-key";
1607
+ version: string;
1608
+ $InferServerPlugin: ReturnType<typeof _better_auth_api_key.apiKey>;
1609
+ pathMethods: {
1610
+ "/api-key/create": "POST";
1611
+ "/api-key/delete": "POST";
1612
+ "/api-key/delete-all-expired-api-keys": "POST";
1613
+ };
1614
+ $ERROR_CODES: {
1615
+ INVALID_METADATA_TYPE: better_auth.RawError<"INVALID_METADATA_TYPE">;
1616
+ REFILL_AMOUNT_AND_INTERVAL_REQUIRED: better_auth.RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
1617
+ REFILL_INTERVAL_AND_AMOUNT_REQUIRED: better_auth.RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
1618
+ USER_BANNED: better_auth.RawError<"USER_BANNED">;
1619
+ UNAUTHORIZED_SESSION: better_auth.RawError<"UNAUTHORIZED_SESSION">;
1620
+ KEY_NOT_FOUND: better_auth.RawError<"KEY_NOT_FOUND">;
1621
+ KEY_DISABLED: better_auth.RawError<"KEY_DISABLED">;
1622
+ KEY_EXPIRED: better_auth.RawError<"KEY_EXPIRED">;
1623
+ USAGE_EXCEEDED: better_auth.RawError<"USAGE_EXCEEDED">;
1624
+ KEY_NOT_RECOVERABLE: better_auth.RawError<"KEY_NOT_RECOVERABLE">;
1625
+ EXPIRES_IN_IS_TOO_SMALL: better_auth.RawError<"EXPIRES_IN_IS_TOO_SMALL">;
1626
+ EXPIRES_IN_IS_TOO_LARGE: better_auth.RawError<"EXPIRES_IN_IS_TOO_LARGE">;
1627
+ INVALID_REMAINING: better_auth.RawError<"INVALID_REMAINING">;
1628
+ INVALID_PREFIX_LENGTH: better_auth.RawError<"INVALID_PREFIX_LENGTH">;
1629
+ INVALID_NAME_LENGTH: better_auth.RawError<"INVALID_NAME_LENGTH">;
1630
+ METADATA_DISABLED: better_auth.RawError<"METADATA_DISABLED">;
1631
+ RATE_LIMIT_EXCEEDED: better_auth.RawError<"RATE_LIMIT_EXCEEDED">;
1632
+ NO_VALUES_TO_UPDATE: better_auth.RawError<"NO_VALUES_TO_UPDATE">;
1633
+ KEY_DISABLED_EXPIRATION: better_auth.RawError<"KEY_DISABLED_EXPIRATION">;
1634
+ INVALID_API_KEY: better_auth.RawError<"INVALID_API_KEY">;
1635
+ INVALID_USER_ID_FROM_API_KEY: better_auth.RawError<"INVALID_USER_ID_FROM_API_KEY">;
1636
+ INVALID_REFERENCE_ID_FROM_API_KEY: better_auth.RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
1637
+ INVALID_API_KEY_GETTER_RETURN_TYPE: better_auth.RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
1638
+ SERVER_ONLY_PROPERTY: better_auth.RawError<"SERVER_ONLY_PROPERTY">;
1639
+ FAILED_TO_UPDATE_API_KEY: better_auth.RawError<"FAILED_TO_UPDATE_API_KEY">;
1640
+ NAME_REQUIRED: better_auth.RawError<"NAME_REQUIRED">;
1641
+ ORGANIZATION_ID_REQUIRED: better_auth.RawError<"ORGANIZATION_ID_REQUIRED">;
1642
+ USER_NOT_MEMBER_OF_ORGANIZATION: better_auth.RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
1643
+ INSUFFICIENT_API_KEY_PERMISSIONS: better_auth.RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
1644
+ NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: better_auth.RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
1645
+ ORGANIZATION_PLUGIN_REQUIRED: better_auth.RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
1646
+ };
1647
+ } | {
1648
+ id: "admin-client";
1649
+ version: string;
1650
+ $InferServerPlugin: {
1651
+ id: "admin";
1543
1652
  version: string;
1653
+ init(): {
1654
+ options: {
1655
+ databaseHooks: {
1656
+ user: {
1657
+ create: {
1658
+ before(user: {
1659
+ id: string;
1660
+ createdAt: Date;
1661
+ updatedAt: Date;
1662
+ email: string;
1663
+ emailVerified: boolean;
1664
+ name: string;
1665
+ image?: string | null | undefined;
1666
+ } & Record<string, unknown>): Promise<{
1667
+ data: {
1668
+ id: string;
1669
+ createdAt: Date;
1670
+ updatedAt: Date;
1671
+ email: string;
1672
+ emailVerified: boolean;
1673
+ name: string;
1674
+ image?: string | null | undefined;
1675
+ role: string;
1676
+ };
1677
+ }>;
1678
+ };
1679
+ };
1680
+ session: {
1681
+ create: {
1682
+ before(session: {
1683
+ id: string;
1684
+ createdAt: Date;
1685
+ updatedAt: Date;
1686
+ userId: string;
1687
+ expiresAt: Date;
1688
+ token: string;
1689
+ ipAddress?: string | null | undefined;
1690
+ userAgent?: string | null | undefined;
1691
+ } & Record<string, unknown>, ctx: better_auth.GenericEndpointContext | null): Promise<void>;
1692
+ };
1693
+ };
1694
+ };
1695
+ };
1696
+ };
1697
+ hooks: {
1698
+ after: {
1699
+ matcher(context: better_auth.HookEndpointContext): boolean;
1700
+ handler: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<better_auth_plugins.SessionWithImpersonatedBy[] | undefined>>;
1701
+ }[];
1702
+ };
1544
1703
  endpoints: {
1545
- enableTwoFactor: better_auth.StrictEndpoint<"/two-factor/enable", {
1704
+ setRole: better_auth.StrictEndpoint<"/admin/set-role", {
1546
1705
  method: "POST";
1547
- body: zod.ZodObject<{
1548
- password: zod.ZodOptional<zod.ZodString>;
1549
- issuer: zod.ZodOptional<zod.ZodString>;
1550
- }, zod_v4_core.$strip> | zod.ZodObject<{
1551
- password: zod.ZodString;
1552
- issuer: zod.ZodOptional<zod.ZodString>;
1706
+ body: z.ZodObject<{
1707
+ userId: z.ZodCoercedString<unknown>;
1708
+ role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
1553
1709
  }, zod_v4_core.$strip>;
1554
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1710
+ requireHeaders: true;
1711
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1555
1712
  session: {
1556
- session: Record<string, any> & {
1713
+ user: better_auth_plugins.UserWithRole;
1714
+ session: {
1557
1715
  id: string;
1558
1716
  createdAt: Date;
1559
1717
  updatedAt: Date;
@@ -1563,19 +1721,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1563
1721
  ipAddress?: string | null | undefined;
1564
1722
  userAgent?: string | null | undefined;
1565
1723
  };
1566
- user: Record<string, any> & {
1567
- id: string;
1568
- createdAt: Date;
1569
- updatedAt: Date;
1570
- email: string;
1571
- emailVerified: boolean;
1572
- name: string;
1573
- image?: string | null | undefined;
1574
- };
1575
1724
  };
1576
- }>)[];
1725
+ }>>[];
1577
1726
  metadata: {
1578
1727
  openapi: {
1728
+ operationId: string;
1579
1729
  summary: string;
1580
1730
  description: string;
1581
1731
  responses: {
@@ -1586,16 +1736,8 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1586
1736
  schema: {
1587
1737
  type: "object";
1588
1738
  properties: {
1589
- totpURI: {
1590
- type: string;
1591
- description: string;
1592
- };
1593
- backupCodes: {
1594
- type: string;
1595
- items: {
1596
- type: string;
1597
- };
1598
- description: string;
1739
+ user: {
1740
+ $ref: string;
1599
1741
  };
1600
1742
  };
1601
1743
  };
@@ -1604,21 +1746,25 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1604
1746
  };
1605
1747
  };
1606
1748
  };
1749
+ $Infer: {
1750
+ body: {
1751
+ userId: string;
1752
+ role: "admin" | "user" | ("admin" | "user")[];
1753
+ };
1754
+ };
1607
1755
  };
1608
1756
  }, {
1609
- totpURI: string;
1610
- backupCodes: string[];
1757
+ user: better_auth_plugins.UserWithRole;
1611
1758
  }>;
1612
- disableTwoFactor: better_auth.StrictEndpoint<"/two-factor/disable", {
1613
- method: "POST";
1614
- body: zod.ZodObject<{
1615
- password: zod.ZodOptional<zod.ZodString>;
1616
- }, zod_v4_core.$strip> | zod.ZodObject<{
1617
- password: zod.ZodString;
1759
+ getUser: better_auth.StrictEndpoint<"/admin/get-user", {
1760
+ method: "GET";
1761
+ query: z.ZodObject<{
1762
+ id: z.ZodString;
1618
1763
  }, zod_v4_core.$strip>;
1619
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1764
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1620
1765
  session: {
1621
- session: Record<string, any> & {
1766
+ user: better_auth_plugins.UserWithRole;
1767
+ session: {
1622
1768
  id: string;
1623
1769
  createdAt: Date;
1624
1770
  updatedAt: Date;
@@ -1628,19 +1774,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1628
1774
  ipAddress?: string | null | undefined;
1629
1775
  userAgent?: string | null | undefined;
1630
1776
  };
1631
- user: Record<string, any> & {
1632
- id: string;
1633
- createdAt: Date;
1634
- updatedAt: Date;
1635
- email: string;
1636
- emailVerified: boolean;
1637
- name: string;
1638
- image?: string | null | undefined;
1639
- };
1640
1777
  };
1641
- }>)[];
1778
+ }>>[];
1642
1779
  metadata: {
1643
1780
  openapi: {
1781
+ operationId: string;
1644
1782
  summary: string;
1645
1783
  description: string;
1646
1784
  responses: {
@@ -1651,8 +1789,8 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1651
1789
  schema: {
1652
1790
  type: "object";
1653
1791
  properties: {
1654
- status: {
1655
- type: string;
1792
+ user: {
1793
+ $ref: string;
1656
1794
  };
1657
1795
  };
1658
1796
  };
@@ -1662,21 +1800,23 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1662
1800
  };
1663
1801
  };
1664
1802
  };
1665
- }, {
1666
- status: boolean;
1667
- }>;
1668
- verifyBackupCode: better_auth.StrictEndpoint<"/two-factor/verify-backup-code", {
1803
+ }, better_auth_plugins.UserWithRole>;
1804
+ createUser: better_auth.StrictEndpoint<"/admin/create-user", {
1669
1805
  method: "POST";
1670
- body: zod.ZodObject<{
1671
- code: zod.ZodString;
1672
- disableSession: zod.ZodOptional<zod.ZodBoolean>;
1673
- trustDevice: zod.ZodOptional<zod.ZodBoolean>;
1806
+ body: z.ZodObject<{
1807
+ email: z.ZodString;
1808
+ password: z.ZodOptional<z.ZodString>;
1809
+ name: z.ZodString;
1810
+ role: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1811
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1674
1812
  }, zod_v4_core.$strip>;
1675
1813
  metadata: {
1676
1814
  openapi: {
1815
+ operationId: string;
1816
+ summary: string;
1677
1817
  description: string;
1678
1818
  responses: {
1679
- "200": {
1819
+ 200: {
1680
1820
  description: string;
1681
1821
  content: {
1682
1822
  "application/json": {
@@ -1684,108 +1824,38 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1684
1824
  type: "object";
1685
1825
  properties: {
1686
1826
  user: {
1687
- type: string;
1688
- properties: {
1689
- id: {
1690
- type: string;
1691
- description: string;
1692
- };
1693
- email: {
1694
- type: string;
1695
- format: string;
1696
- nullable: boolean;
1697
- description: string;
1698
- };
1699
- emailVerified: {
1700
- type: string;
1701
- nullable: boolean;
1702
- description: string;
1703
- };
1704
- name: {
1705
- type: string;
1706
- nullable: boolean;
1707
- description: string;
1708
- };
1709
- image: {
1710
- type: string;
1711
- format: string;
1712
- nullable: boolean;
1713
- description: string;
1714
- };
1715
- twoFactorEnabled: {
1716
- type: string;
1717
- description: string;
1718
- };
1719
- createdAt: {
1720
- type: string;
1721
- format: string;
1722
- description: string;
1723
- };
1724
- updatedAt: {
1725
- type: string;
1726
- format: string;
1727
- description: string;
1728
- };
1729
- };
1730
- required: string[];
1731
- description: string;
1732
- };
1733
- session: {
1734
- type: string;
1735
- properties: {
1736
- token: {
1737
- type: string;
1738
- description: string;
1739
- };
1740
- userId: {
1741
- type: string;
1742
- description: string;
1743
- };
1744
- createdAt: {
1745
- type: string;
1746
- format: string;
1747
- description: string;
1748
- };
1749
- expiresAt: {
1750
- type: string;
1751
- format: string;
1752
- description: string;
1753
- };
1754
- };
1755
- required: string[];
1756
- description: string;
1827
+ $ref: string;
1757
1828
  };
1758
1829
  };
1759
- required: string[];
1760
1830
  };
1761
1831
  };
1762
1832
  };
1763
1833
  };
1764
1834
  };
1765
1835
  };
1836
+ $Infer: {
1837
+ body: {
1838
+ email: string;
1839
+ password?: string | undefined;
1840
+ name: string;
1841
+ role?: "admin" | "user" | ("admin" | "user")[] | undefined;
1842
+ data?: Record<string, any> | undefined;
1843
+ };
1844
+ };
1766
1845
  };
1767
1846
  }, {
1768
- token: string | undefined;
1769
- user: (Record<string, any> & {
1770
- id: string;
1771
- createdAt: Date;
1772
- updatedAt: Date;
1773
- email: string;
1774
- emailVerified: boolean;
1775
- name: string;
1776
- image?: string | null | undefined;
1777
- }) | better_auth_plugins.UserWithTwoFactor;
1847
+ user: better_auth_plugins.UserWithRole;
1778
1848
  }>;
1779
- generateBackupCodes: better_auth.StrictEndpoint<"/two-factor/generate-backup-codes", {
1849
+ adminUpdateUser: better_auth.StrictEndpoint<"/admin/update-user", {
1780
1850
  method: "POST";
1781
- body: zod.ZodObject<{
1782
- password: zod.ZodOptional<zod.ZodString>;
1783
- }, zod_v4_core.$strip> | zod.ZodObject<{
1784
- password: zod.ZodString;
1851
+ body: z.ZodObject<{
1852
+ userId: z.ZodCoercedString<unknown>;
1853
+ data: z.ZodRecord<z.ZodAny, z.ZodAny>;
1785
1854
  }, zod_v4_core.$strip>;
1786
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1855
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1787
1856
  session: {
1788
- session: Record<string, any> & {
1857
+ user: better_auth_plugins.UserWithRole;
1858
+ session: {
1789
1859
  id: string;
1790
1860
  createdAt: Date;
1791
1861
  updatedAt: Date;
@@ -1795,42 +1865,25 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1795
1865
  ipAddress?: string | null | undefined;
1796
1866
  userAgent?: string | null | undefined;
1797
1867
  };
1798
- user: Record<string, any> & {
1799
- id: string;
1800
- createdAt: Date;
1801
- updatedAt: Date;
1802
- email: string;
1803
- emailVerified: boolean;
1804
- name: string;
1805
- image?: string | null | undefined;
1806
- };
1807
1868
  };
1808
- }>)[];
1869
+ }>>[];
1809
1870
  metadata: {
1810
1871
  openapi: {
1872
+ operationId: string;
1873
+ summary: string;
1811
1874
  description: string;
1812
1875
  responses: {
1813
- "200": {
1876
+ 200: {
1814
1877
  description: string;
1815
1878
  content: {
1816
1879
  "application/json": {
1817
1880
  schema: {
1818
1881
  type: "object";
1819
1882
  properties: {
1820
- status: {
1821
- type: string;
1822
- description: string;
1823
- enum: boolean[];
1824
- };
1825
- backupCodes: {
1826
- type: string;
1827
- items: {
1828
- type: string;
1829
- };
1830
- description: string;
1883
+ user: {
1884
+ $ref: string;
1831
1885
  };
1832
1886
  };
1833
- required: string[];
1834
1887
  };
1835
1888
  };
1836
1889
  };
@@ -1838,26 +1891,61 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1838
1891
  };
1839
1892
  };
1840
1893
  };
1841
- }, {
1842
- status: boolean;
1843
- backupCodes: string[];
1844
- }>;
1845
- viewBackupCodes: better_auth.StrictEndpoint<string, {
1846
- method: "POST";
1847
- body: zod.ZodObject<{
1848
- userId: zod.ZodCoercedString<unknown>;
1849
- }, zod_v4_core.$strip>;
1850
- }, {
1851
- status: boolean;
1852
- backupCodes: string[];
1853
- }>;
1854
- sendTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/send-otp", {
1855
- method: "POST";
1856
- body: zod.ZodOptional<zod.ZodObject<{
1857
- trustDevice: zod.ZodOptional<zod.ZodBoolean>;
1858
- }, zod_v4_core.$strip>>;
1894
+ }, better_auth_plugins.UserWithRole>;
1895
+ listUsers: better_auth.StrictEndpoint<"/admin/list-users", {
1896
+ method: "GET";
1897
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1898
+ session: {
1899
+ user: better_auth_plugins.UserWithRole;
1900
+ session: {
1901
+ id: string;
1902
+ createdAt: Date;
1903
+ updatedAt: Date;
1904
+ userId: string;
1905
+ expiresAt: Date;
1906
+ token: string;
1907
+ ipAddress?: string | null | undefined;
1908
+ userAgent?: string | null | undefined;
1909
+ };
1910
+ };
1911
+ }>>[];
1912
+ query: z.ZodObject<{
1913
+ searchValue: z.ZodOptional<z.ZodString>;
1914
+ searchField: z.ZodOptional<z.ZodEnum<{
1915
+ email: "email";
1916
+ name: "name";
1917
+ }>>;
1918
+ searchOperator: z.ZodOptional<z.ZodEnum<{
1919
+ contains: "contains";
1920
+ starts_with: "starts_with";
1921
+ ends_with: "ends_with";
1922
+ }>>;
1923
+ limit: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1924
+ offset: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1925
+ sortBy: z.ZodOptional<z.ZodString>;
1926
+ sortDirection: z.ZodOptional<z.ZodEnum<{
1927
+ asc: "asc";
1928
+ desc: "desc";
1929
+ }>>;
1930
+ filterField: z.ZodOptional<z.ZodString>;
1931
+ filterValue: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodArray<z.ZodString>]>, z.ZodArray<z.ZodNumber>]>>;
1932
+ filterOperator: z.ZodOptional<z.ZodEnum<{
1933
+ in: "in";
1934
+ lte: "lte";
1935
+ eq: "eq";
1936
+ ne: "ne";
1937
+ lt: "lt";
1938
+ gt: "gt";
1939
+ gte: "gte";
1940
+ not_in: "not_in";
1941
+ contains: "contains";
1942
+ starts_with: "starts_with";
1943
+ ends_with: "ends_with";
1944
+ }>>;
1945
+ }, zod_v4_core.$strip>;
1859
1946
  metadata: {
1860
1947
  openapi: {
1948
+ operationId: string;
1861
1949
  summary: string;
1862
1950
  description: string;
1863
1951
  responses: {
@@ -1868,10 +1956,23 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1868
1956
  schema: {
1869
1957
  type: "object";
1870
1958
  properties: {
1871
- status: {
1959
+ users: {
1960
+ type: string;
1961
+ items: {
1962
+ $ref: string;
1963
+ };
1964
+ };
1965
+ total: {
1966
+ type: string;
1967
+ };
1968
+ limit: {
1969
+ type: string;
1970
+ };
1971
+ offset: {
1872
1972
  type: string;
1873
1973
  };
1874
1974
  };
1975
+ required: string[];
1875
1976
  };
1876
1977
  };
1877
1978
  };
@@ -1880,75 +1981,49 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1880
1981
  };
1881
1982
  };
1882
1983
  }, {
1883
- status: boolean;
1984
+ users: better_auth_plugins.UserWithRole[];
1985
+ total: number;
1884
1986
  }>;
1885
- verifyTwoFactorOTP: better_auth.StrictEndpoint<"/two-factor/verify-otp", {
1987
+ listUserSessions: better_auth.StrictEndpoint<"/admin/list-user-sessions", {
1886
1988
  method: "POST";
1887
- body: zod.ZodObject<{
1888
- code: zod.ZodString;
1889
- trustDevice: zod.ZodOptional<zod.ZodBoolean>;
1989
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
1990
+ session: {
1991
+ user: better_auth_plugins.UserWithRole;
1992
+ session: {
1993
+ id: string;
1994
+ createdAt: Date;
1995
+ updatedAt: Date;
1996
+ userId: string;
1997
+ expiresAt: Date;
1998
+ token: string;
1999
+ ipAddress?: string | null | undefined;
2000
+ userAgent?: string | null | undefined;
2001
+ };
2002
+ };
2003
+ }>>[];
2004
+ body: z.ZodObject<{
2005
+ userId: z.ZodCoercedString<unknown>;
1890
2006
  }, zod_v4_core.$strip>;
1891
2007
  metadata: {
1892
2008
  openapi: {
2009
+ operationId: string;
1893
2010
  summary: string;
1894
2011
  description: string;
1895
2012
  responses: {
1896
- "200": {
2013
+ 200: {
1897
2014
  description: string;
1898
2015
  content: {
1899
2016
  "application/json": {
1900
2017
  schema: {
1901
2018
  type: "object";
1902
2019
  properties: {
1903
- token: {
1904
- type: string;
1905
- description: string;
1906
- };
1907
- user: {
2020
+ sessions: {
1908
2021
  type: string;
1909
- properties: {
1910
- id: {
1911
- type: string;
1912
- description: string;
1913
- };
1914
- email: {
1915
- type: string;
1916
- format: string;
1917
- nullable: boolean;
1918
- description: string;
1919
- };
1920
- emailVerified: {
1921
- type: string;
1922
- nullable: boolean;
1923
- description: string;
1924
- };
1925
- name: {
1926
- type: string;
1927
- nullable: boolean;
1928
- description: string;
1929
- };
1930
- image: {
1931
- type: string;
1932
- format: string;
1933
- nullable: boolean;
1934
- description: string;
1935
- };
1936
- createdAt: {
1937
- type: string;
1938
- format: string;
1939
- description: string;
1940
- };
1941
- updatedAt: {
1942
- type: string;
1943
- format: string;
1944
- description: string;
1945
- };
2022
+ items: {
2023
+ $ref: string;
1946
2024
  };
1947
- required: string[];
1948
- description: string;
1949
2025
  };
1950
2026
  };
1951
- required: string[];
1952
2027
  };
1953
2028
  };
1954
2029
  };
@@ -1957,27 +2032,31 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1957
2032
  };
1958
2033
  };
1959
2034
  }, {
1960
- token: string;
1961
- user: better_auth_plugins.UserWithTwoFactor;
1962
- } | {
1963
- token: string;
1964
- user: Record<string, any> & {
1965
- id: string;
1966
- createdAt: Date;
1967
- updatedAt: Date;
1968
- email: string;
1969
- emailVerified: boolean;
1970
- name: string;
1971
- image?: string | null | undefined;
1972
- };
2035
+ sessions: better_auth_plugins.SessionWithImpersonatedBy[];
1973
2036
  }>;
1974
- generateTOTP: better_auth.StrictEndpoint<string, {
2037
+ unbanUser: better_auth.StrictEndpoint<"/admin/unban-user", {
1975
2038
  method: "POST";
1976
- body: zod.ZodObject<{
1977
- secret: zod.ZodString;
2039
+ body: z.ZodObject<{
2040
+ userId: z.ZodCoercedString<unknown>;
1978
2041
  }, zod_v4_core.$strip>;
2042
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2043
+ session: {
2044
+ user: better_auth_plugins.UserWithRole;
2045
+ session: {
2046
+ id: string;
2047
+ createdAt: Date;
2048
+ updatedAt: Date;
2049
+ userId: string;
2050
+ expiresAt: Date;
2051
+ token: string;
2052
+ ipAddress?: string | null | undefined;
2053
+ userAgent?: string | null | undefined;
2054
+ };
2055
+ };
2056
+ }>>[];
1979
2057
  metadata: {
1980
2058
  openapi: {
2059
+ operationId: string;
1981
2060
  summary: string;
1982
2061
  description: string;
1983
2062
  responses: {
@@ -1988,8 +2067,8 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
1988
2067
  schema: {
1989
2068
  type: "object";
1990
2069
  properties: {
1991
- code: {
1992
- type: string;
2070
+ user: {
2071
+ $ref: string;
1993
2072
  };
1994
2073
  };
1995
2074
  };
@@ -2000,13 +2079,19 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2000
2079
  };
2001
2080
  };
2002
2081
  }, {
2003
- code: string;
2082
+ user: better_auth_plugins.UserWithRole;
2004
2083
  }>;
2005
- getTOTPURI: better_auth.StrictEndpoint<"/two-factor/get-totp-uri", {
2084
+ banUser: better_auth.StrictEndpoint<"/admin/ban-user", {
2006
2085
  method: "POST";
2007
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2086
+ body: z.ZodObject<{
2087
+ userId: z.ZodCoercedString<unknown>;
2088
+ banReason: z.ZodOptional<z.ZodString>;
2089
+ banExpiresIn: z.ZodOptional<z.ZodNumber>;
2090
+ }, zod_v4_core.$strip>;
2091
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2008
2092
  session: {
2009
- session: Record<string, any> & {
2093
+ user: better_auth_plugins.UserWithRole;
2094
+ session: {
2010
2095
  id: string;
2011
2096
  createdAt: Date;
2012
2097
  updatedAt: Date;
@@ -2016,24 +2101,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2016
2101
  ipAddress?: string | null | undefined;
2017
2102
  userAgent?: string | null | undefined;
2018
2103
  };
2019
- user: Record<string, any> & {
2020
- id: string;
2021
- createdAt: Date;
2022
- updatedAt: Date;
2023
- email: string;
2024
- emailVerified: boolean;
2025
- name: string;
2026
- image?: string | null | undefined;
2027
- };
2028
2104
  };
2029
- }>)[];
2030
- body: zod.ZodObject<{
2031
- password: zod.ZodOptional<zod.ZodString>;
2032
- }, zod_v4_core.$strip> | zod.ZodObject<{
2033
- password: zod.ZodString;
2034
- }, zod_v4_core.$strip>;
2105
+ }>>[];
2035
2106
  metadata: {
2036
2107
  openapi: {
2108
+ operationId: string;
2037
2109
  summary: string;
2038
2110
  description: string;
2039
2111
  responses: {
@@ -2044,8 +2116,8 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2044
2116
  schema: {
2045
2117
  type: "object";
2046
2118
  properties: {
2047
- totpURI: {
2048
- type: string;
2119
+ user: {
2120
+ $ref: string;
2049
2121
  };
2050
2122
  };
2051
2123
  };
@@ -2056,16 +2128,31 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2056
2128
  };
2057
2129
  };
2058
2130
  }, {
2059
- totpURI: string;
2131
+ user: better_auth_plugins.UserWithRole;
2060
2132
  }>;
2061
- verifyTOTP: better_auth.StrictEndpoint<"/two-factor/verify-totp", {
2133
+ impersonateUser: better_auth.StrictEndpoint<"/admin/impersonate-user", {
2062
2134
  method: "POST";
2063
- body: zod.ZodObject<{
2064
- code: zod.ZodString;
2065
- trustDevice: zod.ZodOptional<zod.ZodBoolean>;
2135
+ body: z.ZodObject<{
2136
+ userId: z.ZodCoercedString<unknown>;
2066
2137
  }, zod_v4_core.$strip>;
2138
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2139
+ session: {
2140
+ user: better_auth_plugins.UserWithRole;
2141
+ session: {
2142
+ id: string;
2143
+ createdAt: Date;
2144
+ updatedAt: Date;
2145
+ userId: string;
2146
+ expiresAt: Date;
2147
+ token: string;
2148
+ ipAddress?: string | null | undefined;
2149
+ userAgent?: string | null | undefined;
2150
+ };
2151
+ };
2152
+ }>>[];
2067
2153
  metadata: {
2068
2154
  openapi: {
2155
+ operationId: string;
2069
2156
  summary: string;
2070
2157
  description: string;
2071
2158
  responses: {
@@ -2076,8 +2163,11 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2076
2163
  schema: {
2077
2164
  type: "object";
2078
2165
  properties: {
2079
- status: {
2080
- type: string;
2166
+ session: {
2167
+ $ref: string;
2168
+ };
2169
+ user: {
2170
+ $ref: string;
2081
2171
  };
2082
2172
  };
2083
2173
  };
@@ -2088,11 +2178,33 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2088
2178
  };
2089
2179
  };
2090
2180
  }, {
2091
- token: string;
2092
- user: better_auth_plugins.UserWithTwoFactor;
2093
- } | {
2094
- token: string;
2095
- user: Record<string, any> & {
2181
+ session: {
2182
+ id: string;
2183
+ createdAt: Date;
2184
+ updatedAt: Date;
2185
+ userId: string;
2186
+ expiresAt: Date;
2187
+ token: string;
2188
+ ipAddress?: string | null | undefined;
2189
+ userAgent?: string | null | undefined;
2190
+ };
2191
+ user: better_auth_plugins.UserWithRole;
2192
+ }>;
2193
+ stopImpersonating: better_auth.StrictEndpoint<"/admin/stop-impersonating", {
2194
+ method: "POST";
2195
+ requireHeaders: true;
2196
+ }, {
2197
+ session: {
2198
+ id: string;
2199
+ createdAt: Date;
2200
+ updatedAt: Date;
2201
+ userId: string;
2202
+ expiresAt: Date;
2203
+ token: string;
2204
+ ipAddress?: string | null | undefined;
2205
+ userAgent?: string | null | undefined;
2206
+ } & Record<string, any>;
2207
+ user: {
2096
2208
  id: string;
2097
2209
  createdAt: Date;
2098
2210
  updatedAt: Date;
@@ -2100,203 +2212,92 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2100
2212
  emailVerified: boolean;
2101
2213
  name: string;
2102
2214
  image?: string | null | undefined;
2103
- };
2215
+ } & Record<string, any>;
2104
2216
  }>;
2105
- };
2106
- options: NoInfer<O>;
2107
- hooks: {
2108
- after: {
2109
- matcher(context: better_auth.HookEndpointContext): boolean;
2110
- handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2111
- twoFactorRedirect: boolean;
2112
- twoFactorMethods: string[];
2113
- } | undefined>;
2114
- }[];
2115
- };
2116
- schema: {
2117
- user: {
2118
- fields: {
2119
- twoFactorEnabled: {
2120
- type: "boolean";
2121
- required: false;
2122
- defaultValue: false;
2123
- input: false;
2124
- };
2125
- };
2126
- };
2127
- twoFactor: {
2128
- fields: {
2129
- secret: {
2130
- type: "string";
2131
- required: true;
2132
- returned: false;
2133
- index: true;
2134
- };
2135
- backupCodes: {
2136
- type: "string";
2137
- required: true;
2138
- returned: false;
2139
- };
2140
- userId: {
2141
- type: "string";
2142
- required: true;
2143
- returned: false;
2144
- references: {
2145
- model: string;
2146
- field: string;
2217
+ revokeUserSession: better_auth.StrictEndpoint<"/admin/revoke-user-session", {
2218
+ method: "POST";
2219
+ body: z.ZodObject<{
2220
+ sessionToken: z.ZodString;
2221
+ }, zod_v4_core.$strip>;
2222
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2223
+ session: {
2224
+ user: better_auth_plugins.UserWithRole;
2225
+ session: {
2226
+ id: string;
2227
+ createdAt: Date;
2228
+ updatedAt: Date;
2229
+ userId: string;
2230
+ expiresAt: Date;
2231
+ token: string;
2232
+ ipAddress?: string | null | undefined;
2233
+ userAgent?: string | null | undefined;
2147
2234
  };
2148
- index: true;
2149
- };
2150
- verified: {
2151
- type: "boolean";
2152
- required: false;
2153
- defaultValue: true;
2154
- input: false;
2155
- };
2156
- failedVerificationCount: {
2157
- type: "number";
2158
- required: false;
2159
- defaultValue: number;
2160
- input: false;
2161
- returned: false;
2162
2235
  };
2163
- lockedUntil: {
2164
- type: "date";
2165
- required: false;
2166
- input: false;
2167
- returned: false;
2236
+ }>>[];
2237
+ metadata: {
2238
+ openapi: {
2239
+ operationId: string;
2240
+ summary: string;
2241
+ description: string;
2242
+ responses: {
2243
+ 200: {
2244
+ description: string;
2245
+ content: {
2246
+ "application/json": {
2247
+ schema: {
2248
+ type: "object";
2249
+ properties: {
2250
+ success: {
2251
+ type: string;
2252
+ };
2253
+ };
2254
+ };
2255
+ };
2256
+ };
2257
+ };
2258
+ };
2168
2259
  };
2169
2260
  };
2170
- };
2171
- };
2172
- rateLimit: {
2173
- pathMatcher(path: string): boolean;
2174
- window: number;
2175
- max: number;
2176
- }[];
2177
- $ERROR_CODES: {
2178
- OTP_NOT_ENABLED: better_auth.RawError<"OTP_NOT_ENABLED">;
2179
- OTP_HAS_EXPIRED: better_auth.RawError<"OTP_HAS_EXPIRED">;
2180
- TOTP_NOT_ENABLED: better_auth.RawError<"TOTP_NOT_ENABLED">;
2181
- TWO_FACTOR_NOT_ENABLED: better_auth.RawError<"TWO_FACTOR_NOT_ENABLED">;
2182
- BACKUP_CODES_NOT_ENABLED: better_auth.RawError<"BACKUP_CODES_NOT_ENABLED">;
2183
- INVALID_BACKUP_CODE: better_auth.RawError<"INVALID_BACKUP_CODE">;
2184
- INVALID_CODE: better_auth.RawError<"INVALID_CODE">;
2185
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: better_auth.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2186
- ACCOUNT_TEMPORARILY_LOCKED: better_auth.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
2187
- INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
2188
- };
2189
- })>;
2190
- atomListeners: {
2191
- matcher: (path: string) => boolean;
2192
- signal: "$sessionSignal";
2193
- }[];
2194
- pathMethods: {
2195
- "/two-factor/disable": "POST";
2196
- "/two-factor/enable": "POST";
2197
- "/two-factor/send-otp": "POST";
2198
- "/two-factor/generate-backup-codes": "POST";
2199
- "/two-factor/get-totp-uri": "POST";
2200
- "/two-factor/verify-totp": "POST";
2201
- "/two-factor/verify-otp": "POST";
2202
- "/two-factor/verify-backup-code": "POST";
2203
- };
2204
- fetchPlugins: {
2205
- id: string;
2206
- name: string;
2207
- hooks: {
2208
- onSuccess(context: better_auth_client.SuccessContext<any>): Promise<void>;
2209
- };
2210
- }[];
2211
- $ERROR_CODES: {
2212
- OTP_NOT_ENABLED: better_auth.RawError<"OTP_NOT_ENABLED">;
2213
- OTP_HAS_EXPIRED: better_auth.RawError<"OTP_HAS_EXPIRED">;
2214
- TOTP_NOT_ENABLED: better_auth.RawError<"TOTP_NOT_ENABLED">;
2215
- TWO_FACTOR_NOT_ENABLED: better_auth.RawError<"TWO_FACTOR_NOT_ENABLED">;
2216
- BACKUP_CODES_NOT_ENABLED: better_auth.RawError<"BACKUP_CODES_NOT_ENABLED">;
2217
- INVALID_BACKUP_CODE: better_auth.RawError<"INVALID_BACKUP_CODE">;
2218
- INVALID_CODE: better_auth.RawError<"INVALID_CODE">;
2219
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: better_auth.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2220
- ACCOUNT_TEMPORARILY_LOCKED: better_auth.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
2221
- INVALID_TWO_FACTOR_COOKIE: better_auth.RawError<"INVALID_TWO_FACTOR_COOKIE">;
2222
- };
2223
- } | {
2224
- id: "better-auth-client";
2225
- version: string;
2226
- $InferServerPlugin: ReturnType<(<O extends better_auth_plugins.JwtOptions>(options?: O) => {
2227
- id: "jwt";
2228
- version: string;
2229
- options: NoInfer<O>;
2230
- endpoints: {
2231
- getJwks: better_auth.StrictEndpoint<string, {
2232
- method: "GET";
2261
+ }, {
2262
+ success: boolean;
2263
+ }>;
2264
+ revokeUserSessions: better_auth.StrictEndpoint<"/admin/revoke-user-sessions", {
2265
+ method: "POST";
2266
+ body: z.ZodObject<{
2267
+ userId: z.ZodCoercedString<unknown>;
2268
+ }, zod_v4_core.$strip>;
2269
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2270
+ session: {
2271
+ user: better_auth_plugins.UserWithRole;
2272
+ session: {
2273
+ id: string;
2274
+ createdAt: Date;
2275
+ updatedAt: Date;
2276
+ userId: string;
2277
+ expiresAt: Date;
2278
+ token: string;
2279
+ ipAddress?: string | null | undefined;
2280
+ userAgent?: string | null | undefined;
2281
+ };
2282
+ };
2283
+ }>>[];
2233
2284
  metadata: {
2234
2285
  openapi: {
2235
2286
  operationId: string;
2287
+ summary: string;
2236
2288
  description: string;
2237
2289
  responses: {
2238
- "200": {
2290
+ 200: {
2239
2291
  description: string;
2240
2292
  content: {
2241
2293
  "application/json": {
2242
2294
  schema: {
2243
2295
  type: "object";
2244
2296
  properties: {
2245
- keys: {
2297
+ success: {
2246
2298
  type: string;
2247
- description: string;
2248
- items: {
2249
- type: string;
2250
- properties: {
2251
- kid: {
2252
- type: string;
2253
- description: string;
2254
- };
2255
- kty: {
2256
- type: string;
2257
- description: string;
2258
- };
2259
- alg: {
2260
- type: string;
2261
- description: string;
2262
- };
2263
- use: {
2264
- type: string;
2265
- description: string;
2266
- enum: string[];
2267
- nullable: boolean;
2268
- };
2269
- n: {
2270
- type: string;
2271
- description: string;
2272
- nullable: boolean;
2273
- };
2274
- e: {
2275
- type: string;
2276
- description: string;
2277
- nullable: boolean;
2278
- };
2279
- crv: {
2280
- type: string;
2281
- description: string;
2282
- nullable: boolean;
2283
- };
2284
- x: {
2285
- type: string;
2286
- description: string;
2287
- nullable: boolean;
2288
- };
2289
- y: {
2290
- type: string;
2291
- description: string;
2292
- nullable: boolean;
2293
- };
2294
- };
2295
- required: string[];
2296
- };
2297
2299
  };
2298
2300
  };
2299
- required: string[];
2300
2301
  };
2301
2302
  };
2302
2303
  };
@@ -2304,13 +2305,18 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2304
2305
  };
2305
2306
  };
2306
2307
  };
2307
- }, jose.JSONWebKeySet>;
2308
- getToken: better_auth.StrictEndpoint<"/token", {
2309
- method: "GET";
2310
- requireHeaders: true;
2311
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2308
+ }, {
2309
+ success: boolean;
2310
+ }>;
2311
+ removeUser: better_auth.StrictEndpoint<"/admin/remove-user", {
2312
+ method: "POST";
2313
+ body: z.ZodObject<{
2314
+ userId: z.ZodCoercedString<unknown>;
2315
+ }, zod_v4_core.$strip>;
2316
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2312
2317
  session: {
2313
- session: Record<string, any> & {
2318
+ user: better_auth_plugins.UserWithRole;
2319
+ session: {
2314
2320
  id: string;
2315
2321
  createdAt: Date;
2316
2322
  updatedAt: Date;
@@ -2320,20 +2326,12 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2320
2326
  ipAddress?: string | null | undefined;
2321
2327
  userAgent?: string | null | undefined;
2322
2328
  };
2323
- user: Record<string, any> & {
2324
- id: string;
2325
- createdAt: Date;
2326
- updatedAt: Date;
2327
- email: string;
2328
- emailVerified: boolean;
2329
- name: string;
2330
- image?: string | null | undefined;
2331
- };
2332
2329
  };
2333
- }>)[];
2330
+ }>>[];
2334
2331
  metadata: {
2335
2332
  openapi: {
2336
2333
  operationId: string;
2334
+ summary: string;
2337
2335
  description: string;
2338
2336
  responses: {
2339
2337
  200: {
@@ -2343,7 +2341,7 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2343
2341
  schema: {
2344
2342
  type: "object";
2345
2343
  properties: {
2346
- token: {
2344
+ success: {
2347
2345
  type: string;
2348
2346
  };
2349
2347
  };
@@ -2355,202 +2353,15 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2355
2353
  };
2356
2354
  };
2357
2355
  }, {
2358
- token: string;
2359
- }>;
2360
- signJWT: better_auth.StrictEndpoint<string, {
2361
- method: "POST";
2362
- metadata: {
2363
- $Infer: {
2364
- body: {
2365
- payload: jose.JWTPayload;
2366
- overrideOptions?: better_auth_plugins.JwtOptions | undefined;
2367
- };
2368
- };
2369
- };
2370
- body: zod.ZodObject<{
2371
- payload: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
2372
- overrideOptions: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
2373
- }, zod_v4_core.$strip>;
2374
- }, {
2375
- token: string;
2376
- }>;
2377
- verifyJWT: better_auth.StrictEndpoint<string, {
2378
- method: "POST";
2379
- metadata: {
2380
- $Infer: {
2381
- body: {
2382
- token: string;
2383
- issuer?: string;
2384
- };
2385
- response: {
2386
- payload: {
2387
- sub: string;
2388
- aud: string;
2389
- [key: string]: any;
2390
- } | null;
2391
- };
2392
- };
2393
- };
2394
- body: zod.ZodObject<{
2395
- token: zod.ZodString;
2396
- issuer: zod.ZodOptional<zod.ZodString>;
2397
- }, zod_v4_core.$strip>;
2398
- }, {
2399
- payload: (jose.JWTPayload & Required<Pick<jose.JWTPayload, "sub" | "aud">>) | null;
2356
+ success: boolean;
2400
2357
  }>;
2401
- };
2402
- hooks: {
2403
- after: {
2404
- matcher(context: better_auth.HookEndpointContext): boolean;
2405
- handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<void>;
2406
- }[];
2407
- };
2408
- schema: {
2409
- jwks: {
2410
- fields: {
2411
- publicKey: {
2412
- type: "string";
2413
- required: true;
2414
- };
2415
- privateKey: {
2416
- type: "string";
2417
- required: true;
2418
- };
2419
- createdAt: {
2420
- type: "date";
2421
- required: true;
2422
- };
2423
- expiresAt: {
2424
- type: "date";
2425
- required: false;
2426
- };
2427
- };
2428
- };
2429
- };
2430
- })>;
2431
- pathMethods: {
2432
- [x: string]: "GET";
2433
- };
2434
- getActions: ($fetch: better_auth_client.BetterFetch, _$store: better_auth.ClientStore, _options: better_auth.BetterAuthClientOptions | undefined) => {
2435
- jwks: (fetchOptions?: better_auth.ClientFetchOption) => Promise<{
2436
- data: null;
2437
- error: {
2438
- message?: string | undefined;
2439
- status: number;
2440
- statusText: string;
2441
- };
2442
- } | {
2443
- data: jose.JSONWebKeySet;
2444
- error: null;
2445
- }>;
2446
- };
2447
- } | {
2448
- id: "api-key";
2449
- version: string;
2450
- $InferServerPlugin: ReturnType<typeof _better_auth_api_key.apiKey>;
2451
- pathMethods: {
2452
- "/api-key/create": "POST";
2453
- "/api-key/delete": "POST";
2454
- "/api-key/delete-all-expired-api-keys": "POST";
2455
- };
2456
- $ERROR_CODES: {
2457
- INVALID_METADATA_TYPE: better_auth.RawError<"INVALID_METADATA_TYPE">;
2458
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: better_auth.RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
2459
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: better_auth.RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
2460
- USER_BANNED: better_auth.RawError<"USER_BANNED">;
2461
- UNAUTHORIZED_SESSION: better_auth.RawError<"UNAUTHORIZED_SESSION">;
2462
- KEY_NOT_FOUND: better_auth.RawError<"KEY_NOT_FOUND">;
2463
- KEY_DISABLED: better_auth.RawError<"KEY_DISABLED">;
2464
- KEY_EXPIRED: better_auth.RawError<"KEY_EXPIRED">;
2465
- USAGE_EXCEEDED: better_auth.RawError<"USAGE_EXCEEDED">;
2466
- KEY_NOT_RECOVERABLE: better_auth.RawError<"KEY_NOT_RECOVERABLE">;
2467
- EXPIRES_IN_IS_TOO_SMALL: better_auth.RawError<"EXPIRES_IN_IS_TOO_SMALL">;
2468
- EXPIRES_IN_IS_TOO_LARGE: better_auth.RawError<"EXPIRES_IN_IS_TOO_LARGE">;
2469
- INVALID_REMAINING: better_auth.RawError<"INVALID_REMAINING">;
2470
- INVALID_PREFIX_LENGTH: better_auth.RawError<"INVALID_PREFIX_LENGTH">;
2471
- INVALID_NAME_LENGTH: better_auth.RawError<"INVALID_NAME_LENGTH">;
2472
- METADATA_DISABLED: better_auth.RawError<"METADATA_DISABLED">;
2473
- RATE_LIMIT_EXCEEDED: better_auth.RawError<"RATE_LIMIT_EXCEEDED">;
2474
- NO_VALUES_TO_UPDATE: better_auth.RawError<"NO_VALUES_TO_UPDATE">;
2475
- KEY_DISABLED_EXPIRATION: better_auth.RawError<"KEY_DISABLED_EXPIRATION">;
2476
- INVALID_API_KEY: better_auth.RawError<"INVALID_API_KEY">;
2477
- INVALID_USER_ID_FROM_API_KEY: better_auth.RawError<"INVALID_USER_ID_FROM_API_KEY">;
2478
- INVALID_REFERENCE_ID_FROM_API_KEY: better_auth.RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
2479
- INVALID_API_KEY_GETTER_RETURN_TYPE: better_auth.RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
2480
- SERVER_ONLY_PROPERTY: better_auth.RawError<"SERVER_ONLY_PROPERTY">;
2481
- FAILED_TO_UPDATE_API_KEY: better_auth.RawError<"FAILED_TO_UPDATE_API_KEY">;
2482
- NAME_REQUIRED: better_auth.RawError<"NAME_REQUIRED">;
2483
- ORGANIZATION_ID_REQUIRED: better_auth.RawError<"ORGANIZATION_ID_REQUIRED">;
2484
- USER_NOT_MEMBER_OF_ORGANIZATION: better_auth.RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
2485
- INSUFFICIENT_API_KEY_PERMISSIONS: better_auth.RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
2486
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: better_auth.RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
2487
- ORGANIZATION_PLUGIN_REQUIRED: better_auth.RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
2488
- };
2489
- } | {
2490
- id: "admin-client";
2491
- version: string;
2492
- $InferServerPlugin: {
2493
- id: "admin";
2494
- version: string;
2495
- init(): {
2496
- options: {
2497
- databaseHooks: {
2498
- user: {
2499
- create: {
2500
- before(user: {
2501
- id: string;
2502
- createdAt: Date;
2503
- updatedAt: Date;
2504
- email: string;
2505
- emailVerified: boolean;
2506
- name: string;
2507
- image?: string | null | undefined;
2508
- } & Record<string, unknown>): Promise<{
2509
- data: {
2510
- id: string;
2511
- createdAt: Date;
2512
- updatedAt: Date;
2513
- email: string;
2514
- emailVerified: boolean;
2515
- name: string;
2516
- image?: string | null | undefined;
2517
- role: string;
2518
- };
2519
- }>;
2520
- };
2521
- };
2522
- session: {
2523
- create: {
2524
- before(session: {
2525
- id: string;
2526
- createdAt: Date;
2527
- updatedAt: Date;
2528
- userId: string;
2529
- expiresAt: Date;
2530
- token: string;
2531
- ipAddress?: string | null | undefined;
2532
- userAgent?: string | null | undefined;
2533
- } & Record<string, unknown>, ctx: better_auth.GenericEndpointContext | null): Promise<void>;
2534
- };
2535
- };
2536
- };
2537
- };
2538
- };
2539
- hooks: {
2540
- after: {
2541
- matcher(context: better_auth.HookEndpointContext): boolean;
2542
- handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<better_auth_plugins.SessionWithImpersonatedBy[] | undefined>;
2543
- }[];
2544
- };
2545
- endpoints: {
2546
- setRole: better_auth.StrictEndpoint<"/admin/set-role", {
2358
+ setUserPassword: better_auth.StrictEndpoint<"/admin/set-user-password", {
2547
2359
  method: "POST";
2548
- body: zod.ZodObject<{
2549
- userId: zod.ZodCoercedString<unknown>;
2550
- role: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodString>]>;
2360
+ body: z.ZodObject<{
2361
+ newPassword: z.ZodString;
2362
+ userId: z.ZodCoercedString<unknown>;
2551
2363
  }, zod_v4_core.$strip>;
2552
- requireHeaders: true;
2553
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2364
+ use: better_auth.Middleware<better_auth.MiddlewareOptions, (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2554
2365
  session: {
2555
2366
  user: better_auth_plugins.UserWithRole;
2556
2367
  session: {
@@ -2564,7 +2375,7 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2564
2375
  userAgent?: string | null | undefined;
2565
2376
  };
2566
2377
  };
2567
- }>)[];
2378
+ }>>[];
2568
2379
  metadata: {
2569
2380
  openapi: {
2570
2381
  operationId: string;
@@ -2578,661 +2389,8 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
2578
2389
  schema: {
2579
2390
  type: "object";
2580
2391
  properties: {
2581
- user: {
2582
- $ref: string;
2583
- };
2584
- };
2585
- };
2586
- };
2587
- };
2588
- };
2589
- };
2590
- };
2591
- $Infer: {
2592
- body: {
2593
- userId: string;
2594
- role: "admin" | "user" | ("admin" | "user")[];
2595
- };
2596
- };
2597
- };
2598
- }, {
2599
- user: better_auth_plugins.UserWithRole;
2600
- }>;
2601
- getUser: better_auth.StrictEndpoint<"/admin/get-user", {
2602
- method: "GET";
2603
- query: zod.ZodObject<{
2604
- id: zod.ZodString;
2605
- }, zod_v4_core.$strip>;
2606
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2607
- session: {
2608
- user: better_auth_plugins.UserWithRole;
2609
- session: {
2610
- id: string;
2611
- createdAt: Date;
2612
- updatedAt: Date;
2613
- userId: string;
2614
- expiresAt: Date;
2615
- token: string;
2616
- ipAddress?: string | null | undefined;
2617
- userAgent?: string | null | undefined;
2618
- };
2619
- };
2620
- }>)[];
2621
- metadata: {
2622
- openapi: {
2623
- operationId: string;
2624
- summary: string;
2625
- description: string;
2626
- responses: {
2627
- 200: {
2628
- description: string;
2629
- content: {
2630
- "application/json": {
2631
- schema: {
2632
- type: "object";
2633
- properties: {
2634
- user: {
2635
- $ref: string;
2636
- };
2637
- };
2638
- };
2639
- };
2640
- };
2641
- };
2642
- };
2643
- };
2644
- };
2645
- }, better_auth_plugins.UserWithRole>;
2646
- createUser: better_auth.StrictEndpoint<"/admin/create-user", {
2647
- method: "POST";
2648
- body: zod.ZodObject<{
2649
- email: zod.ZodString;
2650
- password: zod.ZodOptional<zod.ZodString>;
2651
- name: zod.ZodString;
2652
- role: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodString>]>>;
2653
- data: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
2654
- }, zod_v4_core.$strip>;
2655
- metadata: {
2656
- openapi: {
2657
- operationId: string;
2658
- summary: string;
2659
- description: string;
2660
- responses: {
2661
- 200: {
2662
- description: string;
2663
- content: {
2664
- "application/json": {
2665
- schema: {
2666
- type: "object";
2667
- properties: {
2668
- user: {
2669
- $ref: string;
2670
- };
2671
- };
2672
- };
2673
- };
2674
- };
2675
- };
2676
- };
2677
- };
2678
- $Infer: {
2679
- body: {
2680
- email: string;
2681
- password?: string | undefined;
2682
- name: string;
2683
- role?: "admin" | "user" | ("admin" | "user")[] | undefined;
2684
- data?: Record<string, any> | undefined;
2685
- };
2686
- };
2687
- };
2688
- }, {
2689
- user: better_auth_plugins.UserWithRole;
2690
- }>;
2691
- adminUpdateUser: better_auth.StrictEndpoint<"/admin/update-user", {
2692
- method: "POST";
2693
- body: zod.ZodObject<{
2694
- userId: zod.ZodCoercedString<unknown>;
2695
- data: zod.ZodRecord<zod.ZodAny, zod.ZodAny>;
2696
- }, zod_v4_core.$strip>;
2697
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2698
- session: {
2699
- user: better_auth_plugins.UserWithRole;
2700
- session: {
2701
- id: string;
2702
- createdAt: Date;
2703
- updatedAt: Date;
2704
- userId: string;
2705
- expiresAt: Date;
2706
- token: string;
2707
- ipAddress?: string | null | undefined;
2708
- userAgent?: string | null | undefined;
2709
- };
2710
- };
2711
- }>)[];
2712
- metadata: {
2713
- openapi: {
2714
- operationId: string;
2715
- summary: string;
2716
- description: string;
2717
- responses: {
2718
- 200: {
2719
- description: string;
2720
- content: {
2721
- "application/json": {
2722
- schema: {
2723
- type: "object";
2724
- properties: {
2725
- user: {
2726
- $ref: string;
2727
- };
2728
- };
2729
- };
2730
- };
2731
- };
2732
- };
2733
- };
2734
- };
2735
- };
2736
- }, better_auth_plugins.UserWithRole>;
2737
- listUsers: better_auth.StrictEndpoint<"/admin/list-users", {
2738
- method: "GET";
2739
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2740
- session: {
2741
- user: better_auth_plugins.UserWithRole;
2742
- session: {
2743
- id: string;
2744
- createdAt: Date;
2745
- updatedAt: Date;
2746
- userId: string;
2747
- expiresAt: Date;
2748
- token: string;
2749
- ipAddress?: string | null | undefined;
2750
- userAgent?: string | null | undefined;
2751
- };
2752
- };
2753
- }>)[];
2754
- query: zod.ZodObject<{
2755
- searchValue: zod.ZodOptional<zod.ZodString>;
2756
- searchField: zod.ZodOptional<zod.ZodEnum<{
2757
- email: "email";
2758
- name: "name";
2759
- }>>;
2760
- searchOperator: zod.ZodOptional<zod.ZodEnum<{
2761
- contains: "contains";
2762
- starts_with: "starts_with";
2763
- ends_with: "ends_with";
2764
- }>>;
2765
- limit: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>>;
2766
- offset: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>>;
2767
- sortBy: zod.ZodOptional<zod.ZodString>;
2768
- sortDirection: zod.ZodOptional<zod.ZodEnum<{
2769
- asc: "asc";
2770
- desc: "desc";
2771
- }>>;
2772
- filterField: zod.ZodOptional<zod.ZodString>;
2773
- filterValue: zod.ZodOptional<zod.ZodUnion<[zod.ZodUnion<[zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, zod.ZodBoolean]>, zod.ZodArray<zod.ZodString>]>, zod.ZodArray<zod.ZodNumber>]>>;
2774
- filterOperator: zod.ZodOptional<zod.ZodEnum<{
2775
- eq: "eq";
2776
- ne: "ne";
2777
- gt: "gt";
2778
- gte: "gte";
2779
- lt: "lt";
2780
- lte: "lte";
2781
- in: "in";
2782
- not_in: "not_in";
2783
- contains: "contains";
2784
- starts_with: "starts_with";
2785
- ends_with: "ends_with";
2786
- }>>;
2787
- }, zod_v4_core.$strip>;
2788
- metadata: {
2789
- openapi: {
2790
- operationId: string;
2791
- summary: string;
2792
- description: string;
2793
- responses: {
2794
- 200: {
2795
- description: string;
2796
- content: {
2797
- "application/json": {
2798
- schema: {
2799
- type: "object";
2800
- properties: {
2801
- users: {
2802
- type: string;
2803
- items: {
2804
- $ref: string;
2805
- };
2806
- };
2807
- total: {
2808
- type: string;
2809
- };
2810
- limit: {
2811
- type: string;
2812
- };
2813
- offset: {
2814
- type: string;
2815
- };
2816
- };
2817
- required: string[];
2818
- };
2819
- };
2820
- };
2821
- };
2822
- };
2823
- };
2824
- };
2825
- }, {
2826
- users: better_auth_plugins.UserWithRole[];
2827
- total: number;
2828
- }>;
2829
- listUserSessions: better_auth.StrictEndpoint<"/admin/list-user-sessions", {
2830
- method: "POST";
2831
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2832
- session: {
2833
- user: better_auth_plugins.UserWithRole;
2834
- session: {
2835
- id: string;
2836
- createdAt: Date;
2837
- updatedAt: Date;
2838
- userId: string;
2839
- expiresAt: Date;
2840
- token: string;
2841
- ipAddress?: string | null | undefined;
2842
- userAgent?: string | null | undefined;
2843
- };
2844
- };
2845
- }>)[];
2846
- body: zod.ZodObject<{
2847
- userId: zod.ZodCoercedString<unknown>;
2848
- }, zod_v4_core.$strip>;
2849
- metadata: {
2850
- openapi: {
2851
- operationId: string;
2852
- summary: string;
2853
- description: string;
2854
- responses: {
2855
- 200: {
2856
- description: string;
2857
- content: {
2858
- "application/json": {
2859
- schema: {
2860
- type: "object";
2861
- properties: {
2862
- sessions: {
2863
- type: string;
2864
- items: {
2865
- $ref: string;
2866
- };
2867
- };
2868
- };
2869
- };
2870
- };
2871
- };
2872
- };
2873
- };
2874
- };
2875
- };
2876
- }, {
2877
- sessions: better_auth_plugins.SessionWithImpersonatedBy[];
2878
- }>;
2879
- unbanUser: better_auth.StrictEndpoint<"/admin/unban-user", {
2880
- method: "POST";
2881
- body: zod.ZodObject<{
2882
- userId: zod.ZodCoercedString<unknown>;
2883
- }, zod_v4_core.$strip>;
2884
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2885
- session: {
2886
- user: better_auth_plugins.UserWithRole;
2887
- session: {
2888
- id: string;
2889
- createdAt: Date;
2890
- updatedAt: Date;
2891
- userId: string;
2892
- expiresAt: Date;
2893
- token: string;
2894
- ipAddress?: string | null | undefined;
2895
- userAgent?: string | null | undefined;
2896
- };
2897
- };
2898
- }>)[];
2899
- metadata: {
2900
- openapi: {
2901
- operationId: string;
2902
- summary: string;
2903
- description: string;
2904
- responses: {
2905
- 200: {
2906
- description: string;
2907
- content: {
2908
- "application/json": {
2909
- schema: {
2910
- type: "object";
2911
- properties: {
2912
- user: {
2913
- $ref: string;
2914
- };
2915
- };
2916
- };
2917
- };
2918
- };
2919
- };
2920
- };
2921
- };
2922
- };
2923
- }, {
2924
- user: better_auth_plugins.UserWithRole;
2925
- }>;
2926
- banUser: better_auth.StrictEndpoint<"/admin/ban-user", {
2927
- method: "POST";
2928
- body: zod.ZodObject<{
2929
- userId: zod.ZodCoercedString<unknown>;
2930
- banReason: zod.ZodOptional<zod.ZodString>;
2931
- banExpiresIn: zod.ZodOptional<zod.ZodNumber>;
2932
- }, zod_v4_core.$strip>;
2933
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2934
- session: {
2935
- user: better_auth_plugins.UserWithRole;
2936
- session: {
2937
- id: string;
2938
- createdAt: Date;
2939
- updatedAt: Date;
2940
- userId: string;
2941
- expiresAt: Date;
2942
- token: string;
2943
- ipAddress?: string | null | undefined;
2944
- userAgent?: string | null | undefined;
2945
- };
2946
- };
2947
- }>)[];
2948
- metadata: {
2949
- openapi: {
2950
- operationId: string;
2951
- summary: string;
2952
- description: string;
2953
- responses: {
2954
- 200: {
2955
- description: string;
2956
- content: {
2957
- "application/json": {
2958
- schema: {
2959
- type: "object";
2960
- properties: {
2961
- user: {
2962
- $ref: string;
2963
- };
2964
- };
2965
- };
2966
- };
2967
- };
2968
- };
2969
- };
2970
- };
2971
- };
2972
- }, {
2973
- user: better_auth_plugins.UserWithRole;
2974
- }>;
2975
- impersonateUser: better_auth.StrictEndpoint<"/admin/impersonate-user", {
2976
- method: "POST";
2977
- body: zod.ZodObject<{
2978
- userId: zod.ZodCoercedString<unknown>;
2979
- }, zod_v4_core.$strip>;
2980
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
2981
- session: {
2982
- user: better_auth_plugins.UserWithRole;
2983
- session: {
2984
- id: string;
2985
- createdAt: Date;
2986
- updatedAt: Date;
2987
- userId: string;
2988
- expiresAt: Date;
2989
- token: string;
2990
- ipAddress?: string | null | undefined;
2991
- userAgent?: string | null | undefined;
2992
- };
2993
- };
2994
- }>)[];
2995
- metadata: {
2996
- openapi: {
2997
- operationId: string;
2998
- summary: string;
2999
- description: string;
3000
- responses: {
3001
- 200: {
3002
- description: string;
3003
- content: {
3004
- "application/json": {
3005
- schema: {
3006
- type: "object";
3007
- properties: {
3008
- session: {
3009
- $ref: string;
3010
- };
3011
- user: {
3012
- $ref: string;
3013
- };
3014
- };
3015
- };
3016
- };
3017
- };
3018
- };
3019
- };
3020
- };
3021
- };
3022
- }, {
3023
- session: {
3024
- id: string;
3025
- createdAt: Date;
3026
- updatedAt: Date;
3027
- userId: string;
3028
- expiresAt: Date;
3029
- token: string;
3030
- ipAddress?: string | null | undefined;
3031
- userAgent?: string | null | undefined;
3032
- };
3033
- user: better_auth_plugins.UserWithRole;
3034
- }>;
3035
- stopImpersonating: better_auth.StrictEndpoint<"/admin/stop-impersonating", {
3036
- method: "POST";
3037
- requireHeaders: true;
3038
- }, {
3039
- session: {
3040
- id: string;
3041
- createdAt: Date;
3042
- updatedAt: Date;
3043
- userId: string;
3044
- expiresAt: Date;
3045
- token: string;
3046
- ipAddress?: string | null | undefined;
3047
- userAgent?: string | null | undefined;
3048
- } & Record<string, any>;
3049
- user: {
3050
- id: string;
3051
- createdAt: Date;
3052
- updatedAt: Date;
3053
- email: string;
3054
- emailVerified: boolean;
3055
- name: string;
3056
- image?: string | null | undefined;
3057
- } & Record<string, any>;
3058
- }>;
3059
- revokeUserSession: better_auth.StrictEndpoint<"/admin/revoke-user-session", {
3060
- method: "POST";
3061
- body: zod.ZodObject<{
3062
- sessionToken: zod.ZodString;
3063
- }, zod_v4_core.$strip>;
3064
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3065
- session: {
3066
- user: better_auth_plugins.UserWithRole;
3067
- session: {
3068
- id: string;
3069
- createdAt: Date;
3070
- updatedAt: Date;
3071
- userId: string;
3072
- expiresAt: Date;
3073
- token: string;
3074
- ipAddress?: string | null | undefined;
3075
- userAgent?: string | null | undefined;
3076
- };
3077
- };
3078
- }>)[];
3079
- metadata: {
3080
- openapi: {
3081
- operationId: string;
3082
- summary: string;
3083
- description: string;
3084
- responses: {
3085
- 200: {
3086
- description: string;
3087
- content: {
3088
- "application/json": {
3089
- schema: {
3090
- type: "object";
3091
- properties: {
3092
- success: {
3093
- type: string;
3094
- };
3095
- };
3096
- };
3097
- };
3098
- };
3099
- };
3100
- };
3101
- };
3102
- };
3103
- }, {
3104
- success: boolean;
3105
- }>;
3106
- revokeUserSessions: better_auth.StrictEndpoint<"/admin/revoke-user-sessions", {
3107
- method: "POST";
3108
- body: zod.ZodObject<{
3109
- userId: zod.ZodCoercedString<unknown>;
3110
- }, zod_v4_core.$strip>;
3111
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3112
- session: {
3113
- user: better_auth_plugins.UserWithRole;
3114
- session: {
3115
- id: string;
3116
- createdAt: Date;
3117
- updatedAt: Date;
3118
- userId: string;
3119
- expiresAt: Date;
3120
- token: string;
3121
- ipAddress?: string | null | undefined;
3122
- userAgent?: string | null | undefined;
3123
- };
3124
- };
3125
- }>)[];
3126
- metadata: {
3127
- openapi: {
3128
- operationId: string;
3129
- summary: string;
3130
- description: string;
3131
- responses: {
3132
- 200: {
3133
- description: string;
3134
- content: {
3135
- "application/json": {
3136
- schema: {
3137
- type: "object";
3138
- properties: {
3139
- success: {
3140
- type: string;
3141
- };
3142
- };
3143
- };
3144
- };
3145
- };
3146
- };
3147
- };
3148
- };
3149
- };
3150
- }, {
3151
- success: boolean;
3152
- }>;
3153
- removeUser: better_auth.StrictEndpoint<"/admin/remove-user", {
3154
- method: "POST";
3155
- body: zod.ZodObject<{
3156
- userId: zod.ZodCoercedString<unknown>;
3157
- }, zod_v4_core.$strip>;
3158
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3159
- session: {
3160
- user: better_auth_plugins.UserWithRole;
3161
- session: {
3162
- id: string;
3163
- createdAt: Date;
3164
- updatedAt: Date;
3165
- userId: string;
3166
- expiresAt: Date;
3167
- token: string;
3168
- ipAddress?: string | null | undefined;
3169
- userAgent?: string | null | undefined;
3170
- };
3171
- };
3172
- }>)[];
3173
- metadata: {
3174
- openapi: {
3175
- operationId: string;
3176
- summary: string;
3177
- description: string;
3178
- responses: {
3179
- 200: {
3180
- description: string;
3181
- content: {
3182
- "application/json": {
3183
- schema: {
3184
- type: "object";
3185
- properties: {
3186
- success: {
3187
- type: string;
3188
- };
3189
- };
3190
- };
3191
- };
3192
- };
3193
- };
3194
- };
3195
- };
3196
- };
3197
- }, {
3198
- success: boolean;
3199
- }>;
3200
- setUserPassword: better_auth.StrictEndpoint<"/admin/set-user-password", {
3201
- method: "POST";
3202
- body: zod.ZodObject<{
3203
- newPassword: zod.ZodString;
3204
- userId: zod.ZodCoercedString<unknown>;
3205
- }, zod_v4_core.$strip>;
3206
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
3207
- session: {
3208
- user: better_auth_plugins.UserWithRole;
3209
- session: {
3210
- id: string;
3211
- createdAt: Date;
3212
- updatedAt: Date;
3213
- userId: string;
3214
- expiresAt: Date;
3215
- token: string;
3216
- ipAddress?: string | null | undefined;
3217
- userAgent?: string | null | undefined;
3218
- };
3219
- };
3220
- }>)[];
3221
- metadata: {
3222
- openapi: {
3223
- operationId: string;
3224
- summary: string;
3225
- description: string;
3226
- responses: {
3227
- 200: {
3228
- description: string;
3229
- content: {
3230
- "application/json": {
3231
- schema: {
3232
- type: "object";
3233
- properties: {
3234
- status: {
3235
- type: string;
2392
+ status: {
2393
+ type: string;
3236
2394
  };
3237
2395
  };
3238
2396
  };
@@ -3247,13 +2405,13 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3247
2405
  }>;
3248
2406
  userHasPermission: better_auth.StrictEndpoint<"/admin/has-permission", {
3249
2407
  method: "POST";
3250
- body: zod.ZodIntersection<zod.ZodObject<{
3251
- userId: zod.ZodOptional<zod.ZodCoercedString<unknown>>;
3252
- role: zod.ZodOptional<zod.ZodString>;
3253
- }, zod_v4_core.$strip>, zod.ZodXor<readonly [zod.ZodObject<{
3254
- permission: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString>>;
3255
- }, zod_v4_core.$strip>, zod.ZodObject<{
3256
- permissions: zod.ZodRecord<zod.ZodString, zod.ZodArray<zod.ZodString>>;
2408
+ body: z.ZodIntersection<z.ZodObject<{
2409
+ userId: z.ZodOptional<z.ZodCoercedString<unknown>>;
2410
+ role: z.ZodOptional<z.ZodString>;
2411
+ }, zod_v4_core.$strip>, z.ZodXor<readonly [z.ZodObject<{
2412
+ permission: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
2413
+ }, zod_v4_core.$strip>, z.ZodObject<{
2414
+ permissions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
3257
2415
  }, zod_v4_core.$strip>]>>;
3258
2416
  metadata: {
3259
2417
  openapi: {
@@ -3569,82 +2727,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3569
2727
  error: {
3570
2728
  message?: string | undefined;
3571
2729
  status: number;
3572
- statusText: string;
3573
- };
3574
- }>;
3575
- completeAuthorizationFlow: (code: string, codeVerifier: string) => Promise<{
3576
- data: null;
3577
- error: {
3578
- message?: string | undefined;
3579
- status: number;
3580
- statusText: string;
3581
- };
3582
- } | {
3583
- data: CompleteAuthorizationFlowResponse;
3584
- error: null;
3585
- }>;
3586
- refreshAccessToken: (refreshToken: string) => Promise<{
3587
- data: null;
3588
- error: {
3589
- message?: string | undefined;
3590
- status: number;
3591
- statusText: string;
3592
- };
3593
- } | {
3594
- data: CompleteAuthorizationFlowResponse;
3595
- error: null;
3596
- }>;
3597
- whoAmI: (accessToken: string, options?: WhoAmIOptions) => Promise<{
3598
- data: null;
3599
- error: {
3600
- message?: string | undefined;
3601
- status: number;
3602
- statusText: string;
3603
- };
3604
- } | {
3605
- data: WhoAmIResponse;
3606
- error: null;
3607
- }>;
3608
- switchOrganization: (organizationId: string, accessToken: string) => Promise<{
3609
- data: null;
3610
- error: {
3611
- message?: string | undefined;
3612
- status: number;
3613
- statusText: string;
3614
- };
3615
- } | {
3616
- data: CompleteAuthorizationFlowResponse;
3617
- error: null;
3618
- }>;
3619
- logout: (refreshToken: string) => Promise<{
3620
- data: null;
3621
- error: {
3622
- message?: string | undefined;
3623
- status: number;
3624
- statusText: string;
3625
- };
3626
- } | {
3627
- data: void;
3628
- error: null;
3629
- }>;
3630
- listApplicationRoles: () => Promise<{
3631
- data: null;
3632
- error: {
3633
- message?: string | undefined;
3634
- status: number;
3635
- statusText: string;
3636
- };
3637
- } | {
3638
- data: ApplicationRole[];
3639
- error: null;
2730
+ statusText: string;
2731
+ };
3640
2732
  }>;
3641
- };
3642
- };
3643
- } | {
3644
- id: "session-assurance";
3645
- getActions: ($fetch: better_auth_client.BetterFetch) => {
3646
- sessionAssurance: {
3647
- getSessionAssurance: () => Promise<{
2733
+ completeAuthorizationFlow: (code: string, codeVerifier: string) => Promise<{
3648
2734
  data: null;
3649
2735
  error: {
3650
2736
  message?: string | undefined;
@@ -3652,12 +2738,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3652
2738
  statusText: string;
3653
2739
  };
3654
2740
  } | {
3655
- data: unknown;
2741
+ data: CompleteAuthorizationFlowResponse;
3656
2742
  error: null;
3657
2743
  }>;
3658
- stepUpWithPassword: (body: {
3659
- password: string;
3660
- }) => Promise<{
2744
+ refreshAccessToken: (refreshToken: string) => Promise<{
3661
2745
  data: null;
3662
2746
  error: {
3663
2747
  message?: string | undefined;
@@ -3665,10 +2749,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3665
2749
  statusText: string;
3666
2750
  };
3667
2751
  } | {
3668
- data: unknown;
2752
+ data: CompleteAuthorizationFlowResponse;
3669
2753
  error: null;
3670
2754
  }>;
3671
- sendOtp: () => Promise<{
2755
+ whoAmI: (accessToken: string, options?: WhoAmIOptions) => Promise<{
3672
2756
  data: null;
3673
2757
  error: {
3674
2758
  message?: string | undefined;
@@ -3676,12 +2760,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3676
2760
  statusText: string;
3677
2761
  };
3678
2762
  } | {
3679
- data: unknown;
2763
+ data: WhoAmIResponse;
3680
2764
  error: null;
3681
2765
  }>;
3682
- verifyOtp: (body: {
3683
- otp: string;
3684
- }) => Promise<{
2766
+ switchOrganization: (organizationId: string, accessToken: string) => Promise<{
3685
2767
  data: null;
3686
2768
  error: {
3687
2769
  message?: string | undefined;
@@ -3689,13 +2771,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3689
2771
  statusText: string;
3690
2772
  };
3691
2773
  } | {
3692
- data: unknown;
2774
+ data: CompleteAuthorizationFlowResponse;
3693
2775
  error: null;
3694
2776
  }>;
3695
- beginOAuthStepUp: (body: {
3696
- provider: OAuthStepUpProvider;
3697
- returnUrl?: string;
3698
- }) => Promise<{
2777
+ logout: (refreshToken: string) => Promise<{
3699
2778
  data: null;
3700
2779
  error: {
3701
2780
  message?: string | undefined;
@@ -3703,12 +2782,10 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3703
2782
  statusText: string;
3704
2783
  };
3705
2784
  } | {
3706
- data: unknown;
2785
+ data: void;
3707
2786
  error: null;
3708
2787
  }>;
3709
- completeOAuthStepUp: (body: {
3710
- stepUpToken: string;
3711
- }) => Promise<{
2788
+ listApplicationRoles: () => Promise<{
3712
2789
  data: null;
3713
2790
  error: {
3714
2791
  message?: string | undefined;
@@ -3716,16 +2793,16 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3716
2793
  statusText: string;
3717
2794
  };
3718
2795
  } | {
3719
- data: unknown;
2796
+ data: ApplicationRole[];
3720
2797
  error: null;
3721
2798
  }>;
3722
2799
  };
3723
2800
  };
3724
2801
  } | {
3725
- id: "login-methods";
2802
+ id: "session-assurance";
3726
2803
  getActions: ($fetch: better_auth_client.BetterFetch) => {
3727
- loginMethods: {
3728
- get: () => Promise<{
2804
+ sessionAssurance: {
2805
+ getSessionAssurance: () => Promise<{
3729
2806
  data: null;
3730
2807
  error: {
3731
2808
  message?: string | undefined;
@@ -3733,547 +2810,96 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
3733
2810
  statusText: string;
3734
2811
  };
3735
2812
  } | {
3736
- data: LoginMethodsResponse;
2813
+ data: unknown;
3737
2814
  error: null;
3738
2815
  }>;
3739
- };
3740
- };
3741
- } | {
3742
- id: "email-otp";
3743
- version: string;
3744
- $InferServerPlugin: ReturnType<(options: better_auth_plugins.EmailOTPOptions) => {
3745
- id: "email-otp";
3746
- version: string;
3747
- init(ctx: better_auth.AuthContext): {
3748
- options: {
3749
- emailVerification: {
3750
- sendVerificationEmail(data: {
3751
- user: better_auth.User;
3752
- url: string;
3753
- token: string;
3754
- }, request: Request | undefined): Promise<void>;
3755
- };
3756
- };
3757
- } | undefined;
3758
- endpoints: {
3759
- sendVerificationOTP: better_auth.StrictEndpoint<"/email-otp/send-verification-otp", {
3760
- method: "POST";
3761
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<void>)[];
3762
- body: zod.ZodObject<{
3763
- email: zod.ZodString;
3764
- type: zod.ZodEnum<{
3765
- "sign-in": "sign-in";
3766
- "change-email": "change-email";
3767
- "email-verification": "email-verification";
3768
- "forget-password": "forget-password";
3769
- }>;
3770
- }, zod_v4_core.$strip>;
3771
- metadata: {
3772
- openapi: {
3773
- operationId: string;
3774
- description: string;
3775
- responses: {
3776
- 200: {
3777
- description: string;
3778
- content: {
3779
- "application/json": {
3780
- schema: {
3781
- type: "object";
3782
- properties: {
3783
- success: {
3784
- type: string;
3785
- };
3786
- };
3787
- };
3788
- };
3789
- };
3790
- };
3791
- };
3792
- };
3793
- };
3794
- }, {
3795
- success: boolean;
3796
- }>;
3797
- createVerificationOTP: better_auth.StrictEndpoint<string, {
3798
- method: "POST";
3799
- body: zod.ZodObject<{
3800
- email: zod.ZodString;
3801
- type: zod.ZodEnum<{
3802
- "sign-in": "sign-in";
3803
- "change-email": "change-email";
3804
- "email-verification": "email-verification";
3805
- "forget-password": "forget-password";
3806
- }>;
3807
- }, zod_v4_core.$strip>;
3808
- metadata: {
3809
- openapi: {
3810
- operationId: string;
3811
- description: string;
3812
- responses: {
3813
- 200: {
3814
- description: string;
3815
- content: {
3816
- "application/json": {
3817
- schema: {
3818
- type: "string";
3819
- };
3820
- };
3821
- };
3822
- };
3823
- };
3824
- };
3825
- };
3826
- }, string>;
3827
- getVerificationOTP: better_auth.StrictEndpoint<string, {
3828
- method: "GET";
3829
- query: zod.ZodObject<{
3830
- email: zod.ZodString;
3831
- type: zod.ZodEnum<{
3832
- "sign-in": "sign-in";
3833
- "change-email": "change-email";
3834
- "email-verification": "email-verification";
3835
- "forget-password": "forget-password";
3836
- }>;
3837
- }, zod_v4_core.$strip>;
3838
- metadata: {
3839
- openapi: {
3840
- operationId: string;
3841
- description: string;
3842
- responses: {
3843
- "200": {
3844
- description: string;
3845
- content: {
3846
- "application/json": {
3847
- schema: {
3848
- type: "object";
3849
- properties: {
3850
- otp: {
3851
- type: string;
3852
- nullable: boolean;
3853
- description: string;
3854
- };
3855
- };
3856
- required: string[];
3857
- };
3858
- };
3859
- };
3860
- };
3861
- };
3862
- };
3863
- };
3864
- }, {
3865
- otp: null;
3866
- } | {
3867
- otp: string;
3868
- }>;
3869
- checkVerificationOTP: better_auth.StrictEndpoint<"/email-otp/check-verification-otp", {
3870
- method: "POST";
3871
- body: zod.ZodObject<{
3872
- email: zod.ZodString;
3873
- type: zod.ZodEnum<{
3874
- "sign-in": "sign-in";
3875
- "change-email": "change-email";
3876
- "email-verification": "email-verification";
3877
- "forget-password": "forget-password";
3878
- }>;
3879
- otp: zod.ZodString;
3880
- }, zod_v4_core.$strip>;
3881
- metadata: {
3882
- openapi: {
3883
- operationId: string;
3884
- description: string;
3885
- responses: {
3886
- 200: {
3887
- description: string;
3888
- content: {
3889
- "application/json": {
3890
- schema: {
3891
- type: "object";
3892
- properties: {
3893
- success: {
3894
- type: string;
3895
- };
3896
- };
3897
- };
3898
- };
3899
- };
3900
- };
3901
- };
3902
- };
3903
- };
3904
- }, {
3905
- success: boolean;
3906
- }>;
3907
- verifyEmailOTP: better_auth.StrictEndpoint<"/email-otp/verify-email", {
3908
- method: "POST";
3909
- body: zod.ZodObject<{
3910
- email: zod.ZodString;
3911
- otp: zod.ZodString;
3912
- }, zod_v4_core.$strip>;
3913
- metadata: {
3914
- openapi: {
3915
- description: string;
3916
- responses: {
3917
- 200: {
3918
- description: string;
3919
- content: {
3920
- "application/json": {
3921
- schema: {
3922
- type: "object";
3923
- properties: {
3924
- status: {
3925
- type: string;
3926
- description: string;
3927
- enum: boolean[];
3928
- };
3929
- token: {
3930
- type: string;
3931
- nullable: boolean;
3932
- description: string;
3933
- };
3934
- user: {
3935
- $ref: string;
3936
- };
3937
- };
3938
- required: string[];
3939
- };
3940
- };
3941
- };
3942
- };
3943
- };
3944
- };
3945
- };
3946
- }, {
3947
- status: boolean;
3948
- token: string;
3949
- user: {
3950
- id: string;
3951
- createdAt: Date;
3952
- updatedAt: Date;
3953
- email: string;
3954
- emailVerified: boolean;
3955
- name: string;
3956
- image?: string | null | undefined;
3957
- } & Record<string, any>;
3958
- } | {
3959
- status: boolean;
3960
- token: null;
3961
- user: {
3962
- id: string;
3963
- createdAt: Date;
3964
- updatedAt: Date;
3965
- email: string;
3966
- emailVerified: boolean;
3967
- name: string;
3968
- image?: string | null | undefined;
3969
- } & Record<string, any>;
3970
- }>;
3971
- signInEmailOTP: better_auth.StrictEndpoint<"/sign-in/email-otp", {
3972
- method: "POST";
3973
- body: zod.ZodIntersection<zod.ZodObject<{
3974
- email: zod.ZodString;
3975
- otp: zod.ZodString;
3976
- name: zod.ZodOptional<zod.ZodString>;
3977
- image: zod.ZodOptional<zod.ZodString>;
3978
- }, zod_v4_core.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
3979
- metadata: {
3980
- openapi: {
3981
- operationId: string;
3982
- description: string;
3983
- responses: {
3984
- 200: {
3985
- description: string;
3986
- content: {
3987
- "application/json": {
3988
- schema: {
3989
- type: "object";
3990
- properties: {
3991
- token: {
3992
- type: string;
3993
- description: string;
3994
- };
3995
- user: {
3996
- $ref: string;
3997
- };
3998
- };
3999
- required: string[];
4000
- };
4001
- };
4002
- };
4003
- };
4004
- };
4005
- };
4006
- };
4007
- }, {
4008
- token: string;
4009
- user: {
4010
- id: string;
4011
- createdAt: Date;
4012
- updatedAt: Date;
4013
- email: string;
4014
- emailVerified: boolean;
4015
- name: string;
4016
- image?: string | null | undefined;
2816
+ stepUpWithPassword: (body: {
2817
+ password: string;
2818
+ }) => Promise<{
2819
+ data: null;
2820
+ error: {
2821
+ message?: string | undefined;
2822
+ status: number;
2823
+ statusText: string;
4017
2824
  };
2825
+ } | {
2826
+ data: unknown;
2827
+ error: null;
4018
2828
  }>;
4019
- requestPasswordResetEmailOTP: better_auth.StrictEndpoint<"/email-otp/request-password-reset", {
4020
- method: "POST";
4021
- body: zod.ZodObject<{
4022
- email: zod.ZodString;
4023
- }, zod_v4_core.$strip>;
4024
- metadata: {
4025
- openapi: {
4026
- operationId: string;
4027
- description: string;
4028
- responses: {
4029
- 200: {
4030
- description: string;
4031
- content: {
4032
- "application/json": {
4033
- schema: {
4034
- type: "object";
4035
- properties: {
4036
- success: {
4037
- type: string;
4038
- description: string;
4039
- };
4040
- };
4041
- };
4042
- };
4043
- };
4044
- };
4045
- };
4046
- };
2829
+ sendOtp: () => Promise<{
2830
+ data: null;
2831
+ error: {
2832
+ message?: string | undefined;
2833
+ status: number;
2834
+ statusText: string;
4047
2835
  };
4048
- }, {
4049
- success: boolean;
2836
+ } | {
2837
+ data: unknown;
2838
+ error: null;
4050
2839
  }>;
4051
- forgetPasswordEmailOTP: better_auth.StrictEndpoint<"/forget-password/email-otp", {
4052
- method: "POST";
4053
- body: zod.ZodObject<{
4054
- email: zod.ZodString;
4055
- }, zod_v4_core.$strip>;
4056
- metadata: {
4057
- openapi: {
4058
- operationId: string;
4059
- description: string;
4060
- responses: {
4061
- 200: {
4062
- description: string;
4063
- content: {
4064
- "application/json": {
4065
- schema: {
4066
- type: "object";
4067
- properties: {
4068
- success: {
4069
- type: string;
4070
- description: string;
4071
- };
4072
- };
4073
- };
4074
- };
4075
- };
4076
- };
4077
- };
4078
- };
2840
+ verifyOtp: (body: {
2841
+ otp: string;
2842
+ }) => Promise<{
2843
+ data: null;
2844
+ error: {
2845
+ message?: string | undefined;
2846
+ status: number;
2847
+ statusText: string;
4079
2848
  };
4080
- }, {
4081
- success: boolean;
2849
+ } | {
2850
+ data: unknown;
2851
+ error: null;
4082
2852
  }>;
4083
- resetPasswordEmailOTP: better_auth.StrictEndpoint<"/email-otp/reset-password", {
4084
- method: "POST";
4085
- body: zod.ZodObject<{
4086
- email: zod.ZodString;
4087
- otp: zod.ZodString;
4088
- password: zod.ZodString;
4089
- }, zod_v4_core.$strip>;
4090
- metadata: {
4091
- openapi: {
4092
- operationId: string;
4093
- description: string;
4094
- responses: {
4095
- 200: {
4096
- description: string;
4097
- content: {
4098
- "application/json": {
4099
- schema: {
4100
- type: "object";
4101
- properties: {
4102
- success: {
4103
- type: string;
4104
- };
4105
- };
4106
- };
4107
- };
4108
- };
4109
- };
4110
- };
4111
- };
2853
+ beginOAuthStepUp: (body: {
2854
+ provider: OAuthStepUpProvider;
2855
+ returnUrl?: string;
2856
+ }) => Promise<{
2857
+ data: null;
2858
+ error: {
2859
+ message?: string | undefined;
2860
+ status: number;
2861
+ statusText: string;
4112
2862
  };
4113
- }, {
4114
- success: boolean;
2863
+ } | {
2864
+ data: unknown;
2865
+ error: null;
4115
2866
  }>;
4116
- requestEmailChangeEmailOTP: better_auth.StrictEndpoint<"/email-otp/request-email-change", {
4117
- method: "POST";
4118
- body: zod.ZodObject<{
4119
- newEmail: zod.ZodString;
4120
- otp: zod.ZodOptional<zod.ZodString>;
4121
- }, zod_v4_core.$strip>;
4122
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
4123
- session: {
4124
- session: Record<string, any> & {
4125
- id: string;
4126
- createdAt: Date;
4127
- updatedAt: Date;
4128
- userId: string;
4129
- expiresAt: Date;
4130
- token: string;
4131
- ipAddress?: string | null | undefined;
4132
- userAgent?: string | null | undefined;
4133
- };
4134
- user: Record<string, any> & {
4135
- id: string;
4136
- createdAt: Date;
4137
- updatedAt: Date;
4138
- email: string;
4139
- emailVerified: boolean;
4140
- name: string;
4141
- image?: string | null | undefined;
4142
- };
4143
- };
4144
- }>)[];
4145
- metadata: {
4146
- openapi: {
4147
- operationId: string;
4148
- description: string;
4149
- responses: {
4150
- 200: {
4151
- description: string;
4152
- content: {
4153
- "application/json": {
4154
- schema: {
4155
- type: "object";
4156
- properties: {
4157
- success: {
4158
- type: string;
4159
- };
4160
- };
4161
- };
4162
- };
4163
- };
4164
- };
4165
- };
4166
- };
2867
+ completeOAuthStepUp: (body: {
2868
+ stepUpToken: string;
2869
+ }) => Promise<{
2870
+ data: null;
2871
+ error: {
2872
+ message?: string | undefined;
2873
+ status: number;
2874
+ statusText: string;
4167
2875
  };
4168
- }, {
4169
- success: boolean;
2876
+ } | {
2877
+ data: unknown;
2878
+ error: null;
4170
2879
  }>;
4171
- changeEmailEmailOTP: better_auth.StrictEndpoint<"/email-otp/change-email", {
4172
- method: "POST";
4173
- body: zod.ZodObject<{
4174
- newEmail: zod.ZodString;
4175
- otp: zod.ZodString;
4176
- }, zod_v4_core.$strip>;
4177
- use: ((inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<{
4178
- session: {
4179
- session: Record<string, any> & {
4180
- id: string;
4181
- createdAt: Date;
4182
- updatedAt: Date;
4183
- userId: string;
4184
- expiresAt: Date;
4185
- token: string;
4186
- ipAddress?: string | null | undefined;
4187
- userAgent?: string | null | undefined;
4188
- };
4189
- user: Record<string, any> & {
4190
- id: string;
4191
- createdAt: Date;
4192
- updatedAt: Date;
4193
- email: string;
4194
- emailVerified: boolean;
4195
- name: string;
4196
- image?: string | null | undefined;
4197
- };
4198
- };
4199
- }>)[];
4200
- metadata: {
4201
- openapi: {
4202
- operationId: string;
4203
- description: string;
4204
- responses: {
4205
- 200: {
4206
- description: string;
4207
- content: {
4208
- "application/json": {
4209
- schema: {
4210
- type: "object";
4211
- properties: {
4212
- success: {
4213
- type: string;
4214
- };
4215
- };
4216
- };
4217
- };
4218
- };
4219
- };
4220
- };
4221
- };
2880
+ };
2881
+ };
2882
+ } | {
2883
+ id: "login-methods";
2884
+ getActions: ($fetch: better_auth_client.BetterFetch) => {
2885
+ loginMethods: {
2886
+ get: () => Promise<{
2887
+ data: null;
2888
+ error: {
2889
+ message?: string | undefined;
2890
+ status: number;
2891
+ statusText: string;
4222
2892
  };
4223
- }, {
4224
- success: boolean;
2893
+ } | {
2894
+ data: LoginMethodsResponse;
2895
+ error: null;
4225
2896
  }>;
4226
2897
  };
4227
- hooks: {
4228
- after: {
4229
- matcher(context: better_auth.HookEndpointContext): boolean;
4230
- handler: (inputContext: better_auth.MiddlewareInputContext<better_auth.MiddlewareOptions>) => Promise<void>;
4231
- }[];
4232
- };
4233
- rateLimit: ({
4234
- pathMatcher(path: string): path is "/email-otp/send-verification-otp";
4235
- window: number;
4236
- max: number;
4237
- } | {
4238
- pathMatcher(path: string): path is "/email-otp/check-verification-otp";
4239
- window: number;
4240
- max: number;
4241
- } | {
4242
- pathMatcher(path: string): path is "/email-otp/verify-email";
4243
- window: number;
4244
- max: number;
4245
- } | {
4246
- pathMatcher(path: string): path is "/sign-in/email-otp";
4247
- window: number;
4248
- max: number;
4249
- } | {
4250
- pathMatcher(path: string): path is "/email-otp/request-password-reset";
4251
- window: number;
4252
- max: number;
4253
- } | {
4254
- pathMatcher(path: string): path is "/email-otp/reset-password";
4255
- window: number;
4256
- max: number;
4257
- } | {
4258
- pathMatcher(path: string): path is "/forget-password/email-otp";
4259
- window: number;
4260
- max: number;
4261
- } | {
4262
- pathMatcher(path: string): path is "/email-otp/request-email-change";
4263
- window: number;
4264
- max: number;
4265
- } | {
4266
- pathMatcher(path: string): path is "/email-otp/change-email";
4267
- window: number;
4268
- max: number;
4269
- })[];
4270
- options: better_auth_plugins.EmailOTPOptions;
4271
- $ERROR_CODES: {
4272
- OTP_EXPIRED: better_auth.RawError<"OTP_EXPIRED">;
4273
- INVALID_OTP: better_auth.RawError<"INVALID_OTP">;
4274
- TOO_MANY_ATTEMPTS: better_auth.RawError<"TOO_MANY_ATTEMPTS">;
4275
- };
4276
- }>;
2898
+ };
2899
+ } | {
2900
+ id: "email-otp";
2901
+ version: string;
2902
+ $InferServerPlugin: ReturnType<typeof better_auth_plugins.emailOTP>;
4277
2903
  atomListeners: {
4278
2904
  matcher: (path: string) => path is "/email-otp/verify-email" | "/sign-in/email-otp" | "/email-otp/request-email-change";
4279
2905
  signal: "$sessionSignal";
@@ -4293,13 +2919,13 @@ declare function createAPIClient(apiUrl: string, fetchOptions?: BetterFetchOptio
4293
2919
  cache?: RequestCache | undefined;
4294
2920
  integrity?: string | undefined;
4295
2921
  keepalive?: boolean | undefined;
4296
- method?: string | undefined;
2922
+ method?: string;
4297
2923
  mode?: RequestMode | undefined;
4298
2924
  priority?: RequestPriority | undefined;
4299
2925
  redirect?: RequestRedirect | undefined;
4300
2926
  referrer?: string | undefined;
4301
2927
  referrerPolicy?: ReferrerPolicy | undefined;
4302
- signal?: (AbortSignal | null) | undefined;
2928
+ signal?: AbortSignal | null;
4303
2929
  window?: null | undefined;
4304
2930
  onRequest?: (<T extends Record<string, any>>(context: better_auth_client.RequestContext<T>) => Promise<better_auth_client.RequestContext | void> | better_auth_client.RequestContext | void) | undefined;
4305
2931
  onResponse?: ((context: better_auth_client.ResponseContext) => Promise<Response | void | better_auth_client.ResponseContext> | Response | better_auth_client.ResponseContext | void) | undefined;
@@ -5778,8 +4404,13 @@ type InviteUserToOrganizationOptions = {
5778
4404
  role: Role;
5779
4405
  /** Application role granted on acceptance. Required with an application-scoped session. */
5780
4406
  applicationRole?: string;
5781
- /** Optional team to add the user to upon acceptance. */
4407
+ /**
4408
+ * Optional team to add the user to upon acceptance. Sent as `teamIds: [teamId]`.
4409
+ * @deprecated Use `teamIds`. Passing both throws.
4410
+ */
5782
4411
  teamId?: string;
4412
+ /** Teams to add the user to upon acceptance. */
4413
+ teamIds?: string[];
5783
4414
  /** Whether to resend the invitation if one already exists for this email. */
5784
4415
  resend?: boolean;
5785
4416
  };
@@ -5990,11 +4621,12 @@ declare class OrganizationService {
5990
4621
  * @param options.userEmail - Email address of the user to invite
5991
4622
  * @param options.role - Role to assign to the invited user
5992
4623
  * @param options.applicationRole - Application role granted on acceptance; required with an application-scoped session
5993
- * @param options.teamId - Team ID to add the user to
4624
+ * @param options.teamId - Deprecated: team ID to add the user to, sent as `teamIds: [teamId]`
4625
+ * @param options.teamIds - Team IDs to add the user to
5994
4626
  * @param options.resend - Whether to resend if invitation already exists
5995
4627
  * @returns The created invitation
5996
4628
  */
5997
- inviteUserToOrganization({ userEmail, role, applicationRole, teamId, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
4629
+ inviteUserToOrganization({ userEmail, role, applicationRole, teamId, teamIds, resend }: InviteUserToOrganizationOptions): Promise<NonNullable<{
5998
4630
  id: string;
5999
4631
  organizationId: string;
6000
4632
  email: string;
@@ -6230,7 +4862,7 @@ declare class SessionService {
6230
4862
  *
6231
4863
  * @returns The enabled login methods
6232
4864
  */
6233
- getLoginMethods(): Promise<("sso" | "google" | "microsoft" | "password" | "otp")[]>;
4865
+ getLoginMethods(): Promise<("sso" | "google" | "microsoft" | "otp" | "password")[]>;
6234
4866
  /**
6235
4867
  * Initiates social authentication flow with Google or Microsoft.
6236
4868
  *
@@ -6528,12 +5160,14 @@ declare class UserService {
6528
5160
  redirect: boolean;
6529
5161
  }>;
6530
5162
  /**
6531
- * Unlinks a provider from the current user. Requires an AAL2 session (gated
5163
+ * Unlinks an account from the current user. Requires an AAL2 session (gated
6532
5164
  * server-side). The server refuses to remove the user's last account.
5165
+ *
5166
+ * @param params.accountId - The account's `id` from {@link listAccounts}, not
5167
+ * the provider's account identifier
6533
5168
  */
6534
5169
  unlinkAccount(params: {
6535
- providerId: string;
6536
- accountId?: string;
5170
+ accountId: string;
6537
5171
  }): Promise<{
6538
5172
  status: boolean;
6539
5173
  }>;