better-auth 0.4.13 → 0.4.14-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,6 +139,7 @@ type CookieAttributes = {
139
139
  [key: string]: string | boolean;
140
140
  };
141
141
  declare function parseSetCookieHeader(header: string): Map<string, CookieAttributes>;
142
+ declare function parseCookies(cookieHeader: string): Map<string, string>;
142
143
  type EligibleCookies = (string & {}) | (keyof BetterAuthCookies & {});
143
144
 
144
145
  declare const createLogger: (options?: {
@@ -817,6 +818,23 @@ interface BetterAuthOptions {
817
818
  additionalFields?: {
818
819
  [key: string]: FieldAttribute;
819
820
  };
821
+ /**
822
+ * Changing email configuration
823
+ */
824
+ changeEmail?: {
825
+ /**
826
+ * Send a verification email when the user changes their email.
827
+ *
828
+ * If this is set to false, the email will be changed immediately.
829
+ *
830
+ * @default true
831
+ */
832
+ sendVerificationEmail?: boolean;
833
+ /**
834
+ * Disable changing email
835
+ */
836
+ disable?: boolean;
837
+ };
820
838
  };
821
839
  session?: {
822
840
  modelName?: string;
@@ -1228,12 +1246,12 @@ declare const signInOAuth: {
1228
1246
  /**
1229
1247
  * OAuth2 provider to use`
1230
1248
  */
1231
- provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1249
+ provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1232
1250
  }, "strip", z.ZodTypeAny, {
1233
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1251
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1234
1252
  callbackURL?: string | undefined;
1235
1253
  }, {
1236
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1254
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1237
1255
  callbackURL?: string | undefined;
1238
1256
  }>;
1239
1257
  use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -1271,12 +1289,12 @@ declare const signInOAuth: {
1271
1289
  /**
1272
1290
  * OAuth2 provider to use`
1273
1291
  */
1274
- provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1292
+ provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1275
1293
  }, "strip", z.ZodTypeAny, {
1276
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1294
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1277
1295
  callbackURL?: string | undefined;
1278
1296
  }, {
1279
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1297
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1280
1298
  callbackURL?: string | undefined;
1281
1299
  }>;
1282
1300
  use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -1798,7 +1816,11 @@ declare const resetPassword: {
1798
1816
  headers: Headers;
1799
1817
  };
1800
1818
 
1801
- declare function createEmailVerificationToken(secret: string, email: string): Promise<string>;
1819
+ declare function createEmailVerificationToken(secret: string, email: string,
1820
+ /**
1821
+ * The email to update from
1822
+ */
1823
+ updateTo?: string): Promise<string>;
1802
1824
  declare const sendVerificationEmail: {
1803
1825
  <C extends [better_call.Context<"/send-verification-email", {
1804
1826
  method: "POST";
@@ -1863,9 +1885,11 @@ declare const verifyEmail: {
1863
1885
  token: string;
1864
1886
  callbackURL?: string | undefined;
1865
1887
  }>;
1888
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
1866
1889
  }>]>(...ctx: C): Promise<C extends [{
1867
1890
  asResponse: true;
1868
1891
  }] ? Response : {
1892
+ user: any;
1869
1893
  status: boolean;
1870
1894
  }>;
1871
1895
  path: "/verify-email";
@@ -1881,6 +1905,7 @@ declare const verifyEmail: {
1881
1905
  token: string;
1882
1906
  callbackURL?: string | undefined;
1883
1907
  }>;
1908
+ use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
1884
1909
  };
1885
1910
  method: better_call.Method | better_call.Method[];
1886
1911
  headers: Headers;
@@ -2216,6 +2241,96 @@ declare const deleteUser: {
2216
2241
  method: better_call.Method | better_call.Method[];
2217
2242
  headers: Headers;
2218
2243
  };
2244
+ declare const changeEmail: {
2245
+ <C extends [better_call.Context<"/user/change-email", {
2246
+ method: "POST";
2247
+ query: z.ZodOptional<z.ZodObject<{
2248
+ currentURL: z.ZodOptional<z.ZodString>;
2249
+ }, "strip", z.ZodTypeAny, {
2250
+ currentURL?: string | undefined;
2251
+ }, {
2252
+ currentURL?: string | undefined;
2253
+ }>>;
2254
+ body: z.ZodObject<{
2255
+ newEmail: z.ZodString;
2256
+ callbackURL: z.ZodOptional<z.ZodString>;
2257
+ }, "strip", z.ZodTypeAny, {
2258
+ newEmail: string;
2259
+ callbackURL?: string | undefined;
2260
+ }, {
2261
+ newEmail: string;
2262
+ callbackURL?: string | undefined;
2263
+ }>;
2264
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2265
+ session: {
2266
+ session: {
2267
+ id: string;
2268
+ userId: string;
2269
+ expiresAt: Date;
2270
+ ipAddress?: string | undefined;
2271
+ userAgent?: string | undefined;
2272
+ };
2273
+ user: {
2274
+ id: string;
2275
+ email: string;
2276
+ emailVerified: boolean;
2277
+ name: string;
2278
+ createdAt: Date;
2279
+ updatedAt: Date;
2280
+ image?: string | undefined;
2281
+ };
2282
+ };
2283
+ }>, better_call.EndpointOptions>)[];
2284
+ }>]>(...ctx: C): Promise<C extends [{
2285
+ asResponse: true;
2286
+ }] ? Response : {
2287
+ user: any;
2288
+ status: boolean;
2289
+ }>;
2290
+ path: "/user/change-email";
2291
+ options: {
2292
+ method: "POST";
2293
+ query: z.ZodOptional<z.ZodObject<{
2294
+ currentURL: z.ZodOptional<z.ZodString>;
2295
+ }, "strip", z.ZodTypeAny, {
2296
+ currentURL?: string | undefined;
2297
+ }, {
2298
+ currentURL?: string | undefined;
2299
+ }>>;
2300
+ body: z.ZodObject<{
2301
+ newEmail: z.ZodString;
2302
+ callbackURL: z.ZodOptional<z.ZodString>;
2303
+ }, "strip", z.ZodTypeAny, {
2304
+ newEmail: string;
2305
+ callbackURL?: string | undefined;
2306
+ }, {
2307
+ newEmail: string;
2308
+ callbackURL?: string | undefined;
2309
+ }>;
2310
+ use: (better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
2311
+ session: {
2312
+ session: {
2313
+ id: string;
2314
+ userId: string;
2315
+ expiresAt: Date;
2316
+ ipAddress?: string | undefined;
2317
+ userAgent?: string | undefined;
2318
+ };
2319
+ user: {
2320
+ id: string;
2321
+ email: string;
2322
+ emailVerified: boolean;
2323
+ name: string;
2324
+ createdAt: Date;
2325
+ updatedAt: Date;
2326
+ image?: string | undefined;
2327
+ };
2328
+ };
2329
+ }>, better_call.EndpointOptions>)[];
2330
+ };
2331
+ method: better_call.Method | better_call.Method[];
2332
+ headers: Headers;
2333
+ };
2219
2334
 
