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

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-1sp6DKT-.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-C22JHwcK.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";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-1sp6DKT-.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-C22JHwcK.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";
@@ -7,7 +7,6 @@ import { generateRandomString } from "better-auth/crypto";
7
7
  import * as z from "zod";
8
8
  import { Buffer } from "node:buffer";
9
9
  import { timingSafeEqual } from "node:crypto";
10
- import { SocialProviderListEnum } from "@better-auth/core/social-providers";
11
10
  import { safeJSONParse as safeJSONParse$1 } from "@better-auth/core/utils/json";
12
11
  import { createHash } from "@better-auth/utils/hash";
13
12
  import { betterFetch } from "@better-fetch/fetch";
@@ -117,8 +116,6 @@ const electronInitOAuthProxy = (opts) => createAuthEndpoint("/electron/init-oaut
117
116
  }
118
117
  }
119
118
  }, async (ctx) => {
120
- const isSocialProvider = SocialProviderListEnum.safeParse(ctx.query.provider);
121
- if (!isSocialProvider && !ctx.context.getPlugin("generic-oauth")) throw APIError.from("BAD_REQUEST", BASE_ERROR_CODES.PROVIDER_NOT_FOUND);
122
119
  const headers = new Headers(ctx.request?.headers);
123
120
  headers.set("origin", new URL(ctx.context.baseURL).origin);
124
121
  let setCookie = null;
@@ -127,7 +124,7 @@ const electronInitOAuthProxy = (opts) => createAuthEndpoint("/electron/init-oaut
127
124
  searchParams.set("code_challenge", ctx.query.code_challenge);
128
125
  searchParams.set("code_challenge_method", ctx.query.code_challenge_method || "plain");
129
126
  searchParams.set("state", ctx.query.state);
130
- const res = await betterFetch(`${isSocialProvider ? "/sign-in/social" : "/sign-in/oauth2"}?${searchParams.toString()}`, {
127
+ const res = await betterFetch(`/sign-in/social?${searchParams.toString()}`, {
131
128
  baseURL: ctx.context.baseURL,
132
129
  method: "POST",
133
130
  body: { provider: ctx.query.provider },
@@ -201,7 +198,7 @@ const electron = (options) => {
201
198
  ...options || {}
202
199
  };
203
200
  const hookMatcher = (ctx) => {
204
- return !!(ctx.path?.startsWith("/sign-in") || ctx.path?.startsWith("/sign-up") || ctx.path?.startsWith("/callback") || ctx.path?.startsWith("/oauth2/callback") || ctx.path?.startsWith("/magic-link/verify") || ctx.path?.startsWith("/email-otp/verify-email") || ctx.path?.startsWith("/verify-email") || ctx.path?.startsWith("/one-tap/callback") || ctx.path?.startsWith("/passkey/verify-authentication") || ctx.path?.startsWith("/phone-number/verify"));
201
+ return !!(ctx.path?.startsWith("/sign-in") || ctx.path?.startsWith("/sign-up") || ctx.path?.startsWith("/callback") || ctx.path?.startsWith("/magic-link/verify") || ctx.path?.startsWith("/email-otp/verify-email") || ctx.path?.startsWith("/verify-email") || ctx.path?.startsWith("/one-tap/callback") || ctx.path?.startsWith("/passkey/verify-authentication") || ctx.path?.startsWith("/phone-number/verify"));
205
202
  };
206
203
  const handleTransfer = async (ctx, payload) => {
207
204
  const { client_id, state, code_challenge, code_challenge_method = "plain" } = payload;
@@ -676,6 +676,12 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
676
676
  * @returns True if the id token is valid, false otherwise
677
677
  */
678
678
  verifyIdToken?: ((token: string, nonce?: string) => Promise<boolean>) | undefined;
679
+ /**
680
+ * The expected issuer identifier for this provider (RFC 9207).
681
+ * When set, the callback handler validates the `iss` query parameter
682
+ * against this value to prevent authorization server mix-up attacks.
683
+ */
684
+ issuer?: string | undefined;
679
685
  /**
680
686
  * Disable implicit sign up for new users. When set to true for the provider,
681
687
  * sign-in need to be called with with requestSignUp as true to create new users.
package/dist/proxy.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-1sp6DKT-.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-C22JHwcK.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.3";
3
+ const PACKAGE_VERSION = "1.7.0-beta.1";
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.3",
3
+ "version": "1.7.0-beta.1",
4
4
  "description": "Better Auth integration for Electron applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -80,8 +80,8 @@
80
80
  "better-sqlite3": "^12.6.2",
81
81
  "electron": "^38.8.4",
82
82
  "tsdown": "0.21.1",
83
- "@better-auth/core": "1.6.3",
84
- "better-auth": "1.6.3"
83
+ "@better-auth/core": "1.7.0-beta.1",
84
+ "better-auth": "1.7.0-beta.1"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@better-auth/utils": "0.4.0",
@@ -89,8 +89,8 @@
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.3",
93
- "better-auth": "^1.6.3"
92
+ "@better-auth/core": "^1.7.0-beta.1",
93
+ "better-auth": "^1.7.0-beta.1"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "electron": {