@better-auth/electron 1.5.0-beta.19 → 1.5.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.
- package/dist/client.d.mts +2 -2
- package/dist/index.d.mts +1 -0
- package/dist/preload.d.mts +74 -3
- package/package.json +6 -6
package/dist/client.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ declare const electronClient: <O extends ElectronClientOptions>(options: O) => {
|
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
13
|
init(url: string, options: ({
|
|
14
|
+
priority?: RequestPriority | undefined;
|
|
14
15
|
cache?: RequestCache | undefined;
|
|
15
16
|
credentials?: RequestCredentials | undefined;
|
|
16
17
|
headers?: (HeadersInit & (HeadersInit | {
|
|
@@ -22,7 +23,6 @@ declare const electronClient: <O extends ElectronClientOptions>(options: O) => {
|
|
|
22
23
|
keepalive?: boolean | undefined;
|
|
23
24
|
method?: string | undefined;
|
|
24
25
|
mode?: RequestMode | undefined;
|
|
25
|
-
priority?: RequestPriority | undefined;
|
|
26
26
|
redirect?: RequestRedirect | undefined;
|
|
27
27
|
referrer?: string | undefined;
|
|
28
28
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
@@ -66,6 +66,7 @@ declare const electronClient: <O extends ElectronClientOptions>(options: O) => {
|
|
|
66
66
|
} & Record<string, any>) | undefined): Promise<{
|
|
67
67
|
url: string;
|
|
68
68
|
options: {
|
|
69
|
+
priority?: RequestPriority | undefined;
|
|
69
70
|
cache?: RequestCache | undefined;
|
|
70
71
|
credentials?: RequestCredentials | undefined;
|
|
71
72
|
headers?: (HeadersInit & (HeadersInit | {
|
|
@@ -77,7 +78,6 @@ declare const electronClient: <O extends ElectronClientOptions>(options: O) => {
|
|
|
77
78
|
keepalive?: boolean | undefined;
|
|
78
79
|
method?: string | undefined;
|
|
79
80
|
mode?: RequestMode | undefined;
|
|
80
|
-
priority?: RequestPriority | undefined;
|
|
81
81
|
redirect?: RequestRedirect | undefined;
|
|
82
82
|
referrer?: string | undefined;
|
|
83
83
|
referrerPolicy?: ReferrerPolicy | undefined;
|
package/dist/index.d.mts
CHANGED
|
@@ -114,6 +114,7 @@ declare const electron: (options?: ElectronOptions | undefined) => {
|
|
|
114
114
|
internalAdapter: better_auth0.InternalAdapter<better_auth0.BetterAuthOptions>;
|
|
115
115
|
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<better_call0.CookieOptions> | undefined) => better_auth0.BetterAuthCookie;
|
|
116
116
|
secret: string;
|
|
117
|
+
secretConfig: string | better_auth0.SecretConfig;
|
|
117
118
|
sessionConfig: {
|
|
118
119
|
updateAge: number;
|
|
119
120
|
expiresIn: number;
|
package/dist/preload.d.mts
CHANGED
|
@@ -6,6 +6,7 @@ import "nanostores";
|
|
|
6
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
7
|
import { Database } from "bun:sqlite";
|
|
8
8
|
import { DatabaseSync } from "node:sqlite";
|
|
9
|
+
import { D1Database } from "@cloudflare/workers-types";
|
|
9
10
|
import { Dialect, Kysely, Migration, MysqlPool, PostgresPool, SqliteDatabase } from "kysely";
|
|
10
11
|
import "better-auth";
|
|
11
12
|
|
|
@@ -827,6 +828,17 @@ type BetterAuthCookies = {
|
|
|
827
828
|
dontRememberToken: BetterAuthCookie;
|
|
828
829
|
}; //#endregion
|
|
829
830
|
//#endregion
|
|
831
|
+
//#region ../core/dist/types/secret.d.mts
|
|
832
|
+
//#region src/types/secret.d.ts
|
|
833
|
+
interface SecretConfig {
|
|
834
|
+
/** Map of version number → secret value */
|
|
835
|
+
keys: Map<number, string>;
|
|
836
|
+
/** Version to use for new encryption (first entry in secrets array) */
|
|
837
|
+
currentVersion: number;
|
|
838
|
+
/** Legacy secret for bare-hex fallback (from BETTER_AUTH_SECRET) */
|
|
839
|
+
legacySecret?: string;
|
|
840
|
+
} //#endregion
|
|
841
|
+
//#endregion
|
|
830
842
|
//#region ../core/dist/db/schema/session.d.mts
|
|
831
843
|
//#region src/db/schema/session.d.ts
|
|
832
844
|
declare const sessionSchema: z.ZodObject<{
|
|
@@ -1153,7 +1165,9 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
|
|
|
1153
1165
|
}>;
|
|
1154
1166
|
createUser<T extends Record<string, any>>(user: Omit<User, "id" | "createdAt" | "updatedAt" | "emailVerified"> & Partial<User> & Record<string, any>): Promise<T & User>;
|
|
1155
1167
|
createAccount<T extends Record<string, any>>(account: Omit<Account, "id" | "createdAt" | "updatedAt"> & Partial<Account> & T): Promise<T & Account>;
|
|
1156
|
-
listSessions(userId: string
|
|
1168
|
+
listSessions(userId: string, options?: {
|
|
1169
|
+
onlyActiveSessions?: boolean | undefined;
|
|
1170
|
+
} | undefined): Promise<Session[]>;
|
|
1157
1171
|
listUsers(limit?: number | undefined, offset?: number | undefined, sortBy?: {
|
|
1158
1172
|
field: string;
|
|
1159
1173
|
direction: "asc" | "desc";
|
|
@@ -1165,7 +1179,9 @@ interface InternalAdapter<_Options extends BetterAuthOptions = BetterAuthOptions
|
|
|
1165
1179
|
session: Session & Record<string, any>;
|
|
1166
1180
|
user: User & Record<string, any>;
|
|
1167
1181
|
} | null>;
|
|
1168
|
-
findSessions(sessionTokens: string[]
|
|
1182
|
+
findSessions(sessionTokens: string[], options?: {
|
|
1183
|
+
onlyActiveSessions?: boolean | undefined;
|
|
1184
|
+
} | undefined): Promise<{
|
|
1169
1185
|
session: Session;
|
|
1170
1186
|
user: User;
|
|
1171
1187
|
}[]>;
|
|
@@ -1290,6 +1306,7 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = Plugin
|
|
|
1290
1306
|
internalAdapter: InternalAdapter<Options>;
|
|
1291
1307
|
createAuthCookie: CreateCookieGetterFn;
|
|
1292
1308
|
secret: string;
|
|
1309
|
+
secretConfig: string | SecretConfig;
|
|
1293
1310
|
sessionConfig: {
|
|
1294
1311
|
updateAge: number;
|
|
1295
1312
|
expiresIn: number;
|
|
@@ -4982,6 +4999,7 @@ declare const createAuthMiddleware: {
|
|
|
4982
4999
|
internalAdapter: InternalAdapter<BetterAuthOptions>;
|
|
4983
5000
|
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => BetterAuthCookie;
|
|
4984
5001
|
secret: string;
|
|
5002
|
+
secretConfig: string | SecretConfig;
|
|
4985
5003
|
sessionConfig: {
|
|
4986
5004
|
updateAge: number;
|
|
4987
5005
|
expiresIn: number;
|
|
@@ -5110,6 +5128,7 @@ declare const createAuthMiddleware: {
|
|
|
5110
5128
|
internalAdapter: InternalAdapter<BetterAuthOptions>;
|
|
5111
5129
|
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<CookieOptions> | undefined) => BetterAuthCookie;
|
|
5112
5130
|
secret: string;
|
|
5131
|
+
secretConfig: string | SecretConfig;
|
|
5113
5132
|
sessionConfig: {
|
|
5114
5133
|
updateAge: number;
|
|
5115
5134
|
expiresIn: number;
|
|
@@ -5512,10 +5531,26 @@ type BetterAuthOptions = {
|
|
|
5512
5531
|
* ```
|
|
5513
5532
|
*/
|
|
5514
5533
|
secret?: string | undefined;
|
|
5534
|
+
/**
|
|
5535
|
+
* Versioned secrets for non-destructive secret rotation.
|
|
5536
|
+
* When set, encryption uses an envelope format with key IDs.
|
|
5537
|
+
* First entry is the current key used for new encryption.
|
|
5538
|
+
* Remaining entries are decryption-only (previous rotations).
|
|
5539
|
+
*
|
|
5540
|
+
* Can also be set via BETTER_AUTH_SECRETS env var:
|
|
5541
|
+
* `BETTER_AUTH_SECRETS=2:base64secret,1:base64secret`
|
|
5542
|
+
*
|
|
5543
|
+
* When set, `secret` is only used as legacy fallback
|
|
5544
|
+
* for decrypting bare-hex payloads that predate the envelope format.
|
|
5545
|
+
*/
|
|
5546
|
+
secrets?: Array<{
|
|
5547
|
+
version: number;
|
|
5548
|
+
value: string;
|
|
5549
|
+
}> | undefined;
|
|
5515
5550
|
/**
|
|
5516
5551
|
* Database configuration
|
|
5517
5552
|
*/
|
|
5518
|
-
database?: (PostgresPool | MysqlPool | SqliteDatabase | Dialect | DBAdapterInstance | Database | DatabaseSync | {
|
|
5553
|
+
database?: (PostgresPool | MysqlPool | SqliteDatabase | Dialect | DBAdapterInstance | Database | DatabaseSync | D1Database | {
|
|
5519
5554
|
dialect: Dialect;
|
|
5520
5555
|
type: KyselyDatabaseType;
|
|
5521
5556
|
/**
|
|
@@ -5754,6 +5789,42 @@ type BetterAuthOptions = {
|
|
|
5754
5789
|
data: {
|
|
5755
5790
|
user: User;
|
|
5756
5791
|
}, request?: Request) => Promise<void>;
|
|
5792
|
+
/**
|
|
5793
|
+
* Build a custom synthetic user for email enumeration
|
|
5794
|
+
* protection. When a sign-up attempt is made with an
|
|
5795
|
+
* email that already exists, this function is called
|
|
5796
|
+
* to build the fake user response.
|
|
5797
|
+
*
|
|
5798
|
+
* Use this when plugins add fields to the user table
|
|
5799
|
+
* (e.g. admin plugin adds `role`, `banned`, etc.)
|
|
5800
|
+
* to ensure the fake response is indistinguishable
|
|
5801
|
+
* from a real sign-up.
|
|
5802
|
+
*
|
|
5803
|
+
* @example
|
|
5804
|
+
* ```ts
|
|
5805
|
+
* customSyntheticUser: ({ coreFields, additionalFields, id }) => ({
|
|
5806
|
+
* ...coreFields,
|
|
5807
|
+
* role: "user",
|
|
5808
|
+
* banned: false,
|
|
5809
|
+
* banReason: null,
|
|
5810
|
+
* banExpires: null,
|
|
5811
|
+
* ...additionalFields,
|
|
5812
|
+
* id,
|
|
5813
|
+
* })
|
|
5814
|
+
* ```
|
|
5815
|
+
*/
|
|
5816
|
+
customSyntheticUser?: (params: {
|
|
5817
|
+
/** Core user fields: name, email, emailVerified, image, createdAt, updatedAt */coreFields: {
|
|
5818
|
+
name: string;
|
|
5819
|
+
email: string;
|
|
5820
|
+
emailVerified: boolean;
|
|
5821
|
+
image: string | null;
|
|
5822
|
+
createdAt: Date;
|
|
5823
|
+
updatedAt: Date;
|
|
5824
|
+
}; /** Processed additional fields from options.user.additionalFields (with defaults applied) */
|
|
5825
|
+
additionalFields: Record<string, unknown>; /** Generated user ID */
|
|
5826
|
+
id: string;
|
|
5827
|
+
}) => Record<string, unknown>;
|
|
5757
5828
|
} | undefined;
|
|
5758
5829
|
/**
|
|
5759
5830
|
* list of social providers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/electron",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Better Auth integration for Electron applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/better-sqlite3": "^7.6.13",
|
|
79
79
|
"better-sqlite3": "^12.6.2",
|
|
80
|
-
"electron": "^38.8.
|
|
80
|
+
"electron": "^38.8.4",
|
|
81
81
|
"tsdown": "^0.20.3",
|
|
82
|
-
"better-auth": "1.5.0
|
|
83
|
-
"
|
|
82
|
+
"@better-auth/core": "1.5.0",
|
|
83
|
+
"better-auth": "1.5.0"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@better-auth/utils": "0.3.1",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"better-call": "1.3.2",
|
|
89
89
|
"conf": "^15.0.2",
|
|
90
90
|
"electron": ">=36.0.0",
|
|
91
|
-
"@better-auth/core": "1.5.0
|
|
92
|
-
"better-auth": "1.5.0
|
|
91
|
+
"@better-auth/core": "1.5.0",
|
|
92
|
+
"better-auth": "1.5.0"
|
|
93
93
|
},
|
|
94
94
|
"peerDependenciesMeta": {
|
|
95
95
|
"electron": {
|