@better-auth/electron 1.6.0-beta.0 → 1.6.0

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.
@@ -241,7 +241,14 @@ interface ElectronProxyClientOptions extends ElectronSharedClientOptions {
241
241
  //#region src/authenticate.d.ts
242
242
  declare const kElectron: unique symbol;
243
243
  declare const requestAuthOptionsSchema: z.ZodObject<{
244
- [x: string]: any;
244
+ provider: z.ZodOptional<z.ZodString>;
245
+ callbackURL: z.ZodOptional<z.ZodString>;
246
+ newUserCallbackURL: z.ZodOptional<z.ZodString>;
247
+ errorCallbackURL: z.ZodOptional<z.ZodString>;
248
+ disableRedirect: z.ZodOptional<z.ZodBoolean>;
249
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
+ requestSignUp: z.ZodOptional<z.ZodBoolean>;
251
+ additionalData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
245
252
  }, z.core.$strip>;
246
253
  type ElectronRequestAuthOptions = z.infer<typeof requestAuthOptionsSchema>;
247
254
  /**
package/dist/client.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as setupRenderer, a as authenticate, c as ElectronClientOptions, d as Storage, f as FetchUserImageResult, g as SetupRendererConfig, h as ExposedBridges, i as ElectronRequestAuthOptions, l as ElectronProxyClientOptions, m as normalizeUserOutput, n as handleDeepLink, o as kElectron, p as fetchUserImage, r as ElectronAuthenticateOptions, s as requestAuth, t as electronClient, u as ElectronSharedClientOptions, y as ElectronSharedOptions } from "./client-CMv-uqSO.mjs";
1
+ import { _ as setupRenderer, a as authenticate, c as ElectronClientOptions, d as Storage, f as FetchUserImageResult, g as SetupRendererConfig, h as ExposedBridges, i as ElectronRequestAuthOptions, l as ElectronProxyClientOptions, m as normalizeUserOutput, n as handleDeepLink, o as kElectron, p as fetchUserImage, r as ElectronAuthenticateOptions, s as requestAuth, t as electronClient, u as ElectronSharedClientOptions, y as ElectronSharedOptions } from "./client-D6xRwPM0.mjs";
2
2
  export { ElectronAuthenticateOptions, ElectronClientOptions, ElectronProxyClientOptions, ElectronRequestAuthOptions, ElectronSharedClientOptions, ElectronSharedOptions, ExposedBridges, FetchUserImageResult, SetupRendererConfig, Storage, authenticate, electronClient, fetchUserImage, handleDeepLink, kElectron, normalizeUserOutput, requestAuth, setupRenderer };
package/dist/client.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-BqMHXjG-.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-Cf5gNNxE.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.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { f as FetchUserImageResult, m as normalizeUserOutput, p as fetchUserImage, v as ElectronOptions, y as ElectronSharedOptions } from "./client-CMv-uqSO.mjs";
1
+ import { f as FetchUserImageResult, m as normalizeUserOutput, p as fetchUserImage, v as ElectronOptions, y as ElectronSharedOptions } from "./client-D6xRwPM0.mjs";
2
2
  import * as better_auth0 from "better-auth";
3
+ import * as z from "zod";
3
4
  import * as _better_auth_core0 from "@better-auth/core";
4
5
  import { HookEndpointContext } from "@better-auth/core";
5
6
  import * as better_call0 from "better-call";
@@ -21,10 +22,10 @@ declare const electron: (options?: ElectronOptions | undefined) => {
21
22
  hooks: {
22
23
  after: ({
23
24
  matcher: (ctx: HookEndpointContext) => boolean;
24
- handler: better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>;
25
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
25
26
  } | {
26
27
  matcher: (ctx: HookEndpointContext) => boolean;
27
- handler: better_call0.Middleware<(inputContext: Record<string, any>) => Promise<better_call0.MiddlewareContext<{
28
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<better_call0.MiddlewareContext<better_call0.MiddlewareOptions, {
28
29
  returned?: unknown | undefined;
29
30
  responseHeaders?: Headers | undefined;
30
31
  } & better_auth0.PluginContext<better_auth0.BetterAuthOptions> & better_auth0.InfoContext & {
@@ -154,156 +155,171 @@ declare const electron: (options?: ElectronOptions | undefined) => {
154
155
  runInBackgroundOrAwait: (promise: Promise<unknown> | void) => better_auth0.Awaitable<unknown>;
155
156
  }> | {
156
157
  electron_authorization_code: string;
157
- } | undefined>>;
158
+ } | undefined>;
158
159
  })[];
159
160
  };
160
161
  endpoints: {
161
- electronToken: better_call0.Endpoint<"/electron/token", "POST", {
162
- token: string;
163
- state: string;
164
- code_verifier: string;
165
- }, Record<string, any> | undefined, [], {
166
- token: string;
167
- user: better_auth0.User & Record<string, any>;
168
- }, {
169
- scope: "http";
170
- openapi: {
171
- description: string;
172
- operationId: string;
173
- responses: {
174
- 200: {
175
- description: string;
176
- content: {
177
- "application/json": {
178
- schema: {
179
- type: "object";
180
- properties: {
181
- token: {
182
- type: string;
183
- };
184
- user: {
185
- type: string;
186
- $ref: string;
162
+ electronToken: better_call0.StrictEndpoint<"/electron/token", {
163
+ method: "POST";
164
+ body: z.ZodObject<{
165
+ token: z.ZodString;
166
+ state: z.ZodString;
167
+ code_verifier: z.ZodString;
168
+ }, z.core.$strip>;
169
+ metadata: {
170
+ scope: "http";
171
+ openapi: {
172
+ description: string;
173
+ operationId: string;
174
+ responses: {
175
+ 200: {
176
+ description: string;
177
+ content: {
178
+ "application/json": {
179
+ schema: {
180
+ type: "object";
181
+ properties: {
182
+ token: {
183
+ type: string;
184
+ };
185
+ user: {
186
+ type: string;
187
+ $ref: string;
188
+ };
187
189
  };
190
+ required: string[];
188
191
  };
189
- required: string[];
190
192
  };
191
193
  };
192
194
  };
193
195
  };
194
196
  };
195
197
  };
196
- }, undefined>;
197
- electronInitOAuthProxy: better_call0.Endpoint<"/electron/init-oauth-proxy", "GET", undefined, {
198
- provider: string;
199
- state: string;
200
- code_challenge: string;
201
- code_challenge_method?: string | undefined;
202
- }, [], {
203
- url: string | undefined;
204
- redirect: boolean;
205
- user?: better_auth0.User & Record<string, any>;
206
- token?: string;
207
- } | undefined, {
208
- scope: "http";
209
- openapi: {
210
- description: string;
211
- operationId: string;
212
- responses: {
213
- 200: {
214
- description: string;
215
- content: {
216
- "application/json": {
217
- schema: {
218
- type: "object";
219
- properties: {
220
- url: {
221
- type: string;
222
- nullable: boolean;
223
- };
224
- redirect: {
225
- type: string;
226
- };
227
- user: {
228
- type: string;
229
- $ref: string;
230
- };
231
- token: {
232
- type: string;
198
+ }, {
199
+ token: string;
200
+ user: better_auth0.User & Record<string, any>;
201
+ }>;
202
+ electronInitOAuthProxy: better_call0.StrictEndpoint<"/electron/init-oauth-proxy", {
203
+ method: "GET";
204
+ query: z.ZodObject<{
205
+ provider: z.ZodString;
206
+ state: z.ZodString;
207
+ code_challenge: z.ZodString;
208
+ code_challenge_method: z.ZodOptional<z.ZodString>;
209
+ }, z.core.$strip>;
210
+ metadata: {
211
+ scope: "http";
212
+ openapi: {
213
+ description: string;
214
+ operationId: string;
215
+ responses: {
216
+ 200: {
217
+ description: string;
218
+ content: {
219
+ "application/json": {
220
+ schema: {
221
+ type: "object";
222
+ properties: {
223
+ url: {
224
+ type: string;
225
+ nullable: boolean;
226
+ };
227
+ redirect: {
228
+ type: string;
229
+ };
230
+ user: {
231
+ type: string;
232
+ $ref: string;
233
+ };
234
+ token: {
235
+ type: string;
236
+ };
233
237
  };
238
+ required: string[];
234
239
  };
235
- required: string[];
236
240
  };
237
241
  };
238
242
  };
239
243
  };
240
244
  };
241
245
  };
242
- }, undefined>;
243
- electronTransferUser: better_call0.Endpoint<"/electron/transfer-user", "POST", {
244
- callbackURL?: string | undefined;
245
246
  }, {
246
- client_id: string;
247
- state: string;
248
- code_challenge: string;
249
- code_challenge_method?: string | undefined;
250
- }, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
251
- session: {
252
- session: Record<string, any> & {
253
- id: string;
254
- createdAt: Date;
255
- updatedAt: Date;
256
- userId: string;
257
- expiresAt: Date;
258
- token: string;
259
- ipAddress?: string | null | undefined;
260
- userAgent?: string | null | undefined;
261
- };
262
- user: Record<string, any> & {
263
- id: string;
264
- createdAt: Date;
265
- updatedAt: Date;
266
- email: string;
267
- emailVerified: boolean;
268
- name: string;
269
- image?: string | null | undefined;
270
- };
271
- };
272
- }>>], {
273
- url: string | null;
247
+ url: string | undefined;
274
248
  redirect: boolean;
275
- electron_authorization_code: string;
276
- }, {
277
- openapi: {
278
- description: string;
279
- operationId: string;
280
- responses: {
281
- 200: {
282
- description: string;
283
- content: {
284
- "application/json": {
285
- schema: {
286
- type: "object";
287
- properties: {
288
- url: {
289
- type: string;
290
- nullable: boolean;
291
- };
292
- redirect: {
293
- type: string;
294
- };
295
- electron_authorization_code: {
296
- type: string;
249
+ user?: better_auth0.User & Record<string, any>;
250
+ token?: string;
251
+ } | undefined>;
252
+ electronTransferUser: better_call0.StrictEndpoint<"/electron/transfer-user", {
253
+ method: "POST";
254
+ query: z.ZodObject<{
255
+ client_id: z.ZodString;
256
+ state: z.ZodString;
257
+ code_challenge: z.ZodString;
258
+ code_challenge_method: z.ZodOptional<z.ZodString>;
259
+ }, z.core.$strip>;
260
+ body: z.ZodObject<{
261
+ callbackURL: z.ZodOptional<z.ZodString>;
262
+ }, z.core.$strip>;
263
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
264
+ session: {
265
+ session: Record<string, any> & {
266
+ id: string;
267
+ createdAt: Date;
268
+ updatedAt: Date;
269
+ userId: string;
270
+ expiresAt: Date;
271
+ token: string;
272
+ ipAddress?: string | null | undefined;
273
+ userAgent?: string | null | undefined;
274
+ };
275
+ user: Record<string, any> & {
276
+ id: string;
277
+ createdAt: Date;
278
+ updatedAt: Date;
279
+ email: string;
280
+ emailVerified: boolean;
281
+ name: string;
282
+ image?: string | null | undefined;
283
+ };
284
+ };
285
+ }>)[];
286
+ requireHeaders: true;
287
+ metadata: {
288
+ openapi: {
289
+ description: string;
290
+ operationId: string;
291
+ responses: {
292
+ 200: {
293
+ description: string;
294
+ content: {
295
+ "application/json": {
296
+ schema: {
297
+ type: "object";
298
+ properties: {
299
+ url: {
300
+ type: string;
301
+ nullable: boolean;
302
+ };
303
+ redirect: {
304
+ type: string;
305
+ };
306
+ electron_authorization_code: {
307
+ type: string;
308
+ };
297
309
  };
310
+ required: string[];
298
311
  };
299
- required: string[];
300
312
  };
301
313
  };
302
314
  };
303
315
  };
304
316
  };
305
317
  };
306
- }, undefined>;
318
+ }, {
319
+ url: string | null;
320
+ redirect: boolean;
321
+ electron_authorization_code: string;
322
+ }>;
307
323
  };
308
324
  options: {
309
325
  codeExpiresIn: number;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PACKAGE_VERSION } from "./version-BqMHXjG-.mjs";
1
+ import { t as PACKAGE_VERSION } from "./version-Cf5gNNxE.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";