@better-auth/electron 1.7.0-beta.1 → 1.7.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  import electron from "electron";
2
2
  import * as z from "zod";
3
+ import * as jose from "jose";
4
+ import { JWTVerifyGetKey } from "jose";
3
5
  import { Database } from "bun:sqlite";
4
6
  import { DatabaseSync } from "node:sqlite";
5
7
  import { D1Database } from "@cloudflare/workers-types";
@@ -30,6 +32,8 @@ type DBAdapterDebugLogOption = boolean | {
30
32
  findMany?: boolean | undefined;
31
33
  delete?: boolean | undefined;
32
34
  deleteMany?: boolean | undefined;
35
+ consumeOne?: boolean | undefined;
36
+ incrementOne?: boolean | undefined;
33
37
  count?: boolean | undefined;
34
38
  } | {
35
39
  /**
@@ -205,7 +209,7 @@ interface DBAdapterFactoryConfig<Options extends BetterAuthOptions = BetterAuthO
205
209
  /**
206
210
  * The action which was called from the adapter.
207
211
  */
208
- action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "count";
212
+ action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "incrementOne" | "count";
209
213
  /**
210
214
  * The model name.
211
215
  */
@@ -402,8 +406,14 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
402
406
  where?: Where[] | undefined;
403
407
  }) => Promise<number>;
404
408
  /**
405
- * ⚠︎ Update may not return the updated data
406
- * if multiple where clauses are provided
409
+ * Update a single row matching the where clause.
410
+ *
411
+ * Returns the updated row, or `null` when no row matched. Empty `where`
412
+ * clauses return `null`; use `updateMany` for intentional bulk updates.
413
+ *
414
+ * This is not the race-safe primitive for guarded state transitions. Use
415
+ * `incrementOne` when the predicate is both selector and guard, and use
416
+ * `consumeOne` for single-use destructive reads.
407
417
  */
408
418
  update: <T>(data: {
409
419
  model: string;
@@ -423,6 +433,54 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
423
433
  model: string;
424
434
  where: Where[];
425
435
  }) => Promise<number>;
