@classic-homes/auth 0.1.43 → 0.1.45
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/{auth.svelte-LJJ7MGDE.js → auth.svelte-DTSHZMJ4.js} +2 -2
- package/dist/{chunk-7M4DUK45.js → chunk-DSNTNK6T.js} +68 -4
- package/dist/{chunk-BDIQSTES.js → chunk-ES4UOD62.js} +53 -12
- package/dist/{chunk-EVKXT3NR.js → chunk-XSQYERC6.js} +109 -4
- package/dist/chunk-YTMFXVJR.js +216 -0
- package/dist/core/index.d.ts +13 -227
- package/dist/core/index.js +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/svelte/index.d.ts +436 -3
- package/dist/svelte/index.js +5 -4
- package/dist/testing/index.d.ts +1 -2
- package/dist/{types-DGN45Uih.d.ts → types-Ct5g1Nbj.d.ts} +101 -1
- package/dist/user-utils-BtLu_jhF.d.ts +414 -0
- package/package.json +1 -1
- package/dist/chunk-IAPPE4US.js +0 -66
- package/dist/config-C-iBNu07.d.ts +0 -86
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { A as
|
|
1
|
+
import { L as LoginCredentials, h as LoginResponse, j as LogoutResponse, R as RegisterData, k as RegisterResponse, U as User, u as ProfileUpdateData, v as ChangePasswordData, l as Session, m as ApiKey, C as CreateApiKeyRequest, n as CreateApiKeyResponse, o as MFAStatus, M as MFASetupResponse, p as MFAChallengeData, D as Device, q as UserPreferences, s as LinkedAccount, t as SecurityEvent, P as Pagination } from '../types-Ct5g1Nbj.js';
|
|
2
|
+
export { A as AuthConfig, f as AuthState, w as ResetPasswordData, S as SSOConfig, e as StorageAdapter, g as getConfig, b as getDefaultStorage, d as getFetch, c as getStorage, i as initAuth, a as isInitialized, r as resetConfig } from '../types-Ct5g1Nbj.js';
|
|
3
|
+
export { A as AuthService, L as LoginOptions, M as MFAVerifyOptions, R as RoleDeniedError, a as authService, f as formatUserRoles, c as getAvatarFallback, g as getDisplayName, e as getGreeting, d as getUserEmail, b as getUserInitials, i as isRoleDeniedError } from '../user-utils-BtLu_jhF.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* HTTP Client
|
|
@@ -85,6 +85,9 @@ declare const authApi: {
|
|
|
85
85
|
/**
|
|
86
86
|
* Logout the current user.
|
|
87
87
|
* Returns SSO logout URL if applicable for SSO users.
|
|
88
|
+
*
|
|
89
|
+
* Note: API errors are logged via onAuthError callback but still return success
|
|
90
|
+
* so the client can clear local state even if the server call fails.
|
|
88
91
|
*/
|
|
89
92
|
logout(): Promise<LogoutResponse>;
|
|
90
93
|
/**
|
|
@@ -233,6 +236,8 @@ declare const authApi: {
|
|
|
233
236
|
}>;
|
|
234
237
|
/**
|
|
235
238
|
* Get user preferences.
|
|
239
|
+
*
|
|
240
|
+
* @throws Error if the API returns a malformed response
|
|
236
241
|
*/
|
|
237
242
|
getPreferences(customFetch?: typeof fetch): Promise<UserPreferences>;
|
|
238
243
|
/**
|
|
@@ -248,7 +253,10 @@ declare const authApi: {
|
|
|
248
253
|
*/
|
|
249
254
|
unlinkSSOAccount(provider: string, password?: string): Promise<void>;
|
|
250
255
|
/**
|
|
251
|
-
* Link an SSO account (redirects to SSO provider).
|
|
256
|
+
* Link an SSO account (redirects to SSO provider via form POST).
|
|
257
|
+
*
|
|
258
|
+
* Uses form submission to avoid exposing the access token in URL parameters,
|
|
259
|
+
* which could leak via browser history, referrer headers, or server logs.
|
|
252
260
|
*/
|
|
253
261
|
linkSSOAccount(provider?: string): Promise<void>;
|
|
254
262
|
/**
|
|
@@ -264,228 +272,6 @@ declare const authApi: {
|
|
|
264
272
|
}>;
|
|
265
273
|
};
|
|
266
274
|
|
|
267
|
-
/**
|
|
268
|
-
* Auth Service
|
|
269
|
-
*
|
|
270
|
-
* Business logic layer for authentication operations.
|
|
271
|
-
* Wraps authApi calls and provides a clean interface for components.
|
|
272
|
-
*/
|
|
273
|
-
|
|
274
|
-
interface LoginOptions {
|
|
275
|
-
/**
|
|
276
|
-
* Automatically update the auth store after successful login.
|
|
277
|
-
* Set to false to manually handle auth state.
|
|
278
|
-
* @default true
|
|
279
|
-
*/
|
|
280
|
-
autoSetAuth?: boolean;
|
|
281
|
-
}
|
|
282
|
-
interface MFAVerifyOptions {
|
|
283
|
-
/**
|
|
284
|
-
* Automatically update the auth store after successful MFA verification.
|
|
285
|
-
* Set to false to manually handle auth state.
|
|
286
|
-
* @default true
|
|
287
|
-
*/
|
|
288
|
-
autoSetAuth?: boolean;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* AuthService
|
|
292
|
-
*
|
|
293
|
-
* Provides a clean interface for authentication operations.
|
|
294
|
-
* Can be instantiated for testing or used via the singleton export.
|
|
295
|
-
*/
|
|
296
|
-
declare class AuthService {
|
|
297
|
-
/**
|
|
298
|
-
* Login with username and password.
|
|
299
|
-
* By default, automatically sets the auth state on successful login (unless MFA is required).
|
|
300
|
-
* @param credentials - Username and password
|
|
301
|
-
* @param options - Optional settings for login behavior
|
|
302
|
-
*/
|
|
303
|
-
login(credentials: LoginCredentials, options?: LoginOptions): Promise<LoginResponse>;
|
|
304
|
-
/**
|
|
305
|
-
* Logout the current user.
|
|
306
|
-
* Returns SSO logout URL if applicable for SSO users.
|
|
307
|
-
*/
|
|
308
|
-
logout(): Promise<LogoutResponse>;
|
|
309
|
-
/**
|
|
310
|
-
* Register a new user.
|
|
311
|
-
*/
|
|
312
|
-
register(data: RegisterData): Promise<RegisterResponse>;
|
|
313
|
-
/**
|
|
314
|
-
* Request a password reset email.
|
|
315
|
-
*/
|
|
316
|
-
forgotPassword(email: string): Promise<void>;
|
|
317
|
-
/**
|
|
318
|
-
* Reset password with a token.
|
|
319
|
-
*/
|
|
320
|
-
resetPassword(token: string, newPassword: string): Promise<void>;
|
|
321
|
-
/**
|
|
322
|
-
* Change the current user's password.
|
|
323
|
-
*/
|
|
324
|
-
changePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
325
|
-
/**
|
|
326
|
-
* Refresh the access token.
|
|
327
|
-
*/
|
|
328
|
-
refreshToken(refreshToken: string): Promise<{
|
|
329
|
-
accessToken: string;
|
|
330
|
-
refreshToken: string;
|
|
331
|
-
}>;
|
|
332
|
-
/**
|
|
333
|
-
* Initiate SSO login (redirects to SSO provider).
|
|
334
|
-
* @param options.callbackUrl - The URL where the SSO provider should redirect after auth
|
|
335
|
-
* @param options.redirectUrl - The final URL to redirect to after processing the callback
|
|
336
|
-
*/
|
|
337
|
-
initiateSSOLogin(options?: {
|
|
338
|
-
callbackUrl?: string;
|
|
339
|
-
redirectUrl?: string;
|
|
340
|
-
}): void;
|
|
341
|
-
/**
|
|
342
|
-
* Get the current user's profile.
|
|
343
|
-
*/
|
|
344
|
-
getProfile(customFetch?: typeof fetch): Promise<User>;
|
|
345
|
-
/**
|
|
346
|
-
* Update the current user's profile.
|
|
347
|
-
*/
|
|
348
|
-
updateProfile(data: ProfileUpdateData): Promise<User>;
|
|
349
|
-
/**
|
|
350
|
-
* Resend email verification.
|
|
351
|
-
*/
|
|
352
|
-
resendVerification(): Promise<void>;
|
|
353
|
-
/**
|
|
354
|
-
* Verify email with a token.
|
|
355
|
-
*/
|
|
356
|
-
verifyEmail(token: string): Promise<{
|
|
357
|
-
message: string;
|
|
358
|
-
user?: User;
|
|
359
|
-
}>;
|
|
360
|
-
/**
|
|
361
|
-
* Get all active sessions.
|
|
362
|
-
*/
|
|
363
|
-
getSessions(customFetch?: typeof fetch): Promise<{
|
|
364
|
-
sessions: Session[];
|
|
365
|
-
total: number;
|
|
366
|
-
}>;
|
|
367
|
-
/**
|
|
368
|
-
* Revoke a specific session.
|
|
369
|
-
*/
|
|
370
|
-
revokeSession(sessionId: string): Promise<void>;
|
|
371
|
-
/**
|
|
372
|
-
* Revoke all sessions except the current one.
|
|
373
|
-
*/
|
|
374
|
-
revokeAllSessions(): Promise<void>;
|
|
375
|
-
/**
|
|
376
|
-
* Get all API keys.
|
|
377
|
-
*/
|
|
378
|
-
getApiKeys(customFetch?: typeof fetch): Promise<{
|
|
379
|
-
apiKeys: ApiKey[];
|
|
380
|
-
}>;
|
|
381
|
-
/**
|
|
382
|
-
* Create a new API key.
|
|
383
|
-
*/
|
|
384
|
-
createApiKey(data: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
|
|
385
|
-
/**
|
|
386
|
-
* Revoke an API key.
|
|
387
|
-
*/
|
|
388
|
-
revokeApiKey(keyId: string): Promise<void>;
|
|
389
|
-
/**
|
|
390
|
-
* Update an API key's name.
|
|
391
|
-
*/
|
|
392
|
-
updateApiKey(keyId: string, name: string): Promise<void>;
|
|
393
|
-
/**
|
|
394
|
-
* Get MFA status for the current user.
|
|
395
|
-
*/
|
|
396
|
-
getMFAStatus(): Promise<MFAStatus>;
|
|
397
|
-
/**
|
|
398
|
-
* Setup MFA (get QR code and backup codes).
|
|
399
|
-
*/
|
|
400
|
-
setupMFA(): Promise<MFASetupResponse>;
|
|
401
|
-
/**
|
|
402
|
-
* Verify MFA setup with a code.
|
|
403
|
-
*/
|
|
404
|
-
verifyMFASetup(code: string): Promise<void>;
|
|
405
|
-
/**
|
|
406
|
-
* Disable MFA.
|
|
407
|
-
*/
|
|
408
|
-
disableMFA(password: string): Promise<void>;
|
|
409
|
-
/**
|
|
410
|
-
* Regenerate MFA backup codes.
|
|
411
|
-
*/
|
|
412
|
-
regenerateBackupCodes(password: string): Promise<{
|
|
413
|
-
backupCodes: string[];
|
|
414
|
-
}>;
|
|
415
|
-
/**
|
|
416
|
-
* Verify MFA challenge during login.
|
|
417
|
-
* By default, automatically sets the auth state on successful verification.
|
|
418
|
-
* @param data - MFA challenge data including token and code
|
|
419
|
-
* @param options - Optional settings for verification behavior
|
|
420
|
-
*/
|
|
421
|
-
verifyMFAChallenge(data: MFAChallengeData, options?: MFAVerifyOptions): Promise<LoginResponse>;
|
|
422
|
-
/**
|
|
423
|
-
* Get all devices.
|
|
424
|
-
*/
|
|
425
|
-
getDevices(customFetch?: typeof fetch): Promise<{
|
|
426
|
-
devices: Device[];
|
|
427
|
-
}>;
|
|
428
|
-
/**
|
|
429
|
-
* Trust a device.
|
|
430
|
-
*/
|
|
431
|
-
trustDevice(deviceId: string): Promise<void>;
|
|
432
|
-
/**
|
|
433
|
-
* Revoke device trust.
|
|
434
|
-
*/
|
|
435
|
-
revokeDevice(deviceId: string): Promise<void>;
|
|
436
|
-
/**
|
|
437
|
-
* Remove a device completely.
|
|
438
|
-
*/
|
|
439
|
-
removeDevice(deviceId: string): Promise<void>;
|
|
440
|
-
/**
|
|
441
|
-
* Approve a device with a token.
|
|
442
|
-
*/
|
|
443
|
-
approveDevice(token: string): Promise<{
|
|
444
|
-
message: string;
|
|
445
|
-
device?: Device;
|
|
446
|
-
}>;
|
|
447
|
-
/**
|
|
448
|
-
* Block a device with a token.
|
|
449
|
-
*/
|
|
450
|
-
blockDevice(token: string): Promise<{
|
|
451
|
-
message: string;
|
|
452
|
-
device?: Device;
|
|
453
|
-
}>;
|
|
454
|
-
/**
|
|
455
|
-
* Get user preferences.
|
|
456
|
-
*/
|
|
457
|
-
getPreferences(customFetch?: typeof fetch): Promise<UserPreferences>;
|
|
458
|
-
/**
|
|
459
|
-
* Update user preferences.
|
|
460
|
-
*/
|
|
461
|
-
updatePreferences(data: Partial<UserPreferences>): Promise<void>;
|
|
462
|
-
/**
|
|
463
|
-
* Get SSO linked accounts.
|
|
464
|
-
*/
|
|
465
|
-
getLinkedAccounts(customFetch?: typeof fetch): Promise<LinkedAccount[]>;
|
|
466
|
-
/**
|
|
467
|
-
* Link an SSO account (redirects to SSO provider).
|
|
468
|
-
*/
|
|
469
|
-
linkAccount(provider?: string): Promise<void>;
|
|
470
|
-
/**
|
|
471
|
-
* Unlink an SSO account.
|
|
472
|
-
*/
|
|
473
|
-
unlinkAccount(provider: string, password?: string): Promise<void>;
|
|
474
|
-
/**
|
|
475
|
-
* Get security event history.
|
|
476
|
-
*/
|
|
477
|
-
getSecurityEvents(params?: {
|
|
478
|
-
page?: number;
|
|
479
|
-
limit?: number;
|
|
480
|
-
type?: string;
|
|
481
|
-
}, customFetch?: typeof fetch): Promise<{
|
|
482
|
-
events: SecurityEvent[];
|
|
483
|
-
pagination: Pagination;
|
|
484
|
-
}>;
|
|
485
|
-
}
|
|
486
|
-
/** Singleton instance of AuthService */
|
|
487
|
-
declare const authService: AuthService;
|
|
488
|
-
|
|
489
275
|
/**
|
|
490
276
|
* Auth Guards
|
|
491
277
|
*
|
|
@@ -606,4 +392,4 @@ declare function getTokenExpiration(token: string): Date | null;
|
|
|
606
392
|
*/
|
|
607
393
|
declare function extractClaims<T extends string>(token: string, claims: T[]): Pick<JWTPayload, T> | null;
|
|
608
394
|
|
|
609
|
-
export { ApiKey, type ApiRequestOptions, type ApiResponse,
|
|
395
|
+
export { ApiKey, type ApiRequestOptions, type ApiResponse, ChangePasswordData, CreateApiKeyRequest, CreateApiKeyResponse, Device, type JWTPayload, LinkedAccount, LoginCredentials, LoginResponse, LogoutResponse, MFAChallengeData, MFASetupResponse, MFAStatus, Pagination, ProfileUpdateData, RegisterData, RegisterResponse, SecurityEvent, Session, User, UserPreferences, api, apiRequest, authApi, clearStoredAuth, decodeJWT, extractClaims, extractData, getAccessToken, getAvailableMethods, getMfaToken, getRefreshToken, getSessionToken, getTokenExpiration, getTokenRemainingTime, isLoginSuccessResponse, isMfaChallengeResponse, isTokenExpired, updateStoredTokens };
|
package/dist/core/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AuthService, authService, getAvailableMethods, getMfaToken, isLoginSuccessResponse, isMfaChallengeResponse } from '../chunk-
|
|
2
|
-
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-
|
|
1
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from '../chunk-XSQYERC6.js';
|
|
2
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from '../chunk-ES4UOD62.js';
|
|
3
3
|
export { decodeJWT, extractClaims, getConfig, getDefaultStorage, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, initAuth, isInitialized, isTokenExpired, resetConfig } from '../chunk-DCGC6CNV.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { A as AuthConfig, S as SSOConfig, e as StorageAdapter, g as getConfig, b as getDefaultStorage, d as getFetch, c as getStorage, i as initAuth, a as isInitialized, r as resetConfig } from './
|
|
2
|
-
export { ApiRequestOptions, ApiResponse,
|
|
3
|
-
export {
|
|
4
|
-
export { AuthGuardOptions, AuthGuardResult, authActions, authStore, checkAuth, createAuthGuard, currentUser, isAuthenticated, protectedLoad, requireAuth, requirePermission, requireRole } from './svelte/index.js';
|
|
1
|
+
export { m as ApiKey, A as AuthConfig, f as AuthState, v as ChangePasswordData, C as CreateApiKeyRequest, n as CreateApiKeyResponse, D as Device, s as LinkedAccount, L as LoginCredentials, h as LoginResponse, j as LogoutResponse, p as MFAChallengeData, M as MFASetupResponse, o as MFAStatus, P as Pagination, u as ProfileUpdateData, R as RegisterData, k as RegisterResponse, w as ResetPasswordData, S as SSOConfig, t as SecurityEvent, l as Session, e as StorageAdapter, U as User, q as UserPreferences, g as getConfig, b as getDefaultStorage, d as getFetch, c as getStorage, i as initAuth, a as isInitialized, r as resetConfig } from './types-Ct5g1Nbj.js';
|
|
2
|
+
export { ApiRequestOptions, ApiResponse, JWTPayload, api, apiRequest, authApi, clearStoredAuth, decodeJWT, extractClaims, extractData, getAccessToken, getAvailableMethods, getMfaToken, getRefreshToken, getSessionToken, getTokenExpiration, getTokenRemainingTime, isLoginSuccessResponse, isMfaChallengeResponse, isTokenExpired, updateStoredTokens } from './core/index.js';
|
|
3
|
+
export { A as AuthService, L as LoginOptions, M as MFAVerifyOptions, R as RoleDeniedError, a as authService, f as formatUserRoles, c as getAvatarFallback, g as getDisplayName, e as getGreeting, d as getUserEmail, b as getUserInitials, i as isRoleDeniedError } from './user-utils-BtLu_jhF.js';
|
|
4
|
+
export { AuthClient, AuthGuardOptions, AuthGuardResult, AuthHookOptions, CreateAuthClientOptions, NavFilterOptions, RoleRestrictedItem, authActions, authStore, canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, currentUser, filterByAccess, filterNavSections, isAuthenticated, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './svelte/index.js';
|
|
5
|
+
import '@sveltejs/kit';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-
|
|
4
|
-
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-
|
|
1
|
+
export { canAccess, checkAuth, createAuthClient, createAuthGuard, createAuthHook, createNavFilter, filterByAccess, filterNavSections, matchesRoute, protectedLoad, requireAuth, requirePermission, requireRole, routePatterns } from './chunk-YTMFXVJR.js';
|
|
2
|
+
export { AuthService, RoleDeniedError, authService, formatUserRoles, getAvailableMethods, getAvatarFallback, getDisplayName, getGreeting, getMfaToken, getUserEmail, getUserInitials, isLoginSuccessResponse, isMfaChallengeResponse, isRoleDeniedError } from './chunk-XSQYERC6.js';
|
|
3
|
+
export { authActions, authStore, currentUser, isAuthenticated } from './chunk-DSNTNK6T.js';
|
|
4
|
+
export { api, apiRequest, authApi, clearStoredAuth, extractData, getAccessToken, getRefreshToken, getSessionToken, updateStoredTokens } from './chunk-ES4UOD62.js';
|
|
5
5
|
export { decodeJWT, extractClaims, getConfig, getDefaultStorage, getFetch, getStorage, getTokenExpiration, getTokenRemainingTime, initAuth, isInitialized, isTokenExpired, resetConfig } from './chunk-DCGC6CNV.js';
|