@witchcraft/nuxt-auth 0.5.2 → 0.6.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.
Files changed (90) hide show
  1. package/README.md +188 -336
  2. package/dist/module.d.mts +64 -41
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +25 -35
  5. package/dist/runtime/components/ExternalCallback.vue +11 -11
  6. package/dist/runtime/components/LoginProviderButtons.client.d.vue.ts +10 -15
  7. package/dist/runtime/components/LoginProviderButtons.client.vue +4 -10
  8. package/dist/runtime/components/LoginProviderButtons.client.vue.d.ts +10 -15
  9. package/dist/runtime/components/MockBypassRegistrationFields.d.vue.ts +13 -0
  10. package/dist/runtime/components/MockBypassRegistrationFields.vue +18 -0
  11. package/dist/runtime/components/MockBypassRegistrationFields.vue.d.ts +13 -0
  12. package/dist/runtime/components/Mocker.d.vue.ts +5 -1
  13. package/dist/runtime/components/Mocker.vue +7 -10
  14. package/dist/runtime/components/Mocker.vue.d.ts +5 -1
  15. package/dist/runtime/components/SessionStatus.d.vue.ts +86 -42
  16. package/dist/runtime/components/SessionStatus.vue +29 -8
  17. package/dist/runtime/components/SessionStatus.vue.d.ts +86 -42
  18. package/dist/runtime/components/UserRegistration.d.vue.ts +5 -0
  19. package/dist/runtime/components/UserRegistration.vue +2 -0
  20. package/dist/runtime/components/UserRegistration.vue.d.ts +5 -0
  21. package/dist/runtime/composables/useAuth.d.ts +382 -19
  22. package/dist/runtime/composables/useAuth.js +191 -28
  23. package/dist/runtime/composables/useAuthExternalCallback.d.ts +13 -6
  24. package/dist/runtime/composables/useAuthExternalCallback.js +27 -16
  25. package/dist/runtime/composables/useAuthExternalCode.d.ts +2 -2
  26. package/dist/runtime/composables/useAuthExternalCode.js +19 -18
  27. package/dist/runtime/composables/useAuthMocker.d.ts +11 -1
  28. package/dist/runtime/composables/useAuthMocker.js +21 -11
  29. package/dist/runtime/composables/useAuthUserRegistration.d.ts +5 -10
  30. package/dist/runtime/composables/useAuthUserRegistration.js +12 -25
  31. package/dist/runtime/core/providerStyles.js +12 -4
  32. package/dist/runtime/electron/index.d.ts +1 -0
  33. package/dist/runtime/electron/index.js +1 -0
  34. package/dist/runtime/electron/main/ElectronAuth.d.ts +123 -0
  35. package/dist/runtime/electron/main/ElectronAuth.js +200 -0
  36. package/dist/runtime/electron/main/index.d.ts +2 -0
  37. package/dist/runtime/electron/main/index.js +2 -0
  38. package/dist/runtime/electron/main/setupElectronAuthMain.d.ts +665 -0
  39. package/dist/runtime/electron/main/setupElectronAuthMain.js +137 -0
  40. package/dist/runtime/electron/preload/createElectronAuthApi.d.ts +7 -0
  41. package/dist/runtime/electron/preload/createElectronAuthApi.js +15 -0
  42. package/dist/runtime/electron/preload/index.d.ts +2 -0
  43. package/dist/runtime/electron/preload/index.js +2 -0
  44. package/dist/runtime/electron/types.d.ts +54 -0
  45. package/dist/runtime/electron/types.js +2 -0
  46. package/dist/runtime/middleware/authGlobal.js +30 -14
  47. package/dist/runtime/middleware/authProtected.js +2 -2
  48. package/dist/runtime/plugins/client/electronNuxtAuthPlugin.d.ts +48 -0
  49. package/dist/runtime/plugins/client/electronNuxtAuthPlugin.js +86 -0
  50. package/dist/runtime/plugins/client/localOnlyUsers.d.ts +25 -0
  51. package/dist/runtime/plugins/client/localOnlyUsers.js +110 -0
  52. package/dist/runtime/plugins/server/devMock.d.ts +51 -0
  53. package/dist/runtime/plugins/server/devMock.js +162 -0
  54. package/dist/runtime/server/utils/assertEventWithAuthorizedUser.d.ts +11 -0
  55. package/dist/runtime/server/utils/assertEventWithAuthorizedUser.js +10 -0
  56. package/dist/runtime/server/utils/createAuthMiddleware.d.ts +4 -4
  57. package/dist/runtime/server/utils/createAuthMiddleware.js +16 -23
  58. package/dist/runtime/server/utils/createAuthSchema.d.ts +391 -94
  59. package/dist/runtime/server/utils/createAuthSchema.js +43 -13
  60. package/dist/runtime/server/utils/createBetterAuth.d.ts +34 -0
  61. package/dist/runtime/server/utils/createBetterAuth.js +160 -0
  62. package/dist/runtime/server/utils/getBetterAuthInstance.d.ts +3 -0
  63. package/dist/runtime/server/utils/getBetterAuthInstance.js +10 -0
  64. package/dist/runtime/types.d.ts +358 -248
  65. package/dist/runtime/types.js +48 -25
  66. package/dist/runtime/utils/deserializeAuthLocalUser.d.ts +2 -0
  67. package/dist/runtime/utils/deserializeAuthLocalUser.js +9 -0
  68. package/package.json +44 -19
  69. package/dist/runtime/core/providers/github.d.ts +0 -84
  70. package/dist/runtime/core/providers/github.js +0 -55
  71. package/dist/runtime/core/providers/google.d.ts +0 -65
  72. package/dist/runtime/core/providers/google.js +0 -49
  73. package/dist/runtime/server/helpers/getSafeSecretsInfo.d.ts +0 -4
  74. package/dist/runtime/server/helpers/getSafeSecretsInfo.js +0 -10
  75. package/dist/runtime/server/helpers/logSafeRoute.d.ts +0 -1
  76. package/dist/runtime/server/helpers/logSafeRoute.js +0 -3
  77. package/dist/runtime/server/helpers/signJwt.d.ts +0 -3
  78. package/dist/runtime/server/helpers/signJwt.js +0 -16
  79. package/dist/runtime/server/helpers/verifyJwt.d.ts +0 -5
  80. package/dist/runtime/server/helpers/verifyJwt.js +0 -19
  81. package/dist/runtime/server/utils/Auth.d.ts +0 -85
  82. package/dist/runtime/server/utils/Auth.js +0 -671
  83. package/dist/runtime/server/utils/SessionManager.d.ts +0 -26
  84. package/dist/runtime/server/utils/SessionManager.js +0 -94
  85. package/dist/runtime/server/utils/createAuthHandler.d.ts +0 -9
  86. package/dist/runtime/server/utils/createAuthHandler.js +0 -29
  87. package/dist/runtime/utils/createExternalAuthLoginHandler.d.ts +0 -37
  88. package/dist/runtime/utils/createExternalAuthLoginHandler.js +0 -23
  89. package/dist/runtime/utils/getAuthApiRoute.d.ts +0 -6
  90. package/dist/runtime/utils/getAuthApiRoute.js +0 -14
