@vunexa/lixa 0.1.6-alpha.13 → 0.1.6-alpha.14
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/README.md +101 -687
- package/dist/credentials/types.d.ts +6 -6
- package/dist/credentials/types.d.ts.map +1 -1
- package/dist/dao/session-cache.d.ts.map +1 -1
- package/dist/dao/types.d.ts +19 -0
- package/dist/dao/types.d.ts.map +1 -1
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/export-types/index.d.ts +556 -41
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/self-managed.d.ts +52 -0
- package/dist/identity/self-managed.d.ts.map +1 -0
- package/dist/identity/types.d.ts +224 -0
- package/dist/identity/types.d.ts.map +1 -0
- package/dist/index.cjs +658 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +563 -65
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +654 -213
- package/dist/index.js.map +1 -1
- package/dist/lixa.d.ts +123 -28
- package/dist/lixa.d.ts.map +1 -1
- package/dist/models/session.d.ts +2 -2
- package/dist/models/session.d.ts.map +1 -1
- package/dist/providers/IProvider.d.ts +4 -0
- package/dist/providers/IProvider.d.ts.map +1 -1
- package/dist/types.d.ts +82 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -11
package/dist/lixa.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type LixaConfig, type ProviderConfig, type SignUpParams, type SignUpResult, type SignInParams, type SignInResult, type VerifyCredentialsParams, type ChangePasswordParams, type
|
|
1
|
+
import { type LixaConfig, type ProviderConfig, type SignUpParams, type SignUpResult, type SignInParams, type SignInResult, type VerifyCredentialsParams, type ChangePasswordParams, type UserIdentity, type ForgotPasswordParams, type ForgotPasswordResult, type ConfirmPasswordResetParams, type ConfirmSignUpParams, type ResendConfirmationCodeParams, type ResendConfirmationCodeResult, type IIdentityProvider, type SessionCookieResolver } from "./types";
|
|
2
2
|
import { IProvider } from "./providers";
|
|
3
3
|
import { type Session, type ConnectedResource } from "./models/session";
|
|
4
4
|
import { CredentialsManager } from "./credentials/credentials-manager";
|
|
5
5
|
/**
|
|
6
6
|
* Type representing the keys of configured providers
|
|
7
7
|
*/
|
|
8
|
-
type ConfiguredProviderKey<
|
|
8
|
+
export type ConfiguredProviderKey<TProviders extends Record<string, ProviderConfig>> = keyof TProviders & string;
|
|
9
9
|
/**
|
|
10
10
|
* A flexible, provider-agnostic OAuth 2.0 and OpenID Connect (OIDC) client library.
|
|
11
11
|
*
|
|
@@ -58,20 +58,25 @@ type ConfiguredProviderKey<T extends LixaConfig<Record<string, ProviderConfig>>>
|
|
|
58
58
|
*
|
|
59
59
|
* @public
|
|
60
60
|
*/
|
|
61
|
-
declare class Lixa<
|
|
61
|
+
declare class Lixa<TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
62
62
|
private static DEFAULT_PROVIDERS;
|
|
63
63
|
private static CONFIGURED_PROVIDERS;
|
|
64
64
|
private localStateHandler;
|
|
65
65
|
private localSessionHandler;
|
|
66
66
|
private localResourceHandler;
|
|
67
|
+
private localAccountHandler;
|
|
67
68
|
private userResourceStore;
|
|
69
|
+
private userAccountStore;
|
|
68
70
|
private refreshMutexes;
|
|
71
|
+
private identityProvider?;
|
|
69
72
|
private credentialsManager?;
|
|
70
73
|
private config;
|
|
71
74
|
private stateHandler;
|
|
72
75
|
private sessionHandler;
|
|
73
76
|
private resourceHandler;
|
|
77
|
+
private accountHandler;
|
|
74
78
|
private debug;
|
|
79
|
+
private sessionCookieResolver?;
|
|
75
80
|
/**
|
|
76
81
|
* Creates a new Lixa instance with the provided configuration.
|
|
77
82
|
*
|
|
@@ -85,7 +90,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
85
90
|
* @throws Error when provider implementation is missing required properties
|
|
86
91
|
* @throws Error when provider is not available and no inline implementation is provided
|
|
87
92
|
*/
|
|
88
|
-
constructor(config:
|
|
93
|
+
constructor(config: LixaConfig<TProviders>);
|
|
89
94
|
/**
|
|
90
95
|
* Validates that a provider configuration has all required credentials.
|
|
91
96
|
*
|
|
@@ -126,7 +131,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
126
131
|
* }
|
|
127
132
|
* ```
|
|
128
133
|
*/
|
|
129
|
-
isProviderConfigured<T extends string>(provider: T): provider is T & ConfiguredProviderKey<
|
|
134
|
+
isProviderConfigured<T extends string>(provider: T): provider is T & ConfiguredProviderKey<TProviders>;
|
|
130
135
|
/**
|
|
131
136
|
* Gets a provider implementation by name.
|
|
132
137
|
* Resolution priority: inline custom provider \> default providers \> legacy registry
|
|
@@ -307,7 +312,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
307
312
|
* res.redirect(authUrl);
|
|
308
313
|
* ```
|
|
309
314
|
*/
|
|
310
|
-
getAuthUrl(provider: ConfiguredProviderKey<
|
|
315
|
+
getAuthUrl(provider: ConfiguredProviderKey<TProviders> | string, state?: string): Promise<string>;
|
|
311
316
|
/**
|
|
312
317
|
* Restricts primary authentication scopes strictly to AuthN identity scopes unless allowNonAuthScopes is true.
|
|
313
318
|
*/
|
|
@@ -331,10 +336,11 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
331
336
|
* });
|
|
332
337
|
* ```
|
|
333
338
|
*/
|
|
334
|
-
handleCallback({ provider, code, state, }: {
|
|
335
|
-
provider: ConfiguredProviderKey<
|
|
339
|
+
handleCallback({ provider, code, state, sessionId, }: {
|
|
340
|
+
provider: ConfiguredProviderKey<TProviders> | string;
|
|
336
341
|
code: string;
|
|
337
342
|
state?: string;
|
|
343
|
+
sessionId?: string;
|
|
338
344
|
}): Promise<string>;
|
|
339
345
|
/**
|
|
340
346
|
* Explicitly link a new OAuth provider account to an active session.
|
|
@@ -344,7 +350,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
344
350
|
*/
|
|
345
351
|
linkAccount(params: {
|
|
346
352
|
sessionId: string;
|
|
347
|
-
provider: ConfiguredProviderKey<
|
|
353
|
+
provider: ConfiguredProviderKey<TProviders> | string;
|
|
348
354
|
code: string;
|
|
349
355
|
state?: string;
|
|
350
356
|
}): Promise<string>;
|
|
@@ -369,8 +375,8 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
369
375
|
*/
|
|
370
376
|
getResourceAuthUrl(params: {
|
|
371
377
|
sessionId: string;
|
|
372
|
-
provider: ConfiguredProviderKey<
|
|
373
|
-
scopes
|
|
378
|
+
provider: ConfiguredProviderKey<TProviders> | string;
|
|
379
|
+
scopes?: string[];
|
|
374
380
|
state?: string;
|
|
375
381
|
prompt?: string;
|
|
376
382
|
extraConfig?: Record<string, string>;
|
|
@@ -381,11 +387,32 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
381
387
|
*/
|
|
382
388
|
handleResourceCallback(params: {
|
|
383
389
|
sessionId: string;
|
|
384
|
-
provider: ConfiguredProviderKey<
|
|
390
|
+
provider: ConfiguredProviderKey<TProviders> | string;
|
|
385
391
|
code: string;
|
|
386
392
|
state?: string;
|
|
387
393
|
scopes?: string[];
|
|
388
394
|
}): Promise<Session>;
|
|
395
|
+
/**
|
|
396
|
+
* Retrieves configured default resource scopes for a provider.
|
|
397
|
+
*
|
|
398
|
+
* @param provider - Provider name (e.g. 'github', 'google')
|
|
399
|
+
* @returns Array of configured resource scopes, or undefined if not configured
|
|
400
|
+
*/
|
|
401
|
+
getResourceScopes(provider: ConfiguredProviderKey<TProviders> | string): string[] | undefined;
|
|
402
|
+
/**
|
|
403
|
+
* Returns the resolved session cookie name.
|
|
404
|
+
* Dynamically reflects any changes to the active identity provider.
|
|
405
|
+
*
|
|
406
|
+
* @param req - Optional request object for multi-tenant request-scoped cookie resolution
|
|
407
|
+
* @returns Resolved session cookie name
|
|
408
|
+
*/
|
|
409
|
+
getSessionCookieName(req?: unknown): string;
|
|
410
|
+
/**
|
|
411
|
+
* Sets or updates the session cookie name or dynamic resolver on this instance.
|
|
412
|
+
*
|
|
413
|
+
* @param resolver - Static cookie name or dynamic resolver function
|
|
414
|
+
*/
|
|
415
|
+
setSessionCookieName(resolver: SessionCookieResolver<Lixa<TProviders>>): void;
|
|
389
416
|
/**
|
|
390
417
|
* Retrieves a connected resource for a specific User ID / Email directly (independent of session IDs).
|
|
391
418
|
* Automatically refreshes expired access tokens if a refresh token is present.
|
|
@@ -441,46 +468,60 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
441
468
|
deleteSession(sessionId: string): Promise<void>;
|
|
442
469
|
private exchangeCodeForToken;
|
|
443
470
|
/**
|
|
444
|
-
* Checks if
|
|
471
|
+
* Checks if an identity provider (Self-Managed Database, AWS Cognito, Auth0, Okta, etc.) is configured.
|
|
445
472
|
*
|
|
446
|
-
* @returns True if
|
|
473
|
+
* @returns True if identity provider is configured and available
|
|
474
|
+
*/
|
|
475
|
+
isIdentityEnabled(): boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Checks if credentials / identity authentication is configured and enabled.
|
|
478
|
+
*
|
|
479
|
+
* @returns True if credentials / identity authentication is available
|
|
447
480
|
*/
|
|
448
481
|
isCredentialsEnabled(): boolean;
|
|
449
482
|
/**
|
|
450
|
-
* Returns the
|
|
483
|
+
* Returns the configured IdentityProvider instance.
|
|
484
|
+
*/
|
|
485
|
+
getIdentityProvider(): IIdentityProvider | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* Dynamically sets or updates the active identity provider (e.g. SelfManaged, Cognito, Auth0, Okta).
|
|
488
|
+
*
|
|
489
|
+
* @param provider - Identity provider instance or undefined to disable
|
|
490
|
+
*/
|
|
491
|
+
setIdentityProvider(provider?: IIdentityProvider): void;
|
|
492
|
+
/**
|
|
493
|
+
* Returns the underlying CredentialsManager instance if using Self-Managed identity.
|
|
451
494
|
*/
|
|
452
495
|
getCredentialsManager(): CredentialsManager | undefined;
|
|
453
496
|
/**
|
|
454
|
-
* Registers a new user with
|
|
455
|
-
* Automatically
|
|
456
|
-
* stores credentials, and creates a session (unless autoCreateSessionOnSignUp is false).
|
|
497
|
+
* Registers a new user with the configured identity provider (Self-Managed DB, Cognito, Auth0, Okta).
|
|
498
|
+
* Automatically creates an active session unless autoCreateSessionOnSignUp is explicitly set to false.
|
|
457
499
|
*
|
|
458
500
|
* @param params - Registration parameters (identifier, password, email, username, metadata)
|
|
459
|
-
* @returns Created user
|
|
501
|
+
* @returns Created user identity and optional active session
|
|
460
502
|
* @throws WeakPasswordError if password does not meet policy requirements
|
|
461
503
|
* @throws UserAlreadyExistsError if identifier is already registered
|
|
462
|
-
* @throws
|
|
504
|
+
* @throws IdentityNotConfiguredError if identity authentication is not configured
|
|
463
505
|
*/
|
|
464
506
|
signUp(params: SignUpParams): Promise<SignUpResult>;
|
|
465
507
|
/**
|
|
466
|
-
* Authenticates a user with
|
|
467
|
-
*
|
|
468
|
-
* If account linking is configured with AUTO_LINK_BY_VERIFIED_EMAIL, merges with existing session.
|
|
508
|
+
* Authenticates a user with credentials via the configured identity provider (Self-Managed DB, Cognito, Auth0, Okta).
|
|
509
|
+
* Creates an active session and automatically links with existing sessions when AUTO_LINK_BY_VERIFIED_EMAIL is configured.
|
|
469
510
|
*
|
|
470
511
|
* @param params - Sign-in parameters (identifier, password)
|
|
471
512
|
* @returns Authenticated user, session ID, and session object
|
|
472
513
|
* @throws InvalidCredentialsError if authentication fails
|
|
473
|
-
* @throws
|
|
514
|
+
* @throws IdentityNotConfiguredError if identity authentication is not configured
|
|
474
515
|
*/
|
|
475
516
|
signIn(params: SignInParams): Promise<SignInResult>;
|
|
476
517
|
/**
|
|
477
518
|
* Verifies username/email and password credentials without generating a session.
|
|
478
519
|
*
|
|
479
520
|
* @param params - Verification parameters (identifier, password)
|
|
480
|
-
* @returns User credentials
|
|
481
|
-
* @throws
|
|
521
|
+
* @returns User credentials/identity or null if invalid
|
|
522
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
482
523
|
*/
|
|
483
|
-
verifyCredentials(params: VerifyCredentialsParams): Promise<
|
|
524
|
+
verifyCredentials(params: VerifyCredentialsParams): Promise<UserIdentity | null>;
|
|
484
525
|
/**
|
|
485
526
|
* Updates a user's password after verifying the current password and enforcing policy on the new password.
|
|
486
527
|
*
|
|
@@ -489,9 +530,63 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
489
530
|
* @throws UserNotFoundError if user is not found
|
|
490
531
|
* @throws InvalidCredentialsError if current password is incorrect
|
|
491
532
|
* @throws WeakPasswordError if new password does not meet policy requirements
|
|
492
|
-
* @throws
|
|
533
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
493
534
|
*/
|
|
494
535
|
changePassword(params: ChangePasswordParams): Promise<boolean>;
|
|
536
|
+
/**
|
|
537
|
+
* Initiates a password reset (forgot password flow) through the configured identity provider.
|
|
538
|
+
*
|
|
539
|
+
* @param params - Forgot password parameters (identifier, optional metadata)
|
|
540
|
+
* @returns ForgotPasswordResult indicating status and delivery medium (email/SMS)
|
|
541
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
542
|
+
*/
|
|
543
|
+
forgotPassword(params: ForgotPasswordParams): Promise<ForgotPasswordResult>;
|
|
544
|
+
/**
|
|
545
|
+
* Confirms a password reset using a verification code / token and sets the new password.
|
|
546
|
+
*
|
|
547
|
+
* @param params - Verification code, identifier, and new password
|
|
548
|
+
* @returns True if password reset was successfully confirmed
|
|
549
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
550
|
+
*/
|
|
551
|
+
confirmPasswordReset(params: ConfirmPasswordResetParams): Promise<boolean>;
|
|
552
|
+
/**
|
|
553
|
+
* Confirms user account registration using a verification code.
|
|
554
|
+
*
|
|
555
|
+
* @param params - Verification parameters including identifier and confirmationCode
|
|
556
|
+
* @returns True if confirmation was successful
|
|
557
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
558
|
+
* @throws IdentityProviderError if identity provider does not support confirmation
|
|
559
|
+
*/
|
|
560
|
+
confirmSignUp(params: ConfirmSignUpParams): Promise<boolean>;
|
|
561
|
+
/**
|
|
562
|
+
* Resends the sign up confirmation code to the user.
|
|
563
|
+
*
|
|
564
|
+
* @param params - Resend parameters including user identifier
|
|
565
|
+
* @returns Details about the code delivery (medium, destination)
|
|
566
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
567
|
+
* @throws IdentityProviderError if identity provider does not support resending codes
|
|
568
|
+
*/
|
|
569
|
+
resendConfirmationCode(params: ResendConfirmationCodeParams): Promise<ResendConfirmationCodeResult>;
|
|
570
|
+
/**
|
|
571
|
+
* Retrieves a user by their unique ID from the configured identity provider.
|
|
572
|
+
*
|
|
573
|
+
* @param id - Unique user ID
|
|
574
|
+
* @returns UserIdentity or null if not found
|
|
575
|
+
*/
|
|
576
|
+
getUserById(id: string): Promise<UserIdentity | null>;
|
|
577
|
+
/**
|
|
578
|
+
* Retrieves a user by their identifier (username or email) from the configured identity provider.
|
|
579
|
+
*
|
|
580
|
+
* @param identifier - Username or email string
|
|
581
|
+
* @returns UserIdentity or null if not found
|
|
582
|
+
*/
|
|
583
|
+
getUserByIdentifier(identifier: string): Promise<UserIdentity | null>;
|
|
584
|
+
/**
|
|
585
|
+
* Deletes a user account from the configured identity provider.
|
|
586
|
+
*
|
|
587
|
+
* @param id - Unique user ID
|
|
588
|
+
*/
|
|
589
|
+
deleteUser(id: string): Promise<void>;
|
|
495
590
|
private findProviderByType;
|
|
496
591
|
}
|
|
497
592
|
export { Lixa };
|
package/dist/lixa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lixa.d.ts","sourceRoot":"","sources":["../src/lixa.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,K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AAO,CAAC,YAAY,CAAC;IAqGhE;;;;;;OAMG;IACU,iBAAiB,CAC5B,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAe/B;;;;;;;;;OASG;IACU,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB3E;;;;;;OAMG;IACU,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAcxF;;;;;;OAMG;IACU,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC;IAcvF;;;;;;;OAOG;IACU,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAczE;;;;;;;OAOG;IACU,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAchH;;;;;OAKG;IACU,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAOlE;;;;;OAKG;IACU,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAOlF;;;;OAIG;IACU,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlD,OAAO,CAAC,kBAAkB;CAS3B;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/models/session.d.ts
CHANGED
|
@@ -101,9 +101,9 @@ export interface ConnectedResource {
|
|
|
101
101
|
*/
|
|
102
102
|
export interface Session<TRaw = OAuthTokenResponse> {
|
|
103
103
|
/**
|
|
104
|
-
* Unique session ID generated by Lixa upon authentication.
|
|
104
|
+
* Unique canonical session ID generated by Lixa upon authentication.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
sessionId?: string | undefined;
|
|
107
107
|
/**
|
|
108
108
|
* Linked identity provider accounts (AuthN) keyed by provider name.
|
|
109
109
|
* Single source of truth for all authenticated user SSO identities.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/models/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IAEjB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IAEpB,4CAA4C;IAC5C,GAAG,EAAE,kBAAkB,CAAC;IAExB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IAEpB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B,0CAA0C;I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgFG;IACH,aAAa,CAAC,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpG;AAED;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D;;;;;;;OAOG;IACG,aAAa,CAAC,SAAS,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAUzG"}
|
|
@@ -136,6 +136,10 @@ interface IProvider {
|
|
|
136
136
|
* @example ['openid', 'email', 'profile'] or ['read:user', 'user:email']
|
|
137
137
|
*/
|
|
138
138
|
authScopes?: string[];
|
|
139
|
+
/**
|
|
140
|
+
* Default OAuth scopes requested when not explicitly specified in ProviderConfig.
|
|
141
|
+
*/
|
|
142
|
+
defaultScopes?: string[];
|
|
139
143
|
}
|
|
140
144
|
export { IProvider };
|
|
141
145
|
//# sourceMappingURL=IProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IProvider.d.ts","sourceRoot":"","sources":["../../src/providers/IProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,UAAU,SAAS;IACjB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"IProvider.d.ts","sourceRoot":"","sources":["../../src/providers/IProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,UAAU,SAAS;IACjB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { ScryptPasswordHasher, ScryptHasherOptions, Pbkdf2PasswordHasher, Pbkdf2
|
|
|
6
6
|
import { validatePasswordPolicy } from "./credentials/policy";
|
|
7
7
|
import { LocalCredentialsStorage } from "./credentials/local-storage";
|
|
8
8
|
import { CredentialsManager } from "./credentials/credentials-manager";
|
|
9
|
+
import { UserIdentity, IdentityTokens, IdentityAuthResult, ForgotPasswordParams, ForgotPasswordResult, ConfirmPasswordResetParams, ConfirmSignUpParams, ResendConfirmationCodeParams, ResendConfirmationCodeResult, IIdentityProvider, IdentityConfig } from "./identity/types";
|
|
10
|
+
import { SelfManagedIdentityProvider } from "./identity/self-managed";
|
|
9
11
|
export { Session, ConnectedResource } from "./models/session";
|
|
10
12
|
export { ProviderMetadata };
|
|
11
13
|
export { OAuthTokenResponse } from "./models/session";
|
|
@@ -22,6 +24,8 @@ export { ScryptPasswordHasher, ScryptHasherOptions, Pbkdf2PasswordHasher, Pbkdf2
|
|
|
22
24
|
export { validatePasswordPolicy };
|
|
23
25
|
export { LocalCredentialsStorage };
|
|
24
26
|
export { CredentialsManager };
|
|
27
|
+
export { UserIdentity, IdentityTokens, IdentityAuthResult, ForgotPasswordParams, ForgotPasswordResult, ConfirmPasswordResetParams, ConfirmSignUpParams, ResendConfirmationCodeParams, ResendConfirmationCodeResult, IIdentityProvider, IdentityConfig, };
|
|
28
|
+
export { SelfManagedIdentityProvider };
|
|
25
29
|
/**
|
|
26
30
|
* Configuration for an OAuth provider instance.
|
|
27
31
|
*
|
|
@@ -65,8 +69,13 @@ export type ProviderConfig = {
|
|
|
65
69
|
clientSecret: string;
|
|
66
70
|
/** The redirect URI registered with the provider */
|
|
67
71
|
redirectUri: string;
|
|
68
|
-
/** Array of OAuth scopes to request */
|
|
69
|
-
scopes
|
|
72
|
+
/** Array of OAuth scopes to request. If omitted, uses provider default identity scopes. */
|
|
73
|
+
scopes?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Default scopes requested when connecting this provider as a third-party resource (AuthZ).
|
|
76
|
+
* Used automatically by getResourceAuthUrl() and handleResourceCallback() if not overridden at runtime.
|
|
77
|
+
*/
|
|
78
|
+
resourceScopes?: string[];
|
|
70
79
|
/**
|
|
71
80
|
* Set to true to allow non-identity (resource) scopes during primary authentication flow.
|
|
72
81
|
* By default (false), Lixa restricts primary AuthN scopes to identity scopes to maintain
|
|
@@ -184,6 +193,18 @@ export interface AccountLinkingConfig {
|
|
|
184
193
|
*/
|
|
185
194
|
requireVerifiedEmail?: boolean;
|
|
186
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Unified storage adapter interface (e.g. Prisma or Drizzle adapter).
|
|
198
|
+
* When provided to Lixa via config.storage, automatically configures session, state, and resource storage.
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
export interface StorageAdapter {
|
|
202
|
+
sessionStorage?: any;
|
|
203
|
+
resourceStorage?: any;
|
|
204
|
+
stateStorage?: any;
|
|
205
|
+
credentialsStorage?: any;
|
|
206
|
+
accountStorage?: any;
|
|
207
|
+
}
|
|
187
208
|
/**
|
|
188
209
|
* Main configuration object for Lixa.
|
|
189
210
|
* Provides type-safe provider name inference.
|
|
@@ -192,18 +213,50 @@ export interface AccountLinkingConfig {
|
|
|
192
213
|
*/
|
|
193
214
|
export interface LixaConfig<TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
194
215
|
/**
|
|
195
|
-
* Map of provider names to their configurations.
|
|
216
|
+
* Map of federated OAuth 2.0 / OIDC provider names to their configurations (Google, GitHub, etc.)
|
|
217
|
+
* that federate with and work alongside the primary identityProvider.
|
|
196
218
|
* Provider names will be available for autocomplete in getAuthUrl() and handleCallback().
|
|
197
219
|
*/
|
|
220
|
+
federatedOAuthProviders?: TProviders;
|
|
221
|
+
/**
|
|
222
|
+
* Alias for {@link LixaConfig.federatedOAuthProviders}.
|
|
223
|
+
*/
|
|
198
224
|
providers?: TProviders;
|
|
225
|
+
/**
|
|
226
|
+
* Primary Identity Provider configuration (Self-Managed Database, AWS Cognito, Auth0, Okta, or custom IIdentityProvider).
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* Self-managed with Prisma:
|
|
230
|
+
* ```typescript
|
|
231
|
+
* identityProvider: { storage: prismaAdapter.credentialsStorage }
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* AWS Cognito:
|
|
236
|
+
* ```typescript
|
|
237
|
+
* identityProvider: new CognitoIdentityProvider({ userPoolId: '...', clientId: '...', region: 'us-east-1' })
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
identityProvider?: IIdentityProvider | IdentityConfig;
|
|
241
|
+
/**
|
|
242
|
+
* Alias for {@link LixaConfig.identityProvider}.
|
|
243
|
+
*/
|
|
244
|
+
identity?: IIdentityProvider | IdentityConfig;
|
|
199
245
|
/**
|
|
200
246
|
* Credentials (username and password) authentication configuration.
|
|
247
|
+
* Automatically maps to a SelfManagedIdentityProvider.
|
|
201
248
|
*/
|
|
202
249
|
credentials?: CredentialsConfig;
|
|
250
|
+
/**
|
|
251
|
+
* Unified database storage adapter (e.g. createPrismaAdapter or createDrizzleAdapter).
|
|
252
|
+
* Automatically configures sessionHandler, stateHandler, and resourceHandler.
|
|
253
|
+
*/
|
|
254
|
+
storage?: StorageAdapter;
|
|
203
255
|
/**
|
|
204
256
|
* Account linking configuration for multi-SSO user linking.
|
|
257
|
+
* Pass `true` or `"linkByEmail"` for automatic email-verified linking.
|
|
205
258
|
*/
|
|
206
|
-
accountLinking?: AccountLinkingConfig;
|
|
259
|
+
accountLinking?: boolean | AccountLinkingMode | AccountLinkingConfig;
|
|
207
260
|
/**
|
|
208
261
|
* Optional custom state handler.
|
|
209
262
|
* Handles state generation and storage during OAuth authorization flow.
|
|
@@ -247,7 +300,30 @@ export interface LixaConfig<TProviders extends Record<string, ProviderConfig> =
|
|
|
247
300
|
* If provided, all Lixa logs will be routed through this logger.
|
|
248
301
|
*/
|
|
249
302
|
logger?: LixaLogger;
|
|
303
|
+
/**
|
|
304
|
+
* Session cookie name or dynamic resolution function.
|
|
305
|
+
* Can accept a static string or `(lixa: Lixa, req?: unknown) => string`.
|
|
306
|
+
* Automatically evaluated live against the instance when getSessionCookieName() is called.
|
|
307
|
+
*/
|
|
308
|
+
sessionCookieName?: SessionCookieResolver;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Interface exposing identity information for dynamic session cookie name resolution.
|
|
312
|
+
* @public
|
|
313
|
+
*/
|
|
314
|
+
export interface LixaCookieContext {
|
|
315
|
+
/**
|
|
316
|
+
* Retrieves the currently active identity provider.
|
|
317
|
+
*/
|
|
318
|
+
getIdentityProvider(): IIdentityProvider | undefined;
|
|
250
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Dynamic resolver for session cookie name.
|
|
322
|
+
* Can be a static string or a dynamic callback receiving the Lixa instance and an optional request context.
|
|
323
|
+
*
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
export type SessionCookieResolver<TContext extends LixaCookieContext = LixaCookieContext> = string | ((lixa: TContext, req?: unknown) => string);
|
|
251
327
|
/**
|
|
252
328
|
* Log level for Lixa structured logging.
|
|
253
329
|
* @public
|
|
@@ -257,7 +333,7 @@ export type LogLevel = "INFO" | "WARN" | "ERROR" | "DEBUG";
|
|
|
257
333
|
* Log context for Lixa structured logging.
|
|
258
334
|
* @public
|
|
259
335
|
*/
|
|
260
|
-
export type LogContext = "Init" | "Auth" | "Token" | "Session" | "State" | "AccountLinking" | "Resource" | "Credentials";
|
|
336
|
+
export type LogContext = "Init" | "Auth" | "Token" | "Session" | "State" | "AccountLinking" | "Resource" | "Credentials" | "Identity";
|
|
261
337
|
/**
|
|
262
338
|
* Custom logger interface for Lixa.
|
|
263
339
|
* @public
|
|
@@ -277,4 +353,5 @@ export interface LixaLogger {
|
|
|
277
353
|
export type SafeLixaConfig<TProviders extends Record<string, ProviderConfig>> = LixaConfig<TProviders> & {
|
|
278
354
|
providers: TProviders;
|
|
279
355
|
};
|
|
356
|
+
export type { AccountHandler, AccountStorage } from "./dao/types";
|
|
280
357
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtI,OAAO,EAAW,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,q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,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;AAGtI;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAClG;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG;IACvG,SAAS,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vunexa/lixa",
|
|
3
|
-
"version": "0.1.6-alpha.
|
|
3
|
+
"version": "0.1.6-alpha.14",
|
|
4
4
|
"description": "Lixa is a flexible, provider-agnostic OAuth and OpenID Connect (OIDC) client library that simplifies multi-provider authentication flows. It supports seamless integration with providers like Google and GitHub, offers extensible session management, and enables dynamic provider resolution based on callback URLs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oauth",
|
|
7
7
|
"oidc"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"author": "
|
|
11
|
-
"
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/vunexa/lixa.git",
|
|
14
|
-
"directory": "lixa"
|
|
15
|
-
},
|
|
16
|
-
"homepage": "https://github.com/vunexa/lixa/tree/master/lixa#readme",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vunexa/lixa/issues"
|
|
19
|
-
},
|
|
10
|
+
"author": "Vunexa",
|
|
11
|
+
"homepage": "https://lixa.vunexa.app",
|
|
20
12
|
"type": "module",
|
|
21
13
|
"main": "./dist/index.cjs",
|
|
22
14
|
"module": "./dist/index.js",
|