2220
2335
  declare const getCSRFToken: {
2221
2336
  <C extends [(better_call.Context<"/csrf", {
@@ -2473,12 +2588,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2473
2588
  }>>;
2474
2589
  body: zod.ZodObject<{
2475
2590
  callbackURL: zod.ZodOptional<zod.ZodString>;
2476
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2591
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2477
2592
  }, "strip", zod.ZodTypeAny, {
2478
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2593
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2479
2594
  callbackURL?: string | undefined;
2480
2595
  }, {
2481
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2596
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2482
2597
  callbackURL?: string | undefined;
2483
2598
  }>;
2484
2599
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -2506,12 +2621,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2506
2621
  }>>;
2507
2622
  body: zod.ZodObject<{
2508
2623
  callbackURL: zod.ZodOptional<zod.ZodString>;
2509
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2624
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2510
2625
  }, "strip", zod.ZodTypeAny, {
2511
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2626
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2512
2627
  callbackURL?: string | undefined;
2513
2628
  }, {
2514
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2629
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2515
2630
  callbackURL?: string | undefined;
2516
2631
  }>;
2517
2632
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -2909,9 +3024,11 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2909
3024
  token: string;
2910
3025
  callbackURL?: string | undefined;
2911
3026
  }>;
3027
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
2912
3028
  }>]>(...ctx: C_1): Promise<C_1 extends [{
2913
3029
  asResponse: true;
2914
3030
  }] ? Response : {
3031
+ user: any;
2915
3032
  status: boolean;
2916
3033
  }>;