@@ -0,0 +1,665 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import { type BetterAuthClientOptions } from "better-auth/client";
3
+ import { type BrowserWindow, type Session } from "electron";
4
+ import { ElectronAuth } from "./ElectronAuth.js";
5
+ import type { ModulePublicRuntimeConfig } from "../../../module.js";
6
+ /**
7
+ * Wires the main process side of an electron sign-in by setting up:
8
+ * - the better-auth client the preload bridges talk to
9
+ * - deeplink handling
10
+ * - the handlers for the preload APIs
11
+ * - mocking handlers (for a full mock with registration bypass always true, no browser side mocking) if TEST is true (can be disabled via `enableMockingInTestEnvs: false`
12
+ *
13
+ * It does not setup scheme registration or CSP.
14
+ *
15
+ * Call it once, before `app.whenReady()`.
16
+ */
17
+ export declare function setupElectronAuthMain(rc: ModulePublicRuntimeConfig["auth"], { publicServerUrl, getSession, userSchema, getWindow, getActiveUserId, clientOptions, userIdCookieName, enableMockingInTestEnvs, onFinishLogin }: {
18
+ /** Public server url of the better-auth server, e.g. `getPaths().publicServerUrl`. */
19
+ publicServerUrl: string;
20
+ /** Returns the session the window uses, e.g. `() => ses`, undefined until the window is created. Its cookies are what the proxy sends. */
21
+ getSession: () => Session | undefined;
22
+ /**
23
+ * Parses the user before it is written to the window, e.g. `zAuthUserStored`.
24
+ * Build it from the db table so there is one source of truth for the user shape.
25
+ */
26
+ userSchema: StandardSchemaV1<unknown, {
27
+ id: string;
28
+ }>;
29
+ /** Returns the window the bridges act on, null when none exists yet. */
30
+ getWindow: () => BrowserWindow | null | undefined;
31
+ /** Returns the id of the user the app treats as active, e.g. `() => activeUserId`. */
32
+ getActiveUserId: () => string | undefined;
33
+ /** Add options to the better-auth client, deep-merged (via `defuArrayFn`) over the options built here. */
34
+ clientOptions?: BetterAuthClientOptions;
35
+ /** Name of the cookie that records which user a window's session belongs to. @default "userId" */
36
+ userIdCookieName?: string;
37
+ /** Called after an external login is persisted, so the app can record the user (e.g. write its user dir). */
38
+ onFinishLogin?: (ctx: {
39
+ win: BrowserWindow;
40
+ user: {
41
+ id: string;
42
+ username: string | null;
43
+ };
44
+ }) => void | Promise<void>;
45
+ /**
46
+ * Enables mocking when TEST is true.
47
+ *
48
+ * @default true
49
+ */
50
+ enableMockingInTestEnvs?: boolean;
51
+ }): {
52
+ client: import("better-auth/client").AuthClient<Omit<BetterAuthClientOptions, "fetchOptions" | "plugins" | "baseURL"> & Omit<{
53
+ baseURL: string;
54
+ fetchOptions: {
55
+ headers: {
56
+ origin: string;
57
+ };
58
+ };
59
+ plugins: {
60
+ id: "electron";
61
+ version: string;
62
+ fetchPlugins: {
63
+ id: string;
64
+ name: string;
65
+ init(url: string, options: ({
66
+ mode?: RequestMode | undefined;
67
+ cache?: RequestCache | undefined;
68
+ credentials?: RequestCredentials | undefined;
69
+ integrity?: string | undefined;
70
+ keepalive?: boolean | undefined;
71
+ method?: string | undefined;
72
+ priority?: RequestPriority | undefined;
73
+ redirect?: RequestRedirect | undefined;
74
+ referrer?: string | undefined;
75
+ referrerPolicy?: ReferrerPolicy | undefined;
76
+ signal?: (AbortSignal | null) | undefined;
77
+ window?: null | undefined;
78
+ } & {
79
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
80
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
81
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
82
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
83
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
84
+ hookOptions?: {
85
+ cloneResponse?: boolean;
86
+ } | undefined;
87
+ timeout?: number | undefined;
88
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
89
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
90
+ baseURL?: string | undefined;
91
+ throw?: boolean | undefined;
92
+ auth?: ({
93
+ type: "Bearer";
94
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
95
+ } | {
96
+ type: "Basic";
97
+ username: string | (() => string | undefined) | undefined;
98
+ password: string | (() => string | undefined) | undefined;
99
+ } | {
100
+ type: "Custom";
101
+ prefix: string | (() => string | undefined) | undefined;
102
+ value: string | (() => string | undefined) | undefined;
103
+ }) | undefined;
104
+ headers?: {} | {
105
+ [x: string]: string | undefined;
106
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
107
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
108
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
109
+ } | undefined;
110
+ body?: any;
111
+ query?: any;
112
+ params?: any;
113
+ duplex?: "full" | "half" | undefined;
114
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
115
+ retry?: import("better-auth/client").RetryOptions | undefined;
116
+ retryAttempt?: number | undefined;
117
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
118
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
119
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
120
+ disableValidation?: boolean | undefined;
121
+ signal?: (AbortSignal | null) | undefined;
122
+ } & Record<string, any>) | undefined): Promise<{
123
+ url: string;
124
+ options: {
125
+ mode?: RequestMode | undefined;
126
+ cache?: RequestCache | undefined;
127
+ credentials?: RequestCredentials | undefined;
128
+ integrity?: string | undefined;
129
+ keepalive?: boolean | undefined;
130
+ method?: string | undefined;
131
+ priority?: RequestPriority | undefined;
132
+ redirect?: RequestRedirect | undefined;
133
+ referrer?: string | undefined;
134
+ referrerPolicy?: ReferrerPolicy | undefined;
135
+ signal?: (AbortSignal | null) | undefined;
136
+ window?: null | undefined;
137
+ } & {
138
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
139
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
140
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
141
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
142
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
143
+ hookOptions?: {
144
+ cloneResponse?: boolean;
145
+ } | undefined;
146
+ timeout?: number | undefined;
147
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
148
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
149
+ baseURL?: string | undefined;
150
+ throw?: boolean | undefined;
151
+ auth?: ({
152
+ type: "Bearer";
153
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
154
+ } | {
155
+ type: "Basic";
156
+ username: string | (() => string | undefined) | undefined;
157
+ password: string | (() => string | undefined) | undefined;
158
+ } | {
159
+ type: "Custom";
160
+ prefix: string | (() => string | undefined) | undefined;
161
+ value: string | (() => string | undefined) | undefined;
162
+ }) | undefined;
163
+ headers?: {} | {
164
+ [x: string]: string | undefined;
165
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
166
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
167
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
168
+ } | undefined;
169
+ body?: any;
170
+ query?: any;
171
+ params?: any;
172
+ duplex?: "full" | "half" | undefined;
173
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
174
+ retry?: import("better-auth/client").RetryOptions | undefined;
175
+ retryAttempt?: number | undefined;
176
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
177
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
178
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
179
+ disableValidation?: boolean | undefined;
180
+ signal?: (AbortSignal | null) | undefined;
181
+ } & Record<string, any>;
182
+ }>;
183
+ hooks: {
184
+ onSuccess: (context: import("better-auth/client").SuccessContext<any>) => Promise<void>;
185
+ onError: (context: import("better-auth/client").ErrorContext) => Promise<void>;
186
+ };
187
+ }[];
188
+ getActions: ($fetch: import("better-auth/client").BetterFetch, $store: import("better-auth").ClientStore, clientOptions: import("better-auth").BetterAuthClientOptions | undefined) => {
189
+ getCookie: () => string;
190
+ authenticate: (data: import("@better-auth/electron/client").ElectronAuthenticateOptions) => Promise<{
191
+ data: null;
192
+ error: {
193
+ message?: string | undefined;
194
+ status: number;
195
+ statusText: string;
196
+ };
197
+ } | {
198
+ data: {
199
+ token: string;
200
+ user: import("better-auth").User & Record<string, any>;
201
+ };
202
+ error: null;
203
+ }>;
204
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions | undefined) => Promise<void>;
205
+ setupMain: (cfg?: {
206
+ csp?: boolean | undefined;
207
+ bridges?: boolean | undefined;
208
+ scheme?: boolean | undefined;
209
+ getWindow?: () => BrowserWindow | null | undefined;
210
+ }) => void;
211
+ $Infer: {
212
+ Bridges: {
213
+ getUser: () => Promise<({
214
+ id: string;
215
+ createdAt: Date;
216
+ updatedAt: Date;
217
+ email: string;
218
+ emailVerified: boolean;
219
+ name: string;
220
+ image?: string | null | undefined;
221
+ } & Record<string, any>) | null>;
222
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions) => Promise<void>;
223
+ signOut: () => Promise<void>;
224
+ authenticate: (data: {
225
+ token: string;
226
+ }) => Promise<void>;
227
+ onAuthenticated: (callback: (user: {
228
+ id: string;
229
+ createdAt: Date;
230
+ updatedAt: Date;
231
+ email: string;
232
+ emailVerified: boolean;
233
+ name: string;
234
+ image?: string | null | undefined;
235
+ } & Record<string, any>) => unknown) => () => void;
236
+ onUserUpdated: (callback: (user: ({
237
+ id: string;
238
+ createdAt: Date;
239
+ updatedAt: Date;
240
+ email: string;
241
+ emailVerified: boolean;
242
+ name: string;
243
+ image?: string | null | undefined;
244
+ } & Record<string, any>) | null) => unknown) => () => void;
245
+ onAuthError: (callback: (context: import("better-auth/client").BetterFetchError & {
246
+ path: string;
247
+ }) => unknown) => () => void;
248
+ };
249
+ };
250
+ };
251
+ }[];
252
+ }, "fetchOptions" | "plugins" | "baseURL"> & {
253
+ fetchOptions: {
254
+ headers: {
255
+ origin: string;
256
+ };
257
+ } | (Omit<import("better-auth").ClientFetchOption<any, any, any, any>, "headers"> & Omit<{
258
+ headers: {
259
+ origin: string;
260
+ };
261
+ }, "headers"> & {
262
+ headers: {
263
+ origin: string;
264
+ } | (Omit<{}, never> & Omit<{
265
+ origin: string;
266
+ }, never> & {}) | (Omit<{
267
+ [x: string]: string | undefined;
268
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
269
+ "content-type"?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream" | "application/x-www-form-urlencoded" | "multipart/form-data") | undefined;
270
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
271
+ }, "origin"> & Omit<{
272
+ origin: string;
273
+ }, "origin"> & {
274
+ origin: string;
275
+ });
276
+ });
277
+ plugins: {
278
+ id: "electron";
279
+ version: string;
280
+ fetchPlugins: {
281
+ id: string;
282
+ name: string;
283
+ init(url: string, options: ({
284
+ mode?: RequestMode | undefined;
285
+ cache?: RequestCache | undefined;
286
+ credentials?: RequestCredentials | undefined;
287
+ integrity?: string | undefined;
288
+ keepalive?: boolean | undefined;
289
+ method?: string | undefined;
290
+ priority?: RequestPriority | undefined;
291
+ redirect?: RequestRedirect | undefined;
292
+ referrer?: string | undefined;
293
+ referrerPolicy?: ReferrerPolicy | undefined;
294
+ signal?: (AbortSignal | null) | undefined;
295
+ window?: null | undefined;
296
+ } & {
297
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
298
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
299
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
300
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
301
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
302
+ hookOptions?: {
303
+ cloneResponse?: boolean;
304
+ } | undefined;
305
+ timeout?: number | undefined;
306
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
307
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
308
+ baseURL?: string | undefined;
309
+ throw?: boolean | undefined;
310
+ auth?: ({
311
+ type: "Bearer";
312
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
313
+ } | {
314
+ type: "Basic";
315
+ username: string | (() => string | undefined) | undefined;
316
+ password: string | (() => string | undefined) | undefined;
317
+ } | {
318
+ type: "Custom";
319
+ prefix: string | (() => string | undefined) | undefined;
320
+ value: string | (() => string | undefined) | undefined;
321
+ }) | undefined;
322
+ headers?: {} | {
323
+ [x: string]: string | undefined;
324
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
325
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
326
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
327
+ } | undefined;
328
+ body?: any;
329
+ query?: any;
330
+ params?: any;
331
+ duplex?: "full" | "half" | undefined;
332
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
333
+ retry?: import("better-auth/client").RetryOptions | undefined;
334
+ retryAttempt?: number | undefined;
335
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
336
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
337
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
338
+ disableValidation?: boolean | undefined;
339
+ signal?: (AbortSignal | null) | undefined;
340
+ } & Record<string, any>) | undefined): Promise<{
341
+ url: string;
342
+ options: {
343
+ mode?: RequestMode | undefined;
344
+ cache?: RequestCache | undefined;
345
+ credentials?: RequestCredentials | undefined;
346
+ integrity?: string | undefined;
347
+ keepalive?: boolean | undefined;
348
+ method?: string | undefined;
349
+ priority?: RequestPriority | undefined;
350
+ redirect?: RequestRedirect | undefined;
351
+ referrer?: string | undefined;
352
+ referrerPolicy?: ReferrerPolicy | undefined;
353
+ signal?: (AbortSignal | null) | undefined;
354
+ window?: null | undefined;
355
+ } & {
356
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
357
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
358
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
359
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
360
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
361
+ hookOptions?: {
362
+ cloneResponse?: boolean;
363
+ } | undefined;
364
+ timeout?: number | undefined;
365
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
366
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
367
+ baseURL?: string | undefined;
368
+ throw?: boolean | undefined;
369
+ auth?: ({
370
+ type: "Bearer";
371
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
372
+ } | {
373
+ type: "Basic";
374
+ username: string | (() => string | undefined) | undefined;
375
+ password: string | (() => string | undefined) | undefined;
376
+ } | {
377
+ type: "Custom";
378
+ prefix: string | (() => string | undefined) | undefined;
379
+ value: string | (() => string | undefined) | undefined;
380
+ }) | undefined;
381
+ headers?: {} | {
382
+ [x: string]: string | undefined;
383
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
384
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
385
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
386
+ } | undefined;
387
+ body?: any;
388
+ query?: any;
389
+ params?: any;
390
+ duplex?: "full" | "half" | undefined;
391
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
392
+ retry?: import("better-auth/client").RetryOptions | undefined;
393
+ retryAttempt?: number | undefined;
394
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
395
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
396
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
397
+ disableValidation?: boolean | undefined;
398
+ signal?: (AbortSignal | null) | undefined;
399
+ } & Record<string, any>;
400
+ }>;
401
+ hooks: {
402
+ onSuccess: (context: import("better-auth/client").SuccessContext<any>) => Promise<void>;
403
+ onError: (context: import("better-auth/client").ErrorContext) => Promise<void>;
404
+ };
405
+ }[];
406
+ getActions: ($fetch: import("better-auth/client").BetterFetch, $store: import("better-auth").ClientStore, clientOptions: import("better-auth").BetterAuthClientOptions | undefined) => {
407
+ getCookie: () => string;
408
+ authenticate: (data: import("@better-auth/electron/client").ElectronAuthenticateOptions) => Promise<{
409
+ data: null;
410
+ error: {
411
+ message?: string | undefined;
412
+ status: number;
413
+ statusText: string;
414
+ };
415
+ } | {
416
+ data: {
417
+ token: string;
418
+ user: import("better-auth").User & Record<string, any>;
419
+ };
420
+ error: null;
421
+ }>;
422
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions | undefined) => Promise<void>;
423
+ setupMain: (cfg?: {
424
+ csp?: boolean | undefined;
425
+ bridges?: boolean | undefined;
426
+ scheme?: boolean | undefined;
427
+ getWindow?: () => BrowserWindow | null | undefined;
428
+ }) => void;
429
+ $Infer: {
430
+ Bridges: {
431
+ getUser: () => Promise<({
432
+ id: string;
433
+ createdAt: Date;
434
+ updatedAt: Date;
435
+ email: string;
436
+ emailVerified: boolean;
437
+ name: string;
438
+ image?: string | null | undefined;
439
+ } & Record<string, any>) | null>;
440
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions) => Promise<void>;
441
+ signOut: () => Promise<void>;
442
+ authenticate: (data: {
443
+ token: string;
444
+ }) => Promise<void>;
445
+ onAuthenticated: (callback: (user: {
446
+ id: string;
447
+ createdAt: Date;
448
+ updatedAt: Date;
449
+ email: string;
450
+ emailVerified: boolean;
451
+ name: string;
452
+ image?: string | null | undefined;
453
+ } & Record<string, any>) => unknown) => () => void;
454
+ onUserUpdated: (callback: (user: ({
455
+ id: string;
456
+ createdAt: Date;
457
+ updatedAt: Date;
458
+ email: string;
459
+ emailVerified: boolean;
460
+ name: string;
461
+ image?: string | null | undefined;
462
+ } & Record<string, any>) | null) => unknown) => () => void;
463
+ onAuthError: (callback: (context: import("better-auth/client").BetterFetchError & {
464
+ path: string;
465
+ }) => unknown) => () => void;
466
+ };
467
+ };
468
+ };
469
+ }[] | (import("better-auth").BetterAuthClientPlugin | {
470
+ id: "electron";
471
+ version: string;
472
+ fetchPlugins: {
473
+ id: string;
474
+ name: string;
475
+ init(url: string, options: ({
476
+ mode?: RequestMode | undefined;
477
+ cache?: RequestCache | undefined;
478
+ credentials?: RequestCredentials | undefined;
479
+ integrity?: string | undefined;
480
+ keepalive?: boolean | undefined;
481
+ method?: string | undefined;
482
+ priority?: RequestPriority | undefined;
483
+ redirect?: RequestRedirect | undefined;
484
+ referrer?: string | undefined;
485
+ referrerPolicy?: ReferrerPolicy | undefined;
486
+ signal?: (AbortSignal | null) | undefined;
487
+ window?: null | undefined;
488
+ } & {
489
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
490
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
491
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
492
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
493
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
494
+ hookOptions?: {
495
+ cloneResponse?: boolean;
496
+ } | undefined;
497
+ timeout?: number | undefined;
498
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
499
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
500
+ baseURL?: string | undefined;
501
+ throw?: boolean | undefined;
502
+ auth?: ({
503
+ type: "Bearer";
504
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
505
+ } | {
506
+ type: "Basic";
507
+ username: string | (() => string | undefined) | undefined;
508
+ password: string | (() => string | undefined) | undefined;
509
+ } | {
510
+ type: "Custom";
511
+ prefix: string | (() => string | undefined) | undefined;
512
+ value: string | (() => string | undefined) | undefined;
513
+ }) | undefined;
514
+ headers?: {} | {
515
+ [x: string]: string | undefined;
516
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
517
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
518
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
519
+ } | undefined;
520
+ body?: any;
521
+ query?: any;
522
+ params?: any;
523
+ duplex?: "full" | "half" | undefined;
524
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
525
+ retry?: import("better-auth/client").RetryOptions | undefined;
526
+ retryAttempt?: number | undefined;
527
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
528
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
529
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
530
+ disableValidation?: boolean | undefined;
531
+ signal?: (AbortSignal | null) | undefined;
532
+ } & Record<string, any>) | undefined): Promise<{
533
+ url: string;
534
+ options: {
535
+ mode?: RequestMode | undefined;
536
+ cache?: RequestCache | undefined;
537
+ credentials?: RequestCredentials | undefined;
538
+ integrity?: string | undefined;
539
+ keepalive?: boolean | undefined;
540
+ method?: string | undefined;
541
+ priority?: RequestPriority | undefined;
542
+ redirect?: RequestRedirect | undefined;
543
+ referrer?: string | undefined;
544
+ referrerPolicy?: ReferrerPolicy | undefined;
545
+ signal?: (AbortSignal | null) | undefined;
546
+ window?: null | undefined;
547
+ } & {
548
+ onRequest?: (<T extends Record<string, any>>(context: import("better-auth/client").RequestContext<T>) => Promise<import("better-auth/client").RequestContext | void> | import("better-auth/client").RequestContext | void) | undefined;
549
+ onResponse?: ((context: import("better-auth/client").ResponseContext) => Promise<Response | void | import("better-auth/client").ResponseContext> | Response | import("better-auth/client").ResponseContext | void) | undefined;
550
+ onSuccess?: ((context: import("better-auth/client").SuccessContext<any>) => Promise<void> | void) | undefined;
551
+ onError?: ((context: import("better-auth/client").ErrorContext) => Promise<void> | void) | undefined;
552
+ onRetry?: ((response: import("better-auth/client").ResponseContext) => Promise<void> | void) | undefined;
553
+ hookOptions?: {
554
+ cloneResponse?: boolean;
555
+ } | undefined;
556
+ timeout?: number | undefined;
557
+ customFetchImpl?: import("better-auth/client").FetchEsque | undefined;
558
+ plugins?: import("better-auth/client").BetterFetchPlugin[] | undefined;
559
+ baseURL?: string | undefined;
560
+ throw?: boolean | undefined;
561
+ auth?: ({
562
+ type: "Bearer";
563
+ token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
564
+ } | {
565
+ type: "Basic";
566
+ username: string | (() => string | undefined) | undefined;
567
+ password: string | (() => string | undefined) | undefined;
568
+ } | {
569
+ type: "Custom";
570
+ prefix: string | (() => string | undefined) | undefined;
571
+ value: string | (() => string | undefined) | undefined;
572
+ }) | undefined;
573
+ headers?: {} | {
574
+ [x: string]: string | undefined;
575
+ accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
576
+ "content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "multipart/form-data" | "application/octet-stream") | undefined;
577
+ authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
578
+ } | undefined;
579
+ body?: any;
580
+ query?: any;
581
+ params?: any;
582
+ duplex?: "full" | "half" | undefined;
583
+ jsonParser?: ((text: string) => Promise<any> | any) | undefined;
584
+ retry?: import("better-auth/client").RetryOptions | undefined;
585
+ retryAttempt?: number | undefined;
586
+ method?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | (string & {})) | undefined;
587
+ output?: (import("better-auth/client").StandardSchemaV1 | typeof Blob | typeof File) | undefined;
588
+ errorSchema?: import("better-auth/client").StandardSchemaV1 | undefined;
589
+ disableValidation?: boolean | undefined;
590
+ signal?: (AbortSignal | null) | undefined;
591
+ } & Record<string, any>;
592
+ }>;
593
+ hooks: {
594
+ onSuccess: (context: import("better-auth/client").SuccessContext<any>) => Promise<void>;
595
+ onError: (context: import("better-auth/client").ErrorContext) => Promise<void>;
596
+ };
597
+ }[];
598
+ getActions: ($fetch: import("better-auth/client").BetterFetch, $store: import("better-auth").ClientStore, clientOptions: import("better-auth").BetterAuthClientOptions | undefined) => {
599
+ getCookie: () => string;
600
+ authenticate: (data: import("@better-auth/electron/client").ElectronAuthenticateOptions) => Promise<{
601
+ data: null;
602
+ error: {
603
+ message?: string | undefined;
604
+ status: number;
605
+ statusText: string;
606
+ };
607
+ } | {
608
+ data: {
609
+ token: string;
610
+ user: import("better-auth").User & Record<string, any>;
611
+ };
612
+ error: null;
613
+ }>;
614
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions | undefined) => Promise<void>;
615
+ setupMain: (cfg?: {
616
+ csp?: boolean | undefined;
617
+ bridges?: boolean | undefined;
618
+ scheme?: boolean | undefined;
619
+ getWindow?: () => BrowserWindow | null | undefined;
620
+ }) => void;
621
+ $Infer: {
622
+ Bridges: {
623
+ getUser: () => Promise<({
624
+ id: string;
625
+ createdAt: Date;
626
+ updatedAt: Date;
627
+ email: string;
628
+ emailVerified: boolean;
629
+ name: string;
630
+ image?: string | null | undefined;
631
+ } & Record<string, any>) | null>;
632
+ requestAuth: (options?: import("@better-auth/electron/client").ElectronRequestAuthOptions) => Promise<void>;
633
+ signOut: () => Promise<void>;
634
+ authenticate: (data: {
635
+ token: string;
636
+ }) => Promise<void>;
637
+ onAuthenticated: (callback: (user: {
638
+ id: string;
639
+ createdAt: Date;
640
+ updatedAt: Date;
641
+ email: string;
642
+ emailVerified: boolean;
643
+ name: string;
644
+ image?: string | null | undefined;
645
+ } & Record<string, any>) => unknown) => () => void;
646
+ onUserUpdated: (callback: (user: ({
647
+ id: string;
648
+ createdAt: Date;
649
+ updatedAt: Date;
650
+ email: string;
651
+ emailVerified: boolean;
652
+ name: string;
653
+ image?: string | null | undefined;
654
+ } & Record<string, any>) | null) => unknown) => () => void;
655
+ onAuthError: (callback: (context: import("better-auth/client").BetterFetchError & {
656
+ path: string;
657
+ }) => unknown) => () => void;
658
+ };
659
+ };
660
+ };
661
+ })[];
662
+ baseURL: string;
663
+ }>;
664
+ electronAuth: ElectronAuth;
665
+ };