@nauth-toolkit/client 0.1.5 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/index.cjs +31 -0
- package/dist/angular/index.cjs.map +1 -1
- package/dist/angular/index.d.mts +21 -0
- package/dist/angular/index.d.ts +21 -0
- package/dist/angular/index.mjs +31 -0
- package/dist/angular/index.mjs.map +1 -1
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.mjs +21 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/angular/index.d.mts
CHANGED
|
@@ -27,6 +27,16 @@ interface UpdateProfileRequest {
|
|
|
27
27
|
email?: string;
|
|
28
28
|
phone?: string;
|
|
29
29
|
}
|
|
30
|
+
interface ForgotPasswordResponse {
|
|
31
|
+
success: boolean;
|
|
32
|
+
destination?: string;
|
|
33
|
+
deliveryMedium?: 'email' | 'sms';
|
|
34
|
+
expiresIn?: number;
|
|
35
|
+
}
|
|
36
|
+
interface ConfirmForgotPasswordResponse {
|
|
37
|
+
success: boolean;
|
|
38
|
+
mustChangePassword: boolean;
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
declare enum NAuthErrorCode {
|
|
32
42
|
AUTH_INVALID_CREDENTIALS = "AUTH_INVALID_CREDENTIALS",
|
|
@@ -74,6 +84,11 @@ declare enum NAuthErrorCode {
|
|
|
74
84
|
PASSWORD_INCORRECT = "PASSWORD_INCORRECT",
|
|
75
85
|
PASSWORD_REUSED = "PASSWORD_REUSED",
|
|
76
86
|
PASSWORD_CHANGE_NOT_ALLOWED = "PASSWORD_CHANGE_NOT_ALLOWED",
|
|
87
|
+
WEAK_PASSWORD = "SIGNUP_WEAK_PASSWORD",
|
|
88
|
+
PASSWORD_RESET_CODE_INVALID = "PASSWORD_RESET_CODE_INVALID",
|
|
89
|
+
PASSWORD_RESET_CODE_EXPIRED = "PASSWORD_RESET_CODE_EXPIRED",
|
|
90
|
+
PASSWORD_RESET_MAX_ATTEMPTS = "PASSWORD_RESET_MAX_ATTEMPTS",
|
|
91
|
+
RATE_LIMIT_PASSWORD_RESET = "RATE_LIMIT_PASSWORD_RESET",
|
|
77
92
|
SIGNIN_BLOCKED_HIGH_RISK = "SIGNIN_BLOCKED_HIGH_RISK",
|
|
78
93
|
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
|
|
79
94
|
FORBIDDEN = "FORBIDDEN",
|
|
@@ -125,6 +140,8 @@ interface NAuthEndpoints {
|
|
|
125
140
|
profile: string;
|
|
126
141
|
changePassword: string;
|
|
127
142
|
requestPasswordChange: string;
|
|
143
|
+
forgotPassword: string;
|
|
144
|
+
confirmForgotPassword: string;
|
|
128
145
|
mfaStatus: string;
|
|
129
146
|
mfaDevices: string;
|
|
130
147
|
mfaSetupData: string;
|
|
@@ -488,6 +505,8 @@ declare class NAuthClient {
|
|
|
488
505
|
getProfile(): Promise<AuthUser>;
|
|
489
506
|
updateProfile(updates: UpdateProfileRequest): Promise<AuthUser>;
|
|
490
507
|
changePassword(oldPassword: string, newPassword: string): Promise<void>;
|
|
508
|
+
forgotPassword(identifier: string): Promise<ForgotPasswordResponse>;
|
|
509
|
+
confirmForgotPassword(identifier: string, code: string, newPassword: string): Promise<ConfirmForgotPasswordResponse>;
|
|
491
510
|
requestPasswordChange(): Promise<void>;
|
|
492
511
|
getMfaStatus(): Promise<MFAStatus>;
|
|
493
512
|
getMfaDevices(): Promise<unknown[]>;
|
|
@@ -577,6 +596,8 @@ declare class AuthService {
|
|
|
577
596
|
revokedCount: number;
|
|
578
597
|
}>;
|
|
579
598
|
refresh(): Observable<TokenResponse>;
|
|
599
|
+
forgotPassword(identifier: string): Observable<ForgotPasswordResponse>;
|
|
600
|
+
confirmForgotPassword(identifier: string, code: string, newPassword: string): Observable<ConfirmForgotPasswordResponse>;
|
|
580
601
|
respondToChallenge(response: ChallengeResponse): Observable<AuthResponse>;
|
|
581
602
|
resendCode(session: string): Observable<{
|
|
582
603
|
destination: string;
|
package/dist/angular/index.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ interface UpdateProfileRequest {
|
|
|
27
27
|
email?: string;
|
|
28
28
|
phone?: string;
|
|
29
29
|
}
|
|
30
|
+
interface ForgotPasswordResponse {
|
|
31
|
+
success: boolean;
|
|
32
|
+
destination?: string;
|
|
33
|
+
deliveryMedium?: 'email' | 'sms';
|
|
34
|
+
expiresIn?: number;
|
|
35
|
+
}
|
|
36
|
+
interface ConfirmForgotPasswordResponse {
|
|
37
|
+
success: boolean;
|
|
38
|
+
mustChangePassword: boolean;
|
|
39
|
+
}
|
|
30
40
|
|
|
31
41
|
declare enum NAuthErrorCode {
|
|
32
42
|
AUTH_INVALID_CREDENTIALS = "AUTH_INVALID_CREDENTIALS",
|
|
@@ -74,6 +84,11 @@ declare enum NAuthErrorCode {
|
|
|
74
84
|
PASSWORD_INCORRECT = "PASSWORD_INCORRECT",
|
|
75
85
|
PASSWORD_REUSED = "PASSWORD_REUSED",
|
|
76
86
|
PASSWORD_CHANGE_NOT_ALLOWED = "PASSWORD_CHANGE_NOT_ALLOWED",
|
|
87
|
+
WEAK_PASSWORD = "SIGNUP_WEAK_PASSWORD",
|
|
88
|
+
PASSWORD_RESET_CODE_INVALID = "PASSWORD_RESET_CODE_INVALID",
|
|
89
|
+
PASSWORD_RESET_CODE_EXPIRED = "PASSWORD_RESET_CODE_EXPIRED",
|
|
90
|
+
PASSWORD_RESET_MAX_ATTEMPTS = "PASSWORD_RESET_MAX_ATTEMPTS",
|
|
91
|
+
RATE_LIMIT_PASSWORD_RESET = "RATE_LIMIT_PASSWORD_RESET",
|
|
77
92
|
SIGNIN_BLOCKED_HIGH_RISK = "SIGNIN_BLOCKED_HIGH_RISK",
|
|
78
93
|
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
|
|
79
94
|
FORBIDDEN = "FORBIDDEN",
|
|
@@ -125,6 +140,8 @@ interface NAuthEndpoints {
|
|
|
125
140
|
profile: string;
|
|
126
141
|
changePassword: string;
|
|
127
142
|
requestPasswordChange: string;
|
|
143
|
+
forgotPassword: string;
|
|
144
|
+
confirmForgotPassword: string;
|
|
128
145
|
mfaStatus: string;
|
|
129
146
|
mfaDevices: string;
|
|
130
147
|
mfaSetupData: string;
|
|
@@ -488,6 +505,8 @@ declare class NAuthClient {
|
|
|
488
505
|
getProfile(): Promise<AuthUser>;
|
|
489
506
|
updateProfile(updates: UpdateProfileRequest): Promise<AuthUser>;
|
|
490
507
|
changePassword(oldPassword: string, newPassword: string): Promise<void>;
|
|
508
|
+
forgotPassword(identifier: string): Promise<ForgotPasswordResponse>;
|
|
509
|
+
confirmForgotPassword(identifier: string, code: string, newPassword: string): Promise<ConfirmForgotPasswordResponse>;
|
|
491
510
|
requestPasswordChange(): Promise<void>;
|
|
492
511
|
getMfaStatus(): Promise<MFAStatus>;
|
|
493
512
|
getMfaDevices(): Promise<unknown[]>;
|
|
@@ -577,6 +596,8 @@ declare class AuthService {
|
|
|
577
596
|
revokedCount: number;
|
|
578
597
|
}>;
|
|
579
598
|
refresh(): Observable<TokenResponse>;
|
|
599
|
+
forgotPassword(identifier: string): Observable<ForgotPasswordResponse>;
|
|
600
|
+
confirmForgotPassword(identifier: string, code: string, newPassword: string): Observable<ConfirmForgotPasswordResponse>;
|
|
580
601
|
respondToChallenge(response: ChallengeResponse): Observable<AuthResponse>;
|
|
581
602
|
resendCode(session: string): Observable<{
|
|
582
603
|
destination: string;
|
package/dist/angular/index.mjs
CHANGED
|
@@ -183,6 +183,8 @@ var defaultEndpoints = {
|
|
|
183
183
|
profile: "/profile",
|
|
184
184
|
changePassword: "/change-password",
|
|
185
185
|
requestPasswordChange: "/request-password-change",
|
|
186
|
+
forgotPassword: "/forgot-password",
|
|
187
|
+
confirmForgotPassword: "/forgot-password/confirm",
|
|
186
188
|
mfaStatus: "/mfa/status",
|
|
187
189
|
mfaDevices: "/mfa/devices",
|
|
188
190
|
mfaSetupData: "/mfa/setup-data",
|
|
@@ -794,6 +796,20 @@ var _NAuthClient = class _NAuthClient {
|
|
|
794
796
|
const payload = { currentPassword: oldPassword, newPassword };
|
|
795
797
|
await this.post(this.config.endpoints.changePassword, payload, true);
|
|
796
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* Request a password reset code (forgot password).
|
|
801
|
+
*/
|
|
802
|
+
async forgotPassword(identifier) {
|
|
803
|
+
const payload = { identifier };
|
|
804
|
+
return this.post(this.config.endpoints.forgotPassword, payload);
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Confirm a password reset code and set a new password.
|
|
808
|
+
*/
|
|
809
|
+
async confirmForgotPassword(identifier, code, newPassword) {
|
|
810
|
+
const payload = { identifier, code, newPassword };
|
|
811
|
+
return this.post(this.config.endpoints.confirmForgotPassword, payload);
|
|
812
|
+
}
|
|
797
813
|
/**
|
|
798
814
|
* Request password change (must change on next login).
|
|
799
815
|
*/
|
|
@@ -1531,6 +1547,21 @@ var AuthService = class {
|
|
|
1531
1547
|
return from(this.client.refreshTokens());
|
|
1532
1548
|
}
|
|
1533
1549
|
// ============================================================================
|
|
1550
|
+
// Account Recovery (Forgot Password)
|
|
1551
|
+
// ============================================================================
|
|
1552
|
+
/**
|
|
1553
|
+
* Request a password reset code (forgot password).
|
|
1554
|
+
*/
|
|
1555
|
+
forgotPassword(identifier) {
|
|
1556
|
+
return from(this.client.forgotPassword(identifier));
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Confirm a password reset code and set a new password.
|
|
1560
|
+
*/
|
|
1561
|
+
confirmForgotPassword(identifier, code, newPassword) {
|
|
1562
|
+
return from(this.client.confirmForgotPassword(identifier, code, newPassword));
|
|
1563
|
+
}
|
|
1564
|
+
// ============================================================================
|
|
1534
1565
|
// Challenge Flow Methods (Essential for any auth flow)
|
|
1535
1566
|
// ============================================================================
|
|
1536
1567
|
/**
|