2917
3034
  path: "/verify-email";
@@ -2927,6 +3044,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2927
3044
  token: string;
2928
3045
  callbackURL?: string | undefined;
2929
3046
  }>;
3047
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
2930
3048
  };
2931
3049
  method: better_call.Method | better_call.Method[];
2932
3050
  headers: Headers;
@@ -2982,6 +3100,96 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2982
3100
  method: better_call.Method | better_call.Method[];
2983
3101
  headers: Headers;
2984
3102
  };
3103
+ changeEmail: {
3104
+ <C_1 extends [better_call.Context<"/user/change-email", {
3105
+ method: "POST";
3106
+ query: zod.ZodOptional<zod.ZodObject<{
3107
+ currentURL: zod.ZodOptional<zod.ZodString>;
3108
+ }, "strip", zod.ZodTypeAny, {
3109
+ currentURL?: string | undefined;
3110
+ }, {
3111
+ currentURL?: string | undefined;
3112
+ }>>;
3113
+ body: zod.ZodObject<{
3114
+ newEmail: zod.ZodString;
3115
+ callbackURL: zod.ZodOptional<zod.ZodString>;
3116
+ }, "strip", zod.ZodTypeAny, {
3117
+ newEmail: string;
3118
+ callbackURL?: string | undefined;
3119
+ }, {
3120
+ newEmail: string;
3121
+ callbackURL?: string | undefined;
3122
+ }>;
3123
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
3124
+ session: {
3125
+ session: {
3126
+ id: string;
3127
+ userId: string;
3128
+ expiresAt: Date;
3129
+ ipAddress?: string | undefined;
3130
+ userAgent?: string | undefined;
3131
+ };
3132
+ user: {
3133
+ id: string;
3134
+ email: string;
3135
+ emailVerified: boolean;
3136
+ name: string;
3137
+ createdAt: Date;
3138
+ updatedAt: Date;
3139
+ image?: string | undefined;
3140
+ };
3141
+ };
3142
+ }>, better_call.EndpointOptions>)[];
3143
+ }>]>(...ctx: C_1): Promise<C_1 extends [{
3144
+ asResponse: true;
3145
+ }] ? Response : {
3146
+ user: any;
3147
+ status: boolean;
3148
+ }>;
3149
+ path: "/user/change-email";
3150
+ options: {
3151
+ method: "POST";
3152
+ query: zod.ZodOptional<zod.ZodObject<{
3153
+ currentURL: zod.ZodOptional<zod.ZodString>;
3154
+ }, "strip", zod.ZodTypeAny, {
3155
+ currentURL?: string | undefined;
3156
+ }, {
3157
+ currentURL?: string | undefined;
3158
+ }>>;
3159
+ body: zod.ZodObject<{
3160
+ newEmail: zod.ZodString;
3161
+ callbackURL: zod.ZodOptional<zod.ZodString>;
3162
+ }, "strip", zod.ZodTypeAny, {
3163
+ newEmail: string;
3164
+ callbackURL?: string | undefined;
3165
+ }, {
3166
+ newEmail: string;
3167
+ callbackURL?: string | undefined;
3168
+ }>;
3169
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
3170
+ session: {
3171
+ session: {
3172
+ id: string;
3173
+ userId: string;
3174
+ expiresAt: Date;
3175
+ ipAddress?: string | undefined;
3176
+ userAgent?: string | undefined;
3177
+ };
3178
+ user: {
3179
+ id: string;
3180
+ email: string;
3181
+ emailVerified: boolean;
3182
+ name: string;
3183
+ createdAt: Date;
3184
+ updatedAt: Date;
3185
+ image?: string | undefined;
3186
+ };
3187
+ };
3188
+ }>, better_call.EndpointOptions>)[];
3189
+ };
3190
+ method: better_call.Method | better_call.Method[];
3191
+ headers: Headers;
3192
+ };
2985
3193
  changePassword: {
2986
3194
  <C_1 extends [better_call.Context<"/user/change-password", {
2987
3195
  method: "POST";
@@ -3568,12 +3776,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3568
3776
  }>>;
3569
3777
  body: zod.ZodObject<{
3570
3778
  callbackURL: zod.ZodOptional<zod.ZodString>;
3571
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3779
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3572
3780
  }, "strip", zod.ZodTypeAny, {
3573
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3781
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3574
3782
  callbackURL?: string | undefined;
3575
3783
  }, {
3576
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3784
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3577
3785
  callbackURL?: string | undefined;
3578
3786
  }>;
3579
3787
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -3601,12 +3809,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3601
3809
  }>>;
3602
3810
  body: zod.ZodObject<{
3603
3811
  callbackURL: zod.ZodOptional<zod.ZodString>;
3604
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3812
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3605
3813
  }, "strip", zod.ZodTypeAny, {
3606
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3814
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3607
3815
  callbackURL?: string | undefined;
3608
3816
  }, {
3609
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3817
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3610
3818
  callbackURL?: string | undefined;
3611
3819
  }>;
3612
3820
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -4004,9 +4212,11 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4004
4212
  token: string;
4005
4213
  callbackURL?: string | undefined;
4006
4214
  }>;
