@vunexa/lixa 0.1.6-alpha.13 → 0.1.6-alpha.15
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 +392 -674
- package/dist/credentials/credentials-manager.d.ts +14 -0
- package/dist/credentials/credentials-manager.d.ts.map +1 -1
- package/dist/credentials/types.d.ts +29 -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 +24 -0
- package/dist/dao/types.d.ts.map +1 -1
- package/dist/errors.d.ts +62 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/export-types/index.d.ts +899 -88
- package/dist/identity/composite.d.ts +65 -0
- package/dist/identity/composite.d.ts.map +1 -0
- package/dist/identity/index.d.ts +4 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/self-managed.d.ts +66 -0
- package/dist/identity/self-managed.d.ts.map +1 -0
- package/dist/identity/types.d.ts +232 -0
- package/dist/identity/types.d.ts.map +1 -0
- package/dist/index.cjs +1543 -341
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +868 -80
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1461 -267
- package/dist/index.js.map +1 -1
- package/dist/lixa.d.ts +190 -35
- package/dist/lixa.d.ts.map +1 -1
- package/dist/models/session.d.ts +12 -6
- 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 +140 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/user-info.d.ts.map +1 -1
- package/package.json +3 -11
package/dist/index.d.cts
CHANGED
|
@@ -58,10 +58,16 @@ interface LinkedAccount {
|
|
|
58
58
|
providerUserId?: string | undefined;
|
|
59
59
|
/** User email for this provider */
|
|
60
60
|
email?: string | undefined;
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Optional OAuth access token for this provider.
|
|
63
|
+
* @deprecated Authentication tokens belong strictly to session.token / session.raw for that session alone. Resource tokens belong in ConnectedResource / user_resources.
|
|
64
|
+
*/
|
|
65
|
+
accessToken?: string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Optional raw token response from provider.
|
|
68
|
+
* @deprecated Authentication tokens belong strictly to session.token / session.raw for that session alone. Resource tokens belong in ConnectedResource / user_resources.
|
|
69
|
+
*/
|
|
70
|
+
raw?: OAuthTokenResponse | undefined;
|
|
65
71
|
/** Unix timestamp in milliseconds when account was linked */
|
|
66
72
|
linkedAt: number;
|
|
67
73
|
}
|
|
@@ -101,9 +107,9 @@ interface ConnectedResource {
|
|
|
101
107
|
*/
|
|
102
108
|
interface Session<TRaw = OAuthTokenResponse> {
|
|
103
109
|
/**
|
|
104
|
-
* Unique session ID generated by Lixa upon authentication.
|
|
110
|
+
* Unique canonical session ID generated by Lixa upon authentication.
|
|
105
111
|
*/
|
|
106
|
-
|
|
112
|
+
sessionId?: string | undefined;
|
|
107
113
|
/**
|
|
108
114
|
* Linked identity provider accounts (AuthN) keyed by provider name.
|
|
109
115
|
* Single source of truth for all authenticated user SSO identities.
|
|
@@ -427,6 +433,30 @@ interface ResourceStorage {
|
|
|
427
433
|
interface ResourceHandler {
|
|
428
434
|
resourceStorage?: ResourceStorage;
|
|
429
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Interface for persistent linked account storage across user sessions.
|
|
438
|
+
*
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
interface AccountStorage {
|
|
442
|
+
saveAccount(userId: string, provider: string, account: LinkedAccount): Promise<void>;
|
|
443
|
+
getAccount(userId: string, provider: string): Promise<LinkedAccount | null>;
|
|
444
|
+
getUserAccounts(userId: string): Promise<Record<string, LinkedAccount>>;
|
|
445
|
+
deleteAccount(userId: string, provider: string): Promise<void>;
|
|
446
|
+
findAccountsByEmail?(email: string): Promise<Array<{
|
|
447
|
+
userId: string;
|
|
448
|
+
provider: string;
|
|
449
|
+
account: LinkedAccount;
|
|
450
|
+
}>>;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Account handler configuration.
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
interface AccountHandler {
|
|
458
|
+
accountStorage?: AccountStorage;
|
|
459
|
+
}
|
|
430
460
|
/**
|
|
431
461
|
* Session handler for OAuth authentication.
|
|
432
462
|
*
|
|
@@ -658,7 +688,242 @@ interface IProvider {
|
|
|
658
688
|
* @example ['openid', 'email', 'profile'] or ['read:user', 'user:email']
|
|
659
689
|
*/
|
|
660
690
|
authScopes?: string[];
|
|
691
|
+
/**
|
|
692
|
+
* Default OAuth scopes requested when not explicitly specified in ProviderConfig.
|
|
693
|
+
*/
|
|
694
|
+
defaultScopes?: string[];
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Standardized user identity representation across all identity providers
|
|
699
|
+
* (Self-Managed Database, AWS Cognito, Auth0, Okta, Firebase, etc.).
|
|
700
|
+
*
|
|
701
|
+
* @public
|
|
702
|
+
*/
|
|
703
|
+
interface UserIdentity {
|
|
704
|
+
/** Unique user identifier (UUID, Sub, Auth0 user_id, Okta id) */
|
|
705
|
+
id: string;
|
|
706
|
+
/** Primary unique lookup identifier (email or username) */
|
|
707
|
+
identifier: string;
|
|
708
|
+
/** Associated email address if available */
|
|
709
|
+
email?: string | undefined;
|
|
710
|
+
/** Username of the account if available */
|
|
711
|
+
username?: string | undefined;
|
|
712
|
+
/** Whether the email address has been verified by the identity provider */
|
|
713
|
+
emailVerified?: boolean | undefined;
|
|
714
|
+
/** Unix timestamp in milliseconds when user was created */
|
|
715
|
+
createdAt?: number | undefined;
|
|
716
|
+
/** Unix timestamp in milliseconds when user was last updated */
|
|
717
|
+
updatedAt?: number | undefined;
|
|
718
|
+
/** Custom user metadata or profile attributes */
|
|
719
|
+
metadata?: Record<string, unknown> | undefined;
|
|
720
|
+
/** Identity provider name (e.g. "self-managed", "cognito", "auth0", "okta") */
|
|
721
|
+
provider?: string | undefined;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Standardized token response from an identity provider.
|
|
725
|
+
*
|
|
726
|
+
* @public
|
|
727
|
+
*/
|
|
728
|
+
interface IdentityTokens {
|
|
729
|
+
/** OAuth / IdP Access Token (JWT or opaque token) */
|
|
730
|
+
accessToken?: string | undefined;
|
|
731
|
+
/** OpenID Connect ID Token containing user claims */
|
|
732
|
+
idToken?: string | undefined;
|
|
733
|
+
/** Refresh token for renewing expired credentials */
|
|
734
|
+
refreshToken?: string | undefined;
|
|
735
|
+
/** Token type (usually "Bearer") */
|
|
736
|
+
tokenType?: string | undefined;
|
|
737
|
+
/** Token expiration time in seconds */
|
|
738
|
+
expiresIn?: number | undefined;
|
|
739
|
+
/** Raw response object returned directly by the provider */
|
|
740
|
+
raw?: Record<string, unknown> | undefined;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Result of user authentication through an identity provider.
|
|
744
|
+
*
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
interface IdentityAuthResult {
|
|
748
|
+
/** Authenticated user profile */
|
|
749
|
+
user: UserIdentity;
|
|
750
|
+
/** Optional tokens issued by the identity provider */
|
|
751
|
+
tokens?: IdentityTokens | undefined;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Parameters for requesting a password reset (forgot password).
|
|
755
|
+
*
|
|
756
|
+
* @public
|
|
757
|
+
*/
|
|
758
|
+
interface ForgotPasswordParams {
|
|
759
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
760
|
+
provider?: string | undefined;
|
|
761
|
+
/** Username or email of the account requesting a password reset */
|
|
762
|
+
identifier: string;
|
|
763
|
+
/** Optional custom client metadata or redirect URL */
|
|
764
|
+
metadata?: Record<string, unknown> | undefined;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Result of a password reset request.
|
|
768
|
+
*
|
|
769
|
+
* @public
|
|
770
|
+
*/
|
|
771
|
+
interface ForgotPasswordResult {
|
|
772
|
+
/** Whether the password reset request was accepted */
|
|
773
|
+
success: boolean;
|
|
774
|
+
/** Delivery destination description (e.g. masked email: a***@example.com or phone) */
|
|
775
|
+
deliveryMedium?: string | undefined;
|
|
776
|
+
/** Optional message or status code from provider */
|
|
777
|
+
message?: string | undefined;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Parameters for confirming a password reset with a confirmation code or token.
|
|
781
|
+
*
|
|
782
|
+
* @public
|
|
783
|
+
*/
|
|
784
|
+
interface ConfirmPasswordResetParams {
|
|
785
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
786
|
+
provider?: string | undefined;
|
|
787
|
+
/** Username or email of the account */
|
|
788
|
+
identifier: string;
|
|
789
|
+
/** Verification code (e.g. 6-digit OTP from email/SMS) or reset token */
|
|
790
|
+
confirmationCode: string;
|
|
791
|
+
/** New plaintext password */
|
|
792
|
+
newPassword: string;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Parameters for confirming user registration with a verification code.
|
|
796
|
+
*
|
|
797
|
+
* @public
|
|
798
|
+
*/
|
|
799
|
+
interface ConfirmSignUpParams {
|
|
800
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
801
|
+
provider?: string | undefined;
|
|
802
|
+
/** Username or email of the account to confirm */
|
|
803
|
+
identifier: string;
|
|
804
|
+
/** Verification code (e.g. 6-digit OTP from email/SMS) */
|
|
805
|
+
confirmationCode: string;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Parameters for resending a sign up confirmation code.
|
|
809
|
+
*
|
|
810
|
+
* @public
|
|
811
|
+
*/
|
|
812
|
+
interface ResendConfirmationCodeParams {
|
|
813
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
814
|
+
provider?: string | undefined;
|
|
815
|
+
/** Username or email of the account */
|
|
816
|
+
identifier: string;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Result of resending a sign up confirmation code.
|
|
820
|
+
*
|
|
821
|
+
* @public
|
|
822
|
+
*/
|
|
823
|
+
interface ResendConfirmationCodeResult {
|
|
824
|
+
/** True if code was dispatched */
|
|
825
|
+
success: boolean;
|
|
826
|
+
/** Delivery medium (e.g. 'EMAIL' or 'SMS') */
|
|
827
|
+
deliveryMedium?: string | undefined;
|
|
828
|
+
/** Obscured destination */
|
|
829
|
+
destination?: string | undefined;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Unified interface for Identity Providers in Lixa.
|
|
833
|
+
*
|
|
834
|
+
* @remarks
|
|
835
|
+
* Implement this interface to create custom identity providers (e.g. Supabase Auth,
|
|
836
|
+
* Firebase Auth, Keycloak, or proprietary enterprise directories).
|
|
837
|
+
*
|
|
838
|
+
* Built-in extensions for AWS Cognito, Auth0, and Okta are available in `@vunexa/lixa-extensions`.
|
|
839
|
+
*
|
|
840
|
+
* @public
|
|
841
|
+
*/
|
|
842
|
+
interface IIdentityProvider {
|
|
843
|
+
/**
|
|
844
|
+
* Unique name of the identity provider.
|
|
845
|
+
* Examples: 'self-managed', 'cognito', 'auth0', 'okta'
|
|
846
|
+
*/
|
|
847
|
+
readonly name: string;
|
|
848
|
+
/**
|
|
849
|
+
* Registers a new user with the identity provider.
|
|
850
|
+
*
|
|
851
|
+
* @param params - User registration details (identifier, password, email, username, metadata)
|
|
852
|
+
* @returns Created user identity
|
|
853
|
+
*/
|
|
854
|
+
signUp(params: SignUpParams): Promise<UserIdentity>;
|
|
855
|
+
/**
|
|
856
|
+
* Authenticates a user with credentials.
|
|
857
|
+
*
|
|
858
|
+
* @param params - Sign in credentials (identifier, password)
|
|
859
|
+
* @returns Authenticated user identity and optional provider tokens
|
|
860
|
+
*/
|
|
861
|
+
signIn(params: SignInParams): Promise<IdentityAuthResult>;
|
|
862
|
+
/**
|
|
863
|
+
* Verifies credentials without necessarily creating a full session.
|
|
864
|
+
*
|
|
865
|
+
* @param params - Verification parameters
|
|
866
|
+
* @returns User identity if credentials are valid, null otherwise
|
|
867
|
+
*/
|
|
868
|
+
verifyCredentials?(params: VerifyCredentialsParams): Promise<UserIdentity | null>;
|
|
869
|
+
/**
|
|
870
|
+
* Changes a user's password.
|
|
871
|
+
*
|
|
872
|
+
* @param params - Old password, new password, and user identifier
|
|
873
|
+
* @returns True if password was successfully updated
|
|
874
|
+
*/
|
|
875
|
+
changePassword?(params: ChangePasswordParams): Promise<boolean>;
|
|
876
|
+
/**
|
|
877
|
+
* Requests a password reset (forgot password flow).
|
|
878
|
+
*
|
|
879
|
+
* @param params - Forgot password parameters
|
|
880
|
+
*/
|
|
881
|
+
forgotPassword?(params: ForgotPasswordParams): Promise<ForgotPasswordResult>;
|
|
882
|
+
/**
|
|
883
|
+
* Confirms password reset with verification code and new password.
|
|
884
|
+
*
|
|
885
|
+
* @param params - Confirm password reset parameters
|
|
886
|
+
*/
|
|
887
|
+
confirmPasswordReset?(params: ConfirmPasswordResetParams): Promise<boolean>;
|
|
888
|
+
/**
|
|
889
|
+
* Confirms user registration using a verification code.
|
|
890
|
+
*
|
|
891
|
+
* @param params - Confirm sign up parameters
|
|
892
|
+
*/
|
|
893
|
+
confirmSignUp?(params: ConfirmSignUpParams): Promise<boolean>;
|
|
894
|
+
/**
|
|
895
|
+
* Resends the sign up confirmation code.
|
|
896
|
+
*
|
|
897
|
+
* @param params - Resend confirmation code parameters
|
|
898
|
+
*/
|
|
899
|
+
resendConfirmationCode?(params: ResendConfirmationCodeParams): Promise<ResendConfirmationCodeResult>;
|
|
900
|
+
/**
|
|
901
|
+
* Retrieves a user by their unique ID.
|
|
902
|
+
*
|
|
903
|
+
* @param id - Unique user ID
|
|
904
|
+
*/
|
|
905
|
+
getUserById?(id: string): Promise<UserIdentity | null>;
|
|
906
|
+
/**
|
|
907
|
+
* Retrieves a user by their identifier (email or username).
|
|
908
|
+
*
|
|
909
|
+
* @param identifier - Username or email string
|
|
910
|
+
*/
|
|
911
|
+
getUserByIdentifier?(identifier: string): Promise<UserIdentity | null>;
|
|
912
|
+
/**
|
|
913
|
+
* Deletes a user account.
|
|
914
|
+
*
|
|
915
|
+
* @param id - Unique user ID
|
|
916
|
+
*/
|
|
917
|
+
deleteUser?(id: string): Promise<void>;
|
|
661
918
|
}
|
|
919
|
+
/**
|
|
920
|
+
* Configuration options for Identity Providers in LixaConfig.
|
|
921
|
+
*
|
|
922
|
+
* @public
|
|
923
|
+
*/
|
|
924
|
+
type IdentityConfig = IIdentityProvider | ({
|
|
925
|
+
provider?: "self-managed";
|
|
926
|
+
} & CredentialsConfig);
|
|
662
927
|
|
|
663
928
|
/**
|
|
664
929
|
* User credentials entity representing stored account login information.
|
|
@@ -733,6 +998,12 @@ interface CredentialsStorage {
|
|
|
733
998
|
* @param username - Username string
|
|
734
999
|
*/
|
|
735
1000
|
findUserByUsername?(username: string): Promise<UserCredentials | null>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Optional helper to find user directly by email address.
|
|
1003
|
+
*
|
|
1004
|
+
* @param email - Verified email address
|
|
1005
|
+
*/
|
|
1006
|
+
findUserByEmail?(email: string): Promise<UserCredentials | null>;
|
|
736
1007
|
}
|
|
737
1008
|
/**
|
|
738
1009
|
* Interface for password hashing and verification algorithms.
|
|
@@ -885,6 +1156,13 @@ interface CredentialsConfig {
|
|
|
885
1156
|
* @default 86400 (24 hours)
|
|
886
1157
|
*/
|
|
887
1158
|
sessionTtlSeconds?: number | undefined;
|
|
1159
|
+
/**
|
|
1160
|
+
* Whether identity verification (e.g. email confirmation code) is required before persisting credentials to storage.
|
|
1161
|
+
* When true, signUp creates a pending registration without writing to storage, requiring confirmSignUp() to activate.
|
|
1162
|
+
*
|
|
1163
|
+
* @default false
|
|
1164
|
+
*/
|
|
1165
|
+
requireVerification?: boolean | undefined;
|
|
888
1166
|
}
|
|
889
1167
|
/**
|
|
890
1168
|
* Parameters for user registration (signUp).
|
|
@@ -892,6 +1170,8 @@ interface CredentialsConfig {
|
|
|
892
1170
|
* @public
|
|
893
1171
|
*/
|
|
894
1172
|
interface SignUpParams {
|
|
1173
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
1174
|
+
provider?: string | undefined;
|
|
895
1175
|
/** Username for the user (can be used directly instead of identifier) */
|
|
896
1176
|
username?: string | undefined;
|
|
897
1177
|
/** Primary identifier (username or email) */
|
|
@@ -908,13 +1188,15 @@ interface SignUpParams {
|
|
|
908
1188
|
*
|
|
909
1189
|
* @public
|
|
910
1190
|
*/
|
|
911
|
-
interface SignUpResult<TSession = Session> {
|
|
912
|
-
/** Created user credentials (with passwordHash omitted for safety) */
|
|
913
|
-
user:
|
|
1191
|
+
interface SignUpResult<TSession = Session, TUser = UserIdentity> {
|
|
1192
|
+
/** Created user profile / credentials (with passwordHash omitted for safety) */
|
|
1193
|
+
user: TUser;
|
|
914
1194
|
/** Created session ID if autoCreateSessionOnSignUp is enabled */
|
|
915
1195
|
sessionId?: string | undefined;
|
|
916
1196
|
/** Created session object if autoCreateSessionOnSignUp is enabled */
|
|
917
1197
|
session?: TSession | undefined;
|
|
1198
|
+
requiresVerification?: boolean | undefined;
|
|
1199
|
+
devConfirmationCode?: string | undefined;
|
|
918
1200
|
}
|
|
919
1201
|
/**
|
|
920
1202
|
* Parameters for user authentication (signIn).
|
|
@@ -922,6 +1204,8 @@ interface SignUpResult<TSession = Session> {
|
|
|
922
1204
|
* @public
|
|
923
1205
|
*/
|
|
924
1206
|
interface SignInParams {
|
|
1207
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
1208
|
+
provider?: string | undefined;
|
|
925
1209
|
/** Username or email of the account */
|
|
926
1210
|
username?: string | undefined;
|
|
927
1211
|
/** Primary identifier (username or email) */
|
|
@@ -934,9 +1218,9 @@ interface SignInParams {
|
|
|
934
1218
|
*
|
|
935
1219
|
* @public
|
|
936
1220
|
*/
|
|
937
|
-
interface SignInResult<TSession = Session> {
|
|
938
|
-
/** Authenticated user credentials (with passwordHash omitted for safety) */
|
|
939
|
-
user:
|
|
1221
|
+
interface SignInResult<TSession = Session, TUser = UserIdentity> {
|
|
1222
|
+
/** Authenticated user profile / credentials (with passwordHash omitted for safety) */
|
|
1223
|
+
user: TUser;
|
|
940
1224
|
/** Active session ID */
|
|
941
1225
|
sessionId: string;
|
|
942
1226
|
/** Active session object */
|
|
@@ -948,6 +1232,8 @@ interface SignInResult<TSession = Session> {
|
|
|
948
1232
|
* @public
|
|
949
1233
|
*/
|
|
950
1234
|
interface VerifyCredentialsParams {
|
|
1235
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
1236
|
+
provider?: string | undefined;
|
|
951
1237
|
/** Username or email of the account */
|
|
952
1238
|
username?: string | undefined;
|
|
953
1239
|
/** Primary identifier (username or email) */
|
|
@@ -961,6 +1247,8 @@ interface VerifyCredentialsParams {
|
|
|
961
1247
|
* @public
|
|
962
1248
|
*/
|
|
963
1249
|
interface ChangePasswordParams {
|
|
1250
|
+
/** Target identity provider name when using CompositeIdentityProvider */
|
|
1251
|
+
provider?: string | undefined;
|
|
964
1252
|
/** Username (optional if identifier or userId is provided) */
|
|
965
1253
|
username?: string | undefined;
|
|
966
1254
|
/** Primary identifier (optional if username or userId is provided) */
|
|
@@ -1136,6 +1424,20 @@ declare class CredentialsManager {
|
|
|
1136
1424
|
* @returns True if password was successfully updated
|
|
1137
1425
|
*/
|
|
1138
1426
|
changePassword(params: ChangePasswordParams): Promise<boolean>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Sets a password for a user who doesn't have one yet (e.g. SSO-first users),
|
|
1429
|
+
* or updates an existing password without requiring the old one.
|
|
1430
|
+
* This should only be called from an authenticated context (user already verified their identity via SSO).
|
|
1431
|
+
*
|
|
1432
|
+
* @param params - userId and newPassword
|
|
1433
|
+
* @returns True if password was successfully set
|
|
1434
|
+
*/
|
|
1435
|
+
setPassword(params: {
|
|
1436
|
+
userId: string;
|
|
1437
|
+
newPassword: string;
|
|
1438
|
+
identifier?: string;
|
|
1439
|
+
email?: string;
|
|
1440
|
+
}): Promise<boolean>;
|
|
1139
1441
|
/**
|
|
1140
1442
|
* Finds a user by ID and returns safe user data.
|
|
1141
1443
|
*/
|
|
@@ -1154,6 +1456,131 @@ declare class CredentialsManager {
|
|
|
1154
1456
|
getHasher(): IPasswordHasher;
|
|
1155
1457
|
}
|
|
1156
1458
|
|
|
1459
|
+
/**
|
|
1460
|
+
* Self-Managed Identity Provider implementation for Lixa.
|
|
1461
|
+
*
|
|
1462
|
+
* @remarks
|
|
1463
|
+
* Backed by custom database storage (Prisma, Drizzle, PostgreSQL, SQLite, MongoDB)
|
|
1464
|
+
* or local in-memory storage, with cryptographic password hashing (Scrypt, Argon2, PBKDF2)
|
|
1465
|
+
* and configurable password policy enforcement.
|
|
1466
|
+
*
|
|
1467
|
+
* @public
|
|
1468
|
+
*/
|
|
1469
|
+
declare class SelfManagedIdentityProvider implements IIdentityProvider {
|
|
1470
|
+
readonly name: string;
|
|
1471
|
+
private readonly manager;
|
|
1472
|
+
private readonly pendingSignups;
|
|
1473
|
+
private readonly requireVerification;
|
|
1474
|
+
private readonly config;
|
|
1475
|
+
constructor(configOrManager?: CredentialsConfig | CredentialsManager);
|
|
1476
|
+
private mapUser;
|
|
1477
|
+
private generateConfirmationCode;
|
|
1478
|
+
/**
|
|
1479
|
+
* Registers a new user with optional pending verification.
|
|
1480
|
+
* When requireVerification is true, credentials are NOT persisted to the database until confirmSignUp() is called.
|
|
1481
|
+
*/
|
|
1482
|
+
signUp(params: SignUpParams): Promise<UserIdentity>;
|
|
1483
|
+
/**
|
|
1484
|
+
* Confirms a pending signup registration using the verification code.
|
|
1485
|
+
* Only after successful confirmation is the user persisted to the database.
|
|
1486
|
+
*/
|
|
1487
|
+
confirmSignUp(params: ConfirmSignUpParams): Promise<boolean>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Resends the verification code for a pending signup.
|
|
1490
|
+
*/
|
|
1491
|
+
resendConfirmationCode(params: ResendConfirmationCodeParams): Promise<ResendConfirmationCodeResult>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Authenticates a user with password.
|
|
1494
|
+
*/
|
|
1495
|
+
signIn(params: SignInParams): Promise<IdentityAuthResult>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Verifies credentials without throwing an error if invalid.
|
|
1498
|
+
*/
|
|
1499
|
+
verifyCredentials(params: VerifyCredentialsParams): Promise<UserIdentity | null>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Changes a user's password.
|
|
1502
|
+
*/
|
|
1503
|
+
changePassword(params: ChangePasswordParams): Promise<boolean>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Retrieves a user by their unique ID.
|
|
1506
|
+
*/
|
|
1507
|
+
getUserById(id: string): Promise<UserIdentity | null>;
|
|
1508
|
+
/**
|
|
1509
|
+
* Retrieves a user by their identifier (email or username).
|
|
1510
|
+
*/
|
|
1511
|
+
getUserByIdentifier(identifier: string): Promise<UserIdentity | null>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Deletes a user from storage if supported by the storage adapter.
|
|
1514
|
+
*/
|
|
1515
|
+
deleteUser(id: string): Promise<void>;
|
|
1516
|
+
/**
|
|
1517
|
+
* Returns the underlying CredentialsManager instance.
|
|
1518
|
+
*/
|
|
1519
|
+
getCredentialsManager(): CredentialsManager;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Options for initializing a CompositeIdentityProvider.
|
|
1524
|
+
*
|
|
1525
|
+
* @public
|
|
1526
|
+
*/
|
|
1527
|
+
interface CompositeIdentityProviderOptions<TProviders extends Record<string, IIdentityProvider> = Record<string, IIdentityProvider>, TOAuthProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
1528
|
+
/**
|
|
1529
|
+
* Record of child identity providers keyed by unique provider names.
|
|
1530
|
+
* e.g. `{ cognito: new CognitoIdentityProvider(...), okta: new OktaIdentityProvider(...) }`
|
|
1531
|
+
*/
|
|
1532
|
+
providers: TProviders;
|
|
1533
|
+
/**
|
|
1534
|
+
* Default provider key to use when a request does not explicitly pass a `provider` parameter.
|
|
1535
|
+
*/
|
|
1536
|
+
defaultProvider?: (keyof TProviders & string) | undefined;
|
|
1537
|
+
/**
|
|
1538
|
+
* Record of OAuth 2.0 / OIDC provider configurations (Google, GitHub, etc.)
|
|
1539
|
+
* to register alongside these identity providers.
|
|
1540
|
+
*/
|
|
1541
|
+
oauthProviders?: TOAuthProviders | undefined;
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Composite Identity Provider that aggregates multiple child IIdentityProvider instances
|
|
1545
|
+
* and OAuth 2.0 / OIDC provider configurations under a single unified identityProvider.
|
|
1546
|
+
*
|
|
1547
|
+
* @remarks
|
|
1548
|
+
* Eliminates the need for separate `federatedOAuthProviders` configuration in Lixa.
|
|
1549
|
+
* Provides compile-time autocompletion of configured provider names.
|
|
1550
|
+
* Routing is strictly explicit: uses `params.provider` if provided, or `defaultProvider`.
|
|
1551
|
+
* No silent fallbacks or guesswork.
|
|
1552
|
+
*
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1555
|
+
declare class CompositeIdentityProvider<TProviders extends Record<string, IIdentityProvider> = Record<string, IIdentityProvider>, TOAuthProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> implements IIdentityProvider {
|
|
1556
|
+
readonly name: string;
|
|
1557
|
+
readonly providers: TProviders;
|
|
1558
|
+
readonly defaultProvider?: (keyof TProviders & string) | undefined;
|
|
1559
|
+
readonly oauthProviders?: TOAuthProviders | undefined;
|
|
1560
|
+
constructor(options: CompositeIdentityProviderOptions<TProviders, TOAuthProviders>);
|
|
1561
|
+
/**
|
|
1562
|
+
* Resolves the target child provider based on explicit parameter or defaultProvider.
|
|
1563
|
+
* Throws an error immediately if the provider cannot be resolved or does not exist.
|
|
1564
|
+
*/
|
|
1565
|
+
selectProvider(providerName?: string): IIdentityProvider;
|
|
1566
|
+
/**
|
|
1567
|
+
* Returns all OAuth / OIDC provider configurations aggregated across this composite provider
|
|
1568
|
+
* and any child providers exposing `getOAuthProviders()` or `getProviders()`.
|
|
1569
|
+
*/
|
|
1570
|
+
getProviders(): Record<string, ProviderConfig>;
|
|
1571
|
+
signUp(params: SignUpParams): Promise<UserIdentity>;
|
|
1572
|
+
signIn(params: SignInParams): Promise<IdentityAuthResult>;
|
|
1573
|
+
verifyCredentials(params: VerifyCredentialsParams): Promise<UserIdentity | null>;
|
|
1574
|
+
changePassword(params: ChangePasswordParams): Promise<boolean>;
|
|
1575
|
+
forgotPassword(params: ForgotPasswordParams): Promise<ForgotPasswordResult>;
|
|
1576
|
+
confirmPasswordReset(params: ConfirmPasswordResetParams): Promise<boolean>;
|
|
1577
|
+
confirmSignUp(params: ConfirmSignUpParams): Promise<boolean>;
|
|
1578
|
+
resendConfirmationCode(params: ResendConfirmationCodeParams): Promise<ResendConfirmationCodeResult>;
|
|
1579
|
+
getUserById(id: string, providerName?: string): Promise<UserIdentity | null>;
|
|
1580
|
+
getUserByIdentifier(identifier: string, providerName?: string): Promise<UserIdentity | null>;
|
|
1581
|
+
deleteUser(id: string, providerName?: string): Promise<void>;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1157
1584
|
/**
|
|
1158
1585
|
* Configuration for an OAuth provider instance.
|
|
1159
1586
|
*
|
|
@@ -1190,6 +1617,27 @@ declare class CredentialsManager {
|
|
|
1190
1617
|
*
|
|
1191
1618
|
* @public
|
|
1192
1619
|
*/
|
|
1620
|
+
/**
|
|
1621
|
+
* Scopes configuration explicitly partitioned into authentication and resource authorization.
|
|
1622
|
+
*
|
|
1623
|
+
* @public
|
|
1624
|
+
*/
|
|
1625
|
+
interface ScopesConfig {
|
|
1626
|
+
/**
|
|
1627
|
+
* Explicit identity scopes requested during primary authentication (AuthN) (e.g. ['openid', 'email', 'profile']).
|
|
1628
|
+
* If omitted, uses the provider's default identity scopes.
|
|
1629
|
+
*/
|
|
1630
|
+
auth?: string[];
|
|
1631
|
+
/**
|
|
1632
|
+
* Explicit permission scopes requested during post-authentication resource authorization (AuthZ)
|
|
1633
|
+
* (e.g. ['https://www.googleapis.com/auth/drive.readonly'] or ['repo']).
|
|
1634
|
+
*/
|
|
1635
|
+
resource?: string[];
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Configuration for an OAuth provider instance.
|
|
1639
|
+
* @public
|
|
1640
|
+
*/
|
|
1193
1641
|
type ProviderConfig = {
|
|
1194
1642
|
/** The OAuth client ID provided by the provider */
|
|
1195
1643
|
clientId: string;
|
|
@@ -1197,15 +1645,38 @@ type ProviderConfig = {
|
|
|
1197
1645
|
clientSecret: string;
|
|
1198
1646
|
/** The redirect URI registered with the provider */
|
|
1199
1647
|
redirectUri: string;
|
|
1200
|
-
/**
|
|
1201
|
-
|
|
1648
|
+
/**
|
|
1649
|
+
* Explicit scopes for authentication and post-login resource authorization.
|
|
1650
|
+
* Can be configured as `{ auth: [...], resource: [...] }` or a shorthand `string[]` for auth scopes.
|
|
1651
|
+
*
|
|
1652
|
+
* @example
|
|
1653
|
+
* ```typescript
|
|
1654
|
+
* scopes: {
|
|
1655
|
+
* auth: ["openid", "email", "profile"],
|
|
1656
|
+
* resource: ["https://www.googleapis.com/auth/drive.readonly"],
|
|
1657
|
+
* }
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
scopes?: ScopesConfig | string[];
|
|
1661
|
+
/**
|
|
1662
|
+
* Flat alias for authentication scopes (AuthN).
|
|
1663
|
+
*/
|
|
1664
|
+
authScopes?: string[];
|
|
1665
|
+
/**
|
|
1666
|
+
* Flat alias for post-authentication resource authorization scopes (AuthZ).
|
|
1667
|
+
*/
|
|
1668
|
+
resourceScopes?: string[];
|
|
1202
1669
|
/**
|
|
1203
1670
|
* Set to true to allow non-identity (resource) scopes during primary authentication flow.
|
|
1204
1671
|
* By default (false), Lixa restricts primary AuthN scopes to identity scopes to maintain
|
|
1205
1672
|
* clean AuthN vs AuthZ separation.
|
|
1206
1673
|
*/
|
|
1207
1674
|
allowNonAuthScopes?: boolean;
|
|
1208
|
-
/**
|
|
1675
|
+
/**
|
|
1676
|
+
* Custom query parameters passed to the OAuth authorization endpoint (e.g. `{ identity_provider: "Google" }`).
|
|
1677
|
+
*/
|
|
1678
|
+
authorizationParams?: Record<string, string>;
|
|
1679
|
+
/** Additional provider-specific configuration parameters (alias for authorizationParams) */
|
|
1209
1680
|
extraConfig?: Record<string, string>;
|
|
1210
1681
|
} & ({
|
|
1211
1682
|
provider?: never;
|
|
@@ -1287,14 +1758,16 @@ declare enum AccountLinkingStrategy {
|
|
|
1287
1758
|
/** Automatically merge identities matching the same verified primary email address */
|
|
1288
1759
|
AUTO_LINK_BY_VERIFIED_EMAIL = "AUTO_LINK_BY_VERIFIED_EMAIL",
|
|
1289
1760
|
/** Keep identity profiles isolated per provider (no automatic account merging) */
|
|
1290
|
-
ISOLATED = "ISOLATED"
|
|
1761
|
+
ISOLATED = "ISOLATED",
|
|
1762
|
+
/** Require password or original provider step-up verification before linking secondary accounts */
|
|
1763
|
+
STEP_UP_VERIFICATION = "STEP_UP_VERIFICATION"
|
|
1291
1764
|
}
|
|
1292
1765
|
/**
|
|
1293
1766
|
* Supported mode values for account linking configuration.
|
|
1294
1767
|
*
|
|
1295
1768
|
* @public
|
|
1296
1769
|
*/
|
|
1297
|
-
type AccountLinkingMode = AccountLinkingStrategy | "AUTO_LINK_BY_VERIFIED_EMAIL" | "ISOLATED" | "linkByEmail" | "separate";
|
|
1770
|
+
type AccountLinkingMode = AccountLinkingStrategy | "AUTO_LINK_BY_VERIFIED_EMAIL" | "ISOLATED" | "STEP_UP_VERIFICATION" | "linkByEmail" | "separate" | "stepUp";
|
|
1298
1771
|
/**
|
|
1299
1772
|
* Account linking settings for Lixa.
|
|
1300
1773
|
*
|
|
@@ -1316,26 +1789,81 @@ interface AccountLinkingConfig {
|
|
|
1316
1789
|
*/
|
|
1317
1790
|
requireVerifiedEmail?: boolean;
|
|
1318
1791
|
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Unified storage adapter interface (e.g. Prisma or Drizzle adapter).
|
|
1794
|
+
* When provided to Lixa via config.storage, automatically configures session, state, and resource storage.
|
|
1795
|
+
* @public
|
|
1796
|
+
*/
|
|
1797
|
+
interface StorageAdapter {
|
|
1798
|
+
sessionStorage?: any;
|
|
1799
|
+
resourceStorage?: any;
|
|
1800
|
+
stateStorage?: any;
|
|
1801
|
+
credentialsStorage?: any;
|
|
1802
|
+
accountStorage?: any;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Inferred key of identity providers configured in a CompositeIdentityProvider.
|
|
1806
|
+
*
|
|
1807
|
+
* @public
|
|
1808
|
+
*/
|
|
1809
|
+
type ConfiguredIdentityKey<TIdentity> = TIdentity extends CompositeIdentityProvider<infer TProviders, any> ? (keyof TProviders & string) : string;
|
|
1810
|
+
/**
|
|
1811
|
+
* Inferred key of OAuth / OIDC providers configured in a CompositeIdentityProvider or inline providers.
|
|
1812
|
+
*
|
|
1813
|
+
* @public
|
|
1814
|
+
*/
|
|
1815
|
+
type ConfiguredOAuthKey<TIdentity = unknown, TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> = TIdentity extends CompositeIdentityProvider<any, infer TOAuth> ? (keyof TOAuth & string) | (keyof TProviders & string) : keyof TProviders & string;
|
|
1319
1816
|
/**
|
|
1320
1817
|
* Main configuration object for Lixa.
|
|
1321
1818
|
* Provides type-safe provider name inference.
|
|
1322
1819
|
*
|
|
1323
1820
|
* @public
|
|
1324
1821
|
*/
|
|
1325
|
-
interface LixaConfig<TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
1822
|
+
interface LixaConfig<TIdentity extends IIdentityProvider | IdentityConfig = IIdentityProvider | IdentityConfig, TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
1823
|
+
/**
|
|
1824
|
+
* Primary Identity Provider configuration (Self-Managed Database, AWS Cognito, Auth0, Okta,
|
|
1825
|
+
* or a CompositeIdentityProvider combining multiple backends and OAuth providers).
|
|
1826
|
+
*
|
|
1827
|
+
* @example
|
|
1828
|
+
* Composite Identity Provider:
|
|
1829
|
+
* ```typescript
|
|
1830
|
+
* identityProvider: new CompositeIdentityProvider({
|
|
1831
|
+
* defaultProvider: 'cognito',
|
|
1832
|
+
* providers: {
|
|
1833
|
+
* cognito: new CognitoIdentityProvider(...),
|
|
1834
|
+
* 'self-managed': new SelfManagedIdentityProvider(...)
|
|
1835
|
+
* },
|
|
1836
|
+
* oauthProviders: {
|
|
1837
|
+
* google: { provider: new GoogleProvider(), ... }
|
|
1838
|
+
* }
|
|
1839
|
+
* })
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
identityProvider?: TIdentity;
|
|
1326
1843
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
|
|
1844
|
+
* Alias for {@link LixaConfig.identityProvider}.
|
|
1845
|
+
*/
|
|
1846
|
+
identity?: TIdentity;
|
|
1847
|
+
/**
|
|
1848
|
+
* Direct OAuth 2.0 / OIDC provider configurations (Google, GitHub, etc.).
|
|
1849
|
+
* When using CompositeIdentityProvider, OAuth providers can also be defined in its `oauthProviders` field.
|
|
1329
1850
|
*/
|
|
1330
1851
|
providers?: TProviders;
|
|
1331
1852
|
/**
|
|
1332
1853
|
* Credentials (username and password) authentication configuration.
|
|
1854
|
+
* Automatically maps to a SelfManagedIdentityProvider.
|
|
1333
1855
|
*/
|
|
1334
1856
|
credentials?: CredentialsConfig;
|
|
1857
|
+
/**
|
|
1858
|
+
* Unified database storage adapter (e.g. createPrismaAdapter or createDrizzleAdapter).
|
|
1859
|
+
* Automatically configures sessionHandler, stateHandler, and resourceHandler.
|
|
1860
|
+
*/
|
|
1861
|
+
storage?: StorageAdapter;
|
|
1335
1862
|
/**
|
|
1336
1863
|
* Account linking configuration for multi-SSO user linking.
|
|
1864
|
+
* Pass `true` or `"linkByEmail"` for automatic email-verified linking.
|
|
1337
1865
|
*/
|
|
1338
|
-
accountLinking?: AccountLinkingConfig;
|
|
1866
|
+
accountLinking?: boolean | AccountLinkingMode | AccountLinkingConfig;
|
|
1339
1867
|
/**
|
|
1340
1868
|
* Optional custom state handler.
|
|
1341
1869
|
* Handles state generation and storage during OAuth authorization flow.
|
|
@@ -1379,7 +1907,30 @@ interface LixaConfig<TProviders extends Record<string, ProviderConfig> = Record<
|
|
|
1379
1907
|
* If provided, all Lixa logs will be routed through this logger.
|
|
1380
1908
|
*/
|
|
1381
1909
|
logger?: LixaLogger;
|
|
1910
|
+
/**
|
|
1911
|
+
* Session cookie name or dynamic resolution function.
|
|
1912
|
+
* Can accept a static string or `(lixa: Lixa, req?: unknown) => string`.
|
|
1913
|
+
* Automatically evaluated live against the instance when getSessionCookieName() is called.
|
|
1914
|
+
*/
|
|
1915
|
+
sessionCookieName?: SessionCookieResolver;
|
|
1382
1916
|
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Interface exposing identity information for dynamic session cookie name resolution.
|
|
1919
|
+
* @public
|
|
1920
|
+
*/
|
|
1921
|
+
interface LixaCookieContext {
|
|
1922
|
+
/**
|
|
1923
|
+
* Retrieves the currently active identity provider.
|
|
1924
|
+
*/
|
|
1925
|
+
getIdentityProvider(): IIdentityProvider | undefined;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Dynamic resolver for session cookie name.
|
|
1929
|
+
* Can be a static string or a dynamic callback receiving the Lixa instance and an optional request context.
|
|
1930
|
+
*
|
|
1931
|
+
* @public
|
|
1932
|
+
*/
|
|
1933
|
+
type SessionCookieResolver<TContext extends LixaCookieContext = LixaCookieContext> = string | ((lixa: TContext, req?: unknown) => string);
|
|
1383
1934
|
/**
|
|
1384
1935
|
* Log level for Lixa structured logging.
|
|
1385
1936
|
* @public
|
|
@@ -1389,7 +1940,7 @@ type LogLevel = "INFO" | "WARN" | "ERROR" | "DEBUG";
|
|
|
1389
1940
|
* Log context for Lixa structured logging.
|
|
1390
1941
|
* @public
|
|
1391
1942
|
*/
|
|
1392
|
-
type LogContext = "Init" | "Auth" | "Token" | "Session" | "State" | "AccountLinking" | "Resource" | "Credentials";
|
|
1943
|
+
type LogContext = "Init" | "Auth" | "Token" | "Session" | "State" | "AccountLinking" | "Resource" | "Credentials" | "Identity";
|
|
1393
1944
|
/**
|
|
1394
1945
|
* Custom logger interface for Lixa.
|
|
1395
1946
|
* @public
|
|
@@ -1413,7 +1964,7 @@ type SafeLixaConfig<TProviders extends Record<string, ProviderConfig>> = LixaCon
|
|
|
1413
1964
|
/**
|
|
1414
1965
|
* Type representing the keys of configured providers
|
|
1415
1966
|
*/
|
|
1416
|
-
type ConfiguredProviderKey<
|
|
1967
|
+
type ConfiguredProviderKey<TProviders extends Record<string, ProviderConfig>> = keyof TProviders & string;
|
|
1417
1968
|
/**
|
|
1418
1969
|
* A flexible, provider-agnostic OAuth 2.0 and OpenID Connect (OIDC) client library.
|
|
1419
1970
|
*
|
|
@@ -1466,20 +2017,25 @@ type ConfiguredProviderKey<T extends LixaConfig<Record<string, ProviderConfig>>>
|
|
|
1466
2017
|
*
|
|
1467
2018
|
* @public
|
|
1468
2019
|
*/
|
|
1469
|
-
declare class Lixa<
|
|
2020
|
+
declare class Lixa<TIdentity extends IIdentityProvider | IdentityConfig = IIdentityProvider | IdentityConfig, TProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> {
|
|
1470
2021
|
private static DEFAULT_PROVIDERS;
|
|
1471
2022
|
private static CONFIGURED_PROVIDERS;
|
|
1472
2023
|
private localStateHandler;
|
|
1473
2024
|
private localSessionHandler;
|
|
1474
2025
|
private localResourceHandler;
|
|
2026
|
+
private localAccountHandler;
|
|
1475
2027
|
private userResourceStore;
|
|
2028
|
+
private userAccountStore;
|
|
1476
2029
|
private refreshMutexes;
|
|
2030
|
+
private identityProvider?;
|
|
1477
2031
|
private credentialsManager?;
|
|
1478
2032
|
private config;
|
|
1479
2033
|
private stateHandler;
|
|
1480
2034
|
private sessionHandler;
|
|
1481
2035
|
private resourceHandler;
|
|
2036
|
+
private accountHandler;
|
|
1482
2037
|
private debug;
|
|
2038
|
+
private sessionCookieResolver?;
|
|
1483
2039
|
/**
|
|
1484
2040
|
* Creates a new Lixa instance with the provided configuration.
|
|
1485
2041
|
*
|
|
@@ -1493,7 +2049,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1493
2049
|
* @throws Error when provider implementation is missing required properties
|
|
1494
2050
|
* @throws Error when provider is not available and no inline implementation is provided
|
|
1495
2051
|
*/
|
|
1496
|
-
constructor(config:
|
|
2052
|
+
constructor(config: LixaConfig<TIdentity, TProviders>);
|
|
1497
2053
|
/**
|
|
1498
2054
|
* Validates that a provider configuration has all required credentials.
|
|
1499
2055
|
*
|
|
@@ -1534,7 +2090,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1534
2090
|
* }
|
|
1535
2091
|
* ```
|
|
1536
2092
|
*/
|
|
1537
|
-
isProviderConfigured<T extends string>(provider: T): provider is T & ConfiguredProviderKey<
|
|
2093
|
+
isProviderConfigured<T extends string>(provider: T): provider is T & (ConfiguredOAuthKey<TIdentity, TProviders> | ConfiguredProviderKey<TProviders>);
|
|
1538
2094
|
/**
|
|
1539
2095
|
* Gets a provider implementation by name.
|
|
1540
2096
|
* Resolution priority: inline custom provider \> default providers \> legacy registry
|
|
@@ -1715,7 +2271,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1715
2271
|
* res.redirect(authUrl);
|
|
1716
2272
|
* ```
|
|
1717
2273
|
*/
|
|
1718
|
-
getAuthUrl(provider:
|
|
2274
|
+
getAuthUrl(provider: ConfiguredOAuthKey<TIdentity, TProviders> | string, state?: string): Promise<string>;
|
|
1719
2275
|
/**
|
|
1720
2276
|
* Restricts primary authentication scopes strictly to AuthN identity scopes unless allowNonAuthScopes is true.
|
|
1721
2277
|
*/
|
|
@@ -1739,10 +2295,11 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1739
2295
|
* });
|
|
1740
2296
|
* ```
|
|
1741
2297
|
*/
|
|
1742
|
-
handleCallback({ provider, code, state, }: {
|
|
1743
|
-
provider:
|
|
2298
|
+
handleCallback({ provider, code, state, sessionId, }: {
|
|
2299
|
+
provider: ConfiguredOAuthKey<TIdentity, TProviders> | string;
|
|
1744
2300
|
code: string;
|
|
1745
2301
|
state?: string;
|
|
2302
|
+
sessionId?: string;
|
|
1746
2303
|
}): Promise<string>;
|
|
1747
2304
|
/**
|
|
1748
2305
|
* Explicitly link a new OAuth provider account to an active session.
|
|
@@ -1752,7 +2309,7 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1752
2309
|
*/
|
|
1753
2310
|
linkAccount(params: {
|
|
1754
2311
|
sessionId: string;
|
|
1755
|
-
provider: ConfiguredProviderKey<
|
|
2312
|
+
provider: ConfiguredProviderKey<TProviders> | string;
|
|
1756
2313
|
code: string;
|
|
1757
2314
|
state?: string;
|
|
1758
2315
|
}): Promise<string>;
|
|
@@ -1764,6 +2321,38 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1764
2321
|
* @returns Promise resolving to true on successful unlink
|
|
1765
2322
|
*/
|
|
1766
2323
|
unlinkAccount(sessionId: string, providerToUnlink: string): Promise<boolean>;
|
|
2324
|
+
/**
|
|
2325
|
+
* Confirms a pending account linking step-up challenge using the user's password.
|
|
2326
|
+
* On successful verification, links the pending provider to the existing account and creates a session.
|
|
2327
|
+
*
|
|
2328
|
+
* @param params - challengeToken and password
|
|
2329
|
+
* @returns Session ID, Session, and User identity
|
|
2330
|
+
* @throws InvalidStateError if challenge is invalid or expired
|
|
2331
|
+
* @throws InvalidCredentialsError if password verification fails
|
|
2332
|
+
*/
|
|
2333
|
+
confirmLinkingWithPassword(params: {
|
|
2334
|
+
challengeToken: string;
|
|
2335
|
+
password: string;
|
|
2336
|
+
}): Promise<{
|
|
2337
|
+
sessionId: string;
|
|
2338
|
+
session: Session;
|
|
2339
|
+
user?: any;
|
|
2340
|
+
}>;
|
|
2341
|
+
/**
|
|
2342
|
+
* Sets a password for an SSO-authenticated user who doesn't have one yet.
|
|
2343
|
+
* Must be called from an authenticated context (user has active session proving identity).
|
|
2344
|
+
*
|
|
2345
|
+
* @param params - userId, newPassword, optional identifier and email
|
|
2346
|
+
* @returns True if password was set successfully
|
|
2347
|
+
* @throws IdentityNotConfiguredError if no identity provider configured
|
|
2348
|
+
* @throws WeakPasswordError if password doesn't meet policy
|
|
2349
|
+
*/
|
|
2350
|
+
setPassword(params: {
|
|
2351
|
+
userId: string;
|
|
2352
|
+
newPassword: string;
|
|
2353
|
+
identifier?: string;
|
|
2354
|
+
email?: string;
|
|
2355
|
+
}): Promise<boolean>;
|
|
1767
2356
|
/**
|
|
1768
2357
|
* Generates an authorization URL for connecting a resource provider (AuthZ) post-login.
|
|
1769
2358
|
*
|
|
@@ -1777,23 +2366,46 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1777
2366
|
*/
|
|
1778
2367
|
getResourceAuthUrl(params: {
|
|
1779
2368
|
sessionId: string;
|
|
1780
|
-
provider:
|
|
1781
|
-
scopes
|
|
2369
|
+
provider: ConfiguredOAuthKey<TIdentity, TProviders> | string;
|
|
2370
|
+
scopes?: string[];
|
|
1782
2371
|
state?: string;
|
|
1783
2372
|
prompt?: string;
|
|
2373
|
+
authorizationParams?: Record<string, string>;
|
|
1784
2374
|
extraConfig?: Record<string, string>;
|
|
1785
2375
|
}): Promise<string>;
|
|
1786
2376
|
private getUserKeyFromSession;
|
|
2377
|
+
private sanitizeIdentityForStorage;
|
|
1787
2378
|
/**
|
|
1788
2379
|
* Handles the OAuth callback for a connected resource provider and stores resource tokens bound to user account.
|
|
1789
2380
|
*/
|
|
1790
2381
|
handleResourceCallback(params: {
|
|
1791
2382
|
sessionId: string;
|
|
1792
|
-
provider:
|
|
2383
|
+
provider: ConfiguredOAuthKey<TIdentity, TProviders> | string;
|
|
1793
2384
|
code: string;
|
|
1794
2385
|
state?: string;
|
|
1795
2386
|
scopes?: string[];
|
|
1796
2387
|
}): Promise<Session>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Retrieves configured default resource scopes for a provider.
|
|
2390
|
+
*
|
|
2391
|
+
* @param provider - Provider name (e.g. 'github', 'google')
|
|
2392
|
+
* @returns Array of configured resource scopes, or undefined if not configured
|
|
2393
|
+
*/
|
|
2394
|
+
getResourceScopes(provider: ConfiguredOAuthKey<TIdentity, TProviders> | string): string[] | undefined;
|
|
2395
|
+
/**
|
|
2396
|
+
* Returns the resolved session cookie name.
|
|
2397
|
+
* Dynamically reflects any changes to the active identity provider.
|
|
2398
|
+
*
|
|
2399
|
+
* @param req - Optional request object for multi-tenant request-scoped cookie resolution
|
|
2400
|
+
* @returns Resolved session cookie name
|
|
2401
|
+
*/
|
|
2402
|
+
getSessionCookieName(req?: unknown): string;
|
|
2403
|
+
/**
|
|
2404
|
+
* Sets or updates the session cookie name or dynamic resolver on this instance.
|
|
2405
|
+
*
|
|
2406
|
+
* @param resolver - Static cookie name or dynamic resolver function
|
|
2407
|
+
*/
|
|
2408
|
+
setSessionCookieName(resolver: SessionCookieResolver<Lixa<TProviders>>): void;
|
|
1797
2409
|
/**
|
|
1798
2410
|
* Retrieves a connected resource for a specific User ID / Email directly (independent of session IDs).
|
|
1799
2411
|
* Automatically refreshes expired access tokens if a refresh token is present.
|
|
@@ -1841,6 +2453,13 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1841
2453
|
* Retrieves active session details from session storage.
|
|
1842
2454
|
*/
|
|
1843
2455
|
fetchSessionInfo(sessionId: string): Promise<Session | null>;
|
|
2456
|
+
/**
|
|
2457
|
+
* Retrieves all linked accounts for a user from account storage.
|
|
2458
|
+
*
|
|
2459
|
+
* @param userIdOrSessionId - User ID, email, or active session ID
|
|
2460
|
+
* @returns Record mapping provider name to linked account metadata
|
|
2461
|
+
*/
|
|
2462
|
+
getUserAccounts(userIdOrSessionId: string): Promise<Record<string, LinkedAccount>>;
|
|
1844
2463
|
/**
|
|
1845
2464
|
* Deletes a session from session storage (e.g. on logout).
|
|
1846
2465
|
*
|
|
@@ -1849,57 +2468,144 @@ declare class Lixa<TConfig extends LixaConfig<Record<string, ProviderConfig>> =
|
|
|
1849
2468
|
deleteSession(sessionId: string): Promise<void>;
|
|
1850
2469
|
private exchangeCodeForToken;
|
|
1851
2470
|
/**
|
|
1852
|
-
* Checks if
|
|
2471
|
+
* Checks if an identity provider (Self-Managed Database, AWS Cognito, Auth0, Okta, etc.) is configured.
|
|
1853
2472
|
*
|
|
1854
|
-
* @returns True if
|
|
2473
|
+
* @returns True if identity provider is configured and available
|
|
2474
|
+
*/
|
|
2475
|
+
isIdentityEnabled(): boolean;
|
|
2476
|
+
/**
|
|
2477
|
+
* Checks if credentials / identity authentication is configured and enabled.
|
|
2478
|
+
*
|
|
2479
|
+
* @returns True if credentials / identity authentication is available
|
|
1855
2480
|
*/
|
|
1856
2481
|
isCredentialsEnabled(): boolean;
|
|
1857
2482
|
/**
|
|
1858
|
-
* Returns the
|
|
2483
|
+
* Returns the configured IdentityProvider instance.
|
|
2484
|
+
*/
|
|
2485
|
+
getIdentityProvider(): IIdentityProvider | undefined;
|
|
2486
|
+
/**
|
|
2487
|
+
* Dynamically sets or updates the active identity provider (e.g. SelfManaged, Cognito, Auth0, Okta).
|
|
2488
|
+
*
|
|
2489
|
+
* @param provider - Identity provider instance or undefined to disable
|
|
2490
|
+
*/
|
|
2491
|
+
setIdentityProvider(provider?: IIdentityProvider): void;
|
|
2492
|
+
/**
|
|
2493
|
+
* Returns the underlying CredentialsManager instance if using Self-Managed identity.
|
|
1859
2494
|
*/
|
|
1860
2495
|
getCredentialsManager(): CredentialsManager | undefined;
|
|
1861
2496
|
/**
|
|
1862
|
-
* Registers a new user with
|
|
1863
|
-
* Automatically
|
|
1864
|
-
* stores credentials, and creates a session (unless autoCreateSessionOnSignUp is false).
|
|
2497
|
+
* Registers a new user with the configured identity provider (Self-Managed DB, Cognito, Auth0, Okta).
|
|
2498
|
+
* Automatically creates an active session unless autoCreateSessionOnSignUp is explicitly set to false.
|
|
1865
2499
|
*
|
|
1866
2500
|
* @param params - Registration parameters (identifier, password, email, username, metadata)
|
|
1867
|
-
* @returns Created user
|
|
2501
|
+
* @returns Created user identity and optional active session
|
|
1868
2502
|
* @throws WeakPasswordError if password does not meet policy requirements
|
|
1869
2503
|
* @throws UserAlreadyExistsError if identifier is already registered
|
|
1870
|
-
* @throws
|
|
2504
|
+
* @throws IdentityNotConfiguredError if identity authentication is not configured
|
|
1871
2505
|
*/
|
|
1872
|
-
signUp(params: SignUpParams
|
|
2506
|
+
signUp(params: SignUpParams & {
|
|
2507
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2508
|
+
}): Promise<SignUpResult>;
|
|
1873
2509
|
/**
|
|
1874
|
-
* Authenticates a user with
|
|
1875
|
-
*
|
|
1876
|
-
* If account linking is configured with AUTO_LINK_BY_VERIFIED_EMAIL, merges with existing session.
|
|
2510
|
+
* Authenticates a user with credentials via the configured identity provider (Self-Managed DB, Cognito, Auth0, Okta, or Composite).
|
|
2511
|
+
* Creates an active session and automatically links with existing sessions when AUTO_LINK_BY_VERIFIED_EMAIL is configured.
|
|
1877
2512
|
*
|
|
1878
|
-
* @param params - Sign-in parameters (identifier, password)
|
|
2513
|
+
* @param params - Sign-in parameters (identifier, password, optional provider)
|
|
1879
2514
|
* @returns Authenticated user, session ID, and session object
|
|
1880
2515
|
* @throws InvalidCredentialsError if authentication fails
|
|
1881
|
-
* @throws
|
|
2516
|
+
* @throws IdentityNotConfiguredError if identity authentication is not configured
|
|
1882
2517
|
*/
|
|
1883
|
-
signIn(params: SignInParams
|
|
2518
|
+
signIn(params: SignInParams & {
|
|
2519
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2520
|
+
}): Promise<SignInResult>;
|
|
1884
2521
|
/**
|
|
1885
2522
|
* Verifies username/email and password credentials without generating a session.
|
|
1886
2523
|
*
|
|
1887
|
-
* @param params - Verification parameters (identifier, password)
|
|
1888
|
-
* @returns User credentials
|
|
1889
|
-
* @throws
|
|
2524
|
+
* @param params - Verification parameters (identifier, password, optional provider)
|
|
2525
|
+
* @returns User credentials/identity or null if invalid
|
|
2526
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
1890
2527
|
*/
|
|
1891
|
-
verifyCredentials(params: VerifyCredentialsParams
|
|
2528
|
+
verifyCredentials(params: VerifyCredentialsParams & {
|
|
2529
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2530
|
+
}): Promise<UserIdentity | null>;
|
|
1892
2531
|
/**
|
|
1893
2532
|
* Updates a user's password after verifying the current password and enforcing policy on the new password.
|
|
1894
2533
|
*
|
|
1895
|
-
* @param params - Change password parameters (userId/identifier, oldPassword, newPassword)
|
|
2534
|
+
* @param params - Change password parameters (userId/identifier, oldPassword, newPassword, optional provider)
|
|
1896
2535
|
* @returns True if password was updated successfully
|
|
1897
2536
|
* @throws UserNotFoundError if user is not found
|
|
1898
2537
|
* @throws InvalidCredentialsError if current password is incorrect
|
|
1899
2538
|
* @throws WeakPasswordError if new password does not meet policy requirements
|
|
1900
|
-
* @throws
|
|
2539
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
1901
2540
|
*/
|
|
1902
|
-
changePassword(params: ChangePasswordParams
|
|
2541
|
+
changePassword(params: ChangePasswordParams & {
|
|
2542
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2543
|
+
}): Promise<boolean>;
|
|
2544
|
+
/**
|
|
2545
|
+
* Initiates a password reset (forgot password flow) through the configured identity provider.
|
|
2546
|
+
*
|
|
2547
|
+
* @param params - Forgot password parameters (identifier, optional metadata, optional provider)
|
|
2548
|
+
* @returns ForgotPasswordResult indicating status and delivery medium (email/SMS)
|
|
2549
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
2550
|
+
*/
|
|
2551
|
+
forgotPassword(params: ForgotPasswordParams & {
|
|
2552
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2553
|
+
}): Promise<ForgotPasswordResult>;
|
|
2554
|
+
/**
|
|
2555
|
+
* Confirms a password reset using a verification code / token and sets the new password.
|
|
2556
|
+
*
|
|
2557
|
+
* @param params - Verification code, identifier, new password, and optional provider
|
|
2558
|
+
* @returns True if password reset was successfully confirmed
|
|
2559
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
2560
|
+
*/
|
|
2561
|
+
confirmPasswordReset(params: ConfirmPasswordResetParams & {
|
|
2562
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2563
|
+
}): Promise<boolean>;
|
|
2564
|
+
/**
|
|
2565
|
+
* Confirms user account registration using a verification code.
|
|
2566
|
+
*
|
|
2567
|
+
* @param params - Verification parameters including identifier, confirmationCode, and optional provider
|
|
2568
|
+
* @returns True if confirmation was successful
|
|
2569
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
2570
|
+
* @throws IdentityProviderError if identity provider does not support confirmation
|
|
2571
|
+
*/
|
|
2572
|
+
confirmSignUp(params: ConfirmSignUpParams & {
|
|
2573
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2574
|
+
}): Promise<boolean>;
|
|
2575
|
+
/**
|
|
2576
|
+
* Resends the sign up confirmation code to the user.
|
|
2577
|
+
*
|
|
2578
|
+
* @param params - Resend parameters including user identifier and optional provider
|
|
2579
|
+
* @returns Details about the code delivery (medium, destination)
|
|
2580
|
+
* @throws IdentityNotConfiguredError if identity auth is not configured
|
|
2581
|
+
* @throws IdentityProviderError if identity provider does not support resending codes
|
|
2582
|
+
*/
|
|
2583
|
+
resendConfirmationCode(params: ResendConfirmationCodeParams & {
|
|
2584
|
+
provider?: ConfiguredIdentityKey<TIdentity>;
|
|
2585
|
+
}): Promise<ResendConfirmationCodeResult>;
|
|
2586
|
+
/**
|
|
2587
|
+
* Retrieves a user by their unique ID from the configured identity provider.
|
|
2588
|
+
*
|
|
2589
|
+
* @param id - Unique user ID
|
|
2590
|
+
* @param provider - Optional provider key when using CompositeIdentityProvider
|
|
2591
|
+
* @returns UserIdentity or null if not found
|
|
2592
|
+
*/
|
|
2593
|
+
getUserById(id: string, provider?: ConfiguredIdentityKey<TIdentity>): Promise<UserIdentity | null>;
|
|
2594
|
+
/**
|
|
2595
|
+
* Retrieves a user by their identifier (username or email) from the configured identity provider.
|
|
2596
|
+
*
|
|
2597
|
+
* @param identifier - Username or email string
|
|
2598
|
+
* @param provider - Optional provider key when using CompositeIdentityProvider
|
|
2599
|
+
* @returns UserIdentity or null if not found
|
|
2600
|
+
*/
|
|
2601
|
+
getUserByIdentifier(identifier: string, provider?: ConfiguredIdentityKey<TIdentity>): Promise<UserIdentity | null>;
|
|
2602
|
+
/**
|
|
2603
|
+
* Deletes a user account from the configured identity provider.
|
|
2604
|
+
*
|
|
2605
|
+
* @param id - Unique user ID
|
|
2606
|
+
* @param provider - Optional provider key when using CompositeIdentityProvider
|
|
2607
|
+
*/
|
|
2608
|
+
deleteUser(id: string, provider?: ConfiguredIdentityKey<TIdentity>): Promise<void>;
|
|
1903
2609
|
private findProviderByType;
|
|
1904
2610
|
}
|
|
1905
2611
|
|
|
@@ -2115,6 +2821,68 @@ declare class WeakPasswordError extends LixaError {
|
|
|
2115
2821
|
declare class CredentialsNotConfiguredError extends LixaError {
|
|
2116
2822
|
constructor(message?: string, details?: Record<string, unknown>);
|
|
2117
2823
|
}
|
|
2824
|
+
/**
|
|
2825
|
+
* Thrown when an identity provider operation fails with an upstream provider error.
|
|
2826
|
+
*
|
|
2827
|
+
* @public
|
|
2828
|
+
*/
|
|
2829
|
+
declare class IdentityProviderError extends LixaError {
|
|
2830
|
+
readonly provider: string | undefined;
|
|
2831
|
+
readonly statusCode: number | undefined;
|
|
2832
|
+
constructor(message: string, provider?: string, statusCode?: number, details?: Record<string, unknown>);
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* Thrown when identity operations (signUp, signIn, etc.) are invoked on a Lixa instance
|
|
2836
|
+
* where neither identity nor credentials authentication is enabled.
|
|
2837
|
+
*
|
|
2838
|
+
* @public
|
|
2839
|
+
*/
|
|
2840
|
+
declare class IdentityNotConfiguredError extends CredentialsNotConfiguredError {
|
|
2841
|
+
constructor(message?: string, details?: Record<string, unknown>);
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Thrown when a login attempt matches an existing user under another provider,
|
|
2845
|
+
* requiring step-up verification (e.g. password or original provider login) before linking.
|
|
2846
|
+
*
|
|
2847
|
+
* @public
|
|
2848
|
+
*/
|
|
2849
|
+
declare class AccountLinkingChallengeRequiredError extends LixaError {
|
|
2850
|
+
readonly challengeToken: string;
|
|
2851
|
+
readonly email: string;
|
|
2852
|
+
readonly incomingProvider: string;
|
|
2853
|
+
readonly incomingProviderUserId?: string | undefined;
|
|
2854
|
+
readonly existingUserId: string;
|
|
2855
|
+
readonly existingProviders: string[];
|
|
2856
|
+
readonly hasPassword: boolean;
|
|
2857
|
+
constructor(message: string, details: {
|
|
2858
|
+
challengeToken: string;
|
|
2859
|
+
email: string;
|
|
2860
|
+
incomingProvider: string;
|
|
2861
|
+
incomingProviderUserId?: string | undefined;
|
|
2862
|
+
existingUserId: string;
|
|
2863
|
+
existingProviders: string[];
|
|
2864
|
+
hasPassword: boolean;
|
|
2865
|
+
});
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Thrown when attempting to sign up with username+password for an email that already has an SSO account.
|
|
2869
|
+
* The user should sign in via their original SSO provider and set a password in Settings.
|
|
2870
|
+
*
|
|
2871
|
+
* @public
|
|
2872
|
+
*/
|
|
2873
|
+
declare class SSOAccountAlreadyExistsError extends LixaError {
|
|
2874
|
+
readonly existingProviders: string[];
|
|
2875
|
+
readonly email: string;
|
|
2876
|
+
constructor(email: string, existingProviders: string[], details?: Record<string, unknown>);
|
|
2877
|
+
}
|
|
2878
|
+
/**
|
|
2879
|
+
* Thrown when a user's account has not been verified/confirmed yet.
|
|
2880
|
+
*
|
|
2881
|
+
* @public
|
|
2882
|
+
*/
|
|
2883
|
+
declare class AccountNotVerifiedError extends LixaError {
|
|
2884
|
+
constructor(identifier?: string, details?: Record<string, unknown>);
|
|
2885
|
+
}
|
|
2118
2886
|
|
|
2119
2887
|
/**
|
|
2120
2888
|
* Sensible default cookie configuration options.
|
|
@@ -2258,31 +3026,51 @@ declare function createStateCookie(state: string, options?: CookieOptions): Cook
|
|
|
2258
3026
|
*/
|
|
2259
3027
|
declare function clearStateCookie(options?: CookieOptions): CookiePayload;
|
|
2260
3028
|
|
|
2261
|
-
type
|
|
2262
|
-
type
|
|
2263
|
-
type
|
|
2264
|
-
declare const
|
|
2265
|
-
type
|
|
2266
|
-
type
|
|
2267
|
-
type
|
|
2268
|
-
declare const
|
|
2269
|
-
type
|
|
2270
|
-
type
|
|
2271
|
-
type
|
|
2272
|
-
type
|
|
2273
|
-
declare const
|
|
2274
|
-
type
|
|
2275
|
-
type
|
|
2276
|
-
declare const
|
|
2277
|
-
type
|
|
2278
|
-
type
|
|
2279
|
-
type
|
|
2280
|
-
type
|
|
2281
|
-
type
|
|
2282
|
-
type
|
|
2283
|
-
declare const
|
|
3029
|
+
type index$1_ChangePasswordParams = ChangePasswordParams;
|
|
3030
|
+
type index$1_CredentialsConfig = CredentialsConfig;
|
|
3031
|
+
type index$1_CredentialsManager = CredentialsManager;
|
|
3032
|
+
declare const index$1_CredentialsManager: typeof CredentialsManager;
|
|
3033
|
+
type index$1_CredentialsStorage = CredentialsStorage;
|
|
3034
|
+
type index$1_IPasswordHasher = IPasswordHasher;
|
|
3035
|
+
type index$1_LocalCredentialsStorage = LocalCredentialsStorage;
|
|
3036
|
+
declare const index$1_LocalCredentialsStorage: typeof LocalCredentialsStorage;
|
|
3037
|
+
type index$1_PasswordPolicyConfig = PasswordPolicyConfig;
|
|
3038
|
+
type index$1_PasswordPolicyResult = PasswordPolicyResult;
|
|
3039
|
+
type index$1_Pbkdf2HasherOptions = Pbkdf2HasherOptions;
|
|
3040
|
+
type index$1_Pbkdf2PasswordHasher = Pbkdf2PasswordHasher;
|
|
3041
|
+
declare const index$1_Pbkdf2PasswordHasher: typeof Pbkdf2PasswordHasher;
|
|
3042
|
+
type index$1_ScryptHasherOptions = ScryptHasherOptions;
|
|
3043
|
+
type index$1_ScryptPasswordHasher = ScryptPasswordHasher;
|
|
3044
|
+
declare const index$1_ScryptPasswordHasher: typeof ScryptPasswordHasher;
|
|
3045
|
+
type index$1_SignInParams = SignInParams;
|
|
3046
|
+
type index$1_SignInResult<TSession = Session, TUser = UserIdentity> = SignInResult<TSession, TUser>;
|
|
3047
|
+
type index$1_SignUpParams = SignUpParams;
|
|
3048
|
+
type index$1_SignUpResult<TSession = Session, TUser = UserIdentity> = SignUpResult<TSession, TUser>;
|
|
3049
|
+
type index$1_UserCredentials = UserCredentials;
|
|
3050
|
+
type index$1_VerifyCredentialsParams = VerifyCredentialsParams;
|
|
3051
|
+
declare const index$1_validatePasswordPolicy: typeof validatePasswordPolicy;
|
|
3052
|
+
declare namespace index$1 {
|
|
3053
|
+
export { type index$1_ChangePasswordParams as ChangePasswordParams, type index$1_CredentialsConfig as CredentialsConfig, index$1_CredentialsManager as CredentialsManager, type index$1_CredentialsStorage as CredentialsStorage, type index$1_IPasswordHasher as IPasswordHasher, index$1_LocalCredentialsStorage as LocalCredentialsStorage, type index$1_PasswordPolicyConfig as PasswordPolicyConfig, type index$1_PasswordPolicyResult as PasswordPolicyResult, type index$1_Pbkdf2HasherOptions as Pbkdf2HasherOptions, index$1_Pbkdf2PasswordHasher as Pbkdf2PasswordHasher, type index$1_ScryptHasherOptions as ScryptHasherOptions, index$1_ScryptPasswordHasher as ScryptPasswordHasher, type index$1_SignInParams as SignInParams, type index$1_SignInResult as SignInResult, type index$1_SignUpParams as SignUpParams, type index$1_SignUpResult as SignUpResult, type index$1_UserCredentials as UserCredentials, type index$1_VerifyCredentialsParams as VerifyCredentialsParams, index$1_validatePasswordPolicy as validatePasswordPolicy };
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
type index_CompositeIdentityProvider<TProviders extends Record<string, IIdentityProvider> = Record<string, IIdentityProvider>, TOAuthProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> = CompositeIdentityProvider<TProviders, TOAuthProviders>;
|
|
3057
|
+
declare const index_CompositeIdentityProvider: typeof CompositeIdentityProvider;
|
|
3058
|
+
type index_CompositeIdentityProviderOptions<TProviders extends Record<string, IIdentityProvider> = Record<string, IIdentityProvider>, TOAuthProviders extends Record<string, ProviderConfig> = Record<string, ProviderConfig>> = CompositeIdentityProviderOptions<TProviders, TOAuthProviders>;
|
|
3059
|
+
type index_ConfirmPasswordResetParams = ConfirmPasswordResetParams;
|
|
3060
|
+
type index_ConfirmSignUpParams = ConfirmSignUpParams;
|
|
3061
|
+
type index_ForgotPasswordParams = ForgotPasswordParams;
|
|
3062
|
+
type index_ForgotPasswordResult = ForgotPasswordResult;
|
|
3063
|
+
type index_IIdentityProvider = IIdentityProvider;
|
|
3064
|
+
type index_IdentityAuthResult = IdentityAuthResult;
|
|
3065
|
+
type index_IdentityConfig = IdentityConfig;
|
|
3066
|
+
type index_IdentityTokens = IdentityTokens;
|
|
3067
|
+
type index_ResendConfirmationCodeParams = ResendConfirmationCodeParams;
|
|
3068
|
+
type index_ResendConfirmationCodeResult = ResendConfirmationCodeResult;
|
|
3069
|
+
type index_SelfManagedIdentityProvider = SelfManagedIdentityProvider;
|
|
3070
|
+
declare const index_SelfManagedIdentityProvider: typeof SelfManagedIdentityProvider;
|
|
3071
|
+
type index_UserIdentity = UserIdentity;
|
|
2284
3072
|
declare namespace index {
|
|
2285
|
-
export {
|
|
3073
|
+
export { index_CompositeIdentityProvider as CompositeIdentityProvider, type index_CompositeIdentityProviderOptions as CompositeIdentityProviderOptions, type index_ConfirmPasswordResetParams as ConfirmPasswordResetParams, type index_ConfirmSignUpParams as ConfirmSignUpParams, type index_ForgotPasswordParams as ForgotPasswordParams, type index_ForgotPasswordResult as ForgotPasswordResult, type index_IIdentityProvider as IIdentityProvider, type index_IdentityAuthResult as IdentityAuthResult, type index_IdentityConfig as IdentityConfig, type index_IdentityTokens as IdentityTokens, type index_ResendConfirmationCodeParams as ResendConfirmationCodeParams, type index_ResendConfirmationCodeResult as ResendConfirmationCodeResult, index_SelfManagedIdentityProvider as SelfManagedIdentityProvider, type index_UserIdentity as UserIdentity };
|
|
2286
3074
|
}
|
|
2287
3075
|
|
|
2288
|
-
export { type AccountLinkingConfig, type AccountLinkingMode, AccountLinkingStrategy, AccountUnlinkError, type ChangePasswordParams, type ConnectedResource, type CookieOptions, type CookiePayload, type CredentialsConfig, CredentialsManager, CredentialsNotConfiguredError, type CredentialsStorage, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_SESSION_MAX_AGE_SECONDS, DEFAULT_STATE_COOKIE_NAME, DEFAULT_STATE_MAX_AGE_SECONDS, EmailNotVerifiedError, type IPasswordHasher, type IProvider, InvalidCredentialsError, InvalidOAuthCallbackError, InvalidProviderConfigError, InvalidStateError, Lixa, type LixaConfig, LixaError, type LixaLogger, LocalCredentialsStorage, type LogContext, type LogLevel, type OAuthTokenResponse, type PasswordPolicyConfig, type PasswordPolicyResult, type Pbkdf2HasherOptions, Pbkdf2PasswordHasher, type ProviderConfig, type ProviderMetadata, ProviderNotConfiguredError, RefreshTokenError, type ResourceHandler, type ResourceStorage, type SafeLixaConfig, type ScryptHasherOptions, ScryptPasswordHasher, type Session, type SessionHandler, SessionNotFoundError, type SessionStorage, type SignInParams, type SignInResult, type SignUpParams, type SignUpResult, type StateData, type StateHandler, type StateStorage, TokenExchangeError, UserAlreadyExistsError, type UserCredentials, type UserInfo, UserNotFoundError, type VerifyCredentialsParams, WeakPasswordError, clearSessionCookie, clearStateCookie, createSessionCookie, createStateCookie, index as credentials, decodeIdToken, determineProviderFromIssuer, extractUserInfo, fetchUserInfo, isProductionEnvironment, serializeCookie, validatePasswordPolicy };
|
|
3076
|
+
export { type AccountHandler, AccountLinkingChallengeRequiredError, type AccountLinkingConfig, type AccountLinkingMode, AccountLinkingStrategy, AccountNotVerifiedError, type AccountStorage, AccountUnlinkError, type ChangePasswordParams, CompositeIdentityProvider, type CompositeIdentityProviderOptions, type ConfiguredIdentityKey, type ConfiguredOAuthKey, type ConfirmPasswordResetParams, type ConfirmSignUpParams, type ConnectedResource, type CookieOptions, type CookiePayload, type CredentialsConfig, CredentialsManager, CredentialsNotConfiguredError, type CredentialsStorage, DEFAULT_SESSION_COOKIE_NAME, DEFAULT_SESSION_MAX_AGE_SECONDS, DEFAULT_STATE_COOKIE_NAME, DEFAULT_STATE_MAX_AGE_SECONDS, EmailNotVerifiedError, type ForgotPasswordParams, type ForgotPasswordResult, type IIdentityProvider, type IPasswordHasher, type IProvider, type IdentityAuthResult, type IdentityConfig, IdentityNotConfiguredError, IdentityProviderError, type IdentityTokens, InvalidCredentialsError, InvalidOAuthCallbackError, InvalidProviderConfigError, InvalidStateError, type LinkedAccount, Lixa, type LixaConfig, type LixaCookieContext, LixaError, type LixaLogger, LocalCredentialsStorage, type LogContext, type LogLevel, type OAuthTokenResponse, type PasswordPolicyConfig, type PasswordPolicyResult, type Pbkdf2HasherOptions, Pbkdf2PasswordHasher, type ProviderConfig, type ProviderMetadata, ProviderNotConfiguredError, RefreshTokenError, type ResendConfirmationCodeParams, type ResendConfirmationCodeResult, type ResourceHandler, type ResourceStorage, SSOAccountAlreadyExistsError, type SafeLixaConfig, type ScopesConfig, type ScryptHasherOptions, ScryptPasswordHasher, SelfManagedIdentityProvider, type Session, type SessionCookieResolver, type SessionHandler, SessionNotFoundError, type SessionStorage, type SignInParams, type SignInResult, type SignUpParams, type SignUpResult, type StateData, type StateHandler, type StateStorage, type StorageAdapter, TokenExchangeError, UserAlreadyExistsError, type UserCredentials, type UserIdentity, type UserInfo, UserNotFoundError, type VerifyCredentialsParams, WeakPasswordError, clearSessionCookie, clearStateCookie, createSessionCookie, createStateCookie, index$1 as credentials, decodeIdToken, determineProviderFromIssuer, extractUserInfo, fetchUserInfo, index as identity, isProductionEnvironment, serializeCookie, validatePasswordPolicy };
|