@better-auth/electron 1.5.6 → 1.5.7-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-DVs5eLfi.d.mts → client-D8BB_eSV.d.mts} +1 -8
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +2 -8
- package/dist/index.d.mts +124 -140
- package/dist/index.mjs +1 -5
- package/dist/preload.d.mts +555 -740
- package/dist/preload.mjs +5 -15
- package/dist/proxy.d.mts +1 -1
- package/dist/proxy.mjs +2 -4
- package/dist/storage.d.mts +1 -1
- package/dist/storage.mjs +1 -3
- package/dist/{utils-DecLU66o.mjs → utils-CRzg_SlK.mjs} +1 -2
- package/package.json +7 -7
|
@@ -241,14 +241,7 @@ 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
|
-
|
|
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>>;
|
|
244
|
+
[x: string]: any;
|
|
252
245
|
}, z.core.$strip>;
|
|
253
246
|
type ElectronRequestAuthOptions = z.infer<typeof requestAuthOptionsSchema>;
|
|
254
247
|
/**
|
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-
|
|
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-D8BB_eSV.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 { n as isProcessType, r as parseProtocolScheme, t as getChannelPrefixWithDelimiter } from "./utils-
|
|
1
|
+
import { n as isProcessType, r as parseProtocolScheme, t as getChannelPrefixWithDelimiter } from "./utils-CRzg_SlK.mjs";
|
|
2
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
3
|
import { base64, base64Url } from "@better-auth/utils/base64";
|
|
4
4
|
import { APIError as APIError$1, getBaseURL, isDevelopment, isTest, safeJSONParse } from "better-auth";
|
|
@@ -11,7 +11,6 @@ import { parseSetCookieHeader } from "better-auth/cookies";
|
|
|
11
11
|
import electron, { shell } from "electron";
|
|
12
12
|
import { isDevelopment as isDevelopment$1 } from "@better-auth/core/env";
|
|
13
13
|
import { resolve } from "node:path";
|
|
14
|
-
|
|
15
14
|
//#region src/user.ts
|
|
16
15
|
const { net } = electron;
|
|
17
16
|
const DEFAULT_MAX_BYTES = 1024 * 1024 * 5;
|
|
@@ -151,7 +150,6 @@ function detectImageType(bytes) {
|
|
|
151
150
|
if (brand === "heix" || brand === "hevc" || brand === "mif1" || brand === "msf1") return "image/heic";
|
|
152
151
|
return null;
|
|
153
152
|
}
|
|
154
|
-
|
|
155
153
|
//#endregion
|
|
156
154
|
//#region src/authenticate.ts
|
|
157
155
|
const kElectron = Symbol.for("better-auth:electron");
|
|
@@ -224,7 +222,6 @@ async function authenticate({ $fetch, options, token, getWindow, fetchOptions })
|
|
|
224
222
|
}
|
|
225
223
|
});
|
|
226
224
|
}
|
|
227
|
-
|
|
228
225
|
//#endregion
|
|
229
226
|
//#region src/browser.ts
|
|
230
227
|
const { app: app$1, session, protocol, BrowserWindow, ipcMain, webContents: webContents$1 } = electron;
|
|
@@ -467,7 +464,6 @@ function setupUserImageProxy(ctx, opts, clientOptions) {
|
|
|
467
464
|
});
|
|
468
465
|
});
|
|
469
466
|
}
|
|
470
|
-
|
|
471
467
|
//#endregion
|
|
472
468
|
//#region src/cookies.ts
|
|
473
469
|
function getSetCookie(header, prevCookie) {
|
|
@@ -553,7 +549,6 @@ function hasBetterAuthCookies(setCookieHeader, cookiePrefix) {
|
|
|
553
549
|
}
|
|
554
550
|
return false;
|
|
555
551
|
}
|
|
556
|
-
|
|
557
552
|
//#endregion
|
|
558
553
|
//#region src/client.ts
|
|
559
554
|
const { app, safeStorage, webContents } = electron;
|
|
@@ -683,6 +678,5 @@ const electronClient = (options) => {
|
|
|
683
678
|
}
|
|
684
679
|
};
|
|
685
680
|
};
|
|
686
|
-
|
|
687
681
|
//#endregion
|
|
688
|
-
export { electronClient, handleDeepLink, normalizeUserOutput };
|
|
682
|
+
export { electronClient, handleDeepLink, normalizeUserOutput };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { f as FetchUserImageResult, m as normalizeUserOutput, p as fetchUserImage, v as ElectronOptions, y as ElectronSharedOptions } from "./client-
|
|
1
|
+
import { f as FetchUserImageResult, m as normalizeUserOutput, p as fetchUserImage, v as ElectronOptions, y as ElectronSharedOptions } from "./client-D8BB_eSV.mjs";
|
|
2
2
|
import * as better_auth0 from "better-auth";
|
|
3
|
-
import * as z from "zod";
|
|
4
3
|
import * as _better_auth_core0 from "@better-auth/core";
|
|
5
4
|
import { HookEndpointContext } from "@better-auth/core";
|
|
6
5
|
import * as better_call0 from "better-call";
|
|
@@ -21,10 +20,10 @@ declare const electron: (options?: ElectronOptions | undefined) => {
|
|
|
21
20
|
hooks: {
|
|
22
21
|
after: ({
|
|
23
22
|
matcher: (ctx: HookEndpointContext) => boolean;
|
|
24
|
-
handler: (inputContext:
|
|
23
|
+
handler: better_call0.Middleware<(inputContext: Record<string, any>) => Promise<void>>;
|
|
25
24
|
} | {
|
|
26
25
|
matcher: (ctx: HookEndpointContext) => boolean;
|
|
27
|
-
handler: (inputContext:
|
|
26
|
+
handler: better_call0.Middleware<(inputContext: Record<string, any>) => Promise<better_call0.MiddlewareContext<{
|
|
28
27
|
returned?: unknown | undefined;
|
|
29
28
|
responseHeaders?: Headers | undefined;
|
|
30
29
|
} & better_auth0.PluginContext<better_auth0.BetterAuthOptions> & better_auth0.InfoContext & {
|
|
@@ -154,171 +153,156 @@ declare const electron: (options?: ElectronOptions | undefined) => {
|
|
|
154
153
|
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => better_auth0.Awaitable<unknown>;
|
|
155
154
|
}> | {
|
|
156
155
|
electron_authorization_code: string;
|
|
157
|
-
} | undefined
|
|
156
|
+
} | undefined>>;
|
|
158
157
|
})[];
|
|
159
158
|
};
|
|
160
159
|
endpoints: {
|
|
161
|
-
electronToken: better_call0.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
code_verifier: z.ZodString;
|
|
167
|
-
}, z.core.$strip>;
|
|
168
|
-
metadata: {
|
|
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;
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
required: string[];
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
}, {
|
|
160
|
+
electronToken: better_call0.Endpoint<"/electron/token", "POST", {
|
|
161
|
+
token: string;
|
|
162
|
+
state: string;
|
|
163
|
+
code_verifier: string;
|
|
164
|
+
}, Record<string, any> | undefined, [], {
|
|
198
165
|
token: string;
|
|
199
166
|
user: better_auth0.User & Record<string, any>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
schema: {
|
|
220
|
-
type: "object";
|
|
221
|
-
properties: {
|
|
222
|
-
url: {
|
|
223
|
-
type: string;
|
|
224
|
-
nullable: boolean;
|
|
225
|
-
};
|
|
226
|
-
redirect: {
|
|
227
|
-
type: string;
|
|
228
|
-
};
|
|
229
|
-
user: {
|
|
230
|
-
type: string;
|
|
231
|
-
$ref: string;
|
|
232
|
-
};
|
|
233
|
-
token: {
|
|
234
|
-
type: string;
|
|
235
|
-
};
|
|
167
|
+
}, {
|
|
168
|
+
scope: "http";
|
|
169
|
+
openapi: {
|
|
170
|
+
description: string;
|
|
171
|
+
operationId: string;
|
|
172
|
+
responses: {
|
|
173
|
+
200: {
|
|
174
|
+
description: string;
|
|
175
|
+
content: {
|
|
176
|
+
"application/json": {
|
|
177
|
+
schema: {
|
|
178
|
+
type: "object";
|
|
179
|
+
properties: {
|
|
180
|
+
token: {
|
|
181
|
+
type: string;
|
|
182
|
+
};
|
|
183
|
+
user: {
|
|
184
|
+
type: string;
|
|
185
|
+
$ref: string;
|
|
236
186
|
};
|
|
237
|
-
required: string[];
|
|
238
187
|
};
|
|
188
|
+
required: string[];
|
|
239
189
|
};
|
|
240
190
|
};
|
|
241
191
|
};
|
|
242
192
|
};
|
|
243
193
|
};
|
|
244
194
|
};
|
|
245
|
-
},
|
|
195
|
+
}, undefined>;
|
|
196
|
+
electronInitOAuthProxy: better_call0.Endpoint<"/electron/init-oauth-proxy", "GET", undefined, {
|
|
197
|
+
provider: string;
|
|
198
|
+
state: string;
|
|
199
|
+
code_challenge: string;
|
|
200
|
+
code_challenge_method?: string | undefined;
|
|
201
|
+
}, [], {
|
|
246
202
|
url: string | undefined;
|
|
247
203
|
redirect: boolean;
|
|
248
204
|
user?: better_auth0.User & Record<string, any>;
|
|
249
205
|
token?: string;
|
|
250
|
-
} | undefined
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
createdAt: Date;
|
|
277
|
-
updatedAt: Date;
|
|
278
|
-
email: string;
|
|
279
|
-
emailVerified: boolean;
|
|
280
|
-
name: string;
|
|
281
|
-
image?: string | null | undefined;
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
}>)[];
|
|
285
|
-
requireHeaders: true;
|
|
286
|
-
metadata: {
|
|
287
|
-
openapi: {
|
|
288
|
-
description: string;
|
|
289
|
-
operationId: string;
|
|
290
|
-
responses: {
|
|
291
|
-
200: {
|
|
292
|
-
description: string;
|
|
293
|
-
content: {
|
|
294
|
-
"application/json": {
|
|
295
|
-
schema: {
|
|
296
|
-
type: "object";
|
|
297
|
-
properties: {
|
|
298
|
-
url: {
|
|
299
|
-
type: string;
|
|
300
|
-
nullable: boolean;
|
|
301
|
-
};
|
|
302
|
-
redirect: {
|
|
303
|
-
type: string;
|
|
304
|
-
};
|
|
305
|
-
electron_authorization_code: {
|
|
306
|
-
type: string;
|
|
307
|
-
};
|
|
206
|
+
} | undefined, {
|
|
207
|
+
scope: "http";
|
|
208
|
+
openapi: {
|
|
209
|
+
description: string;
|
|
210
|
+
operationId: string;
|
|
211
|
+
responses: {
|
|
212
|
+
200: {
|
|
213
|
+
description: string;
|
|
214
|
+
content: {
|
|
215
|
+
"application/json": {
|
|
216
|
+
schema: {
|
|
217
|
+
type: "object";
|
|
218
|
+
properties: {
|
|
219
|
+
url: {
|
|
220
|
+
type: string;
|
|
221
|
+
nullable: boolean;
|
|
222
|
+
};
|
|
223
|
+
redirect: {
|
|
224
|
+
type: string;
|
|
225
|
+
};
|
|
226
|
+
user: {
|
|
227
|
+
type: string;
|
|
228
|
+
$ref: string;
|
|
229
|
+
};
|
|
230
|
+
token: {
|
|
231
|
+
type: string;
|
|
308
232
|
};
|
|
309
|
-
required: string[];
|
|
310
233
|
};
|
|
234
|
+
required: string[];
|
|
311
235
|
};
|
|
312
236
|
};
|
|
313
237
|
};
|
|
314
238
|
};
|
|
315
239
|
};
|
|
316
240
|
};
|
|
241
|
+
}, undefined>;
|
|
242
|
+
electronTransferUser: better_call0.Endpoint<"/electron/transfer-user", "POST", {
|
|
243
|
+
callbackURL?: string | undefined;
|
|
317
244
|
}, {
|
|
245
|
+
client_id: string;
|
|
246
|
+
state: string;
|
|
247
|
+
code_challenge: string;
|
|
248
|
+
code_challenge_method?: string | undefined;
|
|
249
|
+
}, [better_call0.Middleware<(inputContext: Record<string, any>) => Promise<{
|
|
250
|
+
session: {
|
|
251
|
+
session: Record<string, any> & {
|
|
252
|
+
id: string;
|
|
253
|
+
createdAt: Date;
|
|
254
|
+
updatedAt: Date;
|
|
255
|
+
userId: string;
|
|
256
|
+
expiresAt: Date;
|
|
257
|
+
token: string;
|
|
258
|
+
ipAddress?: string | null | undefined;
|
|
259
|
+
userAgent?: string | null | undefined;
|
|
260
|
+
};
|
|
261
|
+
user: Record<string, any> & {
|
|
262
|
+
id: string;
|
|
263
|
+
createdAt: Date;
|
|
264
|
+
updatedAt: Date;
|
|
265
|
+
email: string;
|
|
266
|
+
emailVerified: boolean;
|
|
267
|
+
name: string;
|
|
268
|
+
image?: string | null | undefined;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
}>>], {
|
|
318
272
|
url: string | null;
|
|
319
273
|
redirect: boolean;
|
|
320
274
|
electron_authorization_code: string;
|
|
321
|
-
}
|
|
275
|
+
}, {
|
|
276
|
+
openapi: {
|
|
277
|
+
description: string;
|
|
278
|
+
operationId: string;
|
|
279
|
+
responses: {
|
|
280
|
+
200: {
|
|
281
|
+
description: string;
|
|
282
|
+
content: {
|
|
283
|
+
"application/json": {
|
|
284
|
+
schema: {
|
|
285
|
+
type: "object";
|
|
286
|
+
properties: {
|
|
287
|
+
url: {
|
|
288
|
+
type: string;
|
|
289
|
+
nullable: boolean;
|
|
290
|
+
};
|
|
291
|
+
redirect: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
294
|
+
electron_authorization_code: {
|
|
295
|
+
type: string;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
required: string[];
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
}, undefined>;
|
|
322
306
|
};
|
|
323
307
|
options: {
|
|
324
308
|
codeExpiresIn: number;
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ import { betterFetch } from "@better-fetch/fetch";
|
|
|
13
13
|
import { createAuthEndpoint, sessionMiddleware } from "better-auth/api";
|
|
14
14
|
import { setSessionCookie } from "better-auth/cookies";
|
|
15
15
|
import { parseUserOutput } from "better-auth/db";
|
|
16
|
-
|
|
17
16
|
//#region src/error-codes.ts
|
|
18
17
|
const ELECTRON_ERROR_CODES = defineErrorCodes({
|
|
19
18
|
INVALID_CLIENT_ID: "Invalid client ID",
|
|
@@ -24,7 +23,6 @@ const ELECTRON_ERROR_CODES = defineErrorCodes({
|
|
|
24
23
|
MISSING_STATE: "state is required",
|
|
25
24
|
MISSING_PKCE: "pkce is required"
|
|
26
25
|
});
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
27
|
//#region src/routes.ts
|
|
30
28
|
const electronTokenBodySchema = z.object({
|
|
@@ -191,7 +189,6 @@ const electronTransferUser = (_opts, { handleTransfer }) => createAuthEndpoint("
|
|
|
191
189
|
electron_authorization_code: identifier
|
|
192
190
|
});
|
|
193
191
|
});
|
|
194
|
-
|
|
195
192
|
//#endregion
|
|
196
193
|
//#region src/index.ts
|
|
197
194
|
const electron = (options) => {
|
|
@@ -298,6 +295,5 @@ const electron = (options) => {
|
|
|
298
295
|
$ERROR_CODES: ELECTRON_ERROR_CODES
|
|
299
296
|
};
|
|
300
297
|
};
|
|
301
|
-
|
|
302
298
|
//#endregion
|
|
303
|
-
export { electron };
|
|
299
|
+
export { electron };
|