@lenne.tech/nuxt-extensions 1.15.0 → 1.15.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/module.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/lib/auth-client.d.ts +104 -35
- package/dist/runtime/lib/auth-client.js +22 -11
- package/package.json +1 -1
package/dist/module.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { LtExtensionsModuleOptions } from '../dist/runtime/types/index.js';
|
|
|
3
3
|
export * from '../dist/runtime/types/index.js';
|
|
4
4
|
|
|
5
5
|
declare const name = "@lenne.tech/nuxt-extensions";
|
|
6
|
-
declare const version = "1.15.
|
|
6
|
+
declare const version = "1.15.1";
|
|
7
7
|
declare const configKey = "ltExtensions";
|
|
8
8
|
declare const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
|
|
9
9
|
declare const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, tryResolveModule, addImports, addComp
|
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
|
|
4
4
|
const name = "@lenne.tech/nuxt-extensions";
|
|
5
|
-
const version = "1.15.
|
|
5
|
+
const version = "1.15.1";
|
|
6
6
|
const configKey = "ltExtensions";
|
|
7
7
|
const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
|
|
8
8
|
const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
|
|
@@ -184,8 +184,8 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
184
184
|
}>;
|
|
185
185
|
}>;
|
|
186
186
|
};
|
|
187
|
-
passkey:
|
|
188
|
-
admin:
|
|
187
|
+
passkey: any;
|
|
188
|
+
admin: any;
|
|
189
189
|
$Infer: {
|
|
190
190
|
Session: {
|
|
191
191
|
user: import("better-auth").StripEmptyObjects<{
|
|
@@ -302,7 +302,36 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
302
302
|
changePassword: (params: {
|
|
303
303
|
currentPassword: string;
|
|
304
304
|
newPassword: string;
|
|
305
|
-
}, options?:
|
|
305
|
+
}, options?: any) => Promise<(Omit<{
|
|
306
|
+
token: string | null;
|
|
307
|
+
user: {
|
|
308
|
+
id: string;
|
|
309
|
+
createdAt: Date;
|
|
310
|
+
updatedAt: Date;
|
|
311
|
+
email: string;
|
|
312
|
+
emailVerified: boolean;
|
|
313
|
+
name: string;
|
|
314
|
+
image?: string | null | undefined;
|
|
315
|
+
} & Record<string, any> & {
|
|
316
|
+
id: string;
|
|
317
|
+
createdAt: Date;
|
|
318
|
+
updatedAt: Date;
|
|
319
|
+
email: string;
|
|
320
|
+
emailVerified: boolean;
|
|
321
|
+
name: string;
|
|
322
|
+
image?: string | null | undefined;
|
|
323
|
+
};
|
|
324
|
+
}, "user"> & {
|
|
325
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
326
|
+
id: string;
|
|
327
|
+
createdAt: Date;
|
|
328
|
+
updatedAt: Date;
|
|
329
|
+
email: string;
|
|
330
|
+
emailVerified: boolean;
|
|
331
|
+
name: string;
|
|
332
|
+
image?: string | null | undefined;
|
|
333
|
+
}>;
|
|
334
|
+
}) | {
|
|
306
335
|
data: Omit<{
|
|
307
336
|
token: string | null;
|
|
308
337
|
user: {
|
|
@@ -349,7 +378,9 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
349
378
|
resetPassword: (params: {
|
|
350
379
|
newPassword: string;
|
|
351
380
|
token: string;
|
|
352
|
-
}, options?:
|
|
381
|
+
}, options?: any) => Promise<{
|
|
382
|
+
status: boolean;
|
|
383
|
+
} | {
|
|
353
384
|
data: {
|
|
354
385
|
status: boolean;
|
|
355
386
|
};
|
|
@@ -371,7 +402,30 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
371
402
|
email: string;
|
|
372
403
|
password: string;
|
|
373
404
|
rememberMe?: boolean;
|
|
374
|
-
}, options?:
|
|
405
|
+
}, options?: any) => Promise<(Omit<{
|
|
406
|
+
redirect: boolean;
|
|
407
|
+
token: string;
|
|
408
|
+
url?: string | undefined;
|
|
409
|
+
user: {
|
|
410
|
+
id: string;
|
|
411
|
+
createdAt: Date;
|
|
412
|
+
updatedAt: Date;
|
|
413
|
+
email: string;
|
|
414
|
+
emailVerified: boolean;
|
|
415
|
+
name: string;
|
|
416
|
+
image?: string | null | undefined | undefined;
|
|
417
|
+
};
|
|
418
|
+
}, "user"> & {
|
|
419
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
420
|
+
id: string;
|
|
421
|
+
createdAt: Date;
|
|
422
|
+
updatedAt: Date;
|
|
423
|
+
email: string;
|
|
424
|
+
emailVerified: boolean;
|
|
425
|
+
name: string;
|
|
426
|
+
image?: string | null | undefined;
|
|
427
|
+
}>;
|
|
428
|
+
}) | {
|
|
375
429
|
data: Omit<{
|
|
376
430
|
redirect: boolean;
|
|
377
431
|
token: string;
|
|
@@ -410,7 +464,7 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
410
464
|
* Sign in with passkey (pass through to base client - provided by passkeyClient plugin)
|
|
411
465
|
* @see https://www.better-auth.com/docs/plugins/passkey
|
|
412
466
|
*/
|
|
413
|
-
passkey:
|
|
467
|
+
passkey: any;
|
|
414
468
|
social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
|
|
415
469
|
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
416
470
|
callbackURL?: string | undefined;
|
|
@@ -523,7 +577,49 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
523
577
|
email: string;
|
|
524
578
|
name: string;
|
|
525
579
|
password: string;
|
|
526
|
-
} & Record<string, unknown>, options?:
|
|
580
|
+
} & Record<string, unknown>, options?: any) => Promise<(Omit<{
|
|
581
|
+
token: null;
|
|
582
|
+
user: {
|
|
583
|
+
id: string;
|
|
584
|
+
createdAt: Date;
|
|
585
|
+
updatedAt: Date;
|
|
586
|
+
email: string;
|
|
587
|
+
emailVerified: boolean;
|
|
588
|
+
name: string;
|
|
589
|
+
image?: string | null | undefined | undefined;
|
|
590
|
+
};
|
|
591
|
+
}, "user"> & {
|
|
592
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
593
|
+
id: string;
|
|
594
|
+
createdAt: Date;
|
|
595
|
+
updatedAt: Date;
|
|
596
|
+
email: string;
|
|
597
|
+
emailVerified: boolean;
|
|
598
|
+
name: string;
|
|
599
|
+
image?: string | null | undefined;
|
|
600
|
+
}>;
|
|
601
|
+
}) | (Omit<{
|
|
602
|
+
token: string;
|
|
603
|
+
user: {
|
|
604
|
+
id: string;
|
|
605
|
+
createdAt: Date;
|
|
606
|
+
updatedAt: Date;
|
|
607
|
+
email: string;
|
|
608
|
+
emailVerified: boolean;
|
|
609
|
+
name: string;
|
|
610
|
+
image?: string | null | undefined | undefined;
|
|
611
|
+
};
|
|
612
|
+
}, "user"> & {
|
|
613
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
614
|
+
id: string;
|
|
615
|
+
createdAt: Date;
|
|
616
|
+
updatedAt: Date;
|
|
617
|
+
email: string;
|
|
618
|
+
emailVerified: boolean;
|
|
619
|
+
name: string;
|
|
620
|
+
image?: string | null | undefined;
|
|
621
|
+
}>;
|
|
622
|
+
}) | {
|
|
527
623
|
data: (Omit<{
|
|
528
624
|
token: null;
|
|
529
625
|
user: {
|
|
@@ -578,34 +674,7 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
578
674
|
};
|
|
579
675
|
}>;
|
|
580
676
|
};
|
|
581
|
-
twoFactor:
|
|
582
|
-
/**
|
|
583
|
-
* Disable 2FA (password is hashed before sending)
|
|
584
|
-
*/
|
|
585
|
-
disable: (params: {
|
|
586
|
-
password: string;
|
|
587
|
-
}, options?: unknown) => Promise<unknown>;
|
|
588
|
-
/**
|
|
589
|
-
* Enable 2FA (password is hashed before sending)
|
|
590
|
-
*/
|
|
591
|
-
enable: (params: {
|
|
592
|
-
password: string;
|
|
593
|
-
}, options?: unknown) => Promise<unknown>;
|
|
594
|
-
/**
|
|
595
|
-
* Generate backup codes (password is hashed before sending)
|
|
596
|
-
*/
|
|
597
|
-
generateBackupCodes: (params: {
|
|
598
|
-
password: string;
|
|
599
|
-
}, options?: unknown) => Promise<unknown>;
|
|
600
|
-
/**
|
|
601
|
-
* Verify TOTP code (pass through to base client)
|
|
602
|
-
*/
|
|
603
|
-
verifyTotp: ((...args: unknown[]) => Promise<unknown>) | undefined;
|
|
604
|
-
/**
|
|
605
|
-
* Verify backup code (pass through to base client)
|
|
606
|
-
*/
|
|
607
|
-
verifyBackupCode: ((...args: unknown[]) => Promise<unknown>) | undefined;
|
|
608
|
-
};
|
|
677
|
+
twoFactor: any;
|
|
609
678
|
verifyEmail: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
|
|
610
679
|
token: string;
|
|
611
680
|
callbackURL?: string | undefined;
|
|
@@ -78,15 +78,15 @@ export function createLtAuthClient(config = {}) {
|
|
|
78
78
|
},
|
|
79
79
|
plugins
|
|
80
80
|
});
|
|
81
|
-
const withPlugins = baseClient;
|
|
82
|
-
const signInWithPlugins = baseClient.signIn;
|
|
83
81
|
return {
|
|
84
82
|
// Spread all base client properties and methods
|
|
85
83
|
...baseClient,
|
|
86
84
|
// Explicitly pass through methods not captured by spread operator
|
|
87
85
|
useSession: baseClient.useSession,
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
passkey: baseClient.passkey,
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
+
admin: baseClient.admin,
|
|
90
90
|
$Infer: baseClient.$Infer,
|
|
91
91
|
$fetch: baseClient.$fetch,
|
|
92
92
|
$store: baseClient.$store,
|
|
@@ -94,6 +94,7 @@ export function createLtAuthClient(config = {}) {
|
|
|
94
94
|
/**
|
|
95
95
|
* Change password for an authenticated user (both passwords are hashed)
|
|
96
96
|
*/
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
98
|
changePassword: async (params, options) => {
|
|
98
99
|
const [hashedCurrent, hashedNew] = await Promise.all([ltSha256(params.currentPassword), ltSha256(params.newPassword)]);
|
|
99
100
|
return baseClient.changePassword?.({ currentPassword: hashedCurrent, newPassword: hashedNew }, options);
|
|
@@ -101,6 +102,7 @@ export function createLtAuthClient(config = {}) {
|
|
|
101
102
|
/**
|
|
102
103
|
* Reset password with token (new password is hashed before sending)
|
|
103
104
|
*/
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
106
|
resetPassword: async (params, options) => {
|
|
105
107
|
const hashedPassword = await ltSha256(params.newPassword);
|
|
106
108
|
return baseClient.resetPassword?.({ newPassword: hashedPassword, token: params.token }, options);
|
|
@@ -111,6 +113,7 @@ export function createLtAuthClient(config = {}) {
|
|
|
111
113
|
/**
|
|
112
114
|
* Sign in with email and password (password is hashed before sending)
|
|
113
115
|
*/
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
117
|
email: async (params, options) => {
|
|
115
118
|
const hashedPassword = await ltSha256(params.password);
|
|
116
119
|
return baseClient.signIn.email({ ...params, password: hashedPassword }, options);
|
|
@@ -119,7 +122,8 @@ export function createLtAuthClient(config = {}) {
|
|
|
119
122
|
* Sign in with passkey (pass through to base client - provided by passkeyClient plugin)
|
|
120
123
|
* @see https://www.better-auth.com/docs/plugins/passkey
|
|
121
124
|
*/
|
|
122
|
-
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
|
+
passkey: baseClient.signIn.passkey
|
|
123
127
|
},
|
|
124
128
|
// Explicitly pass through signOut (not captured by spread operator)
|
|
125
129
|
signOut: baseClient.signOut,
|
|
@@ -129,6 +133,7 @@ export function createLtAuthClient(config = {}) {
|
|
|
129
133
|
/**
|
|
130
134
|
* Sign up with email and password (password is hashed before sending)
|
|
131
135
|
*/
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
132
137
|
email: async (params, options) => {
|
|
133
138
|
const hashedPassword = await ltSha256(params.password);
|
|
134
139
|
return baseClient.signUp.email({ ...params, password: hashedPassword }, options);
|
|
@@ -136,36 +141,42 @@ export function createLtAuthClient(config = {}) {
|
|
|
136
141
|
},
|
|
137
142
|
// Override twoFactor to hash passwords (provided by twoFactorClient plugin)
|
|
138
143
|
twoFactor: {
|
|
139
|
-
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
+
...baseClient.twoFactor,
|
|
140
146
|
/**
|
|
141
147
|
* Disable 2FA (password is hashed before sending)
|
|
142
148
|
*/
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
150
|
disable: async (params, options) => {
|
|
144
151
|
const hashedPassword = await ltSha256(params.password);
|
|
145
|
-
return
|
|
152
|
+
return baseClient.twoFactor.disable({ password: hashedPassword }, options);
|
|
146
153
|
},
|
|
147
154
|
/**
|
|
148
155
|
* Enable 2FA (password is hashed before sending)
|
|
149
156
|
*/
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
150
158
|
enable: async (params, options) => {
|
|
151
159
|
const hashedPassword = await ltSha256(params.password);
|
|
152
|
-
return
|
|
160
|
+
return baseClient.twoFactor.enable({ password: hashedPassword }, options);
|
|
153
161
|
},
|
|
154
162
|
/**
|
|
155
163
|
* Generate backup codes (password is hashed before sending)
|
|
156
164
|
*/
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
166
|
generateBackupCodes: async (params, options) => {
|
|
158
167
|
const hashedPassword = await ltSha256(params.password);
|
|
159
|
-
return
|
|
168
|
+
return baseClient.twoFactor.generateBackupCodes({ password: hashedPassword }, options);
|
|
160
169
|
},
|
|
161
170
|
/**
|
|
162
171
|
* Verify TOTP code (pass through to base client)
|
|
163
172
|
*/
|
|
164
|
-
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
+
verifyTotp: baseClient.twoFactor.verifyTotp,
|
|
165
175
|
/**
|
|
166
176
|
* Verify backup code (pass through to base client)
|
|
167
177
|
*/
|
|
168
|
-
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
verifyBackupCode: baseClient.twoFactor.verifyBackupCode
|
|
169
180
|
}
|
|
170
181
|
};
|
|
171
182
|
}
|