@better-auth/electron 1.7.0-beta.0 → 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,17 +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;
854
+ /**
855
+ * The expected issuer identifier for this provider (RFC 9207).
856
+ * When set, the callback handler validates the `iss` query parameter
857
+ * against this value to prevent authorization server mix-up attacks.
858
+ */
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;
679
867
  /**
680
868
  * Disable implicit sign up for new users. When set to true for the provider,
681
869
  * sign-in need to be called with with requestSignUp as true to create new users.
@@ -685,6 +873,17 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
685
873
  * Disable sign up for new users.
686
874
  */
687
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;
688
887
  /**
689
888
  * Options for the provider
690
889
  */
@@ -694,9 +893,10 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
694
893
  /**
695
894
  * The client ID of your application.
696
895
  *
697
- * 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.
698
898
  */
699
- clientId?: unknown | undefined;
899
+ clientId?: LiteralString | string[] | undefined;
700
900
  /**
701
901
  * The client secret of your application
702
902
  */
@@ -797,6 +997,29 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
797
997
  * @default false
798
998
  */
799
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;
800
1023
  }; //#endregion
801
1024
  //#endregion
802
1025
  //#region ../core/dist/social-providers/apple.d.mts
@@ -813,7 +1036,7 @@ interface AppleProfile {
813
1036
  * The email address is either the user's real email address or the proxy
814
1037
  * address, depending on their status private email relay service.
815
1038
  */
816
- email: string;
1039
+ email?: string;
817
1040
  /**
818
1041
  * A string or Boolean value that indicates whether the service verifies
819
1042
  * the email. The value can either be a string ("true" or "false") or a
@@ -861,7 +1084,7 @@ interface AppleNonConformUser {
861
1084
  email: string;
862
1085
  }
863
1086
  interface AppleOptions extends ProviderOptions<AppleProfile> {
864
- clientId: string;
1087
+ clientId: string | string[];
865
1088
  appBundleIdentifier?: string | undefined;
866
1089
  audience?: (string | string[]) | undefined;
867
1090
  }
@@ -908,7 +1131,7 @@ interface CognitoProfile {
908
1131
  [key: string]: any;
909
1132
  }
910
1133
  interface CognitoOptions extends ProviderOptions<CognitoProfile> {
911
- clientId: string;
1134
+ clientId: string | string[];
912
1135
  /**
913
1136
  * The Cognito domain (e.g., "your-app.auth.us-east-1.amazoncognito.com")
914
1137
  */
@@ -919,6 +1142,19 @@ interface CognitoOptions extends ProviderOptions<CognitoProfile> {
919
1142
  region: string;
920
1143
  userPoolId: string;
921
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;
922
1158
  }
923
1159
  //#endregion
924
1160
  //#region ../core/dist/social-providers/discord.d.mts
@@ -961,7 +1197,7 @@ interface DiscordProfile extends Record<string, any> {
961
1197
  /** whether the email on this account has been verified */
962
1198
  verified: boolean;
963
1199
  /** the user's email */
964
- email: string;
1200
+ email?: string | null;
965
1201
  /**
966
1202
  * the flags on a user's account:
967
1203
  * https://discord.com/developers/docs/resources/user#user-object-user-flags
@@ -1003,8 +1239,8 @@ interface DiscordOptions extends ProviderOptions<DiscordProfile> {
1003
1239
  interface FacebookProfile {
1004
1240
  id: string;
1005
1241
  name: string;
1006
- email: string;
1007
- email_verified: boolean;
1242
+ email?: string;
1243
+ email_verified?: boolean;
1008
1244
  picture: {
1009
1245
  data: {
1010
1246
  height: number;
@@ -1015,7 +1251,7 @@ interface FacebookProfile {
1015
1251
  };
1016
1252
  }
1017
1253
  interface FacebookOptions extends ProviderOptions<FacebookProfile> {
1018
- clientId: string;
1254
+ clientId: string | string[];
1019
1255
  /**
1020
1256
  * Extend list of fields to retrieve from the Facebook user profile.
1021
1257
  *
@@ -1065,7 +1301,7 @@ interface GithubProfile {
1065
1301
  company: string;
1066
1302
  blog: string;
1067
1303
  location: string;
1068
- email: string;
1304
+ email: string | null;
1069
1305
  hireable: boolean;
1070
1306
  bio: string;
1071
1307
  twitter_username: string;
@@ -1092,6 +1328,15 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
1092
1328
  clientId: string;
1093
1329
  }
1094
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
1095
1340
  //#region ../core/dist/social-providers/microsoft-entra-id.d.mts
1096
1341
  //#region src/social-providers/microsoft-entra-id.d.ts
1097
1342
  /**
@@ -1119,7 +1364,7 @@ interface MicrosoftEntraIDProfile extends Record<string, any> {
1119
1364
  /** The primary username that represents the user */
1120
1365
  preferred_username: string;
1121
1366
  /** User's email address */
1122
- email: string;
1367
+ email?: string;
1123
1368
  /** Human-readable value that identifies the subject of the token */
1124
1369
  name: string;
1125
1370
  /** Matches the parameter included in the original authorize request */
@@ -1198,26 +1443,34 @@ interface MicrosoftEntraIDProfile extends Record<string, any> {
1198
1443
  given_name: string;
1199
1444
  }
1200
1445
  interface MicrosoftOptions extends ProviderOptions<MicrosoftEntraIDProfile> {
1201
- clientId: string;
1446
+ clientId: string | string[];
1202
1447
  /**
1203
1448
  * The tenant ID of the Microsoft account
1204
1449
  * @default "common"
1205
1450
  */
1206
- tenantId?: string | undefined;
1451
+ tenantId?: string;
1207
1452
  /**
1208
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.
1209
1454
  * @default "https://login.microsoftonline.com"
1210
1455
  */
1211
- 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;
1212
1465
  /**
1213
1466
  * The size of the profile photo
1214
1467
  * @default 48
1215
1468
  */
1216
- profilePhotoSize?: (48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648) | undefined;
1469
+ profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
1217
1470
  /**
1218
1471
  * Disable profile photo
1219
1472
  */
1220
- disableProfilePhoto?: boolean | undefined;
1473
+ disableProfilePhoto?: boolean;
1221
1474
  }
1222
1475
  //#endregion
1223
1476
  //#region ../core/dist/social-providers/google.d.mts
@@ -1249,7 +1502,7 @@ interface GoogleProfile {
1249
1502
  sub: string;
1250
1503
  }
1251
1504
  interface GoogleOptions extends ProviderOptions<GoogleProfile> {
1252
- clientId: string;
1505
+ clientId: string | string[];
1253
1506
  /**
1254
1507
  * The access type to use for the authorization code request
1255
1508
  */
@@ -1259,9 +1512,25 @@ interface GoogleOptions extends ProviderOptions<GoogleProfile> {
1259
1512
  */
1260
1513
  display?: ("page" | "popup" | "touch" | "wap") | undefined;
1261
1514
  /**
1262
- * 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.
1263
1521
  */
1264
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;
1265
1534
  }
1266
1535
  //#endregion
1267
1536
  //#region ../core/dist/social-providers/huggingface.d.mts
@@ -1533,8 +1802,8 @@ interface LinkedInProfile {
1533
1802
  country: string;
1534
1803
  language: string;
1535
1804
  };
1536
- email: string;
1537
- email_verified: boolean;
1805
+ email?: string;
1806
+ email_verified?: boolean;
1538
1807
  }
1539
1808
  interface LinkedInOptions extends ProviderOptions<LinkedInProfile> {
1540
1809
  clientId: string;
@@ -1979,6 +2248,7 @@ interface PaybinOptions extends ProviderOptions<PaybinProfile> {
1979
2248
  //#region ../core/dist/social-providers/paypal.d.mts
1980
2249
  //#region src/social-providers/paypal.d.ts
1981
2250
  interface PayPalProfile {
2251
+ sub?: string | undefined;
1982
2252
  user_id: string;
1983
2253
  name: string;
1984
2254
  given_name: string;
@@ -2135,7 +2405,8 @@ declare const socialProviders: {
2135
2405
  createAuthorizationURL({
2136
2406
  state,
2137
2407
  scopes,
2138
- redirectURI
2408
+ redirectURI,
2409
+ additionalParams
2139
2410
  }: {
2140
2411
  state: string;
2141
2412
  codeVerifier: string;
@@ -2143,6 +2414,8 @@ declare const socialProviders: {
2143
2414
  redirectURI: string;
2144
2415
  display?: string | undefined;
2145
2416
  loginHint?: string | undefined;
2417
+ idTokenNonce?: string | undefined;
2418
+ additionalParams?: Record<string, string> | undefined;
2146
2419
  }): Promise<URL>;
2147
2420
  validateAuthorizationCode: ({
2148
2421
  code,
@@ -2154,9 +2427,16 @@ declare const socialProviders: {
2154
2427
  codeVerifier?: string | undefined;
2155
2428
  deviceId?: string | undefined;
2156
2429
  }) => Promise<OAuth2Tokens>;
2157
- 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
+ };
2158
2437
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2159
2438
  getUserInfo(token: OAuth2Tokens & {
2439
+ expectedIdTokenNonce?: string | undefined;
2160
2440
  user?: {
2161
2441
  name?: {
2162
2442
  firstName?: string;
@@ -2184,7 +2464,8 @@ declare const socialProviders: {
2184
2464
  state,
2185
2465
  scopes,
2186
2466
  codeVerifier,
2187
- redirectURI
2467
+ redirectURI,
2468
+ additionalParams
2188
2469
  }: {
2189
2470
  state: string;
2190
2471
  codeVerifier: string;
@@ -2192,6 +2473,8 @@ declare const socialProviders: {
2192
2473
  redirectURI: string;
2193
2474
  display?: string | undefined;
2194
2475
  loginHint?: string | undefined;
2476
+ idTokenNonce?: string | undefined;
2477
+ additionalParams?: Record<string, string> | undefined;
2195
2478
  }): Promise<URL>;
2196
2479
  validateAuthorizationCode: ({
2197
2480
  code,
@@ -2205,6 +2488,7 @@ declare const socialProviders: {
2205
2488
  }) => Promise<OAuth2Tokens>;
2206
2489
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2207
2490
  getUserInfo(token: OAuth2Tokens & {
2491
+ expectedIdTokenNonce?: string | undefined;
2208
2492
  user?: {
2209
2493
  name?: {
2210
2494
  firstName?: string;
@@ -2232,7 +2516,8 @@ declare const socialProviders: {
2232
2516
  state,
2233
2517
  scopes,
2234
2518
  codeVerifier,
2235
- redirectURI
2519
+ redirectURI,
2520
+ additionalParams
2236
2521
  }: {
2237
2522
  state: string;
2238
2523
  codeVerifier: string;
@@ -2240,6 +2525,8 @@ declare const socialProviders: {
2240
2525
  redirectURI: string;
2241
2526
  display?: string | undefined;
2242
2527
  loginHint?: string | undefined;
2528
+ idTokenNonce?: string | undefined;
2529
+ additionalParams?: Record<string, string> | undefined;
2243
2530
  }): Promise<URL>;
2244
2531
  validateAuthorizationCode: ({
2245
2532
  code,
@@ -2252,8 +2539,14 @@ declare const socialProviders: {
2252
2539
  deviceId?: string | undefined;
2253
2540
  }) => Promise<OAuth2Tokens>;
2254
2541
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2255
- 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
+ };
2256
2548
  getUserInfo(token: OAuth2Tokens & {
2549
+ expectedIdTokenNonce?: string | undefined;
2257
2550
  user?: {
2258
2551
  name?: {
2259
2552
  firstName?: string;
@@ -2280,7 +2573,8 @@ declare const socialProviders: {
2280
2573
  createAuthorizationURL({
2281
2574
  state,
2282
2575
  scopes,
2283
- redirectURI
2576
+ redirectURI,
2577
+ additionalParams
2284
2578
  }: {
2285
2579
  state: string;
2286
2580
  codeVerifier: string;
@@ -2288,7 +2582,9 @@ declare const socialProviders: {
2288
2582
  redirectURI: string;
2289
2583
  display?: string | undefined;
2290
2584
  loginHint?: string | undefined;
2291
- }): URL;
2585
+ idTokenNonce?: string | undefined;
2586
+ additionalParams?: Record<string, string> | undefined;
2587
+ }): Promise<URL>;
2292
2588
  validateAuthorizationCode: ({
2293
2589
  code,
2294
2590
  redirectURI
@@ -2300,6 +2596,7 @@ declare const socialProviders: {
2300
2596
  }) => Promise<OAuth2Tokens>;
2301
2597
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2302
2598
  getUserInfo(token: OAuth2Tokens & {
2599
+ expectedIdTokenNonce?: string | undefined;
2303
2600
  user?: {
2304
2601
  name?: {
2305
2602
  firstName?: string;
@@ -2327,7 +2624,8 @@ declare const socialProviders: {
2327
2624
  state,
2328
2625
  scopes,
2329
2626
  redirectURI,
2330
- loginHint
2627
+ loginHint,
2628
+ additionalParams
2331
2629
  }: {
2332
2630
  state: string;
2333
2631
  codeVerifier: string;
@@ -2335,6 +2633,8 @@ declare const socialProviders: {
2335
2633
  redirectURI: string;
2336
2634
  display?: string | undefined;
2337
2635
  loginHint?: string | undefined;
2636
+ idTokenNonce?: string | undefined;
2637
+ additionalParams?: Record<string, string> | undefined;
2338
2638
  }): Promise<URL>;
2339
2639
  validateAuthorizationCode: ({
2340
2640
  code,
@@ -2345,9 +2645,23 @@ declare const socialProviders: {
2345
2645
  codeVerifier?: string | undefined;
2346
2646
  deviceId?: string | undefined;
2347
2647
  }) => Promise<OAuth2Tokens>;
2348
- 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
+ };
2349
2662
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2350
2663
  getUserInfo(token: OAuth2Tokens & {
2664
+ expectedIdTokenNonce?: string | undefined;
2351
2665
  user?: {
2352
2666
  name?: {
2353
2667
  firstName?: string;
@@ -2375,7 +2689,8 @@ declare const socialProviders: {
2375
2689
  state,
2376
2690
  scopes,
2377
2691
  codeVerifier,
2378
- redirectURI
2692
+ redirectURI,
2693
+ additionalParams
2379
2694
  }: {
2380
2695
  state: string;
2381
2696
  codeVerifier: string;
@@ -2383,6 +2698,8 @@ declare const socialProviders: {
2383
2698
  redirectURI: string;
2384
2699
  display?: string | undefined;
2385
2700
  loginHint?: string | undefined;
2701
+ idTokenNonce?: string | undefined;
2702
+ additionalParams?: Record<string, string> | undefined;
2386
2703
  }): Promise<URL>;
2387
2704
  validateAuthorizationCode: ({
2388
2705
  code,
@@ -2396,6 +2713,7 @@ declare const socialProviders: {
2396
2713
  }) => Promise<OAuth2Tokens>;
2397
2714
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2398
2715
  getUserInfo(token: OAuth2Tokens & {
2716
+ expectedIdTokenNonce?: string | undefined;
2399
2717
  user?: {
2400
2718
  name?: {
2401
2719
  firstName?: string;
@@ -2424,7 +2742,8 @@ declare const socialProviders: {
2424
2742
  scopes,
2425
2743
  loginHint,
2426
2744
  codeVerifier,
2427
- redirectURI
2745
+ redirectURI,
2746
+ additionalParams
2428
2747
  }: {
2429
2748
  state: string;
2430
2749
  codeVerifier: string;
@@ -2432,6 +2751,8 @@ declare const socialProviders: {
2432
2751
  redirectURI: string;
2433
2752
  display?: string | undefined;
2434
2753
  loginHint?: string | undefined;
2754
+ idTokenNonce?: string | undefined;
2755
+ additionalParams?: Record<string, string> | undefined;
2435
2756
  }): Promise<URL>;
2436
2757
  validateAuthorizationCode: ({
2437
2758
  code,
@@ -2445,6 +2766,7 @@ declare const socialProviders: {
2445
2766
  }) => Promise<OAuth2Tokens | null>;
2446
2767
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2447
2768
  getUserInfo(token: OAuth2Tokens & {
2769
+ expectedIdTokenNonce?: string | undefined;
2448
2770
  user?: {
2449
2771
  name?: {
2450
2772
  firstName?: string;
@@ -2475,6 +2797,8 @@ declare const socialProviders: {
2475
2797
  redirectURI: string;
2476
2798
  display?: string | undefined;
2477
2799
  loginHint?: string | undefined;
2800
+ idTokenNonce?: string | undefined;
2801
+ additionalParams?: Record<string, string> | undefined;
2478
2802
  }): Promise<URL>;
2479
2803
  validateAuthorizationCode({
2480
2804
  code,
@@ -2486,8 +2810,15 @@ declare const socialProviders: {
2486
2810
  codeVerifier?: string | undefined;
2487
2811
  deviceId?: string | undefined;
2488
2812
  }): Promise<OAuth2Tokens>;
2489
- 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
+ };
2490
2820
  getUserInfo(token: OAuth2Tokens & {
2821
+ expectedIdTokenNonce?: string | undefined;
2491
2822
  user?: {
2492
2823
  name?: {
2493
2824
  firstName?: string;
@@ -2518,7 +2849,8 @@ declare const socialProviders: {
2518
2849
  codeVerifier,
2519
2850
  redirectURI,
2520
2851
  loginHint,
2521
- display
2852
+ display,
2853
+ additionalParams
2522
2854
  }: {
2523
2855
  state: string;
2524
2856
  codeVerifier: string;
@@ -2526,6 +2858,8 @@ declare const socialProviders: {
2526
2858
  redirectURI: string;
2527
2859
  display?: string | undefined;
2528
2860
  loginHint?: string | undefined;
2861
+ idTokenNonce?: string | undefined;
2862
+ additionalParams?: Record<string, string> | undefined;
2529
2863
  }): Promise<URL>;
2530
2864
  validateAuthorizationCode: ({
2531
2865
  code,
@@ -2538,8 +2872,15 @@ declare const socialProviders: {
2538
2872
  deviceId?: string | undefined;
2539
2873
  }) => Promise<OAuth2Tokens>;
2540
2874
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2541
- 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
+ };
2542
2882
  getUserInfo(token: OAuth2Tokens & {
2883
+ expectedIdTokenNonce?: string | undefined;
2543
2884
  user?: {
2544
2885
  name?: {
2545
2886
  firstName?: string;
@@ -2567,7 +2908,8 @@ declare const socialProviders: {
2567
2908
  state,
2568
2909
  scopes,
2569
2910
  codeVerifier,
2570
- redirectURI
2911
+ redirectURI,
2912
+ additionalParams
2571
2913
  }: {
2572
2914
  state: string;
2573
2915
  codeVerifier: string;
@@ -2575,6 +2917,8 @@ declare const socialProviders: {
2575
2917
  redirectURI: string;
2576
2918
  display?: string | undefined;
2577
2919
  loginHint?: string | undefined;
2920
+ idTokenNonce?: string | undefined;
2921
+ additionalParams?: Record<string, string> | undefined;
2578
2922
  }): Promise<URL>;
2579
2923
  validateAuthorizationCode: ({
2580
2924
  code,
@@ -2588,6 +2932,7 @@ declare const socialProviders: {
2588
2932
  }) => Promise<OAuth2Tokens>;
2589
2933
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2590
2934
  getUserInfo(token: OAuth2Tokens & {
2935
+ expectedIdTokenNonce?: string | undefined;
2591
2936
  user?: {
2592
2937
  name?: {
2593
2938
  firstName?: string;
@@ -2614,7 +2959,8 @@ declare const socialProviders: {
2614
2959
  createAuthorizationURL({
2615
2960
  state,
2616
2961
  scopes,
2617
- redirectURI
2962
+ redirectURI,
2963
+ additionalParams
2618
2964
  }: {
2619
2965
  state: string;
2620
2966
  codeVerifier: string;
@@ -2622,7 +2968,9 @@ declare const socialProviders: {
2622
2968
  redirectURI: string;
2623
2969
  display?: string | undefined;
2624
2970
  loginHint?: string | undefined;
2625
- }): URL;
2971
+ idTokenNonce?: string | undefined;
2972
+ additionalParams?: Record<string, string> | undefined;
2973
+ }): Promise<URL>;
2626
2974
  validateAuthorizationCode: ({
2627
2975
  code,
2628
2976
  redirectURI
@@ -2634,6 +2982,7 @@ declare const socialProviders: {
2634
2982
  }) => Promise<OAuth2Tokens>;
2635
2983
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2636
2984
  getUserInfo(token: OAuth2Tokens & {
2985
+ expectedIdTokenNonce?: string | undefined;
2637
2986
  user?: {
2638
2987
  name?: {
2639
2988
  firstName?: string;
@@ -2661,7 +3010,8 @@ declare const socialProviders: {
2661
3010
  state,
2662
3011
  scopes,
2663
3012
  codeVerifier,
2664
- redirectURI
3013
+ redirectURI,
3014
+ additionalParams
2665
3015
  }: {
2666
3016
  state: string;
2667
3017
  codeVerifier: string;
@@ -2669,6 +3019,8 @@ declare const socialProviders: {
2669
3019
  redirectURI: string;
2670
3020
  display?: string | undefined;
2671
3021
  loginHint?: string | undefined;
3022
+ idTokenNonce?: string | undefined;
3023
+ additionalParams?: Record<string, string> | undefined;
2672
3024
  }): Promise<URL>;
2673
3025
  validateAuthorizationCode: ({
2674
3026
  code,
@@ -2682,6 +3034,7 @@ declare const socialProviders: {
2682
3034
  }) => Promise<OAuth2Tokens>;
2683
3035
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2684
3036
  getUserInfo(token: OAuth2Tokens & {
3037
+ expectedIdTokenNonce?: string | undefined;
2685
3038
  user?: {
2686
3039
  name?: {
2687
3040
  firstName?: string;
@@ -2708,7 +3061,8 @@ declare const socialProviders: {
2708
3061
  createAuthorizationURL({
2709
3062
  state,
2710
3063
  scopes,
2711
- redirectURI
3064
+ redirectURI,
3065
+ additionalParams
2712
3066
  }: {
2713
3067
  state: string;
2714
3068
  codeVerifier: string;
@@ -2716,6 +3070,8 @@ declare const socialProviders: {
2716
3070
  redirectURI: string;
2717
3071
  display?: string | undefined;
2718
3072
  loginHint?: string | undefined;
3073
+ idTokenNonce?: string | undefined;
3074
+ additionalParams?: Record<string, string> | undefined;
2719
3075
  }): Promise<URL>;
2720
3076
  validateAuthorizationCode: ({
2721
3077
  code,
@@ -2728,6 +3084,7 @@ declare const socialProviders: {
2728
3084
  }) => Promise<OAuth2Tokens>;
2729
3085
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2730
3086
  getUserInfo(token: OAuth2Tokens & {
3087
+ expectedIdTokenNonce?: string | undefined;
2731
3088
  user?: {
2732
3089
  name?: {
2733
3090
  firstName?: string;
@@ -2758,6 +3115,8 @@ declare const socialProviders: {
2758
3115
  redirectURI: string;
2759
3116
  display?: string | undefined;
2760
3117
  loginHint?: string | undefined;
3118
+ idTokenNonce?: string | undefined;
3119
+ additionalParams?: Record<string, string> | undefined;
2761
3120
  }): Promise<URL>;
2762
3121
  validateAuthorizationCode: ({
2763
3122
  code,
@@ -2771,6 +3130,7 @@ declare const socialProviders: {
2771
3130
  }) => Promise<OAuth2Tokens>;
2772
3131
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2773
3132
  getUserInfo(token: OAuth2Tokens & {
3133
+ expectedIdTokenNonce?: string | undefined;
2774
3134
  user?: {
2775
3135
  name?: {
2776
3136
  firstName?: string;
@@ -2798,7 +3158,8 @@ declare const socialProviders: {
2798
3158
  state,
2799
3159
  scopes,
2800
3160
  codeVerifier,
2801
- redirectURI
3161
+ redirectURI,
3162
+ additionalParams
2802
3163
  }: {
2803
3164
  state: string;
2804
3165
  codeVerifier: string;
@@ -2806,6 +3167,8 @@ declare const socialProviders: {
2806
3167
  redirectURI: string;
2807
3168
  display?: string | undefined;
2808
3169
  loginHint?: string | undefined;
3170
+ idTokenNonce?: string | undefined;
3171
+ additionalParams?: Record<string, string> | undefined;
2809
3172
  }) => Promise<URL>;
2810
3173
  validateAuthorizationCode: ({
2811
3174
  code,
@@ -2819,6 +3182,7 @@ declare const socialProviders: {
2819
3182
  }) => Promise<OAuth2Tokens>;
2820
3183
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2821
3184
  getUserInfo(token: OAuth2Tokens & {
3185
+ expectedIdTokenNonce?: string | undefined;
2822
3186
  user?: {
2823
3187
  name?: {
2824
3188
  firstName?: string;
@@ -2846,7 +3210,8 @@ declare const socialProviders: {
2846
3210
  state,
2847
3211
  scopes,
2848
3212
  redirectURI,
2849
- codeVerifier
3213
+ codeVerifier,
3214
+ additionalParams
2850
3215
  }: {
2851
3216
  state: string;
2852
3217
  codeVerifier: string;
@@ -2854,6 +3219,8 @@ declare const socialProviders: {
2854
3219
  redirectURI: string;
2855
3220
  display?: string | undefined;
2856
3221
  loginHint?: string | undefined;
3222
+ idTokenNonce?: string | undefined;
3223
+ additionalParams?: Record<string, string> | undefined;
2857
3224
  }): Promise<URL>;
2858
3225
  validateAuthorizationCode({
2859
3226
  code,
@@ -2867,6 +3234,7 @@ declare const socialProviders: {
2867
3234
  }): Promise<OAuth2Tokens>;
2868
3235
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2869
3236
  getUserInfo(token: OAuth2Tokens & {
3237
+ expectedIdTokenNonce?: string | undefined;
2870
3238
  user?: {
2871
3239
  name?: {
2872
3240
  firstName?: string;
@@ -2894,7 +3262,8 @@ declare const socialProviders: {
2894
3262
  state,
2895
3263
  scopes,
2896
3264
  loginHint,
2897
- redirectURI
3265
+ redirectURI,
3266
+ additionalParams
2898
3267
  }: {
2899
3268
  state: string;
2900
3269
  codeVerifier: string;
@@ -2902,6 +3271,8 @@ declare const socialProviders: {
2902
3271
  redirectURI: string;
2903
3272
  display?: string | undefined;
2904
3273
  loginHint?: string | undefined;
3274
+ idTokenNonce?: string | undefined;
3275
+ additionalParams?: Record<string, string> | undefined;
2905
3276
  }): Promise<URL>;
2906
3277
  validateAuthorizationCode: ({
2907
3278
  code,
@@ -2914,6 +3285,7 @@ declare const socialProviders: {
2914
3285
  }) => Promise<OAuth2Tokens>;
2915
3286
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2916
3287
  getUserInfo(token: OAuth2Tokens & {
3288
+ expectedIdTokenNonce?: string | undefined;
2917
3289
  user?: {
2918
3290
  name?: {
2919
3291
  firstName?: string;
@@ -2941,7 +3313,8 @@ declare const socialProviders: {
2941
3313
  state,
2942
3314
  scopes,
2943
3315
  redirectURI,
2944
- loginHint
3316
+ loginHint,
3317
+ additionalParams
2945
3318
  }: {
2946
3319
  state: string;
2947
3320
  codeVerifier: string;
@@ -2949,6 +3322,8 @@ declare const socialProviders: {
2949
3322
  redirectURI: string;
2950
3323
  display?: string | undefined;
2951
3324
  loginHint?: string | undefined;
3325
+ idTokenNonce?: string | undefined;
3326
+ additionalParams?: Record<string, string> | undefined;
2952
3327
  }) => Promise<URL>;
2953
3328
  validateAuthorizationCode: ({
2954
3329
  code,
@@ -2961,6 +3336,7 @@ declare const socialProviders: {
2961
3336
  }) => Promise<OAuth2Tokens>;
2962
3337
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2963
3338
  getUserInfo(token: OAuth2Tokens & {
3339
+ expectedIdTokenNonce?: string | undefined;
2964
3340
  user?: {
2965
3341
  name?: {
2966
3342
  firstName?: string;
@@ -2989,7 +3365,8 @@ declare const socialProviders: {
2989
3365
  scopes,
2990
3366
  codeVerifier,
2991
3367
  loginHint,
2992
- redirectURI
3368
+ redirectURI,
3369
+ additionalParams
2993
3370
  }: {
2994
3371
  state: string;
2995
3372
  codeVerifier: string;
@@ -2997,6 +3374,8 @@ declare const socialProviders: {
2997
3374
  redirectURI: string;
2998
3375
  display?: string | undefined;
2999
3376
  loginHint?: string | undefined;
3377
+ idTokenNonce?: string | undefined;
3378
+ additionalParams?: Record<string, string> | undefined;
3000
3379
  }) => Promise<URL>;
3001
3380
  validateAuthorizationCode: ({
3002
3381
  code,
@@ -3010,6 +3389,7 @@ declare const socialProviders: {
3010
3389
  }) => Promise<OAuth2Tokens>;
3011
3390
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3012
3391
  getUserInfo(token: OAuth2Tokens & {
3392
+ expectedIdTokenNonce?: string | undefined;
3013
3393
  user?: {
3014
3394
  name?: {
3015
3395
  firstName?: string;
@@ -3057,7 +3437,8 @@ declare const socialProviders: {
3057
3437
  createAuthorizationURL({
3058
3438
  state,
3059
3439
  scopes,
3060
- redirectURI
3440
+ redirectURI,
3441
+ additionalParams
3061
3442
  }: {
3062
3443
  state: string;
3063
3444
  codeVerifier: string;
@@ -3065,6 +3446,8 @@ declare const socialProviders: {
3065
3446
  redirectURI: string;
3066
3447
  display?: string | undefined;
3067
3448
  loginHint?: string | undefined;
3449
+ idTokenNonce?: string | undefined;
3450
+ additionalParams?: Record<string, string> | undefined;
3068
3451
  }): URL;
3069
3452
  validateAuthorizationCode: ({
3070
3453
  code,
@@ -3077,6 +3460,7 @@ declare const socialProviders: {
3077
3460
  }) => Promise<OAuth2Tokens>;
3078
3461
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3079
3462
  getUserInfo(token: OAuth2Tokens & {
3463
+ expectedIdTokenNonce?: string | undefined;
3080
3464
  user?: {
3081
3465
  name?: {
3082
3466
  firstName?: string;
@@ -3103,7 +3487,8 @@ declare const socialProviders: {
3103
3487
  createAuthorizationURL({
3104
3488
  state,
3105
3489
  scopes,
3106
- redirectURI
3490
+ redirectURI,
3491
+ additionalParams
3107
3492
  }: {
3108
3493
  state: string;
3109
3494
  codeVerifier: string;
@@ -3111,6 +3496,8 @@ declare const socialProviders: {
3111
3496
  redirectURI: string;
3112
3497
  display?: string | undefined;
3113
3498
  loginHint?: string | undefined;
3499
+ idTokenNonce?: string | undefined;
3500
+ additionalParams?: Record<string, string> | undefined;
3114
3501
  }): Promise<URL>;
3115
3502
  validateAuthorizationCode: ({
3116
3503
  code,
@@ -3123,6 +3510,7 @@ declare const socialProviders: {
3123
3510
  }) => Promise<OAuth2Tokens>;
3124
3511
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3125
3512
  getUserInfo(token: OAuth2Tokens & {
3513
+ expectedIdTokenNonce?: string | undefined;
3126
3514
  user?: {
3127
3515
  name?: {
3128
3516
  firstName?: string;
@@ -3149,7 +3537,8 @@ declare const socialProviders: {
3149
3537
  createAuthorizationURL({
3150
3538
  state,
3151
3539
  scopes,
3152
- redirectURI
3540
+ redirectURI,
3541
+ additionalParams
3153
3542
  }: {
3154
3543
  state: string;
3155
3544
  codeVerifier: string;
@@ -3157,7 +3546,9 @@ declare const socialProviders: {
3157
3546
  redirectURI: string;
3158
3547
  display?: string | undefined;
3159
3548
  loginHint?: string | undefined;
3160
- }): URL;
3549
+ idTokenNonce?: string | undefined;
3550
+ additionalParams?: Record<string, string> | undefined;
3551
+ }): Promise<URL>;
3161
3552
  validateAuthorizationCode: ({
3162
3553
  code,
3163
3554
  redirectURI
@@ -3169,6 +3560,7 @@ declare const socialProviders: {
3169
3560
  }) => Promise<OAuth2Tokens>;
3170
3561
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3171
3562
  getUserInfo(token: OAuth2Tokens & {
3563
+ expectedIdTokenNonce?: string | undefined;
3172
3564
  user?: {
3173
3565
  name?: {
3174
3566
  firstName?: string;
@@ -3196,7 +3588,8 @@ declare const socialProviders: {
3196
3588
  state,
3197
3589
  scopes,
3198
3590
  codeVerifier,
3199
- redirectURI
3591
+ redirectURI,
3592
+ additionalParams
3200
3593
  }: {
3201
3594
  state: string;
3202
3595
  codeVerifier: string;
@@ -3204,6 +3597,8 @@ declare const socialProviders: {
3204
3597
  redirectURI: string;
3205
3598
  display?: string | undefined;
3206
3599
  loginHint?: string | undefined;
3600
+ idTokenNonce?: string | undefined;
3601
+ additionalParams?: Record<string, string> | undefined;
3207
3602
  }): Promise<URL>;
3208
3603
  validateAuthorizationCode: ({
3209
3604
  code,
@@ -3217,6 +3612,7 @@ declare const socialProviders: {
3217
3612
  }) => Promise<OAuth2Tokens>;
3218
3613
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3219
3614
  getUserInfo(token: OAuth2Tokens & {
3615
+ expectedIdTokenNonce?: string | undefined;
3220
3616
  user?: {
3221
3617
  name?: {
3222
3618
  firstName?: string;
@@ -3244,7 +3640,8 @@ declare const socialProviders: {
3244
3640
  state,
3245
3641
  scopes,
3246
3642
  codeVerifier,
3247
- redirectURI
3643
+ redirectURI,
3644
+ additionalParams
3248
3645
  }: {
3249
3646
  state: string;
3250
3647
  codeVerifier: string;
@@ -3252,6 +3649,8 @@ declare const socialProviders: {
3252
3649
  redirectURI: string;
3253
3650
  display?: string | undefined;
3254
3651
  loginHint?: string | undefined;
3652
+ idTokenNonce?: string | undefined;
3653
+ additionalParams?: Record<string, string> | undefined;
3255
3654
  }): Promise<URL>;
3256
3655
  validateAuthorizationCode: ({
3257
3656
  code,
@@ -3266,6 +3665,7 @@ declare const socialProviders: {
3266
3665
  }) => Promise<OAuth2Tokens>;
3267
3666
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3268
3667
  getUserInfo(data: OAuth2Tokens & {
3668
+ expectedIdTokenNonce?: string | undefined;
3269
3669
  user?: {
3270
3670
  name?: {
3271
3671
  firstName?: string;
@@ -3292,7 +3692,8 @@ declare const socialProviders: {
3292
3692
  createAuthorizationURL: ({
3293
3693
  state,
3294
3694
  redirectURI,
3295
- codeVerifier
3695
+ codeVerifier,
3696
+ additionalParams
3296
3697
  }: {
3297
3698
  state: string;
3298
3699
  codeVerifier: string;
@@ -3300,6 +3701,8 @@ declare const socialProviders: {
3300
3701
  redirectURI: string;
3301
3702
  display?: string | undefined;
3302
3703
  loginHint?: string | undefined;
3704
+ idTokenNonce?: string | undefined;
3705
+ additionalParams?: Record<string, string> | undefined;
3303
3706
  }) => Promise<URL>;
3304
3707
  validateAuthorizationCode: ({
3305
3708
  code,
@@ -3313,6 +3716,7 @@ declare const socialProviders: {
3313
3716
  }) => Promise<OAuth2Tokens>;
3314
3717
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3315
3718
  getUserInfo(token: OAuth2Tokens & {
3719
+ expectedIdTokenNonce?: string | undefined;
3316
3720
  user?: {
3317
3721
  name?: {
3318
3722
  firstName?: string;
@@ -3339,7 +3743,8 @@ declare const socialProviders: {
3339
3743
  state,
3340
3744
  scopes,
3341
3745
  loginHint,
3342
- redirectURI
3746
+ redirectURI,
3747
+ additionalParams
3343
3748
  }: {
3344
3749
  state: string;
3345
3750
  codeVerifier: string;
@@ -3347,6 +3752,8 @@ declare const socialProviders: {
3347
3752
  redirectURI: string;
3348
3753
  display?: string | undefined;
3349
3754
  loginHint?: string | undefined;
3755
+ idTokenNonce?: string | undefined;
3756
+ additionalParams?: Record<string, string> | undefined;
3350
3757
  }): Promise<URL>;
3351
3758
  validateAuthorizationCode: ({
3352
3759
  code,
@@ -3359,6 +3766,7 @@ declare const socialProviders: {
3359
3766
  }) => Promise<OAuth2Tokens>;
3360
3767
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3361
3768
  getUserInfo(token: OAuth2Tokens & {
3769
+ expectedIdTokenNonce?: string | undefined;
3362
3770
  user?: {
3363
3771
  name?: {
3364
3772
  firstName?: string;
@@ -3385,7 +3793,8 @@ declare const socialProviders: {
3385
3793
  createAuthorizationURL({
3386
3794
  state,
3387
3795
  scopes,
3388
- redirectURI
3796
+ redirectURI,
3797
+ additionalParams
3389
3798
  }: {
3390
3799
  state: string;
3391
3800
  codeVerifier: string;
@@ -3393,6 +3802,8 @@ declare const socialProviders: {
3393
3802
  redirectURI: string;
3394
3803
  display?: string | undefined;
3395
3804
  loginHint?: string | undefined;
3805
+ idTokenNonce?: string | undefined;
3806
+ additionalParams?: Record<string, string> | undefined;
3396
3807
  }): Promise<URL>;
3397
3808
  validateAuthorizationCode: ({
3398
3809
  code,
@@ -3405,6 +3816,7 @@ declare const socialProviders: {
3405
3816
  }) => Promise<OAuth2Tokens>;
3406
3817
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3407
3818
  getUserInfo(token: OAuth2Tokens & {
3819
+ expectedIdTokenNonce?: string | undefined;
3408
3820
  user?: {
3409
3821
  name?: {
3410
3822
  firstName?: string;
@@ -3452,7 +3864,8 @@ declare const socialProviders: {
3452
3864
  createAuthorizationURL({
3453
3865
  state,
3454
3866
  scopes,
3455
- redirectURI
3867
+ redirectURI,
3868
+ additionalParams
3456
3869
  }: {
3457
3870
  state: string;
3458
3871
  codeVerifier: string;
@@ -3460,6 +3873,8 @@ declare const socialProviders: {
3460
3873
  redirectURI: string;
3461
3874
  display?: string | undefined;
3462
3875
  loginHint?: string | undefined;
3876
+ idTokenNonce?: string | undefined;
3877
+ additionalParams?: Record<string, string> | undefined;
3463
3878
  }): Promise<URL>;
3464
3879
  validateAuthorizationCode: ({
3465
3880
  code,
@@ -3472,6 +3887,7 @@ declare const socialProviders: {
3472
3887
  }) => Promise<OAuth2Tokens>;
3473
3888
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3474
3889
  getUserInfo(token: OAuth2Tokens & {
3890
+ expectedIdTokenNonce?: string | undefined;
3475
3891
  user?: {
3476
3892
  name?: {
3477
3893
  firstName?: string;
@@ -3521,7 +3937,8 @@ declare const socialProviders: {
3521
3937
  scopes,
3522
3938
  codeVerifier,
3523
3939
  redirectURI,
3524
- loginHint
3940
+ loginHint,
3941
+ additionalParams
3525
3942
  }: {
3526
3943
  state: string;
3527
3944
  codeVerifier: string;
@@ -3529,6 +3946,8 @@ declare const socialProviders: {
3529
3946
  redirectURI: string;
3530
3947
  display?: string | undefined;
3531
3948
  loginHint?: string | undefined;
3949
+ idTokenNonce?: string | undefined;
3950
+ additionalParams?: Record<string, string> | undefined;
3532
3951
  }): Promise<URL>;
3533
3952
  validateAuthorizationCode: ({
3534
3953
  code,
@@ -3541,8 +3960,11 @@ declare const socialProviders: {
3541
3960
  deviceId?: string | undefined;
3542
3961
  }) => Promise<OAuth2Tokens>;
3543
3962
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3544
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
3963
+ idToken: {
3964
+ verify: (token: string, nonce: string | undefined) => Promise<boolean>;
3965
+ };
3545
3966
  getUserInfo(token: OAuth2Tokens & {
3967
+ expectedIdTokenNonce?: string | undefined;
3546
3968
  user?: {
3547
3969
  name?: {
3548
3970
  firstName?: string;
@@ -3592,7 +4014,8 @@ declare const socialProviders: {
3592
4014
  scopes,
3593
4015
  codeVerifier,
3594
4016
  redirectURI,
3595
- loginHint
4017
+ loginHint,
4018
+ additionalParams
3596
4019
  }: {
3597
4020
  state: string;
3598
4021
  codeVerifier: string;
@@ -3600,6 +4023,8 @@ declare const socialProviders: {
3600
4023
  redirectURI: string;
3601
4024
  display?: string | undefined;
3602
4025
  loginHint?: string | undefined;
4026
+ idTokenNonce?: string | undefined;
4027
+ additionalParams?: Record<string, string> | undefined;
3603
4028
  }): Promise<URL>;
3604
4029
  validateAuthorizationCode: ({
3605
4030
  code,
@@ -3613,6 +4038,7 @@ declare const socialProviders: {
3613
4038
  }) => Promise<OAuth2Tokens>;
3614
4039
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3615
4040
  getUserInfo(token: OAuth2Tokens & {
4041
+ expectedIdTokenNonce?: string | undefined;
3616
4042
  user?: {
3617
4043
  name?: {
3618
4044
  firstName?: string;
@@ -3639,7 +4065,8 @@ declare const socialProviders: {
3639
4065
  createAuthorizationURL({
3640
4066
  state,
3641
4067
  codeVerifier,
3642
- redirectURI
4068
+ redirectURI,
4069
+ additionalParams
3643
4070
  }: {
3644
4071
  state: string;
3645
4072
  codeVerifier: string;
@@ -3647,6 +4074,8 @@ declare const socialProviders: {
3647
4074
  redirectURI: string;
3648
4075
  display?: string | undefined;
3649
4076
  loginHint?: string | undefined;
4077
+ idTokenNonce?: string | undefined;
4078
+ additionalParams?: Record<string, string> | undefined;
3650
4079
  }): Promise<URL>;
3651
4080
  validateAuthorizationCode: ({
3652
4081
  code,
@@ -3667,8 +4096,8 @@ declare const socialProviders: {
3667
4096
  refreshToken: any;
3668
4097
  accessTokenExpiresAt: Date | undefined;
3669
4098
  }>);
3670
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
3671
4099
  getUserInfo(token: OAuth2Tokens & {
4100
+ expectedIdTokenNonce?: string | undefined;
3672
4101
  user?: {
3673
4102
  name?: {
3674
4103
  firstName?: string;
@@ -3717,7 +4146,8 @@ declare const socialProviders: {
3717
4146
  state,
3718
4147
  scopes,
3719
4148
  codeVerifier,
3720
- redirectURI
4149
+ redirectURI,
4150
+ additionalParams
3721
4151
  }: {
3722
4152
  state: string;
3723
4153
  codeVerifier: string;
@@ -3725,6 +4155,8 @@ declare const socialProviders: {
3725
4155
  redirectURI: string;
3726
4156
  display?: string | undefined;
3727
4157
  loginHint?: string | undefined;
4158
+ idTokenNonce?: string | undefined;
4159
+ additionalParams?: Record<string, string> | undefined;
3728
4160
  }): Promise<URL>;
3729
4161
  validateAuthorizationCode: ({
3730
4162
  code,
@@ -3738,6 +4170,7 @@ declare const socialProviders: {
3738
4170
  }) => Promise<OAuth2Tokens>;
3739
4171
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3740
4172
  getUserInfo(token: OAuth2Tokens & {
4173
+ expectedIdTokenNonce?: string | undefined;
3741
4174
  user?: {
3742
4175
  name?: {
3743
4176
  firstName?: string;
@@ -3765,7 +4198,8 @@ declare const socialProviders: {
3765
4198
  state,
3766
4199
  scopes,
3767
4200
  codeVerifier,
3768
- redirectURI
4201
+ redirectURI,
4202
+ additionalParams
3769
4203
  }: {
3770
4204
  state: string;
3771
4205
  codeVerifier: string;
@@ -3773,6 +4207,8 @@ declare const socialProviders: {
3773
4207
  redirectURI: string;
3774
4208
  display?: string | undefined;
3775
4209
  loginHint?: string | undefined;
4210
+ idTokenNonce?: string | undefined;
4211
+ additionalParams?: Record<string, string> | undefined;
3776
4212
  }): Promise<URL>;
3777
4213
  validateAuthorizationCode: ({
3778
4214
  code,
@@ -3786,6 +4222,7 @@ declare const socialProviders: {
3786
4222
  }) => Promise<OAuth2Tokens>;
3787
4223
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3788
4224
  getUserInfo(token: OAuth2Tokens & {
4225
+ expectedIdTokenNonce?: string | undefined;
3789
4226
  user?: {
3790
4227
  name?: {
3791
4228
  firstName?: string;
@@ -3813,7 +4250,8 @@ declare const socialProviders: {
3813
4250
  state,
3814
4251
  scopes,
3815
4252
  codeVerifier,
3816
- redirectURI
4253
+ redirectURI,
4254
+ additionalParams
3817
4255
  }: {
3818
4256
  state: string;
3819
4257
  codeVerifier: string;
@@ -3821,6 +4259,8 @@ declare const socialProviders: {
3821
4259
  redirectURI: string;
3822
4260
  display?: string | undefined;
3823
4261
  loginHint?: string | undefined;
4262
+ idTokenNonce?: string | undefined;
4263
+ additionalParams?: Record<string, string> | undefined;
3824
4264
  }): Promise<URL>;
3825
4265
  validateAuthorizationCode: ({
3826
4266
  code,
@@ -3833,6 +4273,7 @@ declare const socialProviders: {
3833
4273
  deviceId?: string | undefined;
3834
4274
  }) => Promise<OAuth2Tokens>;
3835
4275
  getUserInfo(token: OAuth2Tokens & {
4276
+ expectedIdTokenNonce?: string | undefined;
3836
4277
  user?: {
3837
4278
  name?: {
3838
4279
  firstName?: string;
@@ -3859,7 +4300,8 @@ declare const socialProviders: {
3859
4300
  createAuthorizationURL({
3860
4301
  state,
3861
4302
  scopes,
3862
- redirectURI
4303
+ redirectURI,
4304
+ additionalParams
3863
4305
  }: {
3864
4306
  state: string;
3865
4307
  codeVerifier: string;
@@ -3867,6 +4309,8 @@ declare const socialProviders: {
3867
4309
  redirectURI: string;
3868
4310
  display?: string | undefined;
3869
4311
  loginHint?: string | undefined;
4312
+ idTokenNonce?: string | undefined;
4313
+ additionalParams?: Record<string, string> | undefined;
3870
4314
  }): URL;
3871
4315
  validateAuthorizationCode: ({
3872
4316
  code
@@ -3892,6 +4336,7 @@ declare const socialProviders: {
3892
4336
  scopes: string[];
3893
4337
  }>);
3894
4338
  getUserInfo(token: OAuth2Tokens & {
4339
+ expectedIdTokenNonce?: string | undefined;
3895
4340
  user?: {
3896
4341
  name?: {
3897
4342
  firstName?: string;
@@ -3942,14 +4387,14 @@ type BaseAccount = z.infer<typeof accountSchema>;
3942
4387
  */
3943
4388
  type Account<DBOptions extends BetterAuthOptions["account"] = BetterAuthOptions["account"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseAccount & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"account", Plugins>>; //#endregion
3944
4389
  //#endregion
3945
- //#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
3946
4391
  type Prettify<T> = { [K in keyof T]: T[K] } & {};
3947
4392
  type IsEmptyObject<T> = keyof T extends never ? true : false;
3948
4393
  type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
3949
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> : {};
3950
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
3951
4396
  //#endregion
3952
- //#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
3953
4398
  //#region src/standard-schema.d.ts
3954
4399
  /** The Standard Schema interface. */
3955
4400
  interface StandardSchemaV1$1<Input = unknown, Output = Input> {
@@ -4007,7 +4452,7 @@ declare namespace StandardSchemaV1$1 {
4007
4452
  type InferOutput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
4008
4453
  } //#endregion
4009
4454
  //#endregion
4010
- //#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
4011
4456
  declare const statusCodes: {
4012
4457
  OK: number;
4013
4458
  CREATED: number;
@@ -4085,7 +4530,7 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
4085
4530
  errorStack: string | undefined;
4086
4531
  }; //#endregion
4087
4532
  //#endregion
4088
- //#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
4089
4534
  //#region src/cookies.d.ts
4090
4535
  type CookiePrefixOptions = "host" | "secure";
4091
4536
  type CookieOptions = {
@@ -4175,7 +4620,7 @@ type CookieOptions = {
4175
4620
  prefix?: CookiePrefixOptions;
4176
4621
  };
4177
4622
  //#endregion
4178
- //#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
4179
4624
  //#region src/openapi.d.ts
4180
4625
  type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
4181
4626
  interface OpenAPIParameter {
@@ -4197,7 +4642,7 @@ interface OpenAPIParameter {
4197
4642
  };
4198
4643
  }
4199
4644
  //#endregion
4200
- //#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
4201
4646
  //#region src/endpoint.d.ts
4202
4647
  interface EndpointBaseOptions {
4203
4648
  /**
@@ -4518,6 +4963,22 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
4518
4963
  * @returns - The cookie string
4519
4964
  */
4520
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;
4521
4982
  /**
4522
4983
  * JSON
4523
4984
  *
@@ -4560,7 +5021,7 @@ type Endpoint<Path extends string = string, Options extends EndpointOptions = En
4560
5021
  path: Path;
4561
5022
  }; //#endregion
4562
5023
  //#endregion
4563
- //#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
4564
5025
  //#region src/middleware.d.ts
4565
5026
  interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
4566
5027
  type MiddlewareContext<Options extends MiddlewareOptions, Context = {}> = EndpointContext<string, Options & {
@@ -4667,7 +5128,7 @@ type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler e
4667
5128
  options: Options;
4668
5129
  }; //#endregion
4669
5130
  //#endregion
4670
- //#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
4671
5132
  //#region src/context.d.ts
4672
5133
  type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
4673
5134
  type Method = HTTPMethod | "*";
@@ -4807,7 +5268,13 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4807
5268
  user: User;
4808
5269
  account: Account;
4809
5270
  }>;
4810
- 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>;
4811
5278
  createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
4812
5279
  listSessions(userId: string, options?: {
4813
5280
  onlyActiveSessions?: boolean | undefined;
@@ -4832,8 +5299,20 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4832
5299
  updateSession(sessionToken: string, session: Partial<Session> & Record<string, any>): Promise<Session | null>;
4833
5300
  deleteSession(token: string): Promise<void>;
4834
5301
  deleteAccounts(userId: string): Promise<void>;
4835
- deleteAccount(accountId: string): Promise<void>;
4836
- 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>;
4837
5316
  findOAuthUser(email: string, accountId: string, providerId: string): Promise<{
4838
5317
  user: User;
4839
5318
  linkedAccount: Account | null;
@@ -4851,14 +5330,45 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4851
5330
  updateUserByEmail<T extends Record<string, any>>(email: string, data: Partial<User & Record<string, any>>): Promise<User & T>;
4852
5331
  updatePassword(userId: string, password: string): Promise<void>;
4853
5332
  findAccounts(userId: string): Promise<Account[]>;
4854
- findAccount(accountId: string): Promise<Account | null>;
4855
5333
  findAccountByProviderId(accountId: string, providerId: string): Promise<Account | null>;
4856
5334
  findAccountByUserId(userId: string): Promise<Account[]>;
4857
5335
  updateAccount(id: string, data: Partial<Account>): Promise<Account>;
4858
5336
  createVerificationValue(data: Omit<Verification, "createdAt" | "id" | "updatedAt"> & Partial<Verification>): Promise<Verification>;
4859
5337
  findVerificationValue(identifier: string): Promise<Verification | null>;
4860
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>;
4861
5370
  updateVerificationByIdentifier(identifier: string, data: Partial<Verification>): Promise<Verification>;
5371
+ refreshUserSessions(user: User): Promise<void>;
4862
5372
  }
4863
5373
  type CreateCookieGetterFn = (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => BetterAuthCookie;
4864
5374
  type CheckPasswordFn<Options extends BetterAuthOptions = BetterAuthOptions> = (userId: string, ctx: GenericEndpointContext<Options>) => Promise<boolean>;
@@ -4914,7 +5424,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
4914
5424
  * - "cookie": Store state in an encrypted cookie (stateless)
4915
5425
  * - "database": Store state in the database
4916
5426
  *
4917
- * @default "cookie"
5427
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
4918
5428
  */
4919
5429
  storeStateStrategy: "database" | "cookie";
4920
5430
  };
@@ -5297,6 +5807,73 @@ type GenerateIdFn = (options: {
5297
5807
  model: ModelNames;
5298
5808
  size?: number | undefined;
5299
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
+ };
5300
5877
  /**
5301
5878
  * Configuration for dynamic base URL resolution.
5302
5879
  * Allows Better Auth to work with multiple domains (e.g., Vercel preview deployments).
@@ -5341,8 +5918,30 @@ type DynamicBaseURLConfig = {
5341
5918
  */
5342
5919
  type BaseURLConfig = string | DynamicBaseURLConfig;
5343
5920
  interface BetterAuthRateLimitStorage {
5344
- get: (key: string) => Promise<RateLimit | null | undefined>;
5345
- 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
+ }>;
5346
5945
  }
5347
5946
  type BetterAuthRateLimitRule = {
5348
5947
  /**
@@ -5417,7 +6016,7 @@ type BetterAuthAdvancedOptions = {
5417
6016
  * @example ["x-client-ip", "x-forwarded-for", "cf-connecting-ip"]
5418
6017
  *
5419
6018
  * @default
5420
- * @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
5421
6020
  */
5422
6021
  ipAddressHeaders?: string[];
5423
6022
  /**
@@ -5427,12 +6026,28 @@ type BetterAuthAdvancedOptions = {
5427
6026
  */
5428
6027
  disableIpTracking?: boolean;
5429
6028
  /**
5430
- * IPv6 subnet prefix length for rate limiting.
5431
- * 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).
5432
6032
  *
5433
6033
  * @default 64
5434
6034
  */
5435
- 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[];
5436
6051
  } | undefined;
5437
6052
  /**
5438
6053
  * Force cookies to always use the `Secure` attribute. By default,
@@ -5958,6 +6573,30 @@ type BetterAuthOptions = {
5958
6573
  * User configuration
5959
6574
  */
5960
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>;
5961
6600
  /**
5962
6601
  * Changing email configuration
5963
6602
  */
@@ -6099,6 +6738,20 @@ type BetterAuthOptions = {
6099
6738
  * @default "compact"
6100
6739
  */
6101
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
+ };
6102
6755
  /**
6103
6756
  * Controls stateless cookie cache refresh behavior.
6104
6757
  *
@@ -6181,6 +6834,25 @@ type BetterAuthOptions = {
6181
6834
  * @default false
6182
6835
  */
6183
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;
6184
6856
  /**
6185
6857
  * List of trusted providers. Can be a static array or a function
6186
6858
  * that returns providers dynamically. The function is called
@@ -6218,7 +6890,11 @@ type BetterAuthOptions = {
6218
6890
  */
6219
6891
  allowUnlinkingAll?: boolean;
6220
6892
  /**
6221
- * 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.
6222
6898
  *
6223
6899
  * @default false
6224
6900
  */
@@ -6251,13 +6927,17 @@ type BetterAuthOptions = {
6251
6927
  * - "cookie": Store state in an encrypted cookie (stateless)
6252
6928
  * - "database": Store state in the database
6253
6929
  *
6254
- * @default "cookie"
6930
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
6255
6931
  */
6256
6932
  storeStateStrategy?: "database" | "cookie";
6257
6933
  /**
6258
- * 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.
6259
6937
  *
6260
- * 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.
6261
6941
  *
6262
6942
  * @default false
6263
6943
  *
@@ -6760,6 +7440,23 @@ interface SecondaryStorage {
6760
7440
  * @returns - Value of the key
6761
7441
  */
6762
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>;
6763
7460
  set: (
6764
7461
  /**
6765
7462
  * Key to store
@@ -7057,6 +7754,7 @@ declare const requestAuthOptionsSchema: z.ZodObject<{
7057
7754
  disableRedirect: z.ZodOptional<z.ZodBoolean>;
7058
7755
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7059
7756
  requestSignUp: z.ZodOptional<z.ZodBoolean>;
7757
+ additionalParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7060
7758
  additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
7061
7759
  }, z.core.$strip>;
7062
7760
  type ElectronRequestAuthOptions = z.infer<typeof requestAuthOptionsSchema>;