@nauth-toolkit/client 0.1.87 → 0.1.89
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/index.cjs +26 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +16 -19
- package/dist/index.d.ts +16 -19
- package/dist/index.mjs +26 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -100,7 +100,7 @@ interface AuthResponse {
|
|
|
100
100
|
challengeName?: AuthChallenge;
|
|
101
101
|
session?: string;
|
|
102
102
|
challengeParameters?: Record<string, unknown>;
|
|
103
|
-
|
|
103
|
+
sub?: string;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Minimal user information returned inside auth responses.
|
|
@@ -147,7 +147,6 @@ interface LoginRequest {
|
|
|
147
147
|
* Logout request payload.
|
|
148
148
|
*/
|
|
149
149
|
interface LogoutRequest {
|
|
150
|
-
sub?: string;
|
|
151
150
|
forgetMe?: boolean;
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
@@ -159,7 +158,6 @@ interface LogoutAllRequest {
|
|
|
159
158
|
* Default: false (devices remain trusted)
|
|
160
159
|
*/
|
|
161
160
|
forgetDevices?: boolean;
|
|
162
|
-
sub?: string;
|
|
163
161
|
}
|
|
164
162
|
/**
|
|
165
163
|
* Resend code request payload.
|
|
@@ -556,7 +554,6 @@ interface NAuthEndpoints {
|
|
|
556
554
|
getChallengeData: string;
|
|
557
555
|
profile: string;
|
|
558
556
|
changePassword: string;
|
|
559
|
-
requestPasswordChange: string;
|
|
560
557
|
forgotPassword: string;
|
|
561
558
|
confirmForgotPassword: string;
|
|
562
559
|
confirmAdminResetPassword: string;
|
|
@@ -1472,11 +1469,15 @@ declare class NAuthClient {
|
|
|
1472
1469
|
*/
|
|
1473
1470
|
resetPasswordWithCode(identifier: string, code: string, newPassword: string): Promise<ResetPasswordWithCodeResponse>;
|
|
1474
1471
|
/**
|
|
1475
|
-
*
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
*
|
|
1472
|
+
* Get MFA status for current user.
|
|
1473
|
+
*
|
|
1474
|
+
* @returns Promise of MFA status
|
|
1475
|
+
*
|
|
1476
|
+
* @example
|
|
1477
|
+
* ```typescript
|
|
1478
|
+
* const status = await this.client.getMfaStatus();
|
|
1479
|
+
* console.log('MFA enabled:', status.enabled);
|
|
1480
|
+
* ```
|
|
1480
1481
|
*/
|
|
1481
1482
|
getMfaStatus(): Promise<MFAStatus>;
|
|
1482
1483
|
/**
|
|
@@ -1633,26 +1634,22 @@ declare class NAuthClient {
|
|
|
1633
1634
|
trusted: boolean;
|
|
1634
1635
|
}>;
|
|
1635
1636
|
/**
|
|
1636
|
-
* Get
|
|
1637
|
-
*
|
|
1638
|
-
* Returns authentication and security events with full audit details including:
|
|
1639
|
-
* - Event type (login, logout, MFA, etc.)
|
|
1640
|
-
* - Event status (success, failure, suspicious)
|
|
1641
|
-
* - Device information, location, risk factors
|
|
1637
|
+
* Get authentication audit history for current user.
|
|
1642
1638
|
*
|
|
1643
|
-
* @param params -
|
|
1644
|
-
* @returns Paginated audit history
|
|
1639
|
+
* @param params - Optional query parameters (page, limit, eventType, etc.)
|
|
1640
|
+
* @returns Paginated audit history
|
|
1645
1641
|
*
|
|
1646
1642
|
* @example
|
|
1647
1643
|
* ```typescript
|
|
1648
1644
|
* const history = await client.getAuditHistory({
|
|
1649
1645
|
* page: 1,
|
|
1650
1646
|
* limit: 20,
|
|
1651
|
-
*
|
|
1647
|
+
* eventTypes: ['LOGIN_SUCCESS'],
|
|
1648
|
+
* eventStatus: ['FAILURE'],
|
|
1652
1649
|
* });
|
|
1653
1650
|
* ```
|
|
1654
1651
|
*/
|
|
1655
|
-
getAuditHistory(params?: Record<string, string | number | boolean
|
|
1652
|
+
getAuditHistory(params?: Record<string, string | number | boolean | Array<string | number | boolean>>): Promise<AuditHistoryResponse>;
|
|
1656
1653
|
/**
|
|
1657
1654
|
* Initialize client by hydrating state from storage.
|
|
1658
1655
|
* Call this on app startup to restore auth state.
|
package/dist/index.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ interface AuthResponse {
|
|
|
100
100
|
challengeName?: AuthChallenge;
|
|
101
101
|
session?: string;
|
|
102
102
|
challengeParameters?: Record<string, unknown>;
|
|
103
|
-
|
|
103
|
+
sub?: string;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
106
|
* Minimal user information returned inside auth responses.
|
|
@@ -147,7 +147,6 @@ interface LoginRequest {
|
|
|
147
147
|
* Logout request payload.
|
|
148
148
|
*/
|
|
149
149
|
interface LogoutRequest {
|
|
150
|
-
sub?: string;
|
|
151
150
|
forgetMe?: boolean;
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
@@ -159,7 +158,6 @@ interface LogoutAllRequest {
|
|
|
159
158
|
* Default: false (devices remain trusted)
|
|
160
159
|
*/
|
|
161
160
|
forgetDevices?: boolean;
|
|
162
|
-
sub?: string;
|
|
163
161
|
}
|
|
164
162
|
/**
|
|
165
163
|
* Resend code request payload.
|
|
@@ -556,7 +554,6 @@ interface NAuthEndpoints {
|
|
|
556
554
|
getChallengeData: string;
|
|
557
555
|
profile: string;
|
|
558
556
|
changePassword: string;
|
|
559
|
-
requestPasswordChange: string;
|
|
560
557
|
forgotPassword: string;
|
|
561
558
|
confirmForgotPassword: string;
|
|
562
559
|
confirmAdminResetPassword: string;
|
|
@@ -1472,11 +1469,15 @@ declare class NAuthClient {
|
|
|
1472
1469
|
*/
|
|
1473
1470
|
resetPasswordWithCode(identifier: string, code: string, newPassword: string): Promise<ResetPasswordWithCodeResponse>;
|
|
1474
1471
|
/**
|
|
1475
|
-
*
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
*
|
|
1472
|
+
* Get MFA status for current user.
|
|
1473
|
+
*
|
|
1474
|
+
* @returns Promise of MFA status
|
|
1475
|
+
*
|
|
1476
|
+
* @example
|
|
1477
|
+
* ```typescript
|
|
1478
|
+
* const status = await this.client.getMfaStatus();
|
|
1479
|
+
* console.log('MFA enabled:', status.enabled);
|
|
1480
|
+
* ```
|
|
1480
1481
|
*/
|
|
1481
1482
|
getMfaStatus(): Promise<MFAStatus>;
|
|
1482
1483
|
/**
|
|
@@ -1633,26 +1634,22 @@ declare class NAuthClient {
|
|
|
1633
1634
|
trusted: boolean;
|
|
1634
1635
|
}>;
|
|
1635
1636
|
/**
|
|
1636
|
-
* Get
|
|
1637
|
-
*
|
|
1638
|
-
* Returns authentication and security events with full audit details including:
|
|
1639
|
-
* - Event type (login, logout, MFA, etc.)
|
|
1640
|
-
* - Event status (success, failure, suspicious)
|
|
1641
|
-
* - Device information, location, risk factors
|
|
1637
|
+
* Get authentication audit history for current user.
|
|
1642
1638
|
*
|
|
1643
|
-
* @param params -
|
|
1644
|
-
* @returns Paginated audit history
|
|
1639
|
+
* @param params - Optional query parameters (page, limit, eventType, etc.)
|
|
1640
|
+
* @returns Paginated audit history
|
|
1645
1641
|
*
|
|
1646
1642
|
* @example
|
|
1647
1643
|
* ```typescript
|
|
1648
1644
|
* const history = await client.getAuditHistory({
|
|
1649
1645
|
* page: 1,
|
|
1650
1646
|
* limit: 20,
|
|
1651
|
-
*
|
|
1647
|
+
* eventTypes: ['LOGIN_SUCCESS'],
|
|
1648
|
+
* eventStatus: ['FAILURE'],
|
|
1652
1649
|
* });
|
|
1653
1650
|
* ```
|
|
1654
1651
|
*/
|
|
1655
|
-
getAuditHistory(params?: Record<string, string | number | boolean
|
|
1652
|
+
getAuditHistory(params?: Record<string, string | number | boolean | Array<string | number | boolean>>): Promise<AuditHistoryResponse>;
|
|
1656
1653
|
/**
|
|
1657
1654
|
* Initialize client by hydrating state from storage.
|
|
1658
1655
|
* Call this on app startup to restore auth state.
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,6 @@ var defaultEndpoints = {
|
|
|
115
115
|
getChallengeData: "/challenge/challenge-data",
|
|
116
116
|
profile: "/profile",
|
|
117
117
|
changePassword: "/change-password",
|
|
118
|
-
requestPasswordChange: "/request-password-change",
|
|
119
118
|
forgotPassword: "/forgot-password",
|
|
120
119
|
confirmForgotPassword: "/forgot-password/confirm",
|
|
121
120
|
confirmAdminResetPassword: "/admin/reset-password/confirm",
|
|
@@ -1079,13 +1078,15 @@ var NAuthClient = class {
|
|
|
1079
1078
|
return result;
|
|
1080
1079
|
}
|
|
1081
1080
|
/**
|
|
1082
|
-
*
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
*
|
|
1081
|
+
* Get MFA status for current user.
|
|
1082
|
+
*
|
|
1083
|
+
* @returns Promise of MFA status
|
|
1084
|
+
*
|
|
1085
|
+
* @example
|
|
1086
|
+
* ```typescript
|
|
1087
|
+
* const status = await this.client.getMfaStatus();
|
|
1088
|
+
* console.log('MFA enabled:', status.enabled);
|
|
1089
|
+
* ```
|
|
1089
1090
|
*/
|
|
1090
1091
|
async getMfaStatus() {
|
|
1091
1092
|
return this.get(this.config.endpoints.mfaStatus, true);
|
|
@@ -1128,7 +1129,7 @@ var NAuthClient = class {
|
|
|
1128
1129
|
* @returns Success message
|
|
1129
1130
|
*/
|
|
1130
1131
|
async setPreferredMfaMethod(method) {
|
|
1131
|
-
return this.post(this.config.endpoints.mfaPreferred, { method }, true);
|
|
1132
|
+
return this.post(this.config.endpoints.mfaPreferred, { methodType: method }, true);
|
|
1132
1133
|
}
|
|
1133
1134
|
/**
|
|
1134
1135
|
* Generate backup codes.
|
|
@@ -1316,28 +1317,33 @@ var NAuthClient = class {
|
|
|
1316
1317
|
return this.get(this.config.endpoints.isTrustedDevice, true);
|
|
1317
1318
|
}
|
|
1318
1319
|
/**
|
|
1319
|
-
* Get
|
|
1320
|
-
*
|
|
1321
|
-
* Returns authentication and security events with full audit details including:
|
|
1322
|
-
* - Event type (login, logout, MFA, etc.)
|
|
1323
|
-
* - Event status (success, failure, suspicious)
|
|
1324
|
-
* - Device information, location, risk factors
|
|
1320
|
+
* Get authentication audit history for current user.
|
|
1325
1321
|
*
|
|
1326
|
-
* @param params -
|
|
1327
|
-
* @returns Paginated audit history
|
|
1322
|
+
* @param params - Optional query parameters (page, limit, eventType, etc.)
|
|
1323
|
+
* @returns Paginated audit history
|
|
1328
1324
|
*
|
|
1329
1325
|
* @example
|
|
1330
1326
|
* ```typescript
|
|
1331
1327
|
* const history = await client.getAuditHistory({
|
|
1332
1328
|
* page: 1,
|
|
1333
1329
|
* limit: 20,
|
|
1334
|
-
*
|
|
1330
|
+
* eventTypes: ['LOGIN_SUCCESS'],
|
|
1331
|
+
* eventStatus: ['FAILURE'],
|
|
1335
1332
|
* });
|
|
1336
1333
|
* ```
|
|
1337
1334
|
*/
|
|
1338
1335
|
async getAuditHistory(params) {
|
|
1339
|
-
const
|
|
1340
|
-
const
|
|
1336
|
+
const searchParams = new URLSearchParams();
|
|
1337
|
+
for (const [key, rawValue] of Object.entries(params ?? {})) {
|
|
1338
|
+
if (Array.isArray(rawValue)) {
|
|
1339
|
+
for (const item of rawValue) {
|
|
1340
|
+
searchParams.append(key, String(item));
|
|
1341
|
+
}
|
|
1342
|
+
continue;
|
|
1343
|
+
}
|
|
1344
|
+
searchParams.append(key, String(rawValue));
|
|
1345
|
+
}
|
|
1346
|
+
const query = searchParams.toString() ? `?${searchParams.toString()}` : "";
|
|
1341
1347
|
const path = `${this.config.endpoints.auditHistory}${query}`;
|
|
1342
1348
|
return this.get(path, true);
|
|
1343
1349
|
}
|