@better-auth/electron 1.7.0-beta.4 → 1.7.0-beta.6

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";
@@ -31,6 +33,7 @@ type DBAdapterDebugLogOption = boolean | {
31
33
  delete?: boolean | undefined;
32
34
  deleteMany?: boolean | undefined;
33
35
  consumeOne?: boolean | undefined;
36
+ incrementOne?: boolean | undefined;
34
37
  count?: boolean | undefined;
35
38
  } | {
36
39
  /**
@@ -206,7 +209,7 @@ interface DBAdapterFactoryConfig<Options extends BetterAuthOptions = BetterAuthO
206
209
  /**
207
210
  * The action which was called from the adapter.
208
211
  */
209
- action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "count";
212
+ action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "incrementOne" | "count";
210
213
  /**
211
214
  * The model name.
212
215
  */
@@ -435,15 +438,43 @@ type DBAdapter<Options extends BetterAuthOptions = BetterAuthOptions> = {
435
438
  * race-safe primitive for consuming single-use credentials
436
439
  * (verification tokens, authorization codes, one-time tokens).
437
440
  *
438
- * Always defined on the factory-wrapped adapter. When the underlying
439
- * `CustomAdapter` does not implement `consumeOne`, the factory provides
440
- * a fallback that wraps `findMany + deleteMany` in `transaction(...)`
441
- * and returns the row only when the delete reports an affected row.
441
+ * Always defined on the factory-wrapped adapter. The underlying
442
+ * `CustomAdapter` must implement this natively; there is no portable
443
+ * fallback that can guarantee cross-process single-use semantics.
442
444
  */
443
445
  consumeOne: <T>(data: {
444
446
  model: string;
445
447
  where: Where[];
446
448
  }) => Promise<T | null>;
449
+ /**
450
+ * Atomically apply signed numeric deltas to a single row matching the where
451
+ * clause. For each entry in `increment`, the operation applies
452
+ * `field = field + delta` in one atomic step; a negative delta decrements.
453
+ *
454
+ * The `where` clause is both the selector AND the guard: comparison
455
+ * operators are honored, so passing `{ field: "remaining", operator: "gt",
456
+ * value: 0 }` only mutates the row while `remaining` is still above zero.
457
+ * When the guard matches no row, the operation makes no change and returns
458
+ * `null`.
459
+ *
460
+ * The optional `set` map assigns absolute values to fields in the same
461
+ * atomic operation, alongside the increments.
462
+ *
463
+ * Returns the updated row, or `null` when the guard matched no row. Under
464
+ * concurrent invocation against the same row, this is the race-safe
465
+ * primitive for guarded counter updates (e.g. decrementing a remaining-uses
466
+ * counter only while it is still positive).
467
+ *
468
+ * Always defined on the factory-wrapped adapter. The underlying
469
+ * `CustomAdapter` must implement this natively; there is no portable
470
+ * fallback that can guarantee guarded counter semantics across runtimes.
471
+ */
472
+ incrementOne: <T>(data: {
473
+ model: string;
474
+ where: Where[];
475
+ increment: Record<string, number>;
476
+ set?: Record<string, unknown> | undefined;
477
+ }) => Promise<T | null>;
447
478
  /**
448
479
  * Execute multiple operations in a transaction.
449
480
  * If the adapter doesn't support transactions, operations will be executed sequentially.
@@ -526,18 +557,33 @@ interface CustomAdapter {
526
557
  where: CleanedWhere[];
527
558
  }) => Promise<number>;
528
559
  /**
529
- * Optional native atomic single-row consume. When omitted, the adapter
530
- * factory falls back to `transaction(findMany + deleteMany)`.
560
+ * Native atomic single-row consume.
531
561
  * Implementing this method natively (e.g. `DELETE ... RETURNING *`,
532
562
  * `findOneAndDelete`, `OUTPUT deleted.*`) gives one round trip and the
533
563
  * strongest race-safety guarantee. Implementations must delete at most
534
- * one matching row. TODO(consume-one-required): tighten to required in the
535
- * next minor on `next`.
564
+ * one matching row.
536
565
  */
537
- consumeOne?: <T>(data: {
566
+ consumeOne: <T>(data: {
538
567
  model: string;
539
568
  where: CleanedWhere[];
540
569
  }) => Promise<T | null>;
570
+ /**
571
+ * Native atomic guarded counter mutation. Applies
572
+ * `field = field + delta` for each entry in `increment` (negative deltas
573
+ * decrement), with `where` acting as both selector and guard and `set`
574
+ * assigning absolute values in the same operation. Returns the updated row,
575
+ * or `null` when the guard matched no row.
576
+ *
577
+ * Implementing this natively (e.g. `UPDATE ... SET n = n + $delta WHERE ...
578
+ * RETURNING *`) gives one round trip and the strongest race-safety
579
+ * guarantee.
580
+ */
581
+ incrementOne: <T>(data: {
582
+ model: string;
583
+ where: CleanedWhere[];
584
+ increment: Record<string, number>;
585
+ set?: Record<string, unknown> | undefined;
586
+ }) => Promise<T | null>;
541
587
  count: ({
542
588
  model,
543
589
  where
@@ -575,7 +621,6 @@ type BaseRateLimit = z.infer<typeof rateLimitSchema>;
575
621
  /**
576
622
  * Rate limit schema type used by better-auth for rate limiting
577
623
  */
578
- type RateLimit<DBOptions extends BetterAuthOptions["rateLimit"] = BetterAuthOptions["rateLimit"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseRateLimit & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"rateLimit", Plugins>>; //#endregion
579
624
  //#endregion
580
625
  //#region ../core/dist/db/schema/session.d.mts
581
626
  //#region src/db/schema/session.d.ts
@@ -644,6 +689,52 @@ declare const createLogger: (options?: Logger | undefined) => InternalLogger;
644
689
  //#endregion
645
690
  //#region ../core/dist/oauth2/oauth-provider.d.mts
646
691
  //#region src/oauth2/oauth-provider.d.ts
692
+ /**
693
+ * id_token verification config for a social provider.
694
+ *
695
+ * Declares how a client-submitted id_token is verified. The shared verifier
696
+ * (`verifyProviderIdToken`) consumes this instead of each provider implementing its own
697
+ * boolean check, so verification is centralized and fail-closed: a provider without a config
698
+ * cannot accept a forged token by omission.
699
+ */
700
+ type OAuthIdTokenConfig = {
701
+ /**
702
+ * JWKS resolver used to verify the JWS signature. Accepts a jose
703
+ * `createRemoteJWKSet` resolver or a key-resolving function
704
+ * `(protectedHeader) => key`.
705
+ */
706
+ jwks: JWTVerifyGetKey; /** Expected `iss`. Omit for providers whose issuer varies per tenant. */
707
+ issuer?: (string | string[]) | undefined; /** Expected `aud`, usually the client ID. */
708
+ audience: string | string[]; /** Permitted JWS algorithms. Defaults to the token's `alg` header. */
709
+ algorithms?: string[] | undefined; /** Maximum token age passed to jose (e.g. `"1h"`). */
710
+ maxTokenAge?: string | undefined;
711
+ /**
712
+ * How the `nonce` claim is compared to the expected nonce.
713
+ * - `"exact"` (default): strict equality.
714
+ * - `"exact-or-sha256"`: matches the raw nonce or its SHA-256 hex digest (Apple).
715
+ */
716
+ nonceComparison?: ("exact" | "exact-or-sha256") | undefined;
717
+ /**
718
+ * Accept non-JWS (opaque) tokens without signature verification. Identity is then
719
+ * resolved by getUserInfo from the access token via the provider userinfo endpoint,
720
+ * which validates it (e.g. Facebook Graph access tokens).
721
+ */
722
+ allowOpaqueToken?: boolean | undefined;
723
+ /**
724
+ * Provider-specific claim check applied after the signature, issuer,
725
+ * audience, max-age, and nonce checks pass. Return `false` to reject the
726
+ * token. Used to enforce constraints the standard checks cannot express,
727
+ * e.g. Google's hosted-domain (`hd`) restriction. Omitted by providers
728
+ * that have no extra claim requirement.
729
+ */
730
+ verifyClaims?: ((claims: Record<string, unknown>) => boolean) | undefined;
731
+ } | {
732
+ /**
733
+ * Custom verifier for providers that cannot verify against a local JWKS, such as a
734
+ * remote verification endpoint (e.g. LINE).
735
+ */
736
+ verify: (token: string, nonce?: string) => Promise<boolean>;
737
+ };
647
738
  interface OAuth2Tokens {
648
739
  tokenType?: string | undefined;
649
740
  accessToken?: string | undefined;
@@ -665,8 +756,58 @@ type OAuth2UserInfo = {
665
756
  image?: string | undefined;
666
757
  emailVerified: boolean;
667
758
  };
668
- interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
759
+ /**
760
+ * The result of building a provider authorization URL.
761
+ *
762
+ * `requestedScopes` is the effective set of scopes encoded in the URL (the
763
+ * provider's built-in defaults + configured `options.scope` + per-request
764
+ * `scopes`, composed by `resolveRequestedScopes`). Callers persist it so the
765
+ * callback can fall back to the request when the provider omits `scope` from
766
+ * its token response (RFC 6749 §5.1).
767
+ */
768
+ interface AuthorizationURLResult {
769
+ url: URL;
770
+ requestedScopes: string[];
771
+ }
772
+ /**
773
+ * How much an RP trusts a provider's echoed token-response `scope` when
774
+ * persisting `account.grantedScopes`.
775
+ *
776
+ * - `"full-grant"`: the echo is the user's complete current grant, so the seam
777
+ * replaces the stored grant with it. This is the only path that may narrow
778
+ * the grant. Declare it only for providers whose token response reports the
779
+ * full combined grant, e.g. Google with `include_granted_scopes`.
780
+ * - `"projection"`: the echo is this request's subset, so the seam unions it
781
+ * onto the stored grant. The safe default for every provider.
782
+ * - `"absent-echo"`: the provider omitted `scope`, so the grant equals what was
783
+ * requested (RFC 6749 §5.1) and the seam unions the requested set. Resolved
784
+ * at runtime by the persistence seam, never declared by a provider.
785
+ *
786
+ * @see https://www.rfc-editor.org/rfc/rfc6749#section-5.1
787
+ */
788
+ type GrantAuthority = "full-grant" | "projection" | "absent-echo";
789
+ /**
790
+ * The authority a provider may declare for its own echoed scope. `"absent-echo"`
791
+ * is excluded because it is a runtime condition (an omitted echo), not a
792
+ * provider trait.
793
+ */
794
+ type ProviderGrantAuthority = Exclude<GrantAuthority, "absent-echo">;
795
+ interface UpstreamProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
669
796
  id: LiteralString;
797
+ /**
798
+ * The path the provider redirects back to, relative to the app base URL,
799
+ * e.g. `/callback/google`.
800
+ */
801
+ callbackPath: string;
802
+ /**
803
+ * How the persistence seam treats this provider's echoed token-response
804
+ * `scope`. Declare `"full-grant"` only when the echo is the user's complete
805
+ * current grant (e.g. Google with `include_granted_scopes`); otherwise the
806
+ * echo is unioned onto the stored grant.
807
+ *
808
+ * @default "projection"
809
+ */
810
+ grantAuthority?: ProviderGrantAuthority | undefined;
670
811
  createAuthorizationURL: (data: {
671
812
  state: string;
672
813
  codeVerifier: string;
@@ -681,7 +822,7 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
681
822
  * before applying them.
682
823
  */
683
824
  additionalParams?: Record<string, string> | undefined;
684
- }) => Awaitable<URL>;
825
+ }) => Awaitable<AuthorizationURLResult>;
685
826
  name: string;
686
827
  validateAuthorizationCode: (data: {
687
828
  code: string;
@@ -709,14 +850,12 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
709
850
  * Custom function to refresh a token
710
851
  */
711
852
  refreshAccessToken?: ((refreshToken: string) => Promise<OAuth2Tokens>) | undefined;
712
- revokeToken?: ((token: string) => Promise<void>) | undefined;
713
853
  /**
714
- * Verify the id token
715
- * @param token - The id token
716
- * @param nonce - The nonce
717
- * @returns True if the id token is valid, false otherwise
854
+ * Declarative id_token verification config consumed by the shared
855
+ * `verifyProviderIdToken` verifier. Providers set this instead of implementing a boolean
856
+ * verify method, which keeps verification centralized and fail-closed.
718
857
  */
719
- verifyIdToken?: ((token: string, nonce?: string) => Promise<boolean>) | undefined;
858
+ idToken?: OAuthIdTokenConfig | undefined;
720
859
  /**
721
860
  * The expected issuer identifier for this provider (RFC 9207).
722
861
  * When set, the callback handler validates the `iss` query parameter
@@ -856,6 +995,29 @@ type ProviderOptions<Profile extends Record<string, any> = any> = {
856
995
  * @default false
857
996
  */
858
997
  overrideUserInfoOnSignIn?: boolean | undefined;
998
+ /**
999
+ * Require this provider's email to be verified before a session is created.
1000
+ *
1001
+ * When the provider reports the email as unverified, the user and account are
1002
+ * still created/linked, but no session is issued: the OAuth callback redirects
1003
+ * with `?error=email_not_verified` and id-token sign-in returns a `403`
1004
+ * `EMAIL_NOT_VERIFIED`. A verification email is (re)sent per the
1005
+ * `emailVerification` settings (`sendOnSignUp` / `sendOnSignIn`).
1006
+ *
1007
+ * The gate checks the local user's verification state, not the provider's
1008
+ * claim on each request: a user already verified through another method (or a
1009
+ * prior verified sign-in) keeps access even if the provider later reports the
1010
+ * email as unverified.
1011
+ *
1012
+ * This is opt-in per provider and is independent of
1013
+ * `emailAndPassword.requireEmailVerification`; enabling that does not gate
1014
+ * social sign-in. Only enable it for providers that report a trustworthy
1015
+ * `email_verified` signal: several providers always report the email as
1016
+ * unverified, which would block every sign-in.
1017
+ *
1018
+ * @default false
1019
+ */
1020
+ requireEmailVerification?: boolean | undefined;
859
1021
  }; //#endregion
860
1022
  //#endregion
861
1023
  //#region ../core/dist/social-providers/apple.d.mts
@@ -1164,6 +1326,15 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
1164
1326
  clientId: string;
1165
1327
  }
1166
1328
  //#endregion
1329
+ //#region ../core/dist/oauth2/client-assertion.d.mts
1330
+ type ClientAssertionGrantType = "authorization_code" | "refresh_token" | "client_credentials";
1331
+ interface ClientAssertionContext {
1332
+ clientId: string;
1333
+ tokenEndpoint: string;
1334
+ grantType: ClientAssertionGrantType;
1335
+ }
1336
+ type ClientAssertionGetter = (context: ClientAssertionContext) => Awaitable<string>;
1337
+ //#endregion
1167
1338
  //#region ../core/dist/social-providers/microsoft-entra-id.d.mts
1168
1339
  //#region src/social-providers/microsoft-entra-id.d.ts
1169
1340
  /**
@@ -1275,21 +1446,29 @@ interface MicrosoftOptions extends ProviderOptions<MicrosoftEntraIDProfile> {
1275
1446
  * The tenant ID of the Microsoft account
1276
1447
  * @default "common"
1277
1448
  */
1278
- tenantId?: string | undefined;
1449
+ tenantId?: string;
1279
1450
  /**
1280
1451
  * The authentication authority URL. Use the default "https://login.microsoftonline.com" for standard Entra ID or "https://<tenant-id>.ciamlogin.com" for CIAM scenarios.
1281
1452
  * @default "https://login.microsoftonline.com"
1282
1453
  */
1283
- authority?: string | undefined;
1454
+ authority?: string;
1455
+ /**
1456
+ * Function that returns a JWT client assertion for token endpoint authentication.
1457
+ *
1458
+ * Use this instead of `clientSecret` when your Microsoft Entra ID app is
1459
+ * configured for client authentication with assertions (private_key_jwt or
1460
+ * workload identity federation).
1461
+ */
1462
+ clientAssertion?: ClientAssertionGetter;
1284
1463
  /**
1285
1464
  * The size of the profile photo
1286
1465
  * @default 48
1287
1466
  */
1288
- profilePhotoSize?: (48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648) | undefined;
1467
+ profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
1289
1468
  /**
1290
1469
  * Disable profile photo
1291
1470
  */
1292
- disableProfilePhoto?: boolean | undefined;
1471
+ disableProfilePhoto?: boolean;
1293
1472
  }
1294
1473
  //#endregion
1295
1474
  //#region ../core/dist/social-providers/google.d.mts
@@ -1331,9 +1510,22 @@ interface GoogleOptions extends ProviderOptions<GoogleProfile> {
1331
1510
  */
1332
1511
  display?: ("page" | "popup" | "touch" | "wap") | undefined;
1333
1512
  /**
1334
- * The hosted domain of the user
1513
+ * The hosted domain (Google Workspace) the user must belong to.
1514
+ *
1515
+ * This is sent to Google as the `hd` authorization hint and, when set, is
1516
+ * also enforced against the `hd` claim of the returned id token/profile.
1517
+ * Sign-in is rejected when the claim is missing or does not match, so this
1518
+ * can be used to restrict sign-in to a Workspace domain.
1335
1519
  */
1336
1520
  hd?: string | undefined;
1521
+ /**
1522
+ * Enable incremental authorization via Google's `include_granted_scopes`
1523
+ * parameter. When enabled, Google reports the user's full granted scope set
1524
+ * in the token response.
1525
+ *
1526
+ * @default true
1527
+ */
1528
+ includeGrantedScopes?: boolean | undefined;
1337
1529
  }
1338
1530
  //#endregion
1339
1531
  //#region ../core/dist/social-providers/huggingface.d.mts
@@ -2204,6 +2396,7 @@ declare const socialProviders: {
2204
2396
  apple: (options: AppleOptions) => {
2205
2397
  id: "apple";
2206
2398
  name: string;
2399
+ callbackPath: string;
2207
2400
  createAuthorizationURL({
2208
2401
  state,
2209
2402
  scopes,
@@ -2217,7 +2410,10 @@ declare const socialProviders: {
2217
2410
  display?: string | undefined;
2218
2411
  loginHint?: string | undefined;
2219
2412
  additionalParams?: Record<string, string> | undefined;
2220
- }): Promise<URL>;
2413
+ }): Promise<{
2414
+ url: URL;
2415
+ requestedScopes: string[];
2416
+ }>;
2221
2417
  validateAuthorizationCode: ({
2222
2418
  code,
2223
2419
  codeVerifier,
@@ -2228,7 +2424,13 @@ declare const socialProviders: {
2228
2424
  codeVerifier?: string | undefined;
2229
2425
  deviceId?: string | undefined;
2230
2426
  }) => Promise<OAuth2Tokens>;
2231
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2427
+ idToken: {
2428
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2429
+ issuer: string;
2430
+ audience: string | string[];
2431
+ maxTokenAge: string;
2432
+ nonceComparison: "exact-or-sha256";
2433
+ };
2232
2434
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2233
2435
  getUserInfo(token: OAuth2Tokens & {
2234
2436
  user?: {
@@ -2254,6 +2456,7 @@ declare const socialProviders: {
2254
2456
  atlassian: (options: AtlassianOptions) => {
2255
2457
  id: "atlassian";
2256
2458
  name: string;
2459
+ callbackPath: string;
2257
2460
  createAuthorizationURL({
2258
2461
  state,
2259
2462
  scopes,
@@ -2268,7 +2471,10 @@ declare const socialProviders: {
2268
2471
  display?: string | undefined;
2269
2472
  loginHint?: string | undefined;
2270
2473
  additionalParams?: Record<string, string> | undefined;
2271
- }): Promise<URL>;
2474
+ }): Promise<{
2475
+ url: URL;
2476
+ requestedScopes: string[];
2477
+ }>;
2272
2478
  validateAuthorizationCode: ({
2273
2479
  code,
2274
2480
  codeVerifier,
@@ -2304,6 +2510,7 @@ declare const socialProviders: {
2304
2510
  cognito: (options: CognitoOptions) => {
2305
2511
  id: "cognito";
2306
2512
  name: string;
2513
+ callbackPath: string;
2307
2514
  createAuthorizationURL({
2308
2515
  state,
2309
2516
  scopes,
@@ -2318,7 +2525,10 @@ declare const socialProviders: {
2318
2525
  display?: string | undefined;
2319
2526
  loginHint?: string | undefined;
2320
2527
  additionalParams?: Record<string, string> | undefined;
2321
- }): Promise<URL>;
2528
+ }): Promise<{
2529
+ url: URL;
2530
+ requestedScopes: string[];
2531
+ }>;
2322
2532
  validateAuthorizationCode: ({
2323
2533
  code,
2324
2534
  codeVerifier,
@@ -2330,7 +2540,12 @@ declare const socialProviders: {
2330
2540
  deviceId?: string | undefined;
2331
2541
  }) => Promise<OAuth2Tokens>;
2332
2542
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2333
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2543
+ idToken: {
2544
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2545
+ issuer: string;
2546
+ audience: string | string[];
2547
+ maxTokenAge: string;
2548
+ };
2334
2549
  getUserInfo(token: OAuth2Tokens & {
2335
2550
  user?: {
2336
2551
  name?: {
@@ -2355,6 +2570,7 @@ declare const socialProviders: {
2355
2570
  discord: (options: DiscordOptions) => {
2356
2571
  id: "discord";
2357
2572
  name: string;
2573
+ callbackPath: string;
2358
2574
  createAuthorizationURL({
2359
2575
  state,
2360
2576
  scopes,
@@ -2368,7 +2584,10 @@ declare const socialProviders: {
2368
2584
  display?: string | undefined;
2369
2585
  loginHint?: string | undefined;
2370
2586
  additionalParams?: Record<string, string> | undefined;
2371
- }): Promise<URL>;
2587
+ }): Promise<{
2588
+ url: URL;
2589
+ requestedScopes: string[];
2590
+ }>;
2372
2591
  validateAuthorizationCode: ({
2373
2592
  code,
2374
2593
  redirectURI
@@ -2403,6 +2622,7 @@ declare const socialProviders: {
2403
2622
  facebook: (options: FacebookOptions) => {
2404
2623
  id: "facebook";
2405
2624
  name: string;
2625
+ callbackPath: string;
2406
2626
  createAuthorizationURL({
2407
2627
  state,
2408
2628
  scopes,
@@ -2417,7 +2637,10 @@ declare const socialProviders: {
2417
2637
  display?: string | undefined;
2418
2638
  loginHint?: string | undefined;
2419
2639
  additionalParams?: Record<string, string> | undefined;
2420
- }): Promise<URL>;
2640
+ }): Promise<{
2641
+ url: URL;
2642
+ requestedScopes: string[];
2643
+ }>;
2421
2644
  validateAuthorizationCode: ({
2422
2645
  code,
2423
2646
  redirectURI
@@ -2427,7 +2650,20 @@ declare const socialProviders: {
2427
2650
  codeVerifier?: string | undefined;
2428
2651
  deviceId?: string | undefined;
2429
2652
  }) => Promise<OAuth2Tokens>;
2430
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2653
+ idToken: {
2654
+ jwks: {
2655
+ (protectedHeader?: jose.JWSHeaderParameters, token?: jose.FlattenedJWSInput): Promise<jose.CryptoKey>;
2656
+ coolingDown: boolean;
2657
+ fresh: boolean;
2658
+ reloading: boolean;
2659
+ reload: () => Promise<void>;
2660
+ jwks: () => jose.JSONWebKeySet | undefined;
2661
+ };
2662
+ issuer: string;
2663
+ audience: string | string[];
2664
+ algorithms: string[];
2665
+ allowOpaqueToken: true;
2666
+ };
2431
2667
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2432
2668
  getUserInfo(token: OAuth2Tokens & {
2433
2669
  user?: {
@@ -2453,6 +2689,7 @@ declare const socialProviders: {
2453
2689
  figma: (options: FigmaOptions) => {
2454
2690
  id: "figma";
2455
2691
  name: string;
2692
+ callbackPath: string;
2456
2693
  createAuthorizationURL({
2457
2694
  state,
2458
2695
  scopes,
@@ -2467,7 +2704,10 @@ declare const socialProviders: {
2467
2704
  display?: string | undefined;
2468
2705
  loginHint?: string | undefined;
2469
2706
  additionalParams?: Record<string, string> | undefined;
2470
- }): Promise<URL>;
2707
+ }): Promise<{
2708
+ url: URL;
2709
+ requestedScopes: string[];
2710
+ }>;
2471
2711
  validateAuthorizationCode: ({
2472
2712
  code,
2473
2713
  codeVerifier,
@@ -2503,6 +2743,7 @@ declare const socialProviders: {
2503
2743
  github: (options: GithubOptions) => {
2504
2744
  id: "github";
2505
2745
  name: string;
2746
+ callbackPath: string;
2506
2747
  createAuthorizationURL({
2507
2748
  state,
2508
2749
  scopes,
@@ -2518,7 +2759,10 @@ declare const socialProviders: {
2518
2759
  display?: string | undefined;
2519
2760
  loginHint?: string | undefined;
2520
2761
  additionalParams?: Record<string, string> | undefined;
2521
- }): Promise<URL>;
2762
+ }): Promise<{
2763
+ url: URL;
2764
+ requestedScopes: string[];
2765
+ }>;
2522
2766
  validateAuthorizationCode: ({
2523
2767
  code,
2524
2768
  codeVerifier,
@@ -2554,6 +2798,7 @@ declare const socialProviders: {
2554
2798
  microsoft: (options: MicrosoftOptions) => {
2555
2799
  id: "microsoft";
2556
2800
  name: string;
2801
+ callbackPath: string;
2557
2802
  createAuthorizationURL(data: {
2558
2803
  state: string;
2559
2804
  codeVerifier: string;
@@ -2562,7 +2807,10 @@ declare const socialProviders: {
2562
2807
  display?: string | undefined;
2563
2808
  loginHint?: string | undefined;
2564
2809
  additionalParams?: Record<string, string> | undefined;
2565
- }): Promise<URL>;
2810
+ }): Promise<{
2811
+ url: URL;
2812
+ requestedScopes: string[];
2813
+ }>;
2566
2814
  validateAuthorizationCode({
2567
2815
  code,
2568
2816
  codeVerifier,
@@ -2573,7 +2821,13 @@ declare const socialProviders: {
2573
2821
  codeVerifier?: string | undefined;
2574
2822
  deviceId?: string | undefined;
2575
2823
  }): Promise<OAuth2Tokens>;
2576
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2824
+ idToken: {
2825
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2826
+ audience: string | string[];
2827
+ maxTokenAge: string;
2828
+ issuer: string | undefined;
2829
+ verifyClaims: (claims: Record<string, unknown>) => boolean;
2830
+ };
2577
2831
  getUserInfo(token: OAuth2Tokens & {
2578
2832
  user?: {
2579
2833
  name?: {
@@ -2599,6 +2853,8 @@ declare const socialProviders: {
2599
2853
  google: (options: GoogleOptions) => {
2600
2854
  id: "google";
2601
2855
  name: string;
2856
+ callbackPath: string;
2857
+ grantAuthority: "full-grant" | "projection";
2602
2858
  createAuthorizationURL({
2603
2859
  state,
2604
2860
  scopes,
@@ -2615,7 +2871,10 @@ declare const socialProviders: {
2615
2871
  display?: string | undefined;
2616
2872
  loginHint?: string | undefined;
2617
2873
  additionalParams?: Record<string, string> | undefined;
2618
- }): Promise<URL>;
2874
+ }): Promise<{
2875
+ url: URL;
2876
+ requestedScopes: string[];
2877
+ }>;
2619
2878
  validateAuthorizationCode: ({
2620
2879
  code,
2621
2880
  codeVerifier,
@@ -2627,7 +2886,13 @@ declare const socialProviders: {
2627
2886
  deviceId?: string | undefined;
2628
2887
  }) => Promise<OAuth2Tokens>;
2629
2888
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2630
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
2889
+ idToken: {
2890
+ jwks: (header: jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2891
+ issuer: string[];
2892
+ audience: string | string[];
2893
+ maxTokenAge: string;
2894
+ verifyClaims: ((claims: Record<string, unknown>) => boolean) | undefined;
2895
+ };
2631
2896
  getUserInfo(token: OAuth2Tokens & {
2632
2897
  user?: {
2633
2898
  name?: {
@@ -2652,6 +2917,7 @@ declare const socialProviders: {
2652
2917
  huggingface: (options: HuggingFaceOptions) => {
2653
2918
  id: "huggingface";
2654
2919
  name: string;
2920
+ callbackPath: string;
2655
2921
  createAuthorizationURL({
2656
2922
  state,
2657
2923
  scopes,
@@ -2666,7 +2932,10 @@ declare const socialProviders: {
2666
2932
  display?: string | undefined;
2667
2933
  loginHint?: string | undefined;
2668
2934
  additionalParams?: Record<string, string> | undefined;
2669
- }): Promise<URL>;
2935
+ }): Promise<{
2936
+ url: URL;
2937
+ requestedScopes: string[];
2938
+ }>;
2670
2939
  validateAuthorizationCode: ({
2671
2940
  code,
2672
2941
  codeVerifier,
@@ -2702,6 +2971,7 @@ declare const socialProviders: {
2702
2971
  slack: (options: SlackOptions) => {
2703
2972
  id: "slack";
2704
2973
  name: string;
2974
+ callbackPath: string;
2705
2975
  createAuthorizationURL({
2706
2976
  state,
2707
2977
  scopes,
@@ -2715,7 +2985,10 @@ declare const socialProviders: {
2715
2985
  display?: string | undefined;
2716
2986
  loginHint?: string | undefined;
2717
2987
  additionalParams?: Record<string, string> | undefined;
2718
- }): Promise<URL>;
2988
+ }): Promise<{
2989
+ url: URL;
2990
+ requestedScopes: string[];
2991
+ }>;
2719
2992
  validateAuthorizationCode: ({
2720
2993
  code,
2721
2994
  redirectURI
@@ -2750,6 +3023,7 @@ declare const socialProviders: {
2750
3023
  spotify: (options: SpotifyOptions) => {
2751
3024
  id: "spotify";
2752
3025
  name: string;
3026
+ callbackPath: string;
2753
3027
  createAuthorizationURL({
2754
3028
  state,
2755
3029
  scopes,
@@ -2764,7 +3038,10 @@ declare const socialProviders: {
2764
3038
  display?: string | undefined;
2765
3039
  loginHint?: string | undefined;
2766
3040
  additionalParams?: Record<string, string> | undefined;
2767
- }): Promise<URL>;
3041
+ }): Promise<{
3042
+ url: URL;
3043
+ requestedScopes: string[];
3044
+ }>;
2768
3045
  validateAuthorizationCode: ({
2769
3046
  code,
2770
3047
  codeVerifier,
@@ -2800,6 +3077,7 @@ declare const socialProviders: {
2800
3077
  twitch: (options: TwitchOptions) => {
2801
3078
  id: "twitch";
2802
3079
  name: string;
3080
+ callbackPath: string;
2803
3081
  createAuthorizationURL({
2804
3082
  state,
2805
3083
  scopes,
@@ -2813,7 +3091,10 @@ declare const socialProviders: {
2813
3091
  display?: string | undefined;
2814
3092
  loginHint?: string | undefined;
2815
3093
  additionalParams?: Record<string, string> | undefined;
2816
- }): Promise<URL>;
3094
+ }): Promise<{
3095
+ url: URL;
3096
+ requestedScopes: string[];
3097
+ }>;
2817
3098
  validateAuthorizationCode: ({
2818
3099
  code,
2819
3100
  redirectURI
@@ -2848,6 +3129,7 @@ declare const socialProviders: {
2848
3129
  twitter: (options: TwitterOption) => {
2849
3130
  id: "twitter";
2850
3131
  name: string;
3132
+ callbackPath: string;
2851
3133
  createAuthorizationURL(data: {
2852
3134
  state: string;
2853
3135
  codeVerifier: string;
@@ -2856,7 +3138,10 @@ declare const socialProviders: {
2856
3138
  display?: string | undefined;
2857
3139
  loginHint?: string | undefined;
2858
3140
  additionalParams?: Record<string, string> | undefined;
2859
- }): Promise<URL>;
3141
+ }): Promise<{
3142
+ url: URL;
3143
+ requestedScopes: string[];
3144
+ }>;
2860
3145
  validateAuthorizationCode: ({
2861
3146
  code,
2862
3147
  codeVerifier,
@@ -2892,6 +3177,7 @@ declare const socialProviders: {
2892
3177
  dropbox: (options: DropboxOptions) => {
2893
3178
  id: "dropbox";
2894
3179
  name: string;
3180
+ callbackPath: string;
2895
3181
  createAuthorizationURL: ({
2896
3182
  state,
2897
3183
  scopes,
@@ -2906,7 +3192,10 @@ declare const socialProviders: {
2906
3192
  display?: string | undefined;
2907
3193
  loginHint?: string | undefined;
2908
3194
  additionalParams?: Record<string, string> | undefined;
2909
- }) => Promise<URL>;
3195
+ }) => Promise<{
3196
+ url: URL;
3197
+ requestedScopes: string[];
3198
+ }>;
2910
3199
  validateAuthorizationCode: ({
2911
3200
  code,
2912
3201
  codeVerifier,
@@ -2942,6 +3231,7 @@ declare const socialProviders: {
2942
3231
  kick: (options: KickOptions) => {
2943
3232
  id: "kick";
2944
3233
  name: string;
3234
+ callbackPath: string;
2945
3235
  createAuthorizationURL({
2946
3236
  state,
2947
3237
  scopes,
@@ -2956,7 +3246,10 @@ declare const socialProviders: {
2956
3246
  display?: string | undefined;
2957
3247
  loginHint?: string | undefined;
2958
3248
  additionalParams?: Record<string, string> | undefined;
2959
- }): Promise<URL>;
3249
+ }): Promise<{
3250
+ url: URL;
3251
+ requestedScopes: string[];
3252
+ }>;
2960
3253
  validateAuthorizationCode({
2961
3254
  code,
2962
3255
  redirectURI,
@@ -2992,6 +3285,7 @@ declare const socialProviders: {
2992
3285
  linear: (options: LinearOptions) => {
2993
3286
  id: "linear";
2994
3287
  name: string;
3288
+ callbackPath: string;
2995
3289
  createAuthorizationURL({
2996
3290
  state,
2997
3291
  scopes,
@@ -3006,7 +3300,10 @@ declare const socialProviders: {
3006
3300
  display?: string | undefined;
3007
3301
  loginHint?: string | undefined;
3008
3302
  additionalParams?: Record<string, string> | undefined;
3009
- }): Promise<URL>;
3303
+ }): Promise<{
3304
+ url: URL;
3305
+ requestedScopes: string[];
3306
+ }>;
3010
3307
  validateAuthorizationCode: ({
3011
3308
  code,
3012
3309
  redirectURI
@@ -3041,6 +3338,7 @@ declare const socialProviders: {
3041
3338
  linkedin: (options: LinkedInOptions) => {
3042
3339
  id: "linkedin";
3043
3340
  name: string;
3341
+ callbackPath: string;
3044
3342
  createAuthorizationURL: ({
3045
3343
  state,
3046
3344
  scopes,
@@ -3055,7 +3353,10 @@ declare const socialProviders: {
3055
3353
  display?: string | undefined;
3056
3354
  loginHint?: string | undefined;
3057
3355
  additionalParams?: Record<string, string> | undefined;
3058
- }) => Promise<URL>;
3356
+ }) => Promise<{
3357
+ url: URL;
3358
+ requestedScopes: string[];
3359
+ }>;
3059
3360
  validateAuthorizationCode: ({
3060
3361
  code,
3061
3362
  redirectURI
@@ -3090,6 +3391,7 @@ declare const socialProviders: {
3090
3391
  gitlab: (options: GitlabOptions) => {
3091
3392
  id: "gitlab";
3092
3393
  name: string;
3394
+ callbackPath: string;
3093
3395
  createAuthorizationURL: ({
3094
3396
  state,
3095
3397
  scopes,
@@ -3105,7 +3407,10 @@ declare const socialProviders: {
3105
3407
  display?: string | undefined;
3106
3408
  loginHint?: string | undefined;
3107
3409
  additionalParams?: Record<string, string> | undefined;
3108
- }) => Promise<URL>;
3410
+ }) => Promise<{
3411
+ url: URL;
3412
+ requestedScopes: string[];
3413
+ }>;
3109
3414
  validateAuthorizationCode: ({
3110
3415
  code,
3111
3416
  redirectURI,
@@ -3162,6 +3467,7 @@ declare const socialProviders: {
3162
3467
  tiktok: (options: TiktokOptions) => {
3163
3468
  id: "tiktok";
3164
3469
  name: string;
3470
+ callbackPath: string;
3165
3471
  createAuthorizationURL({
3166
3472
  state,
3167
3473
  scopes,
@@ -3175,7 +3481,10 @@ declare const socialProviders: {
3175
3481
  display?: string | undefined;
3176
3482
  loginHint?: string | undefined;
3177
3483
  additionalParams?: Record<string, string> | undefined;
3178
- }): URL;
3484
+ }): {
3485
+ url: URL;
3486
+ requestedScopes: string[];
3487
+ };
3179
3488
  validateAuthorizationCode: ({
3180
3489
  code,
3181
3490
  redirectURI
@@ -3210,6 +3519,7 @@ declare const socialProviders: {
3210
3519
  reddit: (options: RedditOptions) => {
3211
3520
  id: "reddit";
3212
3521
  name: string;
3522
+ callbackPath: string;
3213
3523
  createAuthorizationURL({
3214
3524
  state,
3215
3525
  scopes,
@@ -3223,7 +3533,10 @@ declare const socialProviders: {
3223
3533
  display?: string | undefined;
3224
3534
  loginHint?: string | undefined;
3225
3535
  additionalParams?: Record<string, string> | undefined;
3226
- }): Promise<URL>;
3536
+ }): Promise<{
3537
+ url: URL;
3538
+ requestedScopes: string[];
3539
+ }>;
3227
3540
  validateAuthorizationCode: ({
3228
3541
  code,
3229
3542
  redirectURI
@@ -3258,6 +3571,7 @@ declare const socialProviders: {
3258
3571
  roblox: (options: RobloxOptions) => {
3259
3572
  id: "roblox";
3260
3573
  name: string;
3574
+ callbackPath: string;
3261
3575
  createAuthorizationURL({
3262
3576
  state,
3263
3577
  scopes,
@@ -3271,7 +3585,10 @@ declare const socialProviders: {
3271
3585
  display?: string | undefined;
3272
3586
  loginHint?: string | undefined;
3273
3587
  additionalParams?: Record<string, string> | undefined;
3274
- }): Promise<URL>;
3588
+ }): Promise<{
3589
+ url: URL;
3590
+ requestedScopes: string[];
3591
+ }>;
3275
3592
  validateAuthorizationCode: ({
3276
3593
  code,
3277
3594
  redirectURI
@@ -3306,6 +3623,7 @@ declare const socialProviders: {
3306
3623
  salesforce: (options: SalesforceOptions) => {
3307
3624
  id: "salesforce";
3308
3625
  name: string;
3626
+ callbackPath: string;
3309
3627
  createAuthorizationURL({
3310
3628
  state,
3311
3629
  scopes,
@@ -3320,7 +3638,10 @@ declare const socialProviders: {
3320
3638
  display?: string | undefined;
3321
3639
  loginHint?: string | undefined;
3322
3640
  additionalParams?: Record<string, string> | undefined;
3323
- }): Promise<URL>;
3641
+ }): Promise<{
3642
+ url: URL;
3643
+ requestedScopes: string[];
3644
+ }>;
3324
3645
  validateAuthorizationCode: ({
3325
3646
  code,
3326
3647
  codeVerifier,
@@ -3356,6 +3677,7 @@ declare const socialProviders: {
3356
3677
  vk: (options: VkOption) => {
3357
3678
  id: "vk";
3358
3679
  name: string;
3680
+ callbackPath: string;
3359
3681
  createAuthorizationURL({
3360
3682
  state,
3361
3683
  scopes,
@@ -3370,7 +3692,10 @@ declare const socialProviders: {
3370
3692
  display?: string | undefined;
3371
3693
  loginHint?: string | undefined;
3372
3694
  additionalParams?: Record<string, string> | undefined;
3373
- }): Promise<URL>;
3695
+ }): Promise<{
3696
+ url: URL;
3697
+ requestedScopes: string[];
3698
+ }>;
3374
3699
  validateAuthorizationCode: ({
3375
3700
  code,
3376
3701
  codeVerifier,
@@ -3407,8 +3732,10 @@ declare const socialProviders: {
3407
3732
  zoom: (userOptions: ZoomOptions) => {
3408
3733
  id: "zoom";
3409
3734
  name: string;
3735
+ callbackPath: string;
3410
3736
  createAuthorizationURL: ({
3411
3737
  state,
3738
+ scopes,
3412
3739
  redirectURI,
3413
3740
  codeVerifier,
3414
3741
  additionalParams
@@ -3420,7 +3747,10 @@ declare const socialProviders: {
3420
3747
  display?: string | undefined;
3421
3748
  loginHint?: string | undefined;
3422
3749
  additionalParams?: Record<string, string> | undefined;
3423
- }) => Promise<URL>;
3750
+ }) => Promise<{
3751
+ url: URL;
3752
+ requestedScopes: string[];
3753
+ }>;
3424
3754
  validateAuthorizationCode: ({
3425
3755
  code,
3426
3756
  redirectURI,
@@ -3455,6 +3785,7 @@ declare const socialProviders: {
3455
3785
  notion: (options: NotionOptions) => {
3456
3786
  id: "notion";
3457
3787
  name: string;
3788
+ callbackPath: string;
3458
3789
  createAuthorizationURL({
3459
3790
  state,
3460
3791
  scopes,
@@ -3469,7 +3800,10 @@ declare const socialProviders: {
3469
3800
  display?: string | undefined;
3470
3801
  loginHint?: string | undefined;
3471
3802
  additionalParams?: Record<string, string> | undefined;
3472
- }): Promise<URL>;
3803
+ }): Promise<{
3804
+ url: URL;
3805
+ requestedScopes: string[];
3806
+ }>;
3473
3807
  validateAuthorizationCode: ({
3474
3808
  code,
3475
3809
  redirectURI
@@ -3504,6 +3838,7 @@ declare const socialProviders: {
3504
3838
  kakao: (options: KakaoOptions) => {
3505
3839
  id: "kakao";
3506
3840
  name: string;
3841
+ callbackPath: string;
3507
3842
  createAuthorizationURL({
3508
3843
  state,
3509
3844
  scopes,
@@ -3517,7 +3852,10 @@ declare const socialProviders: {
3517
3852
  display?: string | undefined;
3518
3853
  loginHint?: string | undefined;
3519
3854
  additionalParams?: Record<string, string> | undefined;
3520
- }): Promise<URL>;
3855
+ }): Promise<{
3856
+ url: URL;
3857
+ requestedScopes: string[];
3858
+ }>;
3521
3859
  validateAuthorizationCode: ({
3522
3860
  code,
3523
3861
  redirectURI
@@ -3573,6 +3911,7 @@ declare const socialProviders: {
3573
3911
  naver: (options: NaverOptions) => {
3574
3912
  id: "naver";
3575
3913
  name: string;
3914
+ callbackPath: string;
3576
3915
  createAuthorizationURL({
3577
3916
  state,
3578
3917
  scopes,
@@ -3586,7 +3925,10 @@ declare const socialProviders: {
3586
3925
  display?: string | undefined;
3587
3926
  loginHint?: string | undefined;
3588
3927
  additionalParams?: Record<string, string> | undefined;
3589
- }): Promise<URL>;
3928
+ }): Promise<{
3929
+ url: URL;
3930
+ requestedScopes: string[];
3931
+ }>;
3590
3932
  validateAuthorizationCode: ({
3591
3933
  code,
3592
3934
  redirectURI
@@ -3642,6 +3984,7 @@ declare const socialProviders: {
3642
3984
  line: (options: LineOptions) => {
3643
3985
  id: "line";
3644
3986
  name: string;
3987
+ callbackPath: string;
3645
3988
  createAuthorizationURL({
3646
3989
  state,
3647
3990
  scopes,
@@ -3657,7 +4000,10 @@ declare const socialProviders: {
3657
4000
  display?: string | undefined;
3658
4001
  loginHint?: string | undefined;
3659
4002
  additionalParams?: Record<string, string> | undefined;
3660
- }): Promise<URL>;
4003
+ }): Promise<{
4004
+ url: URL;
4005
+ requestedScopes: string[];
4006
+ }>;
3661
4007
  validateAuthorizationCode: ({
3662
4008
  code,
3663
4009
  codeVerifier,
@@ -3669,7 +4015,9 @@ declare const socialProviders: {
3669
4015
  deviceId?: string | undefined;
3670
4016
  }) => Promise<OAuth2Tokens>;
3671
4017
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3672
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
4018
+ idToken: {
4019
+ verify: (token: string, nonce: string | undefined) => Promise<boolean>;
4020
+ };
3673
4021
  getUserInfo(token: OAuth2Tokens & {
3674
4022
  user?: {
3675
4023
  name?: {
@@ -3715,6 +4063,7 @@ declare const socialProviders: {
3715
4063
  paybin: (options: PaybinOptions) => {
3716
4064
  id: "paybin";
3717
4065
  name: string;
4066
+ callbackPath: string;
3718
4067
  createAuthorizationURL({
3719
4068
  state,
3720
4069
  scopes,
@@ -3730,7 +4079,10 @@ declare const socialProviders: {
3730
4079
  display?: string | undefined;
3731
4080
  loginHint?: string | undefined;
3732
4081
  additionalParams?: Record<string, string> | undefined;
3733
- }): Promise<URL>;
4082
+ }): Promise<{
4083
+ url: URL;
4084
+ requestedScopes: string[];
4085
+ }>;
3734
4086
  validateAuthorizationCode: ({
3735
4087
  code,
3736
4088
  codeVerifier,
@@ -3766,6 +4118,7 @@ declare const socialProviders: {
3766
4118
  paypal: (options: PayPalOptions) => {
3767
4119
  id: "paypal";
3768
4120
  name: string;
4121
+ callbackPath: string;
3769
4122
  createAuthorizationURL({
3770
4123
  state,
3771
4124
  codeVerifier,
@@ -3779,7 +4132,10 @@ declare const socialProviders: {
3779
4132
  display?: string | undefined;
3780
4133
  loginHint?: string | undefined;
3781
4134
  additionalParams?: Record<string, string> | undefined;
3782
- }): Promise<URL>;
4135
+ }): Promise<{
4136
+ url: URL;
4137
+ requestedScopes: string[];
4138
+ }>;
3783
4139
  validateAuthorizationCode: ({
3784
4140
  code,
3785
4141
  redirectURI
@@ -3799,7 +4155,6 @@ declare const socialProviders: {
3799
4155
  refreshToken: any;
3800
4156
  accessTokenExpiresAt: Date | undefined;
3801
4157
  }>);
3802
- verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
3803
4158
  getUserInfo(token: OAuth2Tokens & {
3804
4159
  user?: {
3805
4160
  name?: {
@@ -3845,6 +4200,7 @@ declare const socialProviders: {
3845
4200
  polar: (options: PolarOptions) => {
3846
4201
  id: "polar";
3847
4202
  name: string;
4203
+ callbackPath: string;
3848
4204
  createAuthorizationURL({
3849
4205
  state,
3850
4206
  scopes,
@@ -3859,7 +4215,10 @@ declare const socialProviders: {
3859
4215
  display?: string | undefined;
3860
4216
  loginHint?: string | undefined;
3861
4217
  additionalParams?: Record<string, string> | undefined;
3862
- }): Promise<URL>;
4218
+ }): Promise<{
4219
+ url: URL;
4220
+ requestedScopes: string[];
4221
+ }>;
3863
4222
  validateAuthorizationCode: ({
3864
4223
  code,
3865
4224
  codeVerifier,
@@ -3895,6 +4254,7 @@ declare const socialProviders: {
3895
4254
  railway: (options: RailwayOptions) => {
3896
4255
  id: "railway";
3897
4256
  name: string;
4257
+ callbackPath: string;
3898
4258
  createAuthorizationURL({
3899
4259
  state,
3900
4260
  scopes,
@@ -3909,7 +4269,10 @@ declare const socialProviders: {
3909
4269
  display?: string | undefined;
3910
4270
  loginHint?: string | undefined;
3911
4271
  additionalParams?: Record<string, string> | undefined;
3912
- }): Promise<URL>;
4272
+ }): Promise<{
4273
+ url: URL;
4274
+ requestedScopes: string[];
4275
+ }>;
3913
4276
  validateAuthorizationCode: ({
3914
4277
  code,
3915
4278
  codeVerifier,
@@ -3945,6 +4308,7 @@ declare const socialProviders: {
3945
4308
  vercel: (options: VercelOptions) => {
3946
4309
  id: "vercel";
3947
4310
  name: string;
4311
+ callbackPath: string;
3948
4312
  createAuthorizationURL({
3949
4313
  state,
3950
4314
  scopes,
@@ -3959,7 +4323,10 @@ declare const socialProviders: {
3959
4323
  display?: string | undefined;
3960
4324
  loginHint?: string | undefined;
3961
4325
  additionalParams?: Record<string, string> | undefined;
3962
- }): Promise<URL>;
4326
+ }): Promise<{
4327
+ url: URL;
4328
+ requestedScopes: string[];
4329
+ }>;
3963
4330
  validateAuthorizationCode: ({
3964
4331
  code,
3965
4332
  codeVerifier,
@@ -3994,6 +4361,7 @@ declare const socialProviders: {
3994
4361
  wechat: (options: WeChatOptions) => {
3995
4362
  id: "wechat";
3996
4363
  name: string;
4364
+ callbackPath: string;
3997
4365
  createAuthorizationURL({
3998
4366
  state,
3999
4367
  scopes,
@@ -4007,7 +4375,10 @@ declare const socialProviders: {
4007
4375
  display?: string | undefined;
4008
4376
  loginHint?: string | undefined;
4009
4377
  additionalParams?: Record<string, string> | undefined;
4010
- }): URL;
4378
+ }): {
4379
+ url: URL;
4380
+ requestedScopes: string[];
4381
+ };
4011
4382
  validateAuthorizationCode: ({
4012
4383
  code
4013
4384
  }: {
@@ -4073,7 +4444,7 @@ declare const accountSchema: z.ZodObject<{
4073
4444
  idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4074
4445
  accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
4075
4446
  refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
4076
- scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4447
+ grantedScopes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
4077
4448
  password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
4078
4449
  }, z.core.$strip>;
4079
4450
  type BaseAccount = z.infer<typeof accountSchema>;
@@ -4082,14 +4453,14 @@ type BaseAccount = z.infer<typeof accountSchema>;
4082
4453
  */
4083
4454
  type Account<DBOptions extends BetterAuthOptions["account"] = BetterAuthOptions["account"], Plugins extends BetterAuthOptions["plugins"] = BetterAuthOptions["plugins"]> = Prettify$1<BaseAccount & InferDBFieldsFromOptions<DBOptions> & InferDBFieldsFromPlugins<"account", Plugins>>; //#endregion
4084
4455
  //#endregion
4085
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/helper.d.mts
4456
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/helper.d.mts
4086
4457
  type Prettify<T> = { [K in keyof T]: T[K] } & {};
4087
4458
  type IsEmptyObject<T> = keyof T extends never ? true : false;
4088
4459
  type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
4089
4460
  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> : {};
4090
4461
  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
4091
4462
  //#endregion
4092
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
4463
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/standard-schema.d.mts
4093
4464
  //#region src/standard-schema.d.ts
4094
4465
  /** The Standard Schema interface. */
4095
4466
  interface StandardSchemaV1$1<Input = unknown, Output = Input> {
@@ -4147,7 +4518,7 @@ declare namespace StandardSchemaV1$1 {
4147
4518
  type InferOutput<Schema extends StandardSchemaV1$1> = NonNullable<Schema["~standard"]["types"]>["output"];
4148
4519
  } //#endregion
4149
4520
  //#endregion
4150
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/error.d.mts
4521
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/error.d.mts
4151
4522
  declare const statusCodes: {
4152
4523
  OK: number;
4153
4524
  CREATED: number;
@@ -4225,7 +4596,7 @@ declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "
4225
4596
  errorStack: string | undefined;
4226
4597
  }; //#endregion
4227
4598
  //#endregion
4228
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/cookies.d.mts
4599
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/cookies.d.mts
4229
4600
  //#region src/cookies.d.ts
4230
4601
  type CookiePrefixOptions = "host" | "secure";
4231
4602
  type CookieOptions = {
@@ -4315,7 +4686,7 @@ type CookieOptions = {
4315
4686
  prefix?: CookiePrefixOptions;
4316
4687
  };
4317
4688
  //#endregion
4318
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
4689
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/openapi.d.mts
4319
4690
  //#region src/openapi.d.ts
4320
4691
  type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
4321
4692
  interface OpenAPIParameter {
@@ -4337,7 +4708,7 @@ interface OpenAPIParameter {
4337
4708
  };
4338
4709
  }
4339
4710
  //#endregion
4340
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
4711
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/endpoint.d.mts
4341
4712
  //#region src/endpoint.d.ts
4342
4713
  interface EndpointBaseOptions {
4343
4714
  /**
@@ -4658,6 +5029,22 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
4658
5029
  * @returns - The cookie string
4659
5030
  */
4660
5031
  setSignedCookie: (key: string, value: string, secret: string, options?: CookieOptions) => Promise<string>;
5032
+ /**
5033
+ * Response headers
5034
+ *
5035
+ * The live `Headers` for the response being built in the current
5036
+ * request. Read it to inspect what has already been queued, e.g. to
5037
+ * avoid emitting a `Set-Cookie` twice or to check headers set by an
5038
+ * earlier handler in the chain.
5039
+ *
5040
+ * @example
5041
+ * ```ts
5042
+ * const alreadySet = ctx.responseHeaders
5043
+ * .getSetCookie()
5044
+ * .some((c) => c.startsWith("session="));
5045
+ * ```
5046
+ */
5047
+ responseHeaders: Headers;
4661
5048
  /**
4662
5049
  * JSON
4663
5050
  *
@@ -4700,7 +5087,7 @@ type Endpoint<Path extends string = string, Options extends EndpointOptions = En
4700
5087
  path: Path;
4701
5088
  }; //#endregion
4702
5089
  //#endregion
4703
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
5090
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/middleware.d.mts
4704
5091
  //#region src/middleware.d.ts
4705
5092
  interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
4706
5093
  type MiddlewareContext<Options extends MiddlewareOptions, Context = {}> = EndpointContext<string, Options & {
@@ -4807,7 +5194,7 @@ type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler e
4807
5194
  options: Options;
4808
5195
  }; //#endregion
4809
5196
  //#endregion
4810
- //#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.3.6/node_modules/better-call/dist/context.d.mts
5197
+ //#region ../../node_modules/.pnpm/better-call@1.3.6_zod@4.3.6/node_modules/better-call/dist/context.d.mts
4811
5198
  //#region src/context.d.ts
4812
5199
  type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
4813
5200
  type Method = HTTPMethod | "*";
@@ -4943,11 +5330,13 @@ type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOption
4943
5330
  context: AuthContext<Options>;
4944
5331
  };
4945
5332
  interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions> {
4946
- createOAuthUser(user: Omit<User, "id" | "createdAt" | "updatedAt">, account: Omit<Account, "userId" | "id" | "createdAt" | "updatedAt"> & Partial<Account>): Promise<{
4947
- user: User;
4948
- account: Account;
4949
- }>;
4950
- createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>): Promise<T & User>;
5333
+ createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>,
5334
+ /**
5335
+ * Provisioning source. The creation seam adds `action: "create-user"` and
5336
+ * runs the `user.validateUserInfo` gate.
5337
+ */
5338
+
5339
+ source: UserProvisioningSource): Promise<T & User>;
4951
5340
  createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
4952
5341
  listSessions(userId: string, options?: {
4953
5342
  onlyActiveSessions?: boolean | undefined;
@@ -5023,6 +5412,23 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
5023
5412
  * pair at single-use credential consumption sites.
5024
5413
  */
5025
5414
  consumeVerificationValue(identifier: string): Promise<Verification | null>;
5415
+ /**
5416
+ * First-writer-wins create keyed by a deterministic primary key derived from
5417
+ * `identifier`. Returns `true` when this caller created the row and `false`
5418
+ * when a row for the same identifier already existed.
5419
+ *
5420
+ * The dual of `consumeVerificationValue`: reserve races to create a marker
5421
+ * exactly once, where consume races to delete one exactly once. Use it for
5422
+ * replay tombstones (a SAML assertion id, a JWT `jti`) where the first caller
5423
+ * wins. The database path is atomic via the primary key. Secondary-storage-only
5424
+ * verification is not supported for reservation and runtime implementations
5425
+ * should fail closed unless verification is backed by the database.
5426
+ */
5427
+ reserveVerificationValue(data: {
5428
+ identifier: string;
5429
+ value: string;
5430
+ expiresAt: Date;
5431
+ }): Promise<boolean>;
5026
5432
  updateVerificationByIdentifier(identifier: string, data: Partial<Verification>): Promise<Verification>;
5027
5433
  refreshUserSessions(user: User): Promise<void>;
5028
5434
  }
@@ -5102,7 +5508,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
5102
5508
  session: Session & Record<string, any>;
5103
5509
  user: User & Record<string, any>;
5104
5510
  } | null) => void;
5105
- socialProviders: OAuthProvider[];
5511
+ socialProviders: UpstreamProvider[];
5106
5512
  authCookies: BetterAuthCookies;
5107
5513
  logger: ReturnType<typeof createLogger>;
5108
5514
  rateLimit: {
@@ -5268,7 +5674,7 @@ declare const createAuthMiddleware: {
5268
5674
  image?: string | null | undefined;
5269
5675
  } & Record<string, any>;
5270
5676
  } | null) => void;
5271
- socialProviders: OAuthProvider[];
5677
+ socialProviders: UpstreamProvider[];
5272
5678
  authCookies: BetterAuthCookies;
5273
5679
  logger: ReturnType<typeof createLogger>;
5274
5680
  rateLimit: {
@@ -5397,7 +5803,7 @@ declare const createAuthMiddleware: {
5397
5803
  image?: string | null | undefined;
5398
5804
  } & Record<string, any>;
5399
5805
  } | null) => void;
5400
- socialProviders: OAuthProvider[];
5806
+ socialProviders: UpstreamProvider[];
5401
5807
  authCookies: BetterAuthCookies;
5402
5808
  logger: ReturnType<typeof createLogger>;
5403
5809
  rateLimit: {
@@ -5463,6 +5869,73 @@ type GenerateIdFn = (options: {
5463
5869
  model: ModelNames;
5464
5870
  size?: number | undefined;
5465
5871
  }) => string | false;
5872
+ /**
5873
+ * What Better Auth is about to do with an incoming identity when
5874
+ * {@link BetterAuthOptions.user}'s `validateUserInfo` runs.
5875
+ *
5876
+ * - `create-user`: a brand-new user record is about to be created.
5877
+ * - `link-account`: a new provider account is about to be linked to an
5878
+ * already-existing user.
5879
+ * - `sign-in`: an existing OAuth or SSO user is signing in again. This is the
5880
+ * one case where the provider can assert *changed* data, so the hook receives
5881
+ * the fresh provider email and profile (not the stored row), letting a domain
5882
+ * or org policy reject a user whose provider identity moved out of bounds.
5883
+ *
5884
+ * Non-provider returning sign-ins are not re-validated: they carry only the
5885
+ * stored row, which has not changed since `create-user` gated it. Use the admin
5886
+ * plugin's ban controls or a `databaseHooks.session.create.before` hook to
5887
+ * block those.
5888
+ */
5889
+ type ValidateUserInfoAction = "create-user" | "link-account" | "sign-in";
5890
+ /**
5891
+ * The authentication method that produced the incoming user info. The named
5892
+ * methods cover Better Auth's built-ins; the open `string` keeps it extensible
5893
+ * for plugins (for example `"scim"`).
5894
+ */
5895
+ type ValidateUserInfoMethod = "oauth" | "sso-oidc" | "sso-saml" | "email-password" | "magic-link" | "email-otp" | "anonymous" | "siwe" | "phone-number" | "admin" | (string & {});
5896
+ /** OAuth-specific provisioning context; present only when `method` is `"oauth"`. */
5897
+ type ValidateUserInfoOAuthInfo = {
5898
+ /** The social or generic OAuth provider id (e.g. `"google"`). */providerId: string; /** The raw provider profile (userinfo or id-token claims), unmapped. */
5899
+ profile?: Record<string, unknown> | undefined;
5900
+ };
5901
+ /** SSO-specific provisioning context; present for OIDC and SAML SSO methods. */
5902
+ type ValidateUserInfoSSOInfo = {
5903
+ /** The configured SSO provider id. */providerId: string; /** The raw OIDC claims or SAML assertion attributes, unmapped. */
5904
+ profile?: Record<string, unknown> | undefined;
5905
+ };
5906
+ /** Provisioning origin passed to `createUser`; the creation seam adds `action: "create-user"` to build {@link ValidateUserInfoSource}. */
5907
+ type UserProvisioningSource = {
5908
+ method: ValidateUserInfoMethod; /** Provider id and raw profile; present iff `method` is `"oauth"`. */
5909
+ oauth?: ValidateUserInfoOAuthInfo | undefined; /** Provider id and raw profile; present iff `method` is `"sso-oidc"` or `"sso-saml"`. */
5910
+ sso?: ValidateUserInfoSSOInfo | undefined;
5911
+ };
5912
+ /**
5913
+ * The context passed to `validateUserInfo`: the lifecycle
5914
+ * {@link ValidateUserInfoAction}, the {@link ValidateUserInfoMethod}, and (for
5915
+ * OAuth/SSO provider methods) protocol-specific provider metadata.
5916
+ *
5917
+ * ```ts
5918
+ * // Scope to one OAuth provider:
5919
+ * if (source.oauth?.providerId !== "google") return;
5920
+ * // Branch on the method:
5921
+ * if (source.method === "anonymous") return { error: "no_anonymous" };
5922
+ * // Inspect SSO claims:
5923
+ * if (source.method === "sso-saml" && source.sso?.profile?.department !== "eng") {
5924
+ * return { error: "invalid_department" };
5925
+ * }
5926
+ * ```
5927
+ */
5928
+ type ValidateUserInfoSource = UserProvisioningSource & {
5929
+ action: ValidateUserInfoAction;
5930
+ };
5931
+ type ValidateUserInfoResult = {
5932
+ /** A short, machine-readable rejection code, surfaced to the client. */error: string;
5933
+ /**
5934
+ * A human-readable reason, surfaced to the client. Do not put sensitive
5935
+ * details here.
5936
+ */
5937
+ errorDescription?: string | undefined;
5938
+ };
5466
5939
  /**
5467
5940
  * Configuration for dynamic base URL resolution.
5468
5941
  * Allows Better Auth to work with multiple domains (e.g., Vercel preview deployments).
@@ -5507,8 +5980,30 @@ type DynamicBaseURLConfig = {
5507
5980
  */
5508
5981
  type BaseURLConfig = string | DynamicBaseURLConfig;
5509
5982
  interface BetterAuthRateLimitStorage {
5510
- get: (key: string) => Promise<RateLimit | null | undefined>;
5511
- set: (key: string, value: RateLimit, update?: boolean | undefined) => Promise<void>;
5983
+ /**
5984
+ * Atomically records one request against `key` within the rolling `window`
5985
+ * (in seconds) and reports whether it is allowed.
5986
+ *
5987
+ * When `allowed` is true the count was incremented within the active window,
5988
+ * or the window had elapsed and was reset to start at 1. When `allowed` is
5989
+ * false the limit was already reached and `retryAfter` is the number of
5990
+ * seconds until the window frees up.
5991
+ *
5992
+ * Performing the check and the increment in a single step closes the
5993
+ * concurrent-bypass gap of the separate `get`/`set` path: N simultaneous
5994
+ * requests can no longer all pass a stale read before any increment lands.
5995
+ *
5996
+ * Custom storages must implement this operation directly. Better Auth no
5997
+ * longer accepts separate `get`/`set` rate-limit storage because that shape
5998
+ * cannot enforce a distributed limit under concurrent requests.
5999
+ */
6000
+ consume: (key: string, rule: {
6001
+ window: number;
6002
+ max: number;
6003
+ }) => Promise<{
6004
+ allowed: boolean;
6005
+ retryAfter: number | null;
6006
+ }>;
5512
6007
  }
5513
6008
  type BetterAuthRateLimitRule = {
5514
6009
  /**
@@ -6125,6 +6620,30 @@ type BetterAuthOptions = {
6125
6620
  * User configuration
6126
6621
  */
6127
6622
  user?: (BetterAuthDBOptions<"user", keyof BaseUser> & {
6623
+ /**
6624
+ * Gate which identities Better Auth admits. Called just before
6625
+ * `create-user`, `link-account`, and (for OAuth) `sign-in`, across
6626
+ * every authentication method, including stateless setups with no
6627
+ * persistent database. On `sign-in` the hook receives the *fresh*
6628
+ * provider email and profile, so a domain policy can reject a user
6629
+ * whose provider identity moved out of bounds.
6630
+ *
6631
+ * Non-provider returning sign-ins are not re-validated; use the admin
6632
+ * plugin's ban controls or a `databaseHooks.session.create.before`
6633
+ * hook for those.
6634
+ *
6635
+ * Return nothing to allow; return `{ error }` to reject. Browser flows
6636
+ * redirect to the configured error URL; programmatic flows surface a
6637
+ * `403`.
6638
+ *
6639
+ * TODO: rename to `validateUser` (and the `ValidateUserInfo*` types).
6640
+ * "UserInfo" is the OIDC term and misleads for the email/password,
6641
+ * SIWE, phone, and admin methods.
6642
+ */
6643
+ validateUserInfo?: (data: {
6644
+ user: Partial<User> & Record<string, unknown>;
6645
+ source: ValidateUserInfoSource;
6646
+ }, context: GenericEndpointContext) => Awaitable<void | ValidateUserInfoResult>;
6128
6647
  /**
6129
6648
  * Changing email configuration
6130
6649
  */
@@ -6266,6 +6785,20 @@ type BetterAuthOptions = {
6266
6785
  * @default "compact"
6267
6786
  */
6268
6787
  strategy?: "compact" | "jwt" | "jwe";
6788
+ /**
6789
+ * JWT-specific configuration for `strategy: "jwt"`.
6790
+ */
6791
+ jwt?: {
6792
+ /**
6793
+ * Which signing key is used for cookie-cache JWTs.
6794
+ *
6795
+ * - `"secret"`: uses the Better Auth secret with HS256.
6796
+ * - `"jwt-plugin"`: uses the installed `jwt()` plugin's asymmetric signing keys.
6797
+ *
6798
+ * @default "secret"
6799
+ */
6800
+ signingKey?: "secret" | "jwt-plugin";
6801
+ };
6269
6802
  /**
6270
6803
  * Controls stateless cookie cache refresh behavior.
6271
6804
  *
@@ -6445,9 +6978,13 @@ type BetterAuthOptions = {
6445
6978
  */
6446
6979
  storeStateStrategy?: "database" | "cookie";
6447
6980
  /**
6448
- * Store account data after oauth flow on a cookie
6981
+ * Store provider account data after an OAuth flow in an encrypted
6982
+ * cookie. This includes OAuth token material such as access tokens,
6983
+ * refresh tokens, ID tokens, scopes, and token expiry.
6449
6984
  *
6450
- * This is useful for database-less flow
6985
+ * This is useful for database-less flows, but large provider tokens can
6986
+ * still hit browser or proxy cookie/header limits even though Better Auth
6987
+ * chunks oversized account cookies.
6451
6988
  *
6452
6989
  * @default false
6453
6990
  *
@@ -6952,16 +7489,21 @@ interface SecondaryStorage {
6952
7489
  get: (key: string) => Awaitable<unknown>;
6953
7490
  /**
6954
7491
  * Atomically get a value and delete it from storage.
7492
+ */
7493
+ getAndDelete: (key: string) => Awaitable<unknown>;
7494
+ /**
7495
+ * Atomically increment the counter at `key` by one, returning the
7496
+ * post-increment value.
6955
7497
  *
6956
- * This is optional for backwards compatibility with existing secondary
6957
- * storage implementations. Single-use credential consumers use it when
6958
- * present to avoid a read-then-delete race.
7498
+ * When the key is absent, it is created with a value of `1` and the given
7499
+ * `ttl` (in SECONDS). The TTL is applied only on creation; later increments
7500
+ * never extend it, so the counter expires a fixed window after it was first
7501
+ * created.
6959
7502
  *
6960
- * TODO(secondary-storage-atomic-consume): make this required in the next
6961
- * breaking release, or require database-backed verification storage for
6962
- * security-sensitive consume paths.
7503
+ * Required so secondary-storage-backed rate limiting can enforce the limit
7504
+ * in one distributed-safe operation.
6963
7505
  */
6964
- getAndDelete?: (key: string) => Awaitable<unknown>;
7506
+ increment: (key: string, ttl: number) => Awaitable<number>;
6965
7507
  set: (
6966
7508
  /**
6967
7509
  * Key to store