4215
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
4007
4216
  }>]>(...ctx: C_1): Promise<C_1 extends [{
4008
4217
  asResponse: true;
4009
4218
  }] ? Response : {
4219
+ user: any;
4010
4220
  status: boolean;
4011
4221
  }>;
4012
4222
  path: "/verify-email";
@@ -4022,6 +4232,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4022
4232
  token: string;
4023
4233
  callbackURL?: string | undefined;
4024
4234
  }>;
4235
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
4025
4236
  };
4026
4237
  method: better_call.Method | better_call.Method[];
4027
4238
  headers: Headers;
@@ -4077,6 +4288,96 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4077
4288
  method: better_call.Method | better_call.Method[];
4078
4289
  headers: Headers;
4079
4290
  };
4291
+ changeEmail: {
4292
+ <C_1 extends [better_call.Context<"/user/change-email", {
4293
+ method: "POST";
4294
+ query: zod.ZodOptional<zod.ZodObject<{
4295
+ currentURL: zod.ZodOptional<zod.ZodString>;
4296
+ }, "strip", zod.ZodTypeAny, {
4297
+ currentURL?: string | undefined;
4298
+ }, {
4299
+ currentURL?: string | undefined;
4300
+ }>>;
4301
+ body: zod.ZodObject<{
4302
+ newEmail: zod.ZodString;
4303
+ callbackURL: zod.ZodOptional<zod.ZodString>;
4304
+ }, "strip", zod.ZodTypeAny, {
4305
+ newEmail: string;
4306
+ callbackURL?: string | undefined;
4307
+ }, {
4308
+ newEmail: string;
4309
+ callbackURL?: string | undefined;
4310
+ }>;
4311
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
4312
+ session: {
4313
+ session: {
4314
+ id: string;
4315
+ userId: string;
4316
+ expiresAt: Date;
4317
+ ipAddress?: string | undefined;
4318
+ userAgent?: string | undefined;
4319
+ };
4320
+ user: {
4321
+ id: string;
4322
+ email: string;
4323
+ emailVerified: boolean;
4324
+ name: string;
4325
+ createdAt: Date;
4326
+ updatedAt: Date;
4327
+ image?: string | undefined;
4328
+ };
4329
+ };
4330
+ }>, better_call.EndpointOptions>)[];
4331
+ }>]>(...ctx: C_1): Promise<C_1 extends [{
4332
+ asResponse: true;
4333
+ }] ? Response : {
4334
+ user: any;
4335
+ status: boolean;
4336
+ }>;
4337
+ path: "/user/change-email";
4338
+ options: {
4339
+ method: "POST";
4340
+ query: zod.ZodOptional<zod.ZodObject<{
4341
+ currentURL: zod.ZodOptional<zod.ZodString>;
4342
+ }, "strip", zod.ZodTypeAny, {
4343
+ currentURL?: string | undefined;
4344
+ }, {
4345
+ currentURL?: string | undefined;
4346
+ }>>;
4347
+ body: zod.ZodObject<{
4348
+ newEmail: zod.ZodString;
4349
+ callbackURL: zod.ZodOptional<zod.ZodString>;
4350
+ }, "strip", zod.ZodTypeAny, {
4351
+ newEmail: string;
4352
+ callbackURL?: string | undefined;
4353
+ }, {
4354
+ newEmail: string;
4355
+ callbackURL?: string | undefined;
4356
+ }>;
4357
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
4358
+ session: {
4359
+ session: {
4360
+ id: string;
4361
+ userId: string;
4362
+ expiresAt: Date;
4363
+ ipAddress?: string | undefined;
4364
+ userAgent?: string | undefined;
4365
+ };
4366
+ user: {
4367
+ id: string;
4368
+ email: string;
4369
+ emailVerified: boolean;
4370
+ name: string;
4371
+ createdAt: Date;
4372
+ updatedAt: Date;
4373
+ image?: string | undefined;
4374
+ };
4375
+ };
4376
+ }>, better_call.EndpointOptions>)[];
4377
+ };
4378
+ method: better_call.Method | better_call.Method[];
4379
+ headers: Headers;
4380
+ };
4080
4381
  changePassword: {
4081
4382
  <C_1 extends [better_call.Context<"/user/change-password", {
4082
4383
  method: "POST";
@@ -4665,12 +4966,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4665
4966
  }>>;
4666
4967
  body: zod.ZodObject<{
4667
4968
  callbackURL: zod.ZodOptional<zod.ZodString>;
4668
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4969
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4669
4970
  }, "strip", zod.ZodTypeAny, {
4670
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4971
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4671
4972
  callbackURL?: string | undefined;
4672
4973
  }, {
4673
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4974
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4674
4975
  callbackURL?: string | undefined;
4675
4976
  }>;
4676
4977
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -4698,12 +4999,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4698
4999
  }>>;
4699
5000
  body: zod.ZodObject<{
4700
5001
  callbackURL: zod.ZodOptional<zod.ZodString>;
4701
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
5002
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4702
5003
  }, "strip", zod.ZodTypeAny, {
4703
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
5004
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4704
5005
  callbackURL?: string | undefined;
4705
5006
  }, {
4706
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
5007
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4707
5008
  callbackURL?: string | undefined;
4708
5009
  }>;
4709
5010
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -5101,9 +5402,11 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5101
5402
  token: string;
5102
5403
  callbackURL?: string | undefined;
5103
5404
  }>;
