@better-auth/electron 1.6.11 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-D_ggtAOl.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-BcVD6vO4.mjs";
2
2
  import { n as isProcessType, r as parseProtocolScheme, t as getChannelPrefixWithDelimiter } from "./utils-DxDKRT6e.mjs";
3
3
  import { BetterAuthError } from "@better-auth/core/error";
4
4
  import { base64, base64Url } from "@better-auth/utils/base64";
@@ -8,7 +8,7 @@ import * as z from "zod";
8
8
  import { Buffer } from "node:buffer";
9
9
  import { createHash } from "@better-auth/utils/hash";
10
10
  import { signInSocial } from "better-auth/api";
11
- import { parseSetCookieHeader } from "better-auth/cookies";
11
+ import { cookieNameRegex, parseSetCookieHeader } from "better-auth/cookies";
12
12
  import electron, { shell } from "electron";
13
13
  import { isDevelopment as isDevelopment$1 } from "@better-auth/core/env";
14
14
  import { isPublicRoutableHost } from "@better-auth/core/utils/host";
@@ -474,10 +474,13 @@ function getCookie(cookie) {
474
474
  try {
475
475
  parsed = JSON.parse(cookie);
476
476
  } catch (_e) {}
477
- return Object.entries(parsed).reduce((acc, [key, value]) => {
478
- if (value.expires && new Date(value.expires) < /* @__PURE__ */ new Date()) return acc;
479
- return `${acc}; ${key}=${value.value}`;
480
- }, "");
477
+ const pairs = [];
478
+ for (const [key, value] of Object.entries(parsed)) {
479
+ if (value.expires && new Date(value.expires) < /* @__PURE__ */ new Date()) continue;
480
+ if (!cookieNameRegex.test(key)) continue;
481
+ pairs.push(`${key}=${encodeURIComponent(value.value)}`);
482
+ }
483
+ return pairs.join("; ");
481
484
  }
482
485
  /**
483
486
  * Compare if session cookies have actually changed by comparing their values.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-D_ggtAOl.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-BcVD6vO4.mjs";
2
2
  import { createAuthMiddleware } from "@better-auth/core/api";
3
3
  import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
4
4
  import { base64Url } from "@better-auth/utils/base64";
@@ -4872,7 +4872,14 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4872
4872
  * @param id - The account row's primary key (the `id` column, not the `accountId` column).
4873
4873
  */
4874
4874
  deleteAccount(id: string): Promise<void>;
4875
- deleteSessions(userIdOrSessionTokens: string | string[]): Promise<void>;
4875
+ /**
4876
+ * Delete every session belonging to a user.
4877
+ */
4878
+ deleteUserSessions(userId: string): Promise<void>;
4879
+ /**
4880
+ * Delete sessions by their session tokens.
4881
+ */
4882
+ deleteSessions(sessionTokens: string[]): Promise<void>;
4876
4883
  findOAuthUser(email: string, accountId: string, providerId: string): Promise<{
4877
4884
  user: User;
4878
4885
  linkedAccount: Account | null;
@@ -4890,7 +4897,6 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4890
4897
  updateUserByEmail<T extends Record<string, any>>(email: string, data: Partial<User & Record<string, any>>): Promise<User & T>;
4891
4898
  updatePassword(userId: string, password: string): Promise<void>;
4892
4899
  findAccounts(userId: string): Promise<Account[]>;
4893
- findAccount(accountId: string): Promise<Account | null>;
4894
4900
  findAccountByProviderId(accountId: string, providerId: string): Promise<Account | null>;
4895
4901
  findAccountByUserId(userId: string): Promise<Account[]>;
4896
4902
  updateAccount(id: string, data: Partial<Account>): Promise<Account>;
@@ -4901,9 +4907,11 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
4901
4907
  * Atomically consume a single-use verification row by `identifier` and
4902
4908
  * return it. Only the first concurrent caller receives the latest row;
4903
4909
  * subsequent callers receive `null`. Consuming one row invalidates the
4904
- * whole identifier so stale rows cannot be replayed. Callers MUST gate any
4905
- * state change (issue session, mint token, change password) on a non-null
4906
- * result.
4910
+ * whole identifier so stale rows cannot be replayed. Rows past their
4911
+ * `expiresAt` are treated as already invalid: the row is deleted but
4912
+ * `null` is returned, so callers do not need to gate on `expiresAt`
4913
+ * themselves. Callers MUST gate any state change (issue session, mint
4914
+ * token, change password) on a non-null result.
4907
4915
  *
4908
4916
  * Replaces the racy `findVerificationValue` + `deleteVerificationByIdentifier`
4909
4917
  * pair at single-use credential consumption sites.
@@ -4966,7 +4974,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
4966
4974
  * - "cookie": Store state in an encrypted cookie (stateless)
4967
4975
  * - "database": Store state in the database
4968
4976
  *
4969
- * @default "cookie"
4977
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
4970
4978
  */
4971
4979
  storeStateStrategy: "database" | "cookie";
4972
4980
  };
@@ -6290,7 +6298,11 @@ type BetterAuthOptions = {
6290
6298
  */
6291
6299
  allowUnlinkingAll?: boolean;
6292
6300
  /**
6293
- * If enabled (true), this will update the user information based on the newly linked account
6301
+ * When enabled, linking an account copies the provider's profile onto
6302
+ * the local user, matching the fields persisted on sign-up (`name`,
6303
+ * `image`, and any `mapProfileToUser` fields). The local `email` and
6304
+ * `emailVerified` are never changed, so a link cannot rebind the
6305
+ * account's identity.
6294
6306
  *
6295
6307
  * @default false
6296
6308
  */
@@ -6323,7 +6335,7 @@ type BetterAuthOptions = {
6323
6335
  * - "cookie": Store state in an encrypted cookie (stateless)
6324
6336
  * - "database": Store state in the database
6325
6337
  *
6326
- * @default "cookie"
6338
+ * @default "database" when `database` or `secondaryStorage` is configured, "cookie" otherwise
6327
6339
  */
6328
6340
  storeStateStrategy?: "database" | "cookie";
6329
6341
  /**
package/dist/proxy.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-D_ggtAOl.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-BcVD6vO4.mjs";
2
2
  import { r as parseProtocolScheme } from "./utils-DxDKRT6e.mjs";
3
3
  import { parseCookies } from "better-auth/cookies";
4
4
  //#region src/proxy.ts
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const PACKAGE_VERSION = "1.6.11";
3
+ const PACKAGE_VERSION = "1.6.13";
4
4
  //#endregion
5
5
  export { PACKAGE_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/electron",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "description": "Better Auth integration for Electron applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -80,17 +80,17 @@
80
80
  "better-sqlite3": "^12.6.2",
81
81
  "electron": "^41.2.2",
82
82
  "tsdown": "0.21.1",
83
- "@better-auth/core": "1.6.11",
84
- "better-auth": "1.6.11"
83
+ "@better-auth/core": "1.6.13",
84
+ "better-auth": "1.6.13"
85
85
  },
86
86
  "peerDependencies": {
87
- "@better-auth/utils": "0.4.0",
87
+ "@better-auth/utils": "0.4.1",
88
88
  "@better-fetch/fetch": "1.1.21",
89
89
  "better-call": "1.3.5",
90
90
  "conf": "^15.0.2",
91
91
  "electron": ">=36.0.0",
92
- "@better-auth/core": "^1.6.11",
93
- "better-auth": "^1.6.11"
92
+ "@better-auth/core": "^1.6.13",
93
+ "better-auth": "^1.6.13"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "electron": {