436
+ /**
437
+ * Atomically consume a single row matching the where clause: delete it and
438
+ * return the deleted row, or return `null` if no row matched.
439
+ * Implementations MUST NOT delete any additional rows that also match a
440
+ * non-unique predicate.
441
+ *
442
+ * Under concurrent invocation against the same row, exactly one caller
443
+ * receives the row; subsequent racers receive `null`. This is the
444
+ * race-safe primitive for consuming single-use credentials
445
+ * (verification tokens, authorization codes, one-time tokens).
446
+ *
447
+ * Always defined on the factory-wrapped adapter. The underlying
448
+ * `CustomAdapter` must implement this natively; there is no portable
449
+ * fallback that can guarantee cross-process single-use semantics.
450
+ */
451
+ consumeOne: <T>(data: {
452
+ model: string;
453
+ where: Where[];
454
+ }) => Promise<T | null>;
455
+ /**
456
+ * Atomically apply signed numeric deltas to a single row matching the where
457
+ * clause. For each entry in `increment`, the operation applies
458
+ * `field = field + delta` in one atomic step; a negative delta decrements.
459
+ *
460
+ * The `where` clause is both the selector AND the guard: comparison
461
+ * operators are honored, so passing `{ field: "remaining", operator: "gt",
462
+ * value: 0 }` only mutates the row while `remaining` is still above zero.
463
+ * When the guard matches no row, the operation makes no change and returns
464
+ * `null`.
465
+ *
466
+ * The optional `set` map assigns absolute values to fields in the same
467
+ * atomic operation, alongside the increments.
468
+ *
469
+ * Returns the updated row, or `null` when the guard matched no row. Under
470
+ * concurrent invocation against the same row, this is the race-safe
471
+ * primitive for guarded counter updates (e.g. decrementing a remaining-uses
472
+ * counter only while it is still positive).
473
+ *
474
+ * Always defined on the factory-wrapped adapter. The underlying
475
+ * `CustomAdapter` must implement this natively; there is no portable
476
+ * fallback that can guarantee guarded counter semantics across runtimes.
477
+ */
478
+ incrementOne: <T>(data: {
479
+ model: string;
480
+ where: Where[];
481
+ increment: Record<string, number>;
482
+ set?: Record<string, unknown> | undefined;
483
+ }) => Promise<T | null>;
426
484
  /**
427
485
  * Execute multiple operations in a transaction.
428
486
  * If the adapter doesn't support transactions, operations will be executed sequentially.
@@ -504,6 +562,34 @@ interface CustomAdapter {
504
562
  model: string;
505
563
  where: CleanedWhere[];
506
564
  }) => Promise<number>;
565
+ /**
566
+ * Native atomic single-row consume.
567
+ * Implementing this method natively (e.g. `DELETE ... RETURNING *`,
568
+ * `findOneAndDelete`, `OUTPUT deleted.*`) gives one round trip and the
569
+ * strongest race-safety guarantee. Implementations must delete at most
570
+ * one matching row.
571
+ */
572
+ consumeOne: <T>(data: {
573
+ model: string;
574
+ where: CleanedWhere[];
575
+ }) => Promise<T | null>;
576
+ /**
577
+ * Native atomic guarded counter mutation. Applies
578
+ * `field = field + delta` for each entry in `increment` (negative deltas
579
+ * decrement), with `where` acting as both selector and guard and `set`
580
+ * assigning absolute values in the same operation. Returns the updated row,
581
+ * or `null` when the guard matched no row.
582
+ *
583
+ * Implementing this natively (e.g. `UPDATE ... SET n = n + $delta WHERE ...
584
+ * RETURNING *`) gives one round trip and the strongest race-safety
585
+ * guarantee.
586
+ */
587
+ incrementOne: <T>(data: {
588
+ model: string;
589
+ where: CleanedWhere[];
590
+ increment: Record<string, number>;
591
+ set?: Record<string, unknown> | undefined;
592
+ }) => Promise<T | null>;
507
593
  count: ({
508
594
  model,
509
595
  where
@@ -541,7 +627,6 @@ type BaseRateLimit = z.infer<typeof rateLimitSchema>;
541
627
  /**
542
628
  * Rate limit schema type used by better-auth for rate limiting
543
629
  */
544
- type RateLimit<DBOptions extends BetterAuthOptions["rateLimit"] = BetterAuthOptions["rateLimit"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseRateLimit & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"rateLimit", Plugins>>; //#endregion
545
630
  //#endregion
546
631
  //#region ../core/dist/db/schema/session.d.mts
547
632
  //#region src/db/schema/session.d.ts
@@ -610,6 +695,52 @@ declare const createLogger: (options?: Logger | undefined) => InternalLogger;
610
695
  //#endregion
611
696
  //#region ../core/dist/oauth2/oauth-provider.d.mts
612
697
  //#region src/oauth2/oauth-provider.d.ts
698
+ /**
699
+ * id_token verification config for a social provider.
700
+ *
701
+ * Declares how a client-submitted id_token is verified. The shared verifier
702
+ * (`verifyProviderIdToken`) consumes this instead of each provider implementing its own
703
+ * boolean check, so verification is centralized and fail-closed: a provider without a config
704
+ * cannot accept a forged token by omission.
705
+ */
706
+ type OAuthIdTokenConfig = {
707
+ /**
708
+ * JWKS resolver used to verify the JWS signature. Accepts a jose
709
+ * `createRemoteJWKSet` resolver or a key-resolving function
710
+ * `(protectedHeader) => key`.
711
+ */
712
+ jwks: JWTVerifyGetKey; /** Expected `iss`. Omit for providers whose issuer varies per tenant. */
713
+ issuer?: (string | string[]) | undefined; /** Expected `aud`, usually the client ID. */
714
+ audience: string | string[]; /** Permitted JWS algorithms. Defaults to the token's `alg` header. */
715
+ algorithms?: string[] | undefined; /** Maximum token age passed to jose (e.g. `"1h"`). */
716
+ maxTokenAge?: string | undefined;
717
+ /**
718
+ * How the `nonce` claim is compared to the expected nonce.
719
+ * - `"exact"` (default): strict equality.
720
+ * - `"exact-or-sha256"`: matches the raw nonce or its SHA-256 hex digest (Apple).
721
+ */
722
+ nonceComparison?: ("exact" | "exact-or-sha256") | undefined;
723
+ /**
724
+ * Accept non-JWS (opaque) tokens without signature verification. Identity is then
725
+ * resolved by getUserInfo from the access token via the provider userinfo endpoint,
726
+ * which validates it (e.g. Facebook Graph access tokens).
727
+ */
728
+ allowOpaqueToken?: boolean | undefined;
729
+ /**
730
+ * Provider-specific claim check applied after the signature, issuer,
731
+ * audience, max-age, and nonce checks pass. Return `false` to reject the
732
+ * token. Used to enforce constraints the standard checks cannot express,
733
+ * e.g. Google's hosted-domain (`hd`) restriction. Omitted by providers
734
+ * that have no extra claim requirement.
735
+ */
736
+ verifyClaims?: ((claims: Record<string, unknown>) => boolean) | undefined;
737
+ } | {
738
+ /**
739
+ * Custom verifier for providers that cannot verify against a local JWKS, such as a
740
+ * remote verification endpoint (e.g. LINE).
741
+ */
742
+ verify: (token: string, nonce?: string) => Promise<boolean>;
743
+ };
613
744
  interface OAuth2Tokens {
614
745
  tokenType?: string | undefined;
615
746
  accessToken?: string | undefined;
@@ -631,8 +762,30 @@ type OAuth2UserInfo = {
631
762
  image?: string | undefined;
632
763
  emailVerified: boolean;
633
764
  };
765
+ /**
766
+ * Request metadata available to provider refresh hooks.
767
+ *
768
+ * The refresh flow may be triggered by endpoints such as `getAccessToken` or
769
+ * `refreshToken`; this context gives provider hooks access to the triggering
770
+ * request without exposing the full endpoint implementation surface.
771
+ */
772
+ interface OAuthRefreshContext {
773
+ headers?: Headers | undefined;
774
+ request?: Request | undefined;
775
+ }
634
776
  interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
635
777
  id: LiteralString;
778
+ /**
779
+ * Optional path under the resolved per-request `baseURL` where this
780
+ * provider's OAuth callback handler is mounted. Providers that use the
781
+ * shared `/callback/<id>` route can omit this.
782
+ *
783
+ * Custom paths must start with `/`.
784
+ *
785
+ * Endpoints compose `redirectURI = ctx.context.baseURL + callbackPath` per
786
+ * request, so the provider must not hardcode an origin or `baseURL` here.
787
+ */
788
+ callbackPath?: string | undefined;
636
789
  createAuthorizationURL: (data: {
637
790
  state: string;
638
791
  codeVerifier: string;
@@ -640,6 +793,19 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
640
793
  redirectURI: string;
641
794
  display?: string | undefined;
642
795
  loginHint?: string | undefined;
796
+ /**
797
+ * OIDC nonce generated by the redirect initiator and persisted in OAuth
798
+ * state. Providers that set `requiresIdTokenNonce` must forward this to
799
+ * the authorization URL as the `nonce` parameter.
800
+ */
801
+ idTokenNonce?: string | undefined;
802
+ /**
803
+ * Extra query parameters to append to the authorization URL.
804
+ * Providers forward these to the shared `createAuthorizationURL` helper,
805
+ * which drops any keys present in `RESERVED_AUTHORIZATION_PARAMS`
806
+ * before applying them.
807
+ */
808
+ additionalParams?: Record<string, string> | undefined;
643
809
  }) => Awaitable<URL>;
644
810
  name: string;
645
811
  validateAuthorizationCode: (data: {
@@ -649,6 +815,12 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
649
815
  deviceId?: string | undefined;
650
816
  }) => Promise<OAuth2Tokens | null>;
651
817
  getUserInfo: (token: OAuth2Tokens & {
818
+ /**
819
+ * OIDC nonce recovered from OAuth state. Providers that required an
820
+ * ID-token nonce must pass this to `verifyProviderIdToken` before
821
+ * trusting ID-token claims.
822
+ */
823
+ expectedIdTokenNonce?: string | undefined;
652
824
  /**
653
825
  * The user object from the provider
654
826
  * This is only available for some providers like Apple
@@ -665,23 +837,33 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
665
837
  data: T;
666
838
  } | null>;
667
839
  /**
668
- * Custom function to refresh a token
840
+ * Custom function to refresh a token.
841
+ *
842
+ * Receives request metadata from the endpoint that triggered the refresh.
843
+ * Providers that don't need request-scoped data can ignore the second
844
+ * argument.
669
845
  */
670
- refreshAccessToken?: ((refreshToken: string) => Promise<OAuth2Tokens>) | undefined;
846
+ refreshAccessToken?: ((refreshToken: string, ctx?: OAuthRefreshContext) => Promise<OAuth2Tokens>) | undefined;
671
847
  revokeToken?: ((token: string) => Promise<void>) | undefined;
672
848
  /**
673
- * Verify the id token
674
- * @param token - The id token
675
- * @param nonce - The nonce
676
- * @returns True if the id token is valid, false otherwise
849
+ * Declarative id_token verification config consumed by the shared
850
+ * `verifyProviderIdToken` verifier. Providers set this instead of implementing a boolean
851
+ * verify method, which keeps verification centralized and fail-closed.
677
852
  */
678
- verifyIdToken?: ((token: string, nonce?: string) => Promise<boolean>) | undefined;
853
+ idToken?: OAuthIdTokenConfig | undefined;
679
854
  /**
680
855
  * The expected issuer identifier for this provider (RFC 9207).
681
856
  * When set, the callback handler validates the `iss` query parameter
682
857
  * against this value to prevent authorization server mix-up attacks.
683
858
  */
684
859
  issuer?: string | undefined;
860
+ /**
861
+ * Require shared OAuth redirect routes to bind ID-token verification to an
862
+ * authorization request nonce. When true, routes generate `idTokenNonce`,
863
+ * pass it to `createAuthorizationURL`, persist it in state, and provide it
864
+ * back to `getUserInfo` as `expectedIdTokenNonce`.
865
+ */
866
+ requiresIdTokenNonce?: boolean | undefined;
685
867
  /**
686
868
  * Disable implicit sign up for new users. When set to true for the provider,
687
869
  * sign-in need to be called with with requestSignUp as true to create new users.
@@ -691,6 +873,17 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
691
873
  * Disable sign up for new users.
692
874
  */
693
875
  disableSignUp?: boolean | undefined;
876
+ /**
877
+ * Accept callbacks that arrive without a `state` parameter. When true,
878
+ * the shared OAuth callback handler restarts the flow server-side with
879
+ * fresh `state` and PKCE instead of rejecting the request. Intended for
880
+ * providers that initiate OAuth without RP-side flow kickoff (e.g.
881
+ * Clever). Leave unset for any provider that always initiates from the
882
+ * RP.
883
+ *
884
+ * @default false
885
+ */
886
+ allowIdpInitiated?: boolean | undefined;
694
887
  /**
695
888
  * Options for the provider
696
889
  */
@@ -700,9 +893,10 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
700
893
  /**
701
894
  * The client ID of your application.
702
895
  *
703
- * This is usually a string but can be any type depending on the provider.
896
+ * Some providers accept multiple platform client IDs. The first entry is the
897
+ * primary client ID used for token endpoint client authentication.
704
898
  */
705
- clientId?: unknown | undefined;
899
+ clientId?: LiteralString | string[] | undefined;
706
900
  /**
707
901
  * The client secret of your application
708
902
  */
@@ -803,6 +997,29 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
803
997
  * @default false
804
998
  */
805
999
  overrideUserInfoOnSignIn?: boolean | undefined;
1000
+ /**
1001
+ * Require this provider's email to be verified before a session is created.
1002
+ *
1003
+ * When the provider reports the email as unverified, the user and account are
1004
+ * still created/linked, but no session is issued: the OAuth callback redirects
1005
+ * with `?error=email_not_verified` and id-token sign-in returns a `403`
1006
+ * `EMAIL_NOT_VERIFIED`. A verification email is (re)sent per the
1007
+ * `emailVerification` settings (`sendOnSignUp` / `sendOnSignIn`).
1008
+ *
1009
+ * The gate checks the local user's verification state, not the provider's
1010
+ * claim on each request: a user already verified through another method (or a
1011
+ * prior verified sign-in) keeps access even if the provider later reports the
1012
+ * email as unverified.
1013
+ *
1014
+ * This is opt-in per provider and is independent of
1015
+ * `emailAndPassword.requireEmailVerification`; enabling that does not gate
1016
+ * social sign-in. Only enable it for providers that report a trustworthy
1017
+ * `email_verified` signal: several providers always report the email as
1018
+ * unverified, which would block every sign-in.
1019
+ *
1020
+ * @default false
1021
+ */
1022
+ requireEmailVerification?: boolean | undefined;
806
1023
  }; //#endregion
807
1024
  //#endregion
808
1025
  //#region ../core/dist/social-providers/apple.d.mts
@@ -819,7 +1036,7 @@ interface AppleProfile {
819
1036
  * The email address is either the user's real email address or the proxy
820
1037
  * address, depending on their status private email relay service.
821
1038
  */
822
- email: string;
1039
+ email?: string;
823
1040
  /**
824
1041
  * A string or Boolean value that indicates whether the service verifies
825
1042
  * the email. The value can either be a string ("true" or "false") or a
@@ -867,7 +1084,7 @@ interface AppleNonConformUser {
867
1084
  email: string;
868
1085
  }
869
1086
  interface AppleOptions extends ProviderOptions<AppleProfile> {
870
- clientId: string;
1087
+ clientId: string | string[];
871
1088
  appBundleIdentifier?: string | undefined;
872
1089
  audience?: (string | string[]) | undefined;
873
1090
  }
@@ -914,7 +1131,7 @@ interface CognitoProfile {
914
1131
  [key: string]: any;
915
1132
  }
916
1133
  interface CognitoOptions extends ProviderOptions<CognitoProfile> {
917
- clientId: string;
1134
+ clientId: string | string[];
918
1135
  /**
919
1136
  * The Cognito domain (e.g., "your-app.auth.us-east-1.amazoncognito.com")
920
1137
  */
@@ -925,6 +1142,19 @@ interface CognitoOptions extends ProviderOptions<CognitoProfile> {
925
1142
  region: string;
926
1143
  userPoolId: string;
927
1144
  requireClientSecret?: boolean | undefined;
1145
+ /**
1146
+ * Skip the Cognito hosted-UI identity-provider picker by preselecting an
1147
+ * IdP (maps to the `identity_provider` query parameter on the authorize
1148
+ * request). Accepts `"COGNITO"`, a SAML/OIDC provider name configured on
1149
+ * the User Pool, or one of the social providers (`"Google"`, `"Facebook"`,
1150
+ * `"LoginWithAmazon"`, `"SignInWithApple"`).
1151
+ *
1152
+ * Per-request overrides via `signIn.social({ additionalParams: { identity_provider } })`
1153
+ * take precedence over this value.
1154
+ *
1155
+ * @see https://docs.aws.amazon.com/cognito/latest/developerguide/authorization-endpoint.html
1156
+ */
1157
+ identityProvider?: string | undefined;
928
1158
  }
929
1159
  //#endregion
930
1160
  //#region ../core/dist/social-providers/discord.d.mts
@@ -967,7 +1197,7 @@ interface DiscordProfile extends Record<string, any> {
967
1197
  /** whether the email on this account has been verified */
968
1198
  verified: boolean;
969
1199
  /** the user's email */
970
- email: string;
1200
+ email?: string | null;
971
1201
  /**
972
1202
  * the flags on a user's account:
973
1203
  * https://discord.com/developers/docs/resources/user#user-object-user-flags
@@ -1009,8 +1239,8 @@ interface DiscordOptions extends ProviderOptions<DiscordProfile> {
1009
1239
  interface FacebookProfile {
1010
1240
  id: string;
1011
1241
  name: string;
1012
- email: string;
1013
- email_verified: boolean;
1242
+ email?: string;
1243
+ email_verified?: boolean;
1014
1244
  picture: {
1015
1245
  data: {
1016
1246
  height: number;
@@ -1021,7 +1251,7 @@ interface FacebookProfile {
1021
1251
  };
1022
1252
  }
1023
1253
  interface FacebookOptions extends ProviderOptions<FacebookProfile> {
1024
- clientId: string;
1254
+ clientId: string | string[];
1025
1255
  /**
1026
1256
  * Extend list of fields to retrieve from the Facebook user profile.
1027
1257
  *
@@ -1071,7 +1301,7 @@ interface GithubProfile {
1071
1301
  company: string;
1072
1302
  blog: string;
1073
1303
  location: string;
1074
- email: string;
1304
+ email: string | null;
1075
1305
  hireable: boolean;
1076
1306
  bio: string;
1077
1307
  twitter_username: string;
@@ -1098,6 +1328,15 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
1098
1328
  clientId: string;
1099
1329
  }
1100
1330
  //#endregion
1331
+ //#region ../core/dist/oauth2/client-assertion.d.mts
1332
+ type ClientAssertionGrantType = "authorization_code" | "refresh_token" | "client_credentials";
1333
+ interface ClientAssertionContext {
1334
+ clientId: string;
1335
+ tokenEndpoint: string;
1336
+ grantType: ClientAssertionGrantType;
1337
+ }
1338
+ type ClientAssertionGetter = (context: ClientAssertionContext) => Awaitable<string>;
1339
+ //#endregion
1101
1340
  //#region ../core/dist/social-providers/microsoft-entra-id.d.mts
1102
1341
  //#region src/social-providers/microsoft-entra-id.d.ts
1103
1342
  /**
@@ -1125,7 +1364,7 @@ interface MicrosoftEntraIDProfile extends Record<string, any> {
1125
1364
  /** The primary username that represents the user */
1126
1365
  preferred_username: string;
1127
1366
  /** User's email address */
1128
- email: string;
1367
+ email?: string;
1129
1368
  /** Human-readable value that identifies the subject of the token */
1130
1369
  name: string;
1131
1370
  /** Matches the parameter included in the original authorize request */
@@ -1204,26 +1443,34 @@ interface MicrosoftEntraIDProfile extends Record<string, any> {
1204
1443
  given_name: string;
1205
1444
  }
1206
1445
  interface MicrosoftOptions extends ProviderOptions<MicrosoftEntraIDProfile> {
1207
- clientId: string;
1446
+ clientId: string | string[];
1208
1447
  /**
1209
1448
  * The tenant ID of the Microsoft account
1210
1449
  * @default "common"
1211
1450
  */
1212
- tenantId?: string | undefined;
1451
+ tenantId?: string;
1213
1452
  /**
1214
1453
  * The authentication authority URL. Use the default "https://login.microsoftonline.com" for standard Entra ID or "https://<tenant-id>.ciamlogin.com" for CIAM scenarios.
1215
1454
  * @default "https://login.microsoftonline.com"
1216
1455
  */
1217
- authority?: string | undefined;
1456
+ authority?: string;
1457
+ /**
1458
+ * Function that returns a JWT client assertion for token endpoint authentication.
1459
+ *
1460
+ * Use this instead of `clientSecret` when your Microsoft Entra ID app is
1461
+ * configured for client authentication with assertions (private_key_jwt or
1462
+ * workload identity federation).
1463
+ */
1464
+ clientAssertion?: ClientAssertionGetter;
1218
1465
  /**
1219
1466
  * The size of the profile photo
1220
1467
  * @default 48
1221
1468
  */
1222
- profilePhotoSize?: (48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648) | undefined;
1469
+ profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
1223
1470
  /**
1224
1471
  * Disable profile photo
1225
1472
  */
1226
- disableProfilePhoto?: boolean | undefined;
1473
+ disableProfilePhoto?: boolean;
1227
1474
  }
1228
1475
  //#endregion
1229
1476
  //#region ../core/dist/social-providers/google.d.mts
@@ -1255,7 +1502,7 @@ interface GoogleProfile {
1255
1502
  sub: string;
1256
1503
  }
1257
1504
  interface GoogleOptions extends ProviderOptions<GoogleProfile> {
1258
- clientId: string;
1505
+ clientId: string | string[];
1259
1506
  /**
1260
1507
  * The access type to use for the authorization code request
1261
1508
  */
@@ -1265,9 +1512,25 @@ interface GoogleOptions extends ProviderOptions<GoogleProfile> {
1265
1512
  */
1266
1513
  display?: ("page" | "popup" | "touch" | "wap") | undefined;
1267
1514
  /**
1268
- * The hosted domain of the user
1515
+ * The hosted domain (Google Workspace) the user must belong to.
1516
+ *
1517
+ * This is sent to Google as the `hd` authorization hint and, when set, is
1518
+ * also enforced against the `hd` claim of the returned id token/profile.
1519
+ * Set `hd: "*"` to require any Workspace hosted-domain claim. Sign-in is
1520
+ * rejected when the claim is missing or does not satisfy this restriction.
1269
1521
  */
1270
1522
  hd?: string | undefined;
1523
+ /**
1524
+ * Whether to send `include_granted_scopes=true` to Google's authorization
1525
+ * endpoint, which lets new access tokens cover scopes from prior grants
1526
+ * in addition to the ones requested for this flow. Set to `false` when
1527
+ * each OAuth flow should request only its own scopes.
1528
+ *
1529
+ * Defaults to `true`.
1530
+ *
1531
+ * @see https://developers.google.com/identity/protocols/oauth2/web-server#incrementalAuth
1532
+ */
1533
+ includeGrantedScopes?: boolean | undefined;
1271
1534
  }
1272
1535
  //#endregion
1273
1536
  //#region ../core/dist/social-providers/huggingface.d.mts
@@ -1539,8 +1802,8 @@ interface LinkedInProfile {
1539
1802
  country: string;
1540
1803
  language: string;
1541
1804
  };
1542
- email: string;
1543
- email_verified: boolean;
1805
+ email?: string;
1806
+ email_verified?: boolean;
1544
1807
  }
1545
1808
  interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
1546
1809
  clientId: string;
@@ -1985,6 +2248,7 @@ interface PaybinOptions extends ProviderOptions<PaybinProfile> {
1985
2248
  //#region ../core/dist/social-providers/paypal.d.mts
1986
2249
  //#region src/social-providers/paypal.d.ts
1987
2250
  interface PayPalProfile {
2251
+ sub?: string | undefined;
1988
2252
  user_id: string;
1989
2253
  name: string;
1990
2254
  given_name: string;
@@ -2141,7 +2405,8 @@ declare const socialProviders: {
2141
2405
  createAuthorizationURL({
2142
2406
  state,
2143
2407
  scopes,
2144
- redirectURI
2408
+ redirectURI,
2409
+ additionalParams
2145
2410
  }: {
2146
2411
  state: string;
2147
2412
  codeVerifier: string;
@@ -2149,6 +2414,8 @@ declare const socialProviders: {
2149
2414
  redirectURI: string;
2150
2415
  display?: string | undefined;
2151
2416
  loginHint?: string | undefined;
2417
+ idTokenNonce?: string | undefined;
2418
+ additionalParams?: Record<string, string> | undefined;
2152
2419
  }): Promise<URL>;
2153
2420
  validateAuthorizationCode: ({
2154
2421
  code,
@@ -2160,9 +2427,16 @@ declare const socialProviders: {
2160
2427
  codeVerifier?: string | undefined;
2161
2428
  deviceId?: string | undefined;
2162
2429
  }) => Promise<OAuth2Tokens>;
2163
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2430
+ idToken: {
2431
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2432
+ issuer: string;
2433
+ audience: string | string[];
2434
+ maxTokenAge: string;
2435
+ nonceComparison: "exact-or-sha256";
2436
+ };
2164
2437
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2165
2438
  getUserInfo(token: OAuth2Tokens & {
2439
+ expectedIdTokenNonce?: string | undefined;
2166
2440
  user?: {
2167
2441
  name?: {
2168
2442
  firstName?: string;
@@ -2190,7 +2464,8 @@ declare const socialProviders: {
2190
2464
  state,
2191
2465
  scopes,
2192
2466
  codeVerifier,
2193
- redirectURI
2467
+ redirectURI,
2468
+ additionalParams
2194
2469
  }: {
2195
2470
  state: string;
2196
2471
  codeVerifier: string;
@@ -2198,6 +2473,8 @@ declare const socialProviders: {
2198
2473
  redirectURI: string;
2199
2474
  display?: string | undefined;
2200
2475
  loginHint?: string | undefined;
2476
+ idTokenNonce?: string | undefined;
2477
+ additionalParams?: Record<string, string> | undefined;
2201
2478
  }): Promise<URL>;
2202
2479
  validateAuthorizationCode: ({
2203
2480
  code,
@@ -2211,6 +2488,7 @@ declare const socialProviders: {
2211
2488
  }) => Promise<OAuth2Tokens>;
2212
2489
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2213
2490
  getUserInfo(token: OAuth2Tokens & {
2491
+ expectedIdTokenNonce?: string | undefined;
2214
2492
  user?: {
2215
2493
  name?: {
2216
2494
  firstName?: string;
@@ -2238,7 +2516,8 @@ declare const socialProviders: {
2238
2516
  state,
2239
2517
  scopes,
2240
2518
  codeVerifier,
2241
- redirectURI
2519
+ redirectURI,
2520
+ additionalParams
2242
2521
  }: {
2243
2522
  state: string;
2244
2523
  codeVerifier: string;
@@ -2246,6 +2525,8 @@ declare const socialProviders: {
2246
2525
  redirectURI: string;
2247
2526
  display?: string | undefined;
2248
2527
  loginHint?: string | undefined;
2528
+ idTokenNonce?: string | undefined;
2529
+ additionalParams?: Record<string, string> | undefined;
2249
2530
  }): Promise<URL>;
2250
2531
  validateAuthorizationCode: ({
2251
2532
  code,
@@ -2258,8 +2539,14 @@ declare const socialProviders: {
2258
2539
  deviceId?: string | undefined;
2259
2540
  }) => Promise<OAuth2Tokens>;
2260
2541
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2261
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2542
+ idToken: {
2543
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2544
+ issuer: string;
2545
+ audience: string | string[];
2546
+ maxTokenAge: string;
2547
+ };
2262
2548
  getUserInfo(token: OAuth2Tokens & {
2549
+ expectedIdTokenNonce?: string | undefined;
2263
2550
  user?: {
2264
2551
  name?: {
2265
2552
  firstName?: string;
@@ -2286,7 +2573,8 @@ declare const socialProviders: {
2286
2573
  createAuthorizationURL({
2287
2574
  state,
2288
2575
  scopes,
2289
- redirectURI
2576
+ redirectURI,
2577
+ additionalParams
2290
2578
  }: {
2291
2579
  state: string;
2292
2580
  codeVerifier: string;
@@ -2294,7 +2582,9 @@ declare const socialProviders: {
2294
2582
  redirectURI: string;
2295
2583
  display?: string | undefined;
2296
2584
  loginHint?: string | undefined;
2297
- }): URL;
2585
+ idTokenNonce?: string | undefined;
2586
+ additionalParams?: Record<string, string> | undefined;
2587
+ }): Promise<URL>;
2298
2588
  validateAuthorizationCode: ({
2299
2589
  code,
2300
2590
  redirectURI
@@ -2306,6 +2596,7 @@ declare const socialProviders: {
2306
2596
  }) => Promise<OAuth2Tokens>;
2307
2597
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2308
2598
  getUserInfo(token: OAuth2Tokens & {
2599
+ expectedIdTokenNonce?: string | undefined;
2309
2600
  user?: {
2310
2601
  name?: {
2311
2602
  firstName?: string;
@@ -2333,7 +2624,8 @@ declare const socialProviders: {
2333
2624
  state,
2334
2625
  scopes,
2335
2626
  redirectURI,
2336
- loginHint
2627
+ loginHint,
2628
+ additionalParams
2337
2629
  }: {
2338
2630
  state: string;
2339
2631
  codeVerifier: string;
@@ -2341,6 +2633,8 @@ declare const socialProviders: {
2341
2633
  redirectURI: string;
2342
2634
  display?: string | undefined;
2343
2635
  loginHint?: string | undefined;
2636
+ idTokenNonce?: string | undefined;
2637
+ additionalParams?: Record<string, string> | undefined;
2344
2638
  }): Promise<URL>;
2345
2639
  validateAuthorizationCode: ({
2346
2640
  code,
@@ -2351,9 +2645,23 @@ declare const socialProviders: {
2351
2645
  codeVerifier?: string | undefined;
2352
2646
  deviceId?: string | undefined;
2353
2647
  }) => Promise<OAuth2Tokens>;
2354
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2648
+ idToken: {
2649
+ jwks: {
2650
+ (protectedHeader?: jose.JWSHeaderParameters, token?: jose.FlattenedJWSInput): Promise<jose.CryptoKey>;
2651
+ coolingDown: boolean;
2652
+ fresh: boolean;
2653
+ reloading: boolean;
2654
+ reload: () => Promise<void>;
2655
+ jwks: () => jose.JSONWebKeySet | undefined;
2656
+ };
2657
+ issuer: string;
2658
+ audience: string | string[];
2659
+ algorithms: string[];
2660
+ allowOpaqueToken: true;
2661
+ };
2355
2662
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2356
2663
  getUserInfo(token: OAuth2Tokens & {
2664
+ expectedIdTokenNonce?: string | undefined;
2357
2665
  user?: {
2358
2666
  name?: {
2359
2667
  firstName?: string;
@@ -2381,7 +2689,8 @@ declare const socialProviders: {
2381
2689
  state,
2382
2690
  scopes,
2383
2691
  codeVerifier,
2384
- redirectURI
2692
+ redirectURI,
2693
+ additionalParams
2385
2694
  }: {
2386
2695
  state: string;
2387
2696
  codeVerifier: string;
@@ -2389,6 +2698,8 @@ declare const socialProviders: {
2389
2698
  redirectURI: string;
2390
2699
  display?: string | undefined;
2391
2700
  loginHint?: string | undefined;
2701
+ idTokenNonce?: string | undefined;
2702
+ additionalParams?: Record<string, string> | undefined;
2392
2703
  }): Promise<URL>;
2393
2704
  validateAuthorizationCode: ({
2394
2705
  code,
@@ -2402,6 +2713,7 @@ declare const socialProviders: {
2402
2713
  }) => Promise<OAuth2Tokens>;
2403
2714
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2404
2715
  getUserInfo(token: OAuth2Tokens & {
2716
+ expectedIdTokenNonce?: string | undefined;
2405
2717
  user?: {
2406
2718
  name?: {
2407
2719
  firstName?: string;
@@ -2430,7 +2742,8 @@ declare const socialProviders: {
2430
2742
  scopes,
2431
2743
  loginHint,
2432
2744
  codeVerifier,
2433
- redirectURI
2745
+ redirectURI,
2746
+ additionalParams
2434
2747
  }: {
2435
2748
  state: string;
2436
2749
  codeVerifier: string;
@@ -2438,6 +2751,8 @@ declare const socialProviders: {
2438
2751
  redirectURI: string;
2439
2752
  display?: string | undefined;
2440
2753
  loginHint?: string | undefined;
2754
+ idTokenNonce?: string | undefined;
2755
+ additionalParams?: Record<string, string> | undefined;
2441
2756
  }): Promise<URL>;
2442
2757
  validateAuthorizationCode: ({
2443
2758
  code,
@@ -2451,6 +2766,7 @@ declare const socialProviders: {
2451
2766
  }) => Promise<OAuth2Tokens | null>;
2452
2767
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2453
2768
  getUserInfo(token: OAuth2Tokens & {
2769
+ expectedIdTokenNonce?: string | undefined;
2454
2770
  user?: {
2455
2771
  name?: {
2456
2772
  firstName?: string;
@@ -2481,6 +2797,8 @@ declare const socialProviders: {
2481
2797
  redirectURI: string;
2482
2798
  display?: string | undefined;
2483
2799
  loginHint?: string | undefined;
2800
+ idTokenNonce?: string | undefined;
2801
+ additionalParams?: Record<string, string> | undefined;
2484
2802
  }): Promise<URL>;
2485
2803
  validateAuthorizationCode({
2486
2804
  code,
@@ -2492,8 +2810,15 @@ declare const socialProviders: {
2492
2810
  codeVerifier?: string | undefined;
2493
2811
  deviceId?: string | undefined;
2494
2812
  }): Promise<OAuth2Tokens>;
2495
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2813
+ idToken: {
2814
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2815
+ audience: string | string[];
2816
+ maxTokenAge: string;
2817
+ issuer: string | undefined;
2818
+ verifyClaims: (claims: Record<string, unknown>) => boolean;
2819
+ };
2496
2820
  getUserInfo(token: OAuth2Tokens & {
2821
+ expectedIdTokenNonce?: string | undefined;
2497
2822
  user?: {
2498
2823
  name?: {
2499
2824
  firstName?: string;
@@ -2524,7 +2849,8 @@ declare const socialProviders: {
2524
2849
  codeVerifier,
2525
2850
  redirectURI,
2526
2851
  loginHint,
2527
- display
2852
+ display,
2853
+ additionalParams
2528
2854
  }: {
2529
2855
  state: string;
2530
2856
  codeVerifier: string;
@@ -2532,6 +2858,8 @@ declare const socialProviders: {
2532
2858
  redirectURI: string;
2533
2859
  display?: string | undefined;
2534
2860
  loginHint?: string | undefined;
2861
+ idTokenNonce?: string | undefined;
2862
+ additionalParams?: Record<string, string> | undefined;
2535
2863
  }): Promise<URL>;
2536
2864
  validateAuthorizationCode: ({
2537
2865
  code,
@@ -2544,8 +2872,15 @@ declare const socialProviders: {
2544
2872
  deviceId?: string | undefined;
2545
2873
  }) => Promise<OAuth2Tokens>;
2546
2874
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2547
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2875
+ idToken: {
2876
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2877
+ issuer: string[];
2878
+ audience: string | string[];
2879
+ maxTokenAge: string;
2880
+ verifyClaims: ((claims: Record<string, unknown>) => boolean) | undefined;
2881
+ };
2548
2882
  getUserInfo(token: OAuth2Tokens & {
2883
+ expectedIdTokenNonce?: string | undefined;
2549
2884
  user?: {
2550
2885
  name?: {
2551
2886
  firstName?: string;
@@ -2573,7 +2908,8 @@ declare const socialProviders: {
2573
2908
  state,
2574
2909
  scopes,
2575
2910
  codeVerifier,
2576
- redirectURI
2911
+ redirectURI,
2912
+ additionalParams
2577
2913
  }: {
2578
2914
  state: string;
2579
2915
  codeVerifier: string;
@@ -2581,6 +2917,8 @@ declare const socialProviders: {
2581
2917
  redirectURI: string;
2582
2918
  display?: string | undefined;
2583
2919
  loginHint?: string | undefined;
2920
+ idTokenNonce?: string | undefined;
2921
+ additionalParams?: Record<string, string> | undefined;
2584
2922
  }): Promise<URL>;
2585
2923
  validateAuthorizationCode: ({
2586
2924
  code,
@@ -2594,6 +2932,7 @@ declare const socialProviders: {
2594
2932
  }) => Promise<OAuth2Tokens>;
2595
2933
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2596
2934
  getUserInfo(token: OAuth2Tokens & {
2935
+ expectedIdTokenNonce?: string | undefined;
2597
2936
  user?: {
2598
2937
  name?: {
2599
2938
  firstName?: string;
@@ -2620,7 +2959,8 @@ declare const socialProviders: {
2620
2959
  createAuthorizationURL({
2621
2960
  state,
2622
2961
  scopes,
2623
- redirectURI
2962
+ redirectURI,
2963
+ additionalParams
2624
2964
  }: {
2625
2965
  state: string;
2626
2966
  codeVerifier: string;
@@ -2628,7 +2968,9 @@ declare const socialProviders: {
2628
2968
  redirectURI: string;
2629
2969
  display?: string | undefined;
2630
2970
  loginHint?: string | undefined;
2631
- }): URL;
2971
+ idTokenNonce?: string | undefined;
2972
+ additionalParams?: Record<string, string> | undefined;
2973
+ }): Promise<URL>;
2632
2974
  validateAuthorizationCode: ({
2633
2975
  code,
2634
2976
  redirectURI
@@ -2640,6 +2982,7 @@ declare const socialProviders: {
2640
2982
  }) => Promise<OAuth2Tokens>;
2641
2983
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2642
2984
  getUserInfo(token: OAuth2Tokens & {
2985
+ expectedIdTokenNonce?: string | undefined;
2643
2986
  user?: {
2644
2987
  name?: {
2645
2988
  firstName?: string;
@@ -2667,7 +3010,8 @@ declare const socialProviders: {
2667
3010
  state,
2668
3011
  scopes,
2669
3012
  codeVerifier,
2670
- redirectURI
3013
+ redirectURI,
3014
+ additionalParams
2671
3015
  }: {
2672
3016
  state: string;
2673
3017
  codeVerifier: string;
@@ -2675,6 +3019,8 @@ declare const socialProviders: {
2675
3019
  redirectURI: string;
2676
3020
  display?: string | undefined;
2677
3021
  loginHint?: string | undefined;
3022
+ idTokenNonce?: string | undefined;
3023
+ additionalParams?: Record<string, string> | undefined;
2678
3024
  }): Promise<URL>;
2679
3025
  validateAuthorizationCode: ({
2680
3026
  code,
@@ -2688,6 +3034,7 @@ declare const socialProviders: {
2688
3034
  }) => Promise<OAuth2Tokens>;
2689
3035
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2690
3036
  getUserInfo(token: OAuth2Tokens & {
3037
+ expectedIdTokenNonce?: string | undefined;
2691
3038
  user?: {
2692
3039
  name?: {
2693
3040
  firstName?: string;
@@ -2714,7 +3061,8 @@ declare const socialProviders: {
2714
3061
  createAuthorizationURL({
2715
3062
  state,
2716
3063
  scopes,
2717
- redirectURI
3064
+ redirectURI,
3065
+ additionalParams
2718
3066
  }: {
2719
3067
  state: string;
2720
3068
  codeVerifier: string;
@@ -2722,6 +3070,8 @@ declare const socialProviders: {
2722
3070
  redirectURI: string;
2723
3071
  display?: string | undefined;
2724
3072
  loginHint?: string | undefined;
3073
+ idTokenNonce?: string | undefined;
3074
+ additionalParams?: Record<string, string> | undefined;
2725
3075
  }): Promise<URL>;
2726
3076
  validateAuthorizationCode: ({
2727
3077
  code,
@@ -2734,6 +3084,7 @@ declare const socialProviders: {
2734
3084
  }) => Promise<OAuth2Tokens>;
2735
3085
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2736
3086
  getUserInfo(token: OAuth2Tokens & {
3087
+ expectedIdTokenNonce?: string | undefined;
2737
3088
  user?: {
2738
3089
  name?: {
2739
3090
  firstName?: string;
@@ -2764,6 +3115,8 @@ declare const socialProviders: {
2764
3115
  redirectURI: string;
2765
3116
  display?: string | undefined;
2766
3117
  loginHint?: string | undefined;
3118
+ idTokenNonce?: string | undefined;
3119
+ additionalParams?: Record<string, string> | undefined;
2767
3120
  }): Promise<URL>;
2768
3121
  validateAuthorizationCode: ({
2769
3122
  code,
@@ -2777,6 +3130,7 @@ declare const socialProviders: {
2777
3130
  }) => Promise<OAuth2Tokens>;
2778
3131
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2779
3132
  getUserInfo(token: OAuth2Tokens & {
3133
+ expectedIdTokenNonce?: string | undefined;
2780
3134
  user?: {
2781
3135
  name?: {
2782
3136
  firstName?: string;
@@ -2804,7 +3158,8 @@ declare const socialProviders: {
2804
3158
  state,
2805
3159
  scopes,
2806
3160
  codeVerifier,
2807
- redirectURI
3161
+ redirectURI,
3162
+ additionalParams
2808
3163
  }: {
2809
3164
  state: string;
2810
3165
  codeVerifier: string;
@@ -2812,6 +3167,8 @@ declare const socialProviders: {
2812
3167
  redirectURI: string;
2813
3168
  display?: string | undefined;
2814
3169
  loginHint?: string | undefined;
3170
+ idTokenNonce?: string | undefined;
3171
+ additionalParams?: Record<string, string> | undefined;
2815
3172
  }) => Promise<URL>;
2816
3173
  validateAuthorizationCode: ({
2817
3174
  code,
@@ -2825,6 +3182,7 @@ declare const socialProviders: {
2825
3182
  }) => Promise<OAuth2Tokens>;
2826
3183
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2827
3184
  getUserInfo(token: OAuth2Tokens & {
3185
+ expectedIdTokenNonce?: string | undefined;
2828
3186
  user?: {
2829
3187
  name?: {
2830
3188
  firstName?: string;
@@ -2852,7 +3210,8 @@ declare const socialProviders: {
2852
3210
  state,
2853
3211
  scopes,
2854
3212
  redirectURI,
2855
- codeVerifier
3213
+ codeVerifier,
3214
+ additionalParams
2856
3215
  }: {
2857
3216
  state: string;
2858
3217
  codeVerifier: string;
@@ -2860,6 +3219,8 @@ declare const socialProviders: {
2860
3219
  redirectURI: string;
2861
3220
  display?: string | undefined;
2862
3221
  loginHint?: string | undefined;
3222
+ idTokenNonce?: string | undefined;
3223
+ additionalParams?: Record<string, string> | undefined;
2863
3224
  }): Promise<URL>;
2864
3225
  validateAuthorizationCode({
2865
3226
  code,
@@ -2873,6 +3234,7 @@ declare const socialProviders: {
2873
3234
  }): Promise<OAuth2Tokens>;
2874
3235
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2875
3236
  getUserInfo(token: OAuth2Tokens & {
3237
+ expectedIdTokenNonce?: string | undefined;
2876
3238
  user?: {
2877
3239
  name?: {
2878
3240
  firstName?: string;
@@ -2900,7 +3262,8 @@ declare const socialProviders: {
2900
3262
  state,
2901
3263
  scopes,
2902
3264
  loginHint,
2903
- redirectURI
3265
+ redirectURI,
3266
+ additionalParams
2904
3267
  }: {
2905
3268
  state: string;
2906
3269
  codeVerifier: string;
@@ -2908,6 +3271,8 @@ declare const socialProviders: {
2908
3271
  redirectURI: string;
2909
3272
  display?: string | undefined;
2910
3273
  loginHint?: string | undefined;
3274
+ idTokenNonce?: string | undefined;
3275
+ additionalParams?: Record<string, string> | undefined;
2911
3276
  }): Promise<URL>;
2912
3277
  validateAuthorizationCode: ({
2913
3278
  code,
@@ -2920,6 +3285,7 @@ declare const socialProviders: {
2920
3285
  }) => Promise<OAuth2Tokens>;
2921
3286
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2922
3287
  getUserInfo(token: OAuth2Tokens & {
3288
+ expectedIdTokenNonce?: string | undefined;
2923
3289
  user?: {
2924
3290
  name?: {
2925
3291
  firstName?: string;
@@ -2947,7 +3313,8 @@ declare const socialProviders: {
2947
3313
  state,
2948
3314
  scopes,
2949
3315
  redirectURI,
2950
- loginHint
3316
+ loginHint,
3317
+ additionalParams
2951
3318
  }: {
2952
3319
  state: string;
2953
3320
  codeVerifier: string;
@@ -2955,6 +3322,8 @@ declare const socialProviders: {
2955
3322
  redirectURI: string;
2956
3323
  display?: string | undefined;
2957
3324
  loginHint?: string | undefined;
3325
+ idTokenNonce?: string | undefined;
3326
+ additionalParams?: Record<string, string> | undefined;
2958
3327
  }) => Promise<URL>;
2959
3328
  validateAuthorizationCode: ({
2960
3329
  code,
@@ -2967,6 +3336,7 @@ declare const socialProviders: {
2967
3336
  }) => Promise<OAuth2Tokens>;
2968
3337
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2969
3338
  getUserInfo(token: OAuth2Tokens & {
3339
+ expectedIdTokenNonce?: string | undefined;
2970
3340
  user?: {
2971
3341
  name?: {
2972
3342
  firstName?: string;
@@ -2995,7 +3365,8 @@ declare const socialProviders: {
2995
3365
  scopes,
2996
3366
  codeVerifier,
2997
3367
  loginHint,
2998
- redirectURI
3368
+ redirectURI,
3369
+ additionalParams
2999
3370
  }: {
3000
3371
  state: string;
3001
3372
  codeVerifier: string;
@@ -3003,6 +3374,8 @@ declare const socialProviders: {
3003
3374
  redirectURI: string;
3004
3375
  display?: string | undefined;
3005
3376
  loginHint?: string | undefined;
3377
+ idTokenNonce?: string | undefined;
3378
+ additionalParams?: Record<string, string> | undefined;
3006
3379
  }) => Promise<URL>;
3007
3380
  validateAuthorizationCode: ({
3008
3381
  code,
@@ -3016,6 +3389,7 @@ declare const socialProviders: {
3016
3389
  }) => Promise<OAuth2Tokens>;
3017
3390
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3018
3391
  getUserInfo(token: OAuth2Tokens & {
3392
+ expectedIdTokenNonce?: string | undefined;
3019
3393
  user?: {
3020
3394
  name?: {
3021
3395
  firstName?: string;
@@ -3063,7 +3437,8 @@ declare const socialProviders: {
3063
3437
  createAuthorizationURL({
3064
3438
  state,
3065
3439
  scopes,
3066
- redirectURI
3440
+ redirectURI,
3441
+ additionalParams
3067
3442
  }: {
3068
3443
  state: string;
3069
3444
  codeVerifier: string;
@@ -3071,6 +3446,8 @@ declare const socialProviders: {
3071
3446
  redirectURI: string;
3072
3447
  display?: string | undefined;
3073
3448
  loginHint?: string | undefined;
3449
+ idTokenNonce?: string | undefined;
3450
+ additionalParams?: Record<string, string> | undefined;
3074
3451
  }): URL;
3075
3452
  validateAuthorizationCode: ({
3076
3453
  code,
@@ -3083,6 +3460,7 @@ declare const socialProviders: {
3083
3460
  }) => Promise<OAuth2Tokens>;
3084
3461
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3085
3462
  getUserInfo(token: OAuth2Tokens & {
3463
+ expectedIdTokenNonce?: string | undefined;
3086
3464
  user?: {
3087
3465
  name?: {
3088
3466
  firstName?: string;
@@ -3109,7 +3487,8 @@ declare const socialProviders: {
3109
3487
  createAuthorizationURL({
3110
3488
  state,
3111
3489
  scopes,
3112
- redirectURI
3490
+ redirectURI,
3491
+ additionalParams
3113
3492
  }: {
3114
3493
  state: string;
3115
3494
  codeVerifier: string;
@@ -3117,6 +3496,8 @@ declare const socialProviders: {
3117
3496
  redirectURI: string;
3118
3497
  display?: string | undefined;
3119
3498
  loginHint?: string | undefined;
3499
+ idTokenNonce?: string | undefined;
3500
+ additionalParams?: Record<string, string> | undefined;
3120
3501
  }): Promise<URL>;
3121
3502
  validateAuthorizationCode: ({
3122
3503
  code,
@@ -3129,6 +3510,7 @@ declare const socialProviders: {
3129
3510
  }) => Promise<OAuth2Tokens>;
3130
3511
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3131
3512
  getUserInfo(token: OAuth2Tokens & {
3513
+ expectedIdTokenNonce?: string | undefined;
3132
3514
  user?: {
3133
3515
  name?: {
3134
3516
  firstName?: string;
@@ -3155,7 +3537,8 @@ declare const socialProviders: {
3155
3537
  createAuthorizationURL({
3156
3538
  state,
3157
3539
  scopes,
3158
- redirectURI
3540
+ redirectURI,
3541
+ additionalParams
3159
3542
  }: {
3160
3543
  state: string;
3161
3544
  codeVerifier: string;
@@ -3163,7 +3546,9 @@ declare const socialProviders: {
3163
3546
  redirectURI: string;
3164
3547
  display?: string | undefined;
3165
3548
  loginHint?: string | undefined;
3166
- }): URL;
3549
+ idTokenNonce?: string | undefined;
3550
+ additionalParams?: Record<string, string> | undefined;
3551
+ }): Promise<URL>;
3167
3552
  validateAuthorizationCode: ({
3168
3553
  code,
3169
3554
  redirectURI
@@ -3175,6 +3560,7 @@ declare const socialProviders: {
3175
3560
  }) => Promise<OAuth2Tokens>;
3176
3561
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3177
3562
  getUserInfo(token: OAuth2Tokens & {
3563
+ expectedIdTokenNonce?: string | undefined;
3178
3564
  user?: {
3179
3565
  name?: {
3180
3566
  firstName?: string;
@@ -3202,7 +3588,8 @@ declare const socialProviders: {
3202
3588
  state,
3203
3589
  scopes,
3204
3590
  codeVerifier,
3205
- redirectURI
3591
+ redirectURI,
3592
+ additionalParams
3206
3593
  }: {
3207
3594
  state: string;
3208
3595
  codeVerifier: string;
@@ -3210,6 +3597,8 @@ declare const socialProviders: {
3210
3597
  redirectURI: string;
3211
3598
  display?: string | undefined;
3212
3599
  loginHint?: string | undefined;
3600
+ idTokenNonce?: string | undefined;
3601
+ additionalParams?: Record<string, string> | undefined;
3213
3602
  }): Promise<URL>;
3214
3603
  validateAuthorizationCode: ({
3215
3604
  code,
@@ -3223,6 +3612,7 @@ declare const socialProviders: {
3223
3612
  }) => Promise<OAuth2Tokens>;
3224
3613
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3225
3614
  getUserInfo(token: OAuth2Tokens & {
3615
+ expectedIdTokenNonce?: string | undefined;
3226
3616
  user?: {
3227
3617
  name?: {
3228
3618
  firstName?: string;
@@ -3250,7 +3640,8 @@ declare const socialProviders: {
3250
3640
  state,
3251
3641
  scopes,
3252
3642
  codeVerifier,
3253
- redirectURI
3643
+ redirectURI,
3644
+ additionalParams
3254
3645
  }: {
3255
3646
  state: string;
3256
3647
  codeVerifier: string;
@@ -3258,6 +3649,8 @@ declare const socialProviders: {
3258
3649
  redirectURI: string;
3259
3650
  display?: string | undefined;
3260
3651
  loginHint?: string | undefined;
3652
+ idTokenNonce?: string | undefined;
3653
+ additionalParams?: Record<string, string> | undefined;
3261
3654
  }): Promise<URL>;
3262
3655
  validateAuthorizationCode: ({
3263
3656
  code,
@@ -3272,6 +3665,7 @@ declare const socialProviders: {
3272
3665
  }) => Promise<OAuth2Tokens>;
3273
3666
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3274
3667
  getUserInfo(data: OAuth2Tokens & {
3668
+ expectedIdTokenNonce?: string | undefined;
3275
3669
  user?: {
3276
3670
  name?: {
3277
3671
  firstName?: string;
@@ -3298,7 +3692,8 @@ declare const socialProviders: {
3298
3692
  createAuthorizationURL: ({
3299
3693
  state,
3300
3694
  redirectURI,
3301
- codeVerifier
3695
+ codeVerifier,
3696
+ additionalParams
3302
3697
  }: {
3303
3698
  state: string;
3304
3699
  codeVerifier: string;
@@ -3306,6 +3701,8 @@ declare const socialProviders: {
3306
3701
  redirectURI: string;
3307
3702
  display?: string | undefined;
3308
3703
  loginHint?: string | undefined;
3704
+ idTokenNonce?: string | undefined;
3705
+ additionalParams?: Record<string, string> | undefined;
3309
3706
  }) => Promise<URL>;
3310
3707
  validateAuthorizationCode: ({
3311
3708
  code,
@@ -3319,6 +3716,7 @@ declare const socialProviders: {
3319
3716
  }) => Promise<OAuth2Tokens>;
3320
3717
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3321
3718
  getUserInfo(token: OAuth2Tokens & {
3719
+ expectedIdTokenNonce?: string | undefined;
3322
3720
  user?: {
3323
3721
  name?: {
3324
3722
  firstName?: string;
@@ -3345,7 +3743,8 @@ declare const socialProviders: {
3345
3743
  state,
3346
3744
  scopes,
3347
3745
  loginHint,
3348
- redirectURI
3746
+ redirectURI,
3747
+ additionalParams
3349
3748
  }: {
3350
3749
  state: string;
3351
3750
  codeVerifier: string;
@@ -3353,6 +3752,8 @@ declare const socialProviders: {
3353
3752
  redirectURI: string;
3354
3753
  display?: string | undefined;
3355
3754
  loginHint?: string | undefined;
3755
+ idTokenNonce?: string | undefined;
3756
+ additionalParams?: Record<string, string> | undefined;
3356
3757
  }): Promise<URL>;
3357
3758
  validateAuthorizationCode: ({
3358
3759
  code,
@@ -3365,6 +3766,7 @@ declare const socialProviders: {
3365
3766
  }) => Promise<OAuth2Tokens>;
3366
3767
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3367
3768
  getUserInfo(token: OAuth2Tokens & {
3769
+ expectedIdTokenNonce?: string | undefined;
3368
3770
  user?: {
3369
3771
  name?: {
3370
3772
  firstName?: string;
@@ -3391,7 +3793,8 @@ declare const socialProviders: {
3391
3793
  createAuthorizationURL({
3392
3794
  state,
3393
3795
  scopes,
3394
- redirectURI
3796
+ redirectURI,
3797
+ additionalParams
3395
3798
  }: {
3396
3799
  state: string;
3397
3800
  codeVerifier: string;
@@ -3399,6 +3802,8 @@ declare const socialProviders: {
3399
3802
  redirectURI: string;
3400
3803
  display?: string | undefined;
3401
3804
  loginHint?: string | undefined;
3805
+ idTokenNonce?: string | undefined;
3806
+ additionalParams?: Record<string, string> | undefined;
3402
3807
  }): Promise<URL>;
3403
3808
  validateAuthorizationCode: ({
3404
3809
  code,
@@ -3411,6 +3816,7 @@ declare const socialProviders: {
3411
3816
  }) => Promise<OAuth2Tokens>;
3412
3817
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3413
3818
  getUserInfo(token: OAuth2Tokens & {
3819
+ expectedIdTokenNonce?: string | undefined;
3414
3820
  user?: {
3415
3821
  name?: {
3416
3822
  firstName?: string;
@@ -3458,7 +3864,8 @@ declare const socialProviders: {
3458
3864
  createAuthorizationURL({
3459
3865
  state,
3460
3866
  scopes,
3461
- redirectURI
3867
+ redirectURI,
3868
+ additionalParams
3462
3869
  }: {
3463
3870
  state: string;
3464
3871
  codeVerifier: string;
@@ -3466,6 +3873,8 @@ declare const socialProviders: {
3466
3873
  redirectURI: string;
3467
3874
  display?: string | undefined;
3468
3875
  loginHint?: string | undefined;
3876
+ idTokenNonce?: string | undefined;
3877
+ additionalParams?: Record<string, string> | undefined;
3469
3878
  }): Promise<URL>;
3470
3879
  validateAuthorizationCode: ({
3471
3880
  code,
@@ -3478,6 +3887,7 @@ declare const socialProviders: {
3478
3887
  }) => Promise<OAuth2Tokens>;
3479
3888
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3480
3889
  getUserInfo(token: OAuth2Tokens & {
3890
+ expectedIdTokenNonce?: string | undefined;
3481
3891
  user?: {
3482
3892
  name?: {
3483
3893
  firstName?: string;
@@ -3527,7 +3937,8 @@ declare const socialProviders: {
3527
3937
  scopes,
3528
3938
  codeVerifier,
3529
3939
  redirectURI,
3530
- loginHint
3940
+ loginHint,
3941
+ additionalParams
3531
3942
  }: {
3532
3943
  state: string;
3533
3944
  codeVerifier: string;
@@ -3535,6 +3946,8 @@ declare const socialProviders: {
3535
3946
  redirectURI: string;
3536
3947
  display?: string | undefined;
3537
3948
  loginHint?: string | undefined;
3949
+ idTokenNonce?: string | undefined;
3950
+ additionalParams?: Record<string, string> | undefined;
3538
3951
  }): Promise<URL>;
3539
3952
  validateAuthorizationCode: ({
3540
3953
  code,
@@ -3547,8 +3960,11 @@ declare const socialProviders: {
3547
3960
  deviceId?: string | undefined;
3548
3961
  }) => Promise<OAuth2Tokens>;
3549
3962
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3550
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
3963
+ idToken: {
3964
+ verify: (token: string, nonce: string | undefined) => Promise<boolean>;
3965
+ };
3551
3966
  getUserInfo(token: OAuth2Tokens & {
3967
+ expectedIdTokenNonce?: string | undefined;
3552
3968
  user?: {
3553
3969
  name?: {
3554
3970
  firstName?: string;
@@ -3598,7 +4014,8 @@ declare const socialProviders: {
3598
4014
  scopes,
3599
4015
  codeVerifier,
3600
4016
  redirectURI,
3601
- loginHint
4017
+ loginHint,
4018
+ additionalParams
3602
4019
  }: {
3603
4020
  state: string;
3604
4021
  codeVerifier: string;
@@ -3606,6 +4023,8 @@ declare const socialProviders: {
3606
4023
  redirectURI: string;
3607
4024
  display?: string | undefined;
3608
4025
  loginHint?: string | undefined;
4026
+ idTokenNonce?: string | undefined;
4027
+ additionalParams?: Record<string, string> | undefined;
3609
4028
  }): Promise<URL>;
3610
4029
  validateAuthorizationCode: ({
3611
4030
  code,
@@ -3619,6 +4038,7 @@ declare const socialProviders: {
3619
4038
  }) => Promise<OAuth2Tokens>;
3620
4039
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3621
4040
  getUserInfo(token: OAuth2Tokens & {
4041
+ expectedIdTokenNonce?: string | undefined;
3622
4042
  user?: {
3623
4043
  name?: {
3624
4044
  firstName?: string;
@@ -3645,7 +4065,8 @@ declare const socialProviders: {
3645
4065
  createAuthorizationURL({
3646
4066
  state,
3647
4067
  codeVerifier,
3648
- redirectURI
4068
+ redirectURI,
4069
+ additionalParams
3649
4070
  }: {
3650
4071
  state: string;
3651
4072
  codeVerifier: string;
@@ -3653,6 +4074,8 @@ declare const socialProviders: {
3653
4074
  redirectURI: string;
3654
4075
  display?: string | undefined;
3655
4076
  loginHint?: string | undefined;
4077
+ idTokenNonce?: string | undefined;
4078
+ additionalParams?: Record<string, string> | undefined;
3656
4079
  }): Promise<URL>;
3657
4080
  validateAuthorizationCode: ({
3658
4081
  code,
@@ -3673,8 +4096,8 @@ declare const socialProviders: {
3673
4096
  refreshToken: any;
3674
4097
  accessTokenExpiresAt: Date | undefined;
3675
4098
  }>);
3676
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
3677
4099
  getUserInfo(token: OAuth2Tokens & {
4100
+ expectedIdTokenNonce?: string | undefined;
3678
4101
  user?: {
3679
4102
  name?: {
3680
4103
  firstName?: string;
@@ -3723,7 +4146,8 @@ declare const socialProviders: {
3723
4146
  state,
3724
4147
  scopes,
3725
4148
  codeVerifier,
3726
- redirectURI
4149
+ redirectURI,
4150
+ additionalParams
3727
4151
  }: {
3728
4152
  state: string;
3729
4153
  codeVerifier: string;
@@ -3731,6 +4155,8 @@ declare const socialProviders: {
3731
4155
  redirectURI: string;
3732
4156
  display?: string | undefined;
3733
4157
  loginHint?: string | undefined;
4158
+ idTokenNonce?: string | undefined;
4159
+ additionalParams?: Record<string, string> | undefined;
3734
4160
  }): Promise<URL>;
3735
4161
  validateAuthorizationCode: ({
3736
4162
  code,
@@ -3744,6 +4170,7 @@ declare const socialProviders: {
3744
4170
  }) => Promise<OAuth2Tokens>;
3745
4171
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3746
4172
  getUserInfo(token: OAuth2Tokens & {
4173
+ expectedIdTokenNonce?: string | undefined;
3747
4174
  user?: {
3748
4175
  name?: {
3749
4176
  firstName?: string;
@@ -3771,7 +4198,8 @@ declare const socialProviders: {
3771
4198
  state,
3772
4199
  scopes,
3773
4200
  codeVerifier,
3774
- redirectURI
4201
+ redirectURI,
4202
+ additionalParams
3775
4203
  }: {
3776
4204
  state: string;
3777
4205
  codeVerifier: string;
@@ -3779,6 +4207,8 @@ declare const socialProviders: {
3779
4207
  redirectURI: string;
3780
4208
  display?: string | undefined;
3781
4209
  loginHint?: string | undefined;
4210
+ idTokenNonce?: string | undefined;
4211
+ additionalParams?: Record<string, string> | undefined;
3782
4212
  }): Promise<URL>;
3783
4213
  validateAuthorizationCode: ({
3784
4214
  code,
@@ -3792,6 +4222,7 @@ declare const socialProviders: {
3792
4222
  }) => Promise<OAuth2Tokens>;
3793
4223
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3794
4224
  getUserInfo(token: OAuth2Tokens & {
4225
+ expectedIdTokenNonce?: string | undefined;
3795
4226
  user?: {
3796
4227
  name?: {
3797
4228
  firstName?: string;
@@ -3819,7 +4250,8 @@ declare const socialProviders: {
3819
4250
  state,
3820
4251
  scopes,
3821
4252
  codeVerifier,
3822
- redirectURI
4253
+ redirectURI,
4254
+ additionalParams
3823
4255
  }: {
3824
4256
  state: string;
3825
4257
  codeVerifier: string;
@@ -3827,6 +4259,8 @@ declare const socialProviders: {
3827
4259
  redirectURI: string;
3828
4260
  display?: string | undefined;
3829
4261
  loginHint?: string | undefined;
4262
+ idTokenNonce?: string | undefined;
4263
+ additionalParams?: Record<string, string> | undefined;
3830
4264
  }): Promise<URL>;
3831
4265
  validateAuthorizationCode: ({
3832
4266
  code,
@@ -3839,6 +4273,7 @@ declare const socialProviders: {
3839
4273
  deviceId?: string | undefined;
3840
4274
  }) => Promise<OAuth2Tokens>;
3841
4275
  getUserInfo(token: OAuth2Tokens & {
4276
+ expectedIdTokenNonce?: string | undefined;
3842
4277
  user?: {
3843
4278
  name?: {
3844
4279
  firstName?: string;
@@ -3865,7 +4300,8 @@ declare const socialProviders: {
3865
4300
  createAuthorizationURL({
3866
4301
  state,
3867
4302
  scopes,
3868
- redirectURI
4303
+ redirectURI,
4304
+ additionalParams
3869
4305
  }: {
3870
4306
  state: string;
3871
4307
  codeVerifier: string;
@@ -3873,6 +4309,8 @@ declare const socialProviders: {
3873
4309
  redirectURI: string;
3874
4310
  display?: string | undefined;
3875
4311
  loginHint?: string | undefined;
4312
+ idTokenNonce?: string | undefined;
4313
+ additionalParams?: Record<string, string> | undefined;
3876
4314
  }): URL;
3877
4315
  validateAuthorizationCode: ({
3878
4316
  code
@@ -3898,6 +4336,7 @@ declare const socialProviders: {
3898
4336
  scopes: string[];
3899
4337
  }>);
3900
4338
  getUserInfo(token: OAuth2Tokens & {
4339
+ expectedIdTokenNonce?: string | undefined;
3901
4340
  user?: {
3902
4341
  name?: {
3903
4342
  firstName?: string;
@@ -3948,14 +4387,14 @@ type BaseAccount = z.infer<typeof accountSchema>;
3948
4387
  */
3949
4388
  type Account<DBOptions extends BetterAuthOptions["account"] = BetterAuthOptions["account"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseAccount & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"account", Plugins>>; //#endregion
3950
4389
  //#endregion
3951
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/helper.d.mts
4390
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/helper.d.mts
3952
4391
  type Prettify<T> = { [K in keyof T]: T[K] } & {};
3953
4392
  type IsEmptyObject<T> = keyof T extends never ? true : false;
3954
4393
  type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
3955
4394
  type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
3956
4395
  type InferParamWildCard<Path> = Path extends `${infer _Start}/*:${infer Param}/${infer Rest}` | `${infer _Start}/**:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}/*` ? { [K in "_"]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamWildCard<Rest> : {}; //#endregion
3957
4396
  //#endregion
3958
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
4397
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
3959
4398
  //#region src/standard-schema.d.ts
3960
4399
  /** The Standard Schema interface. */
3961
4400
  interface StandardSchemaV1$1<Input = unknown, Output = Input> {
@@ -4013,7 +4452,7 @@ declare namespace StandardSchemaV1$1 {
4013
4452
  type InferOutput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
4014
4453
  } //#endregion
4015
4454
  //#endregion
4016
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/error.d.mts
4455
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/error.d.mts
4017
4456
  declare const statusCodes: {
4018
4457
  OK: number;
4019
4458
  CREATED: number;
@@ -4091,7 +4530,7 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
4091
4530
  errorStack: string | undefined;
4092
4531
  }; //#endregion
4093
4532
  //#endregion
4094
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/cookies.d.mts
4533
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/cookies.d.mts
4095
4534
  //#region src/cookies.d.ts
4096
4535
  type CookiePrefixOptions = "host" | "secure";
4097
4536
  type CookieOptions = {
@@ -4181,7 +4620,7 @@ type CookieOptions = {
4181
4620
  prefix?: CookiePrefixOptions;
4182
4621
  };
4183
4622
  //#endregion
4184
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
4623
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
4185
4624
  //#region src/openapi.d.ts
4186
4625
  type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
4187
4626
  interface OpenAPIParameter {
@@ -4203,7 +4642,7 @@ interface OpenAPIParameter {
4203
4642
  };
4204
4643
  }
4205
4644
  //#endregion
4206
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
4645
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
4207
4646
  //#region src/endpoint.d.ts
4208
4647
  interface EndpointBaseOptions {
4209
4648
  /**
@@ -4524,6 +4963,22 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
4524
4963
  * @returns - The cookie string
4525
4964
  */
4526
4965
  setSignedCookie: (key: string, value: string, secret: string, options?: CookieOptions) => Promise<string>;
4966
+ /**
4967
+ * Response headers
4968
+ *
4969
+ * The live `Headers` for the response being built in the current
4970
+ * request. Read it to inspect what has already been queued, e.g. to
4971
+ * avoid emitting a `Set-Cookie` twice or to check headers set by an
4972
+ * earlier handler in the chain.
4973
+ *
4974
+ * @example
4975
+ * ```ts
4976
+ * const alreadySet = ctx.responseHeaders
4977
+ * .getSetCookie()
4978
+ * .some((c) => c.startsWith("session="));
4979
+ * ```
4980
+ */
4981
+ responseHeaders: Headers;
4527
4982
  /**
4528
4983
  * JSON
4529
4984
  *
@@ -4566,7 +5021,7 @@ type Endpoint<Path extends string = string, Options extends EndpointOptions = En
4566
5021
  path: Path;
4567
5022
  }; //#endregion
4568
5023
  //#endregion
4569
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
5024
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
4570
5025
  //#region src/middleware.d.ts
4571
5026
  interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
4572
5027
  type MiddlewareContext<Options extends MiddlewareOptions, Context = {}> = EndpointContext<string, Options & {
@@ -4673,7 +5128,7 @@ type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler e
4673
5128
  options: Options;
4674
5129
  }; //#endregion
4675
5130
  //#endregion
4676
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/context.d.mts
5131
+ //#region ../../node_modules/.pnpm/better-call@1.3.7_zod@4.3.6/node_modules/better-call/dist/context.d.mts
4677
5132
  //#region src/context.d.ts
4678
5133
  type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
4679
5134
  type Method = HTTPMethod | "*";
@@ -4813,7 +5268,13 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4813
5268
  user: User;
4814
5269
  account: Account;
4815
5270
  }>;
4816
- createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>): Promise<T & User>;
5271
+ createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>,
5272
+ /**
5273
+ * Provisioning source. The creation seam adds `action: "create-user"` and
5274
+ * runs the `user.validateUserInfo` gate.
5275
+ */
5276
+
5277
+ source: UserProvisioningSource): Promise<T & User>;
4817
5278
  createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
4818
5279
  listSessions(userId: string, options?: {
4819
5280
  onlyActiveSessions?: boolean | undefined;
@@ -4838,8 +5299,20 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4838
5299
  updateSession(sessionToken: string, session: Partial<Session> & Record<string, any>): Promise<Session | null>;
4839
5300
  deleteSession(token: string): Promise<void>;
4840
5301
  deleteAccounts(userId: string): Promise<void>;
4841
- deleteAccount(accountId: string): Promise<void>;
4842
- deleteSessions(userIdOrSessionTokens: string | string[]): Promise<void>;
5302
+ /**
5303
+ * Delete an account by its primary key.
5304
+ *
5305
+ * @param id - The account row's primary key (the `id` column, not the `accountId` column).
5306
+ */
5307
+ deleteAccount(id: string): Promise<void>;
5308
+ /**
5309
+ * Delete every session belonging to a user.
5310
+ */
5311
+ deleteUserSessions(userId: string): Promise<void>;
5312
+ /**
5313
+ * Delete sessions by their session tokens.
5314
+ */
5315
+ deleteSessions(sessionTokens: string[]): Promise<void>;
4843
5316
  findOAuthUser(email: string, accountId: string, providerId: string): Promise<{
4844
5317
  user: User;
4845
5318
  linkedAccount: Account | null;
@@ -4857,14 +5330,45 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4857
5330
  updateUserByEmail<T extends Record<string, any>>(email: string, data: Partial<User & Record<string, any>>): Promise<User & T>;
4858
5331
  updatePassword(userId: string, password: string): Promise<void>;
4859
5332
  findAccounts(userId: string): Promise<Account[]>;
4860
- findAccount(accountId: string): Promise<Account | null>;
4861
5333
  findAccountByProviderId(accountId: string, providerId: string): Promise<Account | null>;
4862
5334
  findAccountByUserId(userId: string): Promise<Account[]>;
4863
5335
  updateAccount(id: string, data: Partial<Account>): Promise<Account>;
4864
5336
  createVerificationValue(data: Omit<Verification, "createdAt" | "id" | "updatedAt"> & Partial<Verification>): Promise<Verification>;
4865
5337
  findVerificationValue(identifier: string): Promise<Verification | null>;
4866
5338
  deleteVerificationByIdentifier(identifier: string): Promise<void>;
5339
+ /**
5340
+ * Atomically consume a single-use verification row by `identifier` and
5341
+ * return it. Only the first concurrent caller receives the latest row;
5342
+ * subsequent callers receive `null`. Consuming one row invalidates the
5343
+ * whole identifier so stale rows cannot be replayed. Rows past their
5344
+ * `expiresAt` are treated as already invalid: the row is deleted but
5345
+ * `null` is returned, so callers do not need to gate on `expiresAt`
5346
+ * themselves. Callers MUST gate any state change (issue session, mint
5347
+ * token, change password) on a non-null result.
5348
+ *
5349
+ * Replaces the racy `findVerificationValue` + `deleteVerificationByIdentifier`
5350
+ * pair at single-use credential consumption sites.
5351
+ */
5352
+ consumeVerificationValue(identifier: string): Promise<Verification | null>;
5353
+ /**
5354
+ * First-writer-wins create keyed by a deterministic primary key derived from
5355
+ * `identifier`. Returns `true` when this caller created the row and `false`
5356
+ * when a row for the same identifier already existed.
5357
+ *
5358
+ * The dual of `consumeVerificationValue`: reserve races to create a marker
5359
+ * exactly once, where consume races to delete one exactly once. Use it for
5360
+ * replay tombstones (a SAML assertion id, a JWT `jti`) where the first caller
5361
+ * wins. The database path is atomic via the primary key. Secondary-storage-only
5362
+ * verification is not supported for reservation and runtime implementations
5363
+ * should fail closed unless verification is backed by the database.
5364
+ */
5365
+ reserveVerificationValue(data: {
5366
+ identifier: string;
5367
+ value: string;
5368
+ expiresAt: Date;
5369
+ }): Promise<boolean>;
4867
5370
  updateVerificationByIdentifier(identifier: string, data: Partial<Verification>): Promise<Verification>;
5371
+ refreshUserSessions(user: User): Promise<void>;
4868
5372
  }
4869
5373
  type CreateCookieGetterFn = (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => BetterAuthCookie;
4870
5374
  type CheckPasswordFn<Options extends BetterAuthOptions = BetterAuthOptions> = (userId: string, ctx: GenericEndpointContext<Options>) => Promise<boolean>;
@@ -4920,7 +5424,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
4920
5424
  * - "cookie": Store state in an encrypted cookie (stateless)
4921
5425
  * - "database": Store state in the database
4922
5426
  *
4923
- * @default "cookie"
5427
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
4924
5428
  */
4925
5429
  storeStateStrategy: "database" | "cookie";
4926
5430
  };
@@ -5303,6 +5807,73 @@ type GenerateIdFn = (options: {
5303
5807
  model: ModelNames;
5304
5808
  size?: number | undefined;
5305
5809
  }) => string | false;
5810
+ /**
5811
+ * What Better Auth is about to do with an incoming identity when
5812
+ * {@link BetterAuthOptions.user}'s `validateUserInfo` runs.
5813
+ *
5814
+ * - `create-user`: a brand-new user record is about to be created.
5815
+ * - `link-account`: a new provider account is about to be linked to an
5816
+ * already-existing user.
5817
+ * - `sign-in`: an existing OAuth or SSO user is signing in again. This is the
5818
+ * one case where the provider can assert *changed* data, so the hook receives
5819
+ * the fresh provider email and profile (not the stored row), letting a domain
5820
+ * or org policy reject a user whose provider identity moved out of bounds.
5821
+ *
5822
+ * Non-provider returning sign-ins are not re-validated: they carry only the
5823
+ * stored row, which has not changed since `create-user` gated it. Use the admin
5824
+ * plugin's ban controls or a `databaseHooks.session.create.before` hook to
5825
+ * block those.
5826
+ */
5827
+ type ValidateUserInfoAction = "create-user" | "link-account" | "sign-in";
5828
+ /**
5829
+ * The authentication method that produced the incoming user info. The named
5830
+ * methods cover Better Auth's built-ins; the open `string` keeps it extensible
5831
+ * for plugins (for example `"scim"`).
5832
+ */
5833
+ type ValidateUserInfoMethod = "oauth" | "sso-oidc" | "sso-saml" | "email-password" | "magic-link" | "email-otp" | "anonymous" | "siwe" | "phone-number" | "admin" | (string & {});
5834
+ /** OAuth-specific provisioning context; present only when `method` is `"oauth"`. */
5835
+ type ValidateUserInfoOAuthInfo = {
5836
+ /** The social or generic OAuth provider id (e.g. `"google"`). */providerId: string; /** The raw provider profile (userinfo or id-token claims), unmapped. */
5837
+ profile?: Record<string, unknown> | undefined;
5838
+ };
5839
+ /** SSO-specific provisioning context; present for OIDC and SAML SSO methods. */
5840
+ type ValidateUserInfoSSOInfo = {
5841
+ /** The configured SSO provider id. */providerId: string; /** The raw OIDC claims or SAML assertion attributes, unmapped. */
5842
+ profile?: Record<string, unknown> | undefined;
5843
+ };
5844
+ /** Provisioning origin passed to `createUser`; the creation seam adds `action: "create-user"` to build {@link ValidateUserInfoSource}. */
5845
+ type UserProvisioningSource = {
5846
+ method: ValidateUserInfoMethod; /** Provider id and raw profile; present iff `method` is `"oauth"`. */
5847
+ oauth?: ValidateUserInfoOAuthInfo | undefined; /** Provider id and raw profile; present iff `method` is `"sso-oidc"` or `"sso-saml"`. */
5848
+ sso?: ValidateUserInfoSSOInfo | undefined;
5849
+ };
5850
+ /**
5851
+ * The context passed to `validateUserInfo`: the lifecycle
5852
+ * {@link ValidateUserInfoAction}, the {@link ValidateUserInfoMethod}, and (for
5853
+ * OAuth/SSO provider methods) protocol-specific provider metadata.
5854
+ *
5855
+ * ```ts
5856
+ * // Scope to one OAuth provider:
5857
+ * if (source.oauth?.providerId !== "google") return;
5858
+ * // Branch on the method:
5859
+ * if (source.method === "anonymous") return { error: "no_anonymous" };
5860
+ * // Inspect SSO claims:
5861
+ * if (source.method === "sso-saml" && source.sso?.profile?.department !== "eng") {
5862
+ * return { error: "invalid_department" };
5863
+ * }
5864
+ * ```
5865
+ */
5866
+ type ValidateUserInfoSource = UserProvisioningSource & {
5867
+ action: ValidateUserInfoAction;
5868
+ };
5869
+ type ValidateUserInfoResult = {
5870
+ /** A short, machine-readable rejection code, surfaced to the client. */error: string;
5871
+ /**
5872
+ * A human-readable reason, surfaced to the client. Do not put sensitive
5873
+ * details here.
5874
+ */
5875
+ errorDescription?: string | undefined;
5876
+ };
5306
5877
  /**
5307
5878
  * Configuration for dynamic base URL resolution.
5308
5879
  * Allows Better Auth to work with multiple domains (e.g., Vercel preview deployments).
@@ -5347,8 +5918,30 @@ type DynamicBaseURLConfig = {
5347
5918
  */
5348
5919
  type BaseURLConfig = string | DynamicBaseURLConfig;
5349
5920
  interface BetterAuthRateLimitStorage {
5350
- get: (key: string) => Promise<RateLimit | null | undefined>;
5351
- set: (key: string, value: RateLimit, update?: boolean | undefined) => Promise<void>;
5921
+ /**
5922
+ * Atomically records one request against `key` within the rolling `window`
5923
+ * (in seconds) and reports whether it is allowed.
5924
+ *
5925
+ * When `allowed` is true the count was incremented within the active window,
5926
+ * or the window had elapsed and was reset to start at 1. When `allowed` is
5927
+ * false the limit was already reached and `retryAfter` is the number of
5928
+ * seconds until the window frees up.
5929
+ *
5930
+ * Performing the check and the increment in a single step closes the
5931
+ * concurrent-bypass gap of the separate `get`/`set` path: N simultaneous
5932
+ * requests can no longer all pass a stale read before any increment lands.
5933
+ *
5934
+ * Custom storages must implement this operation directly. Better Auth no
5935
+ * longer accepts separate `get`/`set` rate-limit storage because that shape
5936
+ * cannot enforce a distributed limit under concurrent requests.
5937
+ */
5938
+ consume: (key: string, rule: {
5939
+ window: number;
5940
+ max: number;
5941
+ }) => Promise<{
5942
+ allowed: boolean;
5943
+ retryAfter: number | null;
5944
+ }>;
5352
5945
  }
5353
5946
  type BetterAuthRateLimitRule = {
5354
5947
  /**
@@ -5423,7 +6016,7 @@ type BetterAuthAdvancedOptions = {
5423
6016
  * @example ["x-client-ip", "x-forwarded-for", "cf-connecting-ip"]
5424
6017
  *
5425
6018
  * @default
5426
- * @link https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/utils/get-request-ip.ts#L8
6019
+ * @link https://github.com/better-auth/better-auth/blob/main/packages/core/src/utils/ip.ts
5427
6020
  */
5428
6021
  ipAddressHeaders?: string[];
5429
6022
  /**
@@ -5433,12 +6026,28 @@ type BetterAuthAdvancedOptions = {
5433
6026
  */
5434
6027
  disableIpTracking?: boolean;
5435
6028
  /**
5436
- * IPv6 subnet prefix length for rate limiting.
5437
- * IPv6 addresses will be normalized to this subnet.
6029
+ * IPv6 prefix length used to collapse addresses before rate-limit keying.
6030
+ * Any integer from 0 to 128 is accepted; common values are 32, 48, 56, 64, 128.
6031
+ * Out-of-range values fall back to safe behavior (negative -> mask all, > 128 -> no mask).
5438
6032
  *
5439
6033
  * @default 64
5440
6034
  */
5441
- ipv6Subnet?: 128 | 64 | 48 | 32;
6035
+ ipv6Subnet?: number;
6036
+ /**
6037
+ * Trusted reverse-proxy IPs or CIDR ranges. When set, a forwarded IP
6038
+ * chain is walked right to left, trusted hops are skipped, and the
6039
+ * first untrusted address is the client IP. Unset trusts only
6040
+ * single-value IP headers. Use the actual address or subnet of your
6041
+ * proxies, not a broad private range that also covers clients.
6042
+ *
6043
+ * This only interprets the forwarded header chain and cannot verify
6044
+ * the direct sender. It is safe only when your origin is reachable
6045
+ * through these proxies and clients cannot set forwarded headers
6046
+ * directly.
6047
+ *
6048
+ * @example ["192.0.2.10", "10.0.0.0/24"]
6049
+ */
6050
+ trustedProxies?: string[];
5442
6051
  } | undefined;
5443
6052
  /**
5444
6053
  * Force cookies to always use the `Secure` attribute. By default,
@@ -5964,6 +6573,30 @@ type BetterAuthOptions = {
5964
6573
  * User configuration
5965
6574
  */
5966
6575
  user?: (BetterAuthDBOptions<"user", keyof BaseUser> & {
6576
+ /**
6577
+ * Gate which identities Better Auth admits. Called just before
6578
+ * `create-user`, `link-account`, and (for OAuth) `sign-in`, across
6579
+ * every authentication method, including stateless setups with no
6580
+ * persistent database. On `sign-in` the hook receives the *fresh*
6581
+ * provider email and profile, so a domain policy can reject a user
6582
+ * whose provider identity moved out of bounds.
6583
+ *
6584
+ * Non-provider returning sign-ins are not re-validated; use the admin
6585
+ * plugin's ban controls or a `databaseHooks.session.create.before`
6586
+ * hook for those.
6587
+ *
6588
+ * Return nothing to allow; return `{ error }` to reject. Browser flows
6589
+ * redirect to the configured error URL; programmatic flows surface a
6590
+ * `403`.
6591
+ *
6592
+ * TODO: rename to `validateUser` (and the `ValidateUserInfo*` types).
6593
+ * "UserInfo" is the OIDC term and misleads for the email/password,
6594
+ * SIWE, phone, and admin methods.
6595
+ */
6596
+ validateUserInfo?: (data: {
6597
+ user: Partial<User> & Record<string, unknown>;
6598
+ source: ValidateUserInfoSource;
6599
+ }, context: GenericEndpointContext) => Awaitable<void | ValidateUserInfoResult>;
5967
6600
  /**
5968
6601
  * Changing email configuration
5969
6602
  */
@@ -6105,6 +6738,20 @@ type BetterAuthOptions = {
6105
6738
  * @default "compact"
6106
6739
  */
6107
6740
  strategy?: "compact" | "jwt" | "jwe";
6741
+ /**
6742
+ * JWT-specific configuration for `strategy: "jwt"`.
6743
+ */
6744
+ jwt?: {
6745
+ /**
6746
+ * Which signing key is used for cookie-cache JWTs.
6747
+ *
6748
+ * - `"secret"`: uses the Better Auth secret with HS256.
6749
+ * - `"jwt-plugin"`: uses the installed `jwt()` plugin's asymmetric signing keys.
6750
+ *
6751
+ * @default "secret"
6752
+ */
6753
+ signingKey?: "secret" | "jwt-plugin";
6754
+ };
6108
6755
  /**
6109
6756
  * Controls stateless cookie cache refresh behavior.
6110
6757
  *
@@ -6187,6 +6834,25 @@ type BetterAuthOptions = {
6187
6834
  * @default false
6188
6835
  */
6189
6836
  disableImplicitLinking?: boolean;
6837
+ /**
6838
+ * Require the existing local user row to have
6839
+ * `emailVerified: true` before implicit account linking
6840
+ * uses the IdP's `email_verified` claim as ownership
6841
+ * proof. Defaults to `true` so an attacker who
6842
+ * pre-registers an unverified account at a victim's
6843
+ * email cannot have the victim's OAuth identity linked
6844
+ * into the attacker-owned row on first sign-in. Set to
6845
+ * `false` for backward compatibility on apps whose
6846
+ * users sign up via OAuth without verifying their email
6847
+ * locally; understand the takeover risk before doing
6848
+ * so.
6849
+ *
6850
+ * @default true
6851
+ *
6852
+ * @deprecated The option will be removed on the next
6853
+ * minor; the gate will become unconditional.
6854
+ */
6855
+ requireLocalEmailVerified?: boolean;
6190
6856
  /**
6191
6857
  * List of trusted providers. Can be a static array or a function
6192
6858
  * that returns providers dynamically. The function is called
@@ -6224,7 +6890,11 @@ type BetterAuthOptions = {
6224
6890
  */
6225
6891
  allowUnlinkingAll?: boolean;
6226
6892
  /**
6227
- * If enabled (true), this will update the user information based on the newly linked account
6893
+ * When enabled, linking an account copies the provider's profile onto
6894
+ * the local user, matching the fields persisted on sign-up (`name`,
6895
+ * `image`, and any `mapProfileToUser` fields). The local `email` and
6896
+ * `emailVerified` are never changed, so a link cannot rebind the
6897
+ * account's identity.
6228
6898
  *
6229
6899
  * @default false
6230
6900
  */
@@ -6257,13 +6927,17 @@ type BetterAuthOptions = {
6257
6927
  * - "cookie": Store state in an encrypted cookie (stateless)
6258
6928
  * - "database": Store state in the database
6259
6929
  *
6260
- * @default "cookie"
6930
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
6261
6931
  */
6262
6932
  storeStateStrategy?: "database" | "cookie";
6263
6933
  /**
6264
- * Store account data after oauth flow on a cookie
6934
+ * Store provider account data after an OAuth flow in an encrypted
6935
+ * cookie. This includes OAuth token material such as access tokens,
6936
+ * refresh tokens, ID tokens, scopes, and token expiry.
6265
6937
  *
6266
- * This is useful for database-less flow
6938
+ * This is useful for database-less flows, but large provider tokens can
6939
+ * still hit browser or proxy cookie/header limits even though Better Auth
6940
+ * chunks oversized account cookies.
6267
6941
  *
6268
6942
  * @default false
6269
6943
  *
@@ -6766,6 +7440,23 @@ interface SecondaryStorage {
6766
7440
  * @returns - Value of the key
6767
7441
  */
6768
7442
  get: (key: string) => Awaitable<unknown>;
7443
+ /**
7444
+ * Atomically get a value and delete it from storage.
7445
+ */
7446
+ getAndDelete: (key: string) => Awaitable<unknown>;
7447
+ /**
7448
+ * Atomically increment the counter at `key` by one, returning the
7449
+ * post-increment value.
7450
+ *
7451
+ * When the key is absent, it is created with a value of `1` and the given
7452
+ * `ttl` (in SECONDS). The TTL is applied only on creation; later increments
7453
+ * never extend it, so the counter expires a fixed window after it was first
7454
+ * created.
7455
+ *
7456
+ * Required so secondary-storage-backed rate limiting can enforce the limit
7457
+ * in one distributed-safe operation.
7458
+ */
7459
+ increment: (key: string, ttl: number) => Awaitable<number>;
6769
7460
  set: (
6770
7461
  /**
6771
7462
  * Key to store
@@ -7063,6 +7754,7 @@ declare const requestAuthOptionsSchema: z.ZodObject<{
7063
7754
  disableRedirect: z.ZodOptional<z.ZodBoolean>;
7064
7755
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7065
7756
  requestSignUp: z.ZodOptional<z.ZodBoolean>;
7757
+ additionalParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7066
7758
  additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
7067
7759
  }, z.core.$strip>;
7068
7760
  type ElectronRequestAuthOptions = z.infer<typeof requestAuthOptionsSchema>;