@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 CHANGED
@@ -155,7 +155,6 @@ var defaultEndpoints = {
155
155
  getChallengeData: "/challenge/challenge-data",
156
156
  profile: "/profile",
157
157
  changePassword: "/change-password",
158
- requestPasswordChange: "/request-password-change",
159
158
  forgotPassword: "/forgot-password",
160
159
  confirmForgotPassword: "/forgot-password/confirm",
161
160
  confirmAdminResetPassword: "/admin/reset-password/confirm",
@@ -1119,13 +1118,15 @@ var NAuthClient = class {
1119
1118
  return result;
1120
1119
  }
1121
1120
  /**
1122
- * Request password change (must change on next login).
1123
- */
1124
- async requestPasswordChange() {
1125
- await this.post(this.config.endpoints.requestPasswordChange, {}, true);
1126
- }
1127
- /**
1128
- * Get MFA status.
1121
+ * Get MFA status for current user.
1122
+ *
1123
+ * @returns Promise of MFA status
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * const status = await this.client.getMfaStatus();
1128
+ * console.log('MFA enabled:', status.enabled);
1129
+ * ```
1129
1130
  */
1130
1131
  async getMfaStatus() {
1131
1132
  return this.get(this.config.endpoints.mfaStatus, true);
@@ -1168,7 +1169,7 @@ var NAuthClient = class {
1168
1169
  * @returns Success message
1169
1170
  */
1170
1171
  async setPreferredMfaMethod(method) {
1171
- return this.post(this.config.endpoints.mfaPreferred, { method }, true);
1172
+ return this.post(this.config.endpoints.mfaPreferred, { methodType: method }, true);
1172
1173
  }
1173
1174
  /**
1174
1175
  * Generate backup codes.
@@ -1356,28 +1357,33 @@ var NAuthClient = class {
1356
1357
  return this.get(this.config.endpoints.isTrustedDevice, true);
1357
1358
  }
1358
1359
  /**
1359
- * Get paginated audit history for the current user.
1360
- *
1361
- * Returns authentication and security events with full audit details including:
1362
- * - Event type (login, logout, MFA, etc.)
1363
- * - Event status (success, failure, suspicious)
1364
- * - Device information, location, risk factors
1360
+ * Get authentication audit history for current user.
1365
1361
  *
1366
- * @param params - Query parameters for filtering and pagination
1367
- * @returns Paginated audit history response
1362
+ * @param params - Optional query parameters (page, limit, eventType, etc.)
1363
+ * @returns Paginated audit history
1368
1364
  *
1369
1365
  * @example
1370
1366
  * ```typescript
1371
1367
  * const history = await client.getAuditHistory({
1372
1368
  * page: 1,
1373
1369
  * limit: 20,
1374
- * eventType: 'LOGIN_SUCCESS'
1370
+ * eventTypes: ['LOGIN_SUCCESS'],
1371
+ * eventStatus: ['FAILURE'],
1375
1372
  * });
1376
1373
  * ```
1377
1374
  */
1378
1375
  async getAuditHistory(params) {
1379
- const entries = Object.entries(params ?? {}).map(([k, v]) => [k, String(v)]);
1380
- const query = entries.length > 0 ? `?${new URLSearchParams(entries).toString()}` : "";
1376
+ const searchParams = new URLSearchParams();
1377
+ for (const [key, rawValue] of Object.entries(params ?? {})) {
1378
+ if (Array.isArray(rawValue)) {
1379
+ for (const item of rawValue) {
1380
+ searchParams.append(key, String(item));
1381
+ }
1382
+ continue;
1383
+ }
1384
+ searchParams.append(key, String(rawValue));
1385
+ }
1386
+ const query = searchParams.toString() ? `?${searchParams.toString()}` : "";
1381
1387
  const path = `${this.config.endpoints.auditHistory}${query}`;
1382
1388
  return this.get(path, true);
1383
1389
  }