@vunexa/lixa 0.1.6-alpha.8 → 0.1.6-alpha.9
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/dao/session-cache.d.ts +2 -1
- package/dist/dao/session-cache.d.ts.map +1 -1
- package/dist/dao/state-cache.d.ts +4 -0
- package/dist/dao/state-cache.d.ts.map +1 -1
- package/dist/dao/types.d.ts +21 -75
- package/dist/dao/types.d.ts.map +1 -1
- package/dist/export-types/index.d.ts +177 -94
- package/dist/express.d.ts +103 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/index.cjs +212 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +166 -95
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -97
- package/dist/index.js.map +1 -1
- package/dist/lixa.d.ts +14 -19
- package/dist/lixa.d.ts.map +1 -1
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/cookies.d.ts +1 -1
- package/dist/utils/cookies.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -314,10 +314,20 @@ interface StateHandler {
|
|
|
314
314
|
* }
|
|
315
315
|
* ```
|
|
316
316
|
*/
|
|
317
|
+
/**
|
|
318
|
+
* Generates OAuth state parameter and associated data (camelCase).
|
|
319
|
+
*/
|
|
317
320
|
generateState?(provider: string): Promise<{
|
|
318
321
|
state: string;
|
|
319
322
|
data: StateData;
|
|
320
323
|
}>;
|
|
324
|
+
/**
|
|
325
|
+
* Generates OAuth state parameter and associated data (PascalCase alias for backward compatibility).
|
|
326
|
+
*/
|
|
327
|
+
GenerateState?(provider: string): Promise<{
|
|
328
|
+
state: string;
|
|
329
|
+
data: StateData;
|
|
330
|
+
}>;
|
|
321
331
|
/**
|
|
322
332
|
* State storage operations.
|
|
323
333
|
*
|
|
@@ -343,7 +353,7 @@ interface SessionStorage {
|
|
|
343
353
|
* Saves a session with expiration.
|
|
344
354
|
*
|
|
345
355
|
* @param sessionId - Unique session identifier
|
|
346
|
-
* @param session - Session data from
|
|
356
|
+
* @param session - Session data from generateSession()
|
|
347
357
|
* @param expiresInSeconds - TTL in seconds (typically 86400 for 24 hours)
|
|
348
358
|
*/
|
|
349
359
|
saveSession<T extends Session>(sessionId: string, session: T, expiresInSeconds: number): Promise<void>;
|
|
@@ -423,13 +433,13 @@ interface ResourceHandler {
|
|
|
423
433
|
* @remarks
|
|
424
434
|
* The SessionHandler manages session generation and storage after successful OAuth authentication.
|
|
425
435
|
*
|
|
426
|
-
* -
|
|
436
|
+
* - generateSession: Optional. Customizes how OAuth tokens are converted into session data.
|
|
427
437
|
* If not provided, uses default implementation (access token as session token).
|
|
428
438
|
*
|
|
429
|
-
* -
|
|
439
|
+
* - sessionStorage: Optional. Provides custom session storage (save/get/delete operations).
|
|
430
440
|
* If not provided, uses in-memory cache (not suitable for production).
|
|
431
441
|
*
|
|
432
|
-
* For production, implement both
|
|
442
|
+
* For production, implement both generateSession (for user creation/lookup) and sessionStorage
|
|
433
443
|
* (for persistent session storage with Redis, database, etc.).
|
|
434
444
|
*
|
|
435
445
|
* @example
|
|
@@ -438,7 +448,7 @@ interface ResourceHandler {
|
|
|
438
448
|
* import { SessionHandler, Session, OAuthTokenResponse, ProviderMetadata, extractUserInfo } from '@vunexa/lixa';
|
|
439
449
|
*
|
|
440
450
|
* const sessionHandler: SessionHandler = {
|
|
441
|
-
*
|
|
451
|
+
* generateSession: async (tokenData, providerMetadata) => {
|
|
442
452
|
* // Extract user info and create/retrieve user
|
|
443
453
|
* const { userInfo } = await extractUserInfo(tokenData, providerMetadata);
|
|
444
454
|
* const user = await db.users.upsert({
|
|
@@ -457,7 +467,7 @@ interface ResourceHandler {
|
|
|
457
467
|
* };
|
|
458
468
|
* },
|
|
459
469
|
*
|
|
460
|
-
*
|
|
470
|
+
* sessionStorage: {
|
|
461
471
|
* saveSession: async (sessionId, session, expiresInSeconds) => {
|
|
462
472
|
* const expiresAt = new Date(Date.now() + expiresInSeconds * 1000);
|
|
463
473
|
* await db.sessions.create({
|
|
@@ -483,78 +493,21 @@ interface ResourceHandler {
|
|
|
483
493
|
* };
|
|
484
494
|
* ```
|
|
485
495
|
*
|
|
486
|
-
* @example
|
|
487
|
-
* Minimal implementation (uses defaults):
|
|
488
|
-
* ```typescript
|
|
489
|
-
* const sessionHandler: SessionHandler = {
|
|
490
|
-
* storage: {
|
|
491
|
-
* saveSession: async (sessionId, session, expiresInSeconds) => {
|
|
492
|
-
* await redis.setex(sessionId, expiresInSeconds, JSON.stringify(session));
|
|
493
|
-
* },
|
|
494
|
-
* getSession: async (sessionId) => {
|
|
495
|
-
* const data = await redis.get(sessionId);
|
|
496
|
-
* return data ? JSON.parse(data) : null;
|
|
497
|
-
* },
|
|
498
|
-
* deleteSession: async (sessionId) => {
|
|
499
|
-
* await redis.del(sessionId);
|
|
500
|
-
* }
|
|
501
|
-
* }
|
|
502
|
-
* };
|
|
503
|
-
* ```
|
|
504
|
-
*
|
|
505
496
|
* @public
|
|
506
497
|
*/
|
|
507
498
|
interface SessionHandler {
|
|
508
499
|
/**
|
|
509
|
-
* Generates session data from OAuth token data.
|
|
500
|
+
* Generates session data from OAuth token data (camelCase).
|
|
510
501
|
*
|
|
511
502
|
* @param tokenData - The token data received from the OAuth provider's token endpoint
|
|
512
503
|
* @param providerMetadata - Provider metadata including name and endpoints
|
|
513
504
|
* @returns A Promise that resolves to session data
|
|
514
|
-
*
|
|
515
|
-
* @remarks
|
|
516
|
-
* This method is responsible for creating session data from OAuth tokens.
|
|
517
|
-
* It is called after successfully exchanging the authorization code for tokens.
|
|
518
|
-
*
|
|
519
|
-
* Token Data:
|
|
520
|
-
* - access_token: OAuth access token
|
|
521
|
-
* - refresh_token: OAuth refresh token (optional)
|
|
522
|
-
* - expires_in: Token expiration time in seconds
|
|
523
|
-
* - token_type: Token type (usually "Bearer")
|
|
524
|
-
* - id_token: OpenID Connect ID token (for OIDC providers)
|
|
525
|
-
* - scope: Granted scopes
|
|
526
|
-
*
|
|
527
|
-
* Provider Metadata:
|
|
528
|
-
* - name: The provider name (e.g., 'google', 'github')
|
|
529
|
-
* - endpoints: Provider endpoints (authorization, token, userInfo)
|
|
530
|
-
*
|
|
531
|
-
* Your implementation should:
|
|
532
|
-
* 1. Extract user info (using extractUserInfo or decode ID token)
|
|
533
|
-
* 2. Create or lookup users in your database
|
|
534
|
-
* 3. Build and return session data with any custom fields
|
|
535
|
-
*
|
|
536
|
-
* Note: This method should NOT store the session. Storage is handled by the storage object.
|
|
537
|
-
*
|
|
538
|
-
* If not provided, defaults to using the access token as the session token.
|
|
539
|
-
*
|
|
540
|
-
* @example
|
|
541
|
-
* ```typescript
|
|
542
|
-
* GenerateSession: async (tokenData, providerMetadata) => {
|
|
543
|
-
* const { userInfo } = await extractUserInfo(tokenData, providerMetadata);
|
|
544
|
-
* const user = await db.users.upsert({ email: userInfo.email });
|
|
545
|
-
*
|
|
546
|
-
* return {
|
|
547
|
-
* token: tokenData.access_token,
|
|
548
|
-
* raw: {
|
|
549
|
-
* ...tokenData,
|
|
550
|
-
* userId: user.id,
|
|
551
|
-
* provider: providerMetadata.name
|
|
552
|
-
* }
|
|
553
|
-
* };
|
|
554
|
-
* }
|
|
555
|
-
* ```
|
|
556
505
|
*/
|
|
557
506
|
generateSession?<T extends Session>(tokenData: OAuthTokenResponse, providerMetadata: ProviderMetadata): Promise<T>;
|
|
507
|
+
/**
|
|
508
|
+
* Generates session data from OAuth token data (PascalCase alias for backward compatibility).
|
|
509
|
+
*/
|
|
510
|
+
GenerateSession?<T extends Session>(tokenData: OAuthTokenResponse, providerMetadata: ProviderMetadata): Promise<T>;
|
|
558
511
|
/**
|
|
559
512
|
* Session storage operations.
|
|
560
513
|
*
|
|
@@ -565,13 +518,6 @@ interface SessionHandler {
|
|
|
565
518
|
* If not provided, uses in-memory cache (not suitable for production).
|
|
566
519
|
*/
|
|
567
520
|
sessionStorage?: SessionStorage;
|
|
568
|
-
/**
|
|
569
|
-
* Optional method to generate session data from OAuth tokens.
|
|
570
|
-
*
|
|
571
|
-
* @remarks
|
|
572
|
-
* If not provided, uses default implementation from LocalSessionHandler.
|
|
573
|
-
*/
|
|
574
|
-
generateSession?<T extends Session>(tokenData: OAuthTokenResponse, providerMetadata: ProviderMetadata): Promise<T>;
|
|
575
521
|
}
|
|
576
522
|
|
|
577
523
|
/**
|
|
@@ -759,6 +705,12 @@ type ProviderConfig = {
|
|
|
759
705
|
redirectUri: string;
|
|
760
706
|
/** Array of OAuth scopes to request */
|
|
761
707
|
scopes: string[];
|
|
708
|
+
/**
|
|
709
|
+
* Set to true to allow non-identity (resource) scopes during primary authentication flow.
|
|
710
|
+
* By default (false), Lixa restricts primary AuthN scopes to identity scopes to maintain
|
|
711
|
+
* clean AuthN vs AuthZ separation.
|
|
712
|
+
*/
|
|
713
|
+
allowNonAuthScopes?: boolean;
|
|
762
714
|
/** Additional provider-specific configuration parameters */
|
|
763
715
|
extraConfig?: Record<string, string>;
|
|
764
716
|
} & ({
|
|
@@ -924,6 +876,28 @@ interface LixaConfig<TProviders extends Record<string, ProviderConfig> = Record<
|
|
|
924
876
|
* Format: [Lixa] [timestamp] [level] [context] message
|
|
925
877
|
*/
|
|
926
878
|
debug?: boolean;
|
|
879
|
+
/**
|
|
880
|
+
* Optional custom structured logger implementation.
|
|
881
|
+
* If provided, all Lixa logs will be routed through this logger.
|
|
882
|
+
*/
|
|
883
|
+
logger?: LixaLogger;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Log level for Lixa structured logging.
|
|
887
|
+
* @public
|
|
888
|
+
*/
|
|
889
|
+
type LogLevel = "INFO" | "WARN" | "ERROR" | "DEBUG";
|
|
890
|
+
/**
|
|
891
|
+
* Log context for Lixa structured logging.
|
|
892
|
+
* @public
|
|
893
|
+
*/
|
|
894
|
+
type LogContext = "Init" | "Auth" | "Token" | "Session" | "State" | "AccountLinking" | "Resource";
|
|
895
|
+
/**
|
|
896
|
+
* Custom logger interface for Lixa.
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
interface LixaLogger {
|
|
900
|
+
log(level: LogLevel, context: LogContext, message: string, data?: Record<string, unknown>): void;
|
|
927
901
|
}
|
|
928
902
|
/**
|
|
929
903
|
* Helper type to create a configuration with only registered providers.
|
|
@@ -997,8 +971,11 @@ type ConfiguredProviderKey<T extends LixaConfig<Record<string, ProviderConfig>>>
|
|
|
997
971
|
declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> = LixaConfig> {
|
|
998
972
|
private static DEFAULT_PROVIDERS;
|
|
999
973
|
private static CONFIGURED_PROVIDERS;
|
|
1000
|
-
private
|
|
1001
|
-
private
|
|
974
|
+
private localStateHandler;
|
|
975
|
+
private localSessionHandler;
|
|
976
|
+
private localResourceHandler;
|
|
977
|
+
private userResourceStore;
|
|
978
|
+
private refreshMutexes;
|
|
1002
979
|
private config;
|
|
1003
980
|
private stateHandler;
|
|
1004
981
|
private sessionHandler;
|
|
@@ -1035,16 +1012,12 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1035
1012
|
*/
|
|
1036
1013
|
private validateProviderImplementation;
|
|
1037
1014
|
/**
|
|
1038
|
-
* Structured
|
|
1015
|
+
* Structured logging with standardized format and custom logger support.
|
|
1039
1016
|
*
|
|
1040
|
-
* @param level - Log level (INFO, WARN, ERROR)
|
|
1041
|
-
* @param context - Context of the log (Init, Auth, Token, Session, State)
|
|
1017
|
+
* @param level - Log level (INFO, WARN, ERROR, DEBUG)
|
|
1018
|
+
* @param context - Context of the log (Init, Auth, Token, Session, State, AccountLinking, Resource)
|
|
1042
1019
|
* @param message - Log message
|
|
1043
1020
|
* @param data - Optional data to log
|
|
1044
|
-
*
|
|
1045
|
-
* @remarks
|
|
1046
|
-
* Format: [Lixa] [timestamp] [level] [context] message
|
|
1047
|
-
* Only logs when debug mode is enabled.
|
|
1048
1021
|
*/
|
|
1049
1022
|
private log;
|
|
1050
1023
|
/**
|
|
@@ -1243,7 +1216,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1243
1216
|
*/
|
|
1244
1217
|
getAuthUrl(provider: ConfiguredProviderKey<TConfig> | string, state?: string): Promise<string>;
|
|
1245
1218
|
/**
|
|
1246
|
-
* Restricts primary authentication scopes strictly to AuthN identity scopes.
|
|
1219
|
+
* Restricts primary authentication scopes strictly to AuthN identity scopes unless allowNonAuthScopes is true.
|
|
1247
1220
|
*/
|
|
1248
1221
|
private resolveAuthNScopes;
|
|
1249
1222
|
/**
|
|
@@ -1309,14 +1282,6 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1309
1282
|
prompt?: string;
|
|
1310
1283
|
extraConfig?: Record<string, string>;
|
|
1311
1284
|
}): Promise<string>;
|
|
1312
|
-
/**
|
|
1313
|
-
* Handles the OAuth callback for a connected resource provider and stores resource tokens on the session.
|
|
1314
|
-
*
|
|
1315
|
-
* @param params - Object containing sessionId, provider, code, state, and requested scopes
|
|
1316
|
-
* @returns Updated Session containing stored resource tokens under session.resources[provider]
|
|
1317
|
-
*/
|
|
1318
|
-
private static userResourceStore;
|
|
1319
|
-
static LOCAL_RESOURCE_HANDLER: ResourceHandler;
|
|
1320
1285
|
private getUserKeyFromSession;
|
|
1321
1286
|
/**
|
|
1322
1287
|
* Handles the OAuth callback for a connected resource provider and stores resource tokens bound to user account.
|
|
@@ -1349,11 +1314,16 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1349
1314
|
getConnectedResource(sessionId: string, provider: string): Promise<ConnectedResource | null>;
|
|
1350
1315
|
/**
|
|
1351
1316
|
* Refreshes a user's resource access token using its refresh token.
|
|
1317
|
+
* Deduplicates concurrent refresh requests via an in-flight promise mutex.
|
|
1352
1318
|
*
|
|
1353
1319
|
* @param userIdOrEmail - User identifier or email
|
|
1354
1320
|
* @param provider - Provider identifier (e.g. 'google', 'github')
|
|
1355
1321
|
*/
|
|
1356
1322
|
refreshUserResourceToken(userIdOrEmail: string, provider: string, existingResource?: ConnectedResource): Promise<ConnectedResource>;
|
|
1323
|
+
/**
|
|
1324
|
+
* Internal execution of refresh token exchange.
|
|
1325
|
+
*/
|
|
1326
|
+
private executeRefreshUserResourceToken;
|
|
1357
1327
|
/**
|
|
1358
1328
|
* Refreshes a connected resource access token for an active session.
|
|
1359
1329
|
*/
|
|
@@ -1622,7 +1592,7 @@ declare const DEFAULT_STATE_COOKIE_NAME = "lixa_oauth_state";
|
|
|
1622
1592
|
*/
|
|
1623
1593
|
declare const DEFAULT_SESSION_MAX_AGE_SECONDS: number;
|
|
1624
1594
|
/**
|
|
1625
|
-
* Default OAuth state max age in seconds (
|
|
1595
|
+
* Default OAuth state max age in seconds (5 minutes / 300 seconds).
|
|
1626
1596
|
* @public
|
|
1627
1597
|
*/
|
|
1628
1598
|
declare const DEFAULT_STATE_MAX_AGE_SECONDS: number;
|
|
@@ -1693,4 +1663,105 @@ declare function createStateCookie(state: string, options?: CookieOptions): Cook
|
|
|
1693
1663
|
*/
|
|
1694
1664
|
declare function clearStateCookie(options?: CookieOptions): CookiePayload;
|
|
1695
1665
|
|
|
1696
|
-
|
|
1666
|
+
/**
|
|
1667
|
+
* Duck-typed Express request interface for framework-agnostic typing.
|
|
1668
|
+
* @public
|
|
1669
|
+
*/
|
|
1670
|
+
interface ExpressLikeRequest {
|
|
1671
|
+
cookies?: Record<string, string>;
|
|
1672
|
+
sessionInfo?: any;
|
|
1673
|
+
sessionId?: string;
|
|
1674
|
+
[key: string]: any;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Duck-typed Express response interface for framework-agnostic typing.
|
|
1678
|
+
* @public
|
|
1679
|
+
*/
|
|
1680
|
+
interface ExpressLikeResponse {
|
|
1681
|
+
cookie(name: string, value: string, options?: any): any;
|
|
1682
|
+
status(code: number): this;
|
|
1683
|
+
json(body: any): any;
|
|
1684
|
+
redirect?(url: string): any;
|
|
1685
|
+
[key: string]: any;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Express-compatible NextFunction type.
|
|
1689
|
+
* @public
|
|
1690
|
+
*/
|
|
1691
|
+
type ExpressLikeNextFunction = (err?: any) => void;
|
|
1692
|
+
/**
|
|
1693
|
+
* Express-compatible RequestHandler type.
|
|
1694
|
+
* @public
|
|
1695
|
+
*/
|
|
1696
|
+
type ExpressLikeRequestHandler = (req: ExpressLikeRequest, res: ExpressLikeResponse, next: ExpressLikeNextFunction) => any;
|
|
1697
|
+
/**
|
|
1698
|
+
* Options for Express authentication helpers.
|
|
1699
|
+
* @public
|
|
1700
|
+
*/
|
|
1701
|
+
interface ExpressAuthHelperOptions {
|
|
1702
|
+
sessionCookieName?: string;
|
|
1703
|
+
sessionCookieOptions?: CookieOptions;
|
|
1704
|
+
stateCookieOptions?: CookieOptions;
|
|
1705
|
+
successRedirectUrl?: string;
|
|
1706
|
+
errorRedirectUrl?: string;
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Sets an RFC 6265bis compliant session cookie on an Express response.
|
|
1710
|
+
*
|
|
1711
|
+
* @param res - Express response object
|
|
1712
|
+
* @param sessionId - Unique session ID
|
|
1713
|
+
* @param options - Optional cookie attribute overrides
|
|
1714
|
+
*
|
|
1715
|
+
* @public
|
|
1716
|
+
*/
|
|
1717
|
+
declare function setSessionCookieOnResponse(res: ExpressLikeResponse, sessionId: string, options?: CookieOptions): void;
|
|
1718
|
+
/**
|
|
1719
|
+
* Clears the session cookie on an Express response.
|
|
1720
|
+
*
|
|
1721
|
+
* @param res - Express response object
|
|
1722
|
+
* @param options - Optional cookie attribute overrides
|
|
1723
|
+
*
|
|
1724
|
+
* @public
|
|
1725
|
+
*/
|
|
1726
|
+
declare function clearSessionCookieOnResponse(res: ExpressLikeResponse, options?: CookieOptions): void;
|
|
1727
|
+
/**
|
|
1728
|
+
* Sets an OAuth CSRF state cookie on an Express response.
|
|
1729
|
+
*
|
|
1730
|
+
* @param res - Express response object
|
|
1731
|
+
* @param state - OAuth state parameter
|
|
1732
|
+
* @param options - Optional cookie attribute overrides
|
|
1733
|
+
*
|
|
1734
|
+
* @public
|
|
1735
|
+
*/
|
|
1736
|
+
declare function setStateCookieOnResponse(res: ExpressLikeResponse, state: string, options?: CookieOptions): void;
|
|
1737
|
+
/**
|
|
1738
|
+
* Clears the OAuth CSRF state cookie on an Express response.
|
|
1739
|
+
*
|
|
1740
|
+
* @param res - Express response object
|
|
1741
|
+
* @param options - Optional cookie attribute overrides
|
|
1742
|
+
*
|
|
1743
|
+
* @public
|
|
1744
|
+
*/
|
|
1745
|
+
declare function clearStateCookieOnResponse(res: ExpressLikeResponse, options?: CookieOptions): void;
|
|
1746
|
+
/**
|
|
1747
|
+
* Creates an Express authentication middleware that verifies the session cookie and populates req.sessionInfo.
|
|
1748
|
+
*
|
|
1749
|
+
* @param lixa - Lixa instance
|
|
1750
|
+
* @param options - Optional session cookie name and custom unauthorized handler
|
|
1751
|
+
*
|
|
1752
|
+
* @example
|
|
1753
|
+
* ```typescript
|
|
1754
|
+
* const requireAuth = createRequireAuthMiddleware(lixa);
|
|
1755
|
+
* app.get('/protected', requireAuth, (req, res) => {
|
|
1756
|
+
* res.json({ user: req.sessionInfo });
|
|
1757
|
+
* });
|
|
1758
|
+
* ```
|
|
1759
|
+
*
|
|
1760
|
+
* @public
|
|
1761
|
+
*/
|
|
1762
|
+
declare function createRequireAuthMiddleware(lixa: Lixa<any>, options?: {
|
|
1763
|
+
sessionCookieName?: string;
|
|
1764
|
+
unauthorizedHandler?: (req: ExpressLikeRequest, res: ExpressLikeResponse) => void;
|
|
1765
|
+
}): ExpressLikeRequestHandler;
|
|
1766
|
+
|
|
1767
|
+
export { type AccountLinkingConfig, type AccountLinkingMode, AccountLinkingStrategy, AccountUnlinkError, type ConnectedResource, type CookieOptions, type CookiePayload, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_SESSION_MAX_AGE_SECONDS, DEFAULT_STATE_COOKIE_NAME, DEFAULT_STATE_MAX_AGE_SECONDS, EmailNotVerifiedError, type ExpressAuthHelperOptions, type IProvider, InvalidOAuthCallbackError, InvalidProviderConfigError, InvalidStateError, Lixa, type LixaConfig, LixaError, type LixaLogger, type LogContext, type LogLevel, type OAuthTokenResponse, type ProviderConfig, type ProviderMetadata, ProviderNotConfiguredError, RefreshTokenError, type ResourceHandler, type ResourceStorage, type SafeLixaConfig, type Session, type SessionHandler, SessionNotFoundError, type SessionStorage, type StateData, type StateHandler, type StateStorage, TokenExchangeError, type UserInfo, clearSessionCookie, clearSessionCookieOnResponse, clearStateCookie, clearStateCookieOnResponse, createRequireAuthMiddleware, createSessionCookie, createStateCookie, decodeIdToken, determineProviderFromIssuer, extractUserInfo, fetchUserInfo, isProductionEnvironment, serializeCookie, setSessionCookieOnResponse, setStateCookieOnResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
* @packageDocumentation
|
|
17
17
|
*/
|
|
18
18
|
export { Lixa } from "./lixa";
|
|
19
|
-
export { type ProviderConfig, type LixaConfig, type SafeLixaConfig, type IProvider, type Session, type ConnectedResource, type ProviderMetadata, type OAuthTokenResponse, type StateHandler, type StateStorage, type SessionHandler, type SessionStorage, type ResourceHandler, type ResourceStorage, type StateData, AccountLinkingStrategy, type AccountLinkingMode, type AccountLinkingConfig, } from "./types";
|
|
19
|
+
export { type ProviderConfig, type LixaConfig, type SafeLixaConfig, type IProvider, type Session, type ConnectedResource, type ProviderMetadata, type OAuthTokenResponse, type StateHandler, type StateStorage, type SessionHandler, type SessionStorage, type ResourceHandler, type ResourceStorage, type StateData, AccountLinkingStrategy, type AccountLinkingMode, type AccountLinkingConfig, type LogLevel, type LogContext, type LixaLogger, } from "./types";
|
|
20
20
|
export { type UserInfo, extractUserInfo, decodeIdToken, fetchUserInfo, determineProviderFromIssuer, } from "./utils/user-info";
|
|
21
21
|
export { LixaError, InvalidStateError, ProviderNotConfiguredError, InvalidProviderConfigError, InvalidOAuthCallbackError, TokenExchangeError, SessionNotFoundError, EmailNotVerifiedError, AccountUnlinkError, RefreshTokenError, } from "./errors";
|
|
22
22
|
export { type CookieOptions, type CookiePayload, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_STATE_COOKIE_NAME, DEFAULT_SESSION_MAX_AGE_SECONDS, DEFAULT_STATE_MAX_AGE_SECONDS, isProductionEnvironment, serializeCookie, createSessionCookie, clearSessionCookie, createStateCookie, clearStateCookie, } from "./utils/cookies";
|
|
23
|
+
export { type ExpressAuthHelperOptions, setSessionCookieOnResponse, clearSessionCookieOnResponse, setStateCookieOnResponse, clearStateCookieOnResponse, createRequireAuthMiddleware, } from "./express";
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,UAAU,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,QAAQ,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,EAC7B,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,wBAAwB,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,WAAW,CAAC"}
|