5405
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
5104
5406
  }>]>(...ctx: C): Promise<C extends [{
5105
5407
  asResponse: true;
5106
5408
  }] ? Response : {
5409
+ user: any;
5107
5410
  status: boolean;
5108
5411
  }>;
5109
5412
  path: "/verify-email";
@@ -5119,6 +5422,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5119
5422
  token: string;
5120
5423
  callbackURL?: string | undefined;
5121
5424
  }>;
5425
+ use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
5122
5426
  };
5123
5427
  method: better_call.Method | better_call.Method[];
5124
5428
  headers: Headers;
@@ -5174,6 +5478,96 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5174
5478
  method: better_call.Method | better_call.Method[];
5175
5479
  headers: Headers;
5176
5480
  };
5481
+ changeEmail: {
5482
+ <C extends [better_call.Context<"/user/change-email", {
5483
+ method: "POST";
5484
+ query: zod.ZodOptional<zod.ZodObject<{
5485
+ currentURL: zod.ZodOptional<zod.ZodString>;
5486
+ }, "strip", zod.ZodTypeAny, {
5487
+ currentURL?: string | undefined;
5488
+ }, {
5489
+ currentURL?: string | undefined;
5490
+ }>>;
5491
+ body: zod.ZodObject<{
5492
+ newEmail: zod.ZodString;
5493
+ callbackURL: zod.ZodOptional<zod.ZodString>;
5494
+ }, "strip", zod.ZodTypeAny, {
5495
+ newEmail: string;
5496
+ callbackURL?: string | undefined;
5497
+ }, {
5498
+ newEmail: string;
5499
+ callbackURL?: string | undefined;
5500
+ }>;
5501
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
5502
+ session: {
5503
+ session: {
5504
+ id: string;
5505
+ userId: string;
5506
+ expiresAt: Date;
5507
+ ipAddress?: string | undefined;
5508
+ userAgent?: string | undefined;
5509
+ };
5510
+ user: {
5511
+ id: string;
5512
+ email: string;
5513
+ emailVerified: boolean;
5514
+ name: string;
5515
+ createdAt: Date;
5516
+ updatedAt: Date;
5517
+ image?: string | undefined;
5518
+ };
5519
+ };
5520
+ }>, better_call.EndpointOptions>)[];
5521
+ }>]>(...ctx: C): Promise<C extends [{
5522
+ asResponse: true;
5523
+ }] ? Response : {
5524
+ user: any;
5525
+ status: boolean;
5526
+ }>;
5527
+ path: "/user/change-email";
5528
+ options: {
5529
+ method: "POST";
5530
+ query: zod.ZodOptional<zod.ZodObject<{
5531
+ currentURL: zod.ZodOptional<zod.ZodString>;
5532
+ }, "strip", zod.ZodTypeAny, {
5533
+ currentURL?: string | undefined;
5534
+ }, {
5535
+ currentURL?: string | undefined;
5536
+ }>>;
5537
+ body: zod.ZodObject<{
5538
+ newEmail: zod.ZodString;
5539
+ callbackURL: zod.ZodOptional<zod.ZodString>;
5540
+ }, "strip", zod.ZodTypeAny, {
5541
+ newEmail: string;
5542
+ callbackURL?: string | undefined;
5543
+ }, {
5544
+ newEmail: string;
5545
+ callbackURL?: string | undefined;
5546
+ }>;
5547
+ use: (Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions> | Endpoint<better_call.Handler<string, better_call.EndpointOptions, {
5548
+ session: {
5549
+ session: {
5550
+ id: string;
5551
+ userId: string;
5552
+ expiresAt: Date;
5553
+ ipAddress?: string | undefined;
5554
+ userAgent?: string | undefined;
5555
+ };
5556
+ user: {
5557
+ id: string;
5558
+ email: string;
5559
+ emailVerified: boolean;
5560
+ name: string;
5561
+ createdAt: Date;
5562
+ updatedAt: Date;
5563
+ image?: string | undefined;
5564
+ };
5565
+ };
5566
+ }>, better_call.EndpointOptions>)[];
5567
+ };
5568
+ method: better_call.Method | better_call.Method[];
5569
+ headers: Headers;
5570
+ };
5177
5571
  changePassword: {
5178
5572
  <C extends [better_call.Context<"/user/change-password", {
5179
5573
  method: "POST";
@@ -5713,4 +6107,4 @@ type Auth = {
5713
6107
  options: BetterAuthOptions;
5714
6108
  };
5715
6109
 
5716
- export { signInEmail as $, type Adapter as A, type BetterAuthOptions as B, type InternalAdapter as C, type FieldAttributeConfig as D, type EligibleCookies as E, type FieldAttribute as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferUser as I, createFieldAttribute as J, type KyselyDatabaseType as K, type InferValueType as L, type InferFieldsOutput as M, type InferFieldsInput as N, type InferFieldsInputClient as O, type PluginSchema as P, type PluginFieldAttribute as Q, type RateLimit as R, type SecondaryStorage as S, type InferFieldsFromPlugins as T, type InferFieldsFromOptions as U, type BetterAuthDbSchema as V, type Where as W, getAuthTables as X, getEndpoints as Y, router as Z, signInOAuth as _, type Auth as a, callbackOAuth as a0, getSession as a1, getSessionFromCtx as a2, sessionMiddleware as a3, listSessions as a4, revokeSession as a5, revokeSessions as a6, signOut as a7, forgetPassword as a8, forgetPasswordCallback as a9, resetPassword as aa, createEmailVerificationToken as ab, sendVerificationEmail as ac, verifyEmail as ad, updateUser as ae, changePassword as af, setPassword as ag, deleteUser as ah, getCSRFToken as ai, error as aj, ok as ak, signUpEmail as al, csrfMiddleware as am, type BetterAuthPlugin as b, createAuthMiddleware as c, createAuthEndpoint as d, type AuthEndpoint as e, type AuthMiddleware as f, betterAuth as g, type AdditionalUserFieldsInput as h, type AdditionalUserFieldsOutput as i, type AdditionalSessionFieldsInput as j, type AdditionalSessionFieldsOutput as k, type InferSession as l, type InferPluginTypes as m, init as n, optionsMiddleware as o, type AuthContext as p, getCookies as q, createCookieGetter as r, type BetterAuthCookies as s, setSessionCookie as t, deleteSessionCookie as u, parseSetCookieHeader as v, createLogger as w, logger as x, type FieldType as y, createInternalAdapter as z };
6110
+ export { signInOAuth as $, type Adapter as A, type BetterAuthOptions as B, createInternalAdapter as C, type InternalAdapter as D, type EligibleCookies as E, type FieldAttribute as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferUser as I, type FieldAttributeConfig as J, type KyselyDatabaseType as K, createFieldAttribute as L, type InferValueType as M, type InferFieldsOutput as N, type InferFieldsInput as O, type PluginSchema as P, type InferFieldsInputClient as Q, type RateLimit as R, type SecondaryStorage as S, type PluginFieldAttribute as T, type InferFieldsFromPlugins as U, type InferFieldsFromOptions as V, type Where as W, type BetterAuthDbSchema as X, getAuthTables as Y, getEndpoints as Z, router as _, type Auth as a, signInEmail as a0, callbackOAuth as a1, getSession as a2, getSessionFromCtx as a3, sessionMiddleware as a4, listSessions as a5, revokeSession as a6, revokeSessions as a7, signOut as a8, forgetPassword as a9, forgetPasswordCallback as aa, resetPassword as ab, createEmailVerificationToken as ac, sendVerificationEmail as ad, verifyEmail as ae, updateUser as af, changePassword as ag, setPassword as ah, deleteUser as ai, changeEmail as aj, getCSRFToken as ak, error as al, ok as am, signUpEmail as an, csrfMiddleware as ao, type BetterAuthPlugin as b, createAuthMiddleware as c, createAuthEndpoint as d, type AuthEndpoint as e, type AuthMiddleware as f, betterAuth as g, type AdditionalUserFieldsInput as h, type AdditionalUserFieldsOutput as i, type AdditionalSessionFieldsInput as j, type AdditionalSessionFieldsOutput as k, type InferSession as l, type InferPluginTypes as m, init as n, optionsMiddleware as o, type AuthContext as p, getCookies as q, createCookieGetter as r, type BetterAuthCookies as s, setSessionCookie as t, deleteSessionCookie as u, parseSetCookieHeader as v, parseCookies as w, createLogger as x, logger as y, type FieldType as z };