@nauth-toolkit/client 0.1.111 → 0.1.112

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.d.mts CHANGED
@@ -44,6 +44,12 @@ interface RemoveMFADeviceResponse {
44
44
  removedMethod: MFADeviceMethod;
45
45
  mfaDisabled: boolean;
46
46
  }
47
+ /**
48
+ * Response from getting user MFA devices.
49
+ */
50
+ interface GetMFADevicesResponse {
51
+ devices: MFADevice[];
52
+ }
47
53
  /**
48
54
  * MFA setup data returned by providers.
49
55
  */
@@ -726,6 +732,8 @@ interface NAuthAdminEndpoints {
726
732
  logoutAll: string;
727
733
  /** GET /users/:sub/mfa/status - Get MFA status */
728
734
  getMfaStatus: string;
735
+ /** GET /users/:sub/mfa/devices - Get MFA devices */
736
+ getMfaDevices: string;
729
737
  /** DELETE /mfa/devices/:deviceId - Remove a single MFA device by id */
730
738
  removeMfaDeviceById: string;
731
739
  /** POST /users/:sub/mfa/devices/:deviceId/preferred - Set preferred MFA device */
@@ -2524,21 +2532,22 @@ declare class AdminOperations {
2524
2532
  */
2525
2533
  getMfaStatus(sub: string): Promise<MFAStatus>;
2526
2534
  /**
2527
- * Set preferred MFA method for a user
2535
+ * Get MFA devices for a user
2528
2536
  *
2529
- * @param sub - User UUID
2530
- * Remove MFA devices for a user
2537
+ * Returns all active MFA devices for a user including device id, name, type, and isPreferred status.
2531
2538
  *
2532
2539
  * @param sub - User UUID
2533
- * @param method - MFA method to remove
2534
- * @returns Success message
2540
+ * @returns Response containing array of MFA devices
2535
2541
  * @throws {NAuthClientError} If operation fails
2536
2542
  *
2537
2543
  * @example
2538
2544
  * ```typescript
2539
- * await client.admin.removeMfaDevices('user-uuid', 'sms');
2545
+ * const result = await client.admin.getMfaDevices('user-uuid');
2546
+ * console.log('Devices:', result.devices);
2547
+ * // [{ id: 1, name: 'My Authenticator', type: 'totp', isPreferred: true, ... }]
2540
2548
  * ```
2541
2549
  */
2550
+ getMfaDevices(sub: string): Promise<GetMFADevicesResponse>;
2542
2551
  /**
2543
2552
  * Remove a single MFA device by device ID (admin).
2544
2553
  *
@@ -3461,4 +3470,4 @@ declare class FetchAdapter implements HttpAdapter {
3461
3470
  request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
3462
3471
  }
3463
3472
 
3464
- export { type AdminAuditHistoryRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type DateFilter, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetSetupDataRequest, type GetSetupDataResponse, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type UpdateProfileRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
3473
+ export { type AdminAuditHistoryRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type DateFilter, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetMFADevicesResponse, type GetSetupDataRequest, type GetSetupDataResponse, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type UpdateProfileRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
package/dist/index.d.ts CHANGED
@@ -44,6 +44,12 @@ interface RemoveMFADeviceResponse {
44
44
  removedMethod: MFADeviceMethod;
45
45
  mfaDisabled: boolean;
46
46
  }
47
+ /**
48
+ * Response from getting user MFA devices.
49
+ */
50
+ interface GetMFADevicesResponse {
51
+ devices: MFADevice[];
52
+ }
47
53
  /**
48
54
  * MFA setup data returned by providers.
49
55
  */
@@ -726,6 +732,8 @@ interface NAuthAdminEndpoints {
726
732
  logoutAll: string;
727
733
  /** GET /users/:sub/mfa/status - Get MFA status */
728
734
  getMfaStatus: string;
735
+ /** GET /users/:sub/mfa/devices - Get MFA devices */
736
+ getMfaDevices: string;
729
737
  /** DELETE /mfa/devices/:deviceId - Remove a single MFA device by id */
730
738
  removeMfaDeviceById: string;
731
739
  /** POST /users/:sub/mfa/devices/:deviceId/preferred - Set preferred MFA device */
@@ -2524,21 +2532,22 @@ declare class AdminOperations {
2524
2532
  */
2525
2533
  getMfaStatus(sub: string): Promise<MFAStatus>;
2526
2534
  /**
2527
- * Set preferred MFA method for a user
2535
+ * Get MFA devices for a user
2528
2536
  *
2529
- * @param sub - User UUID
2530
- * Remove MFA devices for a user
2537
+ * Returns all active MFA devices for a user including device id, name, type, and isPreferred status.
2531
2538
  *
2532
2539
  * @param sub - User UUID
2533
- * @param method - MFA method to remove
2534
- * @returns Success message
2540
+ * @returns Response containing array of MFA devices
2535
2541
  * @throws {NAuthClientError} If operation fails
2536
2542
  *
2537
2543
  * @example
2538
2544
  * ```typescript
2539
- * await client.admin.removeMfaDevices('user-uuid', 'sms');
2545
+ * const result = await client.admin.getMfaDevices('user-uuid');
2546
+ * console.log('Devices:', result.devices);
2547
+ * // [{ id: 1, name: 'My Authenticator', type: 'totp', isPreferred: true, ... }]
2540
2548
  * ```
2541
2549
  */
2550
+ getMfaDevices(sub: string): Promise<GetMFADevicesResponse>;
2542
2551
  /**
2543
2552
  * Remove a single MFA device by device ID (admin).
2544
2553
  *
@@ -3461,4 +3470,4 @@ declare class FetchAdapter implements HttpAdapter {
3461
3470
  request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
3462
3471
  }
3463
3472
 
3464
- export { type AdminAuditHistoryRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type DateFilter, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetSetupDataRequest, type GetSetupDataResponse, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type UpdateProfileRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
3473
+ export { type AdminAuditHistoryRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type AuditHistoryResponse, type AuthAuditEvent, type AuthAuditEventStatus, AuthAuditEventType, AuthChallenge, type AuthChallengeEvent, type AuthErrorEvent, type AuthEvent, type AuthEventListener, type AuthEventType, type AuthLoginEvent, type AuthLogoutEvent, type AuthRefreshEvent, type AuthResponse, type AuthResponseContext, type AuthSessionExpiredEvent, type AuthSignupEvent, type AuthSuccessEvent, type AuthUser, type AuthUserSummary, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type DateFilter, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetMFADevicesResponse, type GetSetupDataRequest, type GetSetupDataResponse, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaRoutesConfig, type NAuthAdminEndpoints, NAuthClient, type NAuthClientConfig, NAuthClientError, type NAuthEndpoints, type NAuthError, NAuthErrorCode, type NAuthRedirectsConfig, type NAuthStorageAdapter, type OAuthCallbackEvent, type OAuthCompletedEvent, type OAuthErrorEvent, type OAuthStartedEvent, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type UpdateProfileRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
package/dist/index.mjs CHANGED
@@ -149,6 +149,7 @@ var defaultAdminEndpoints = {
149
149
  getUserSessions: "/users/:sub/sessions",
150
150
  logoutAll: "/users/:sub/logout-all",
151
151
  getMfaStatus: "/users/:sub/mfa/status",
152
+ getMfaDevices: "/users/:sub/mfa/devices",
152
153
  removeMfaDeviceById: "/mfa/devices/:deviceId",
153
154
  setPreferredMfaDevice: "/users/:sub/mfa/devices/:deviceId/preferred",
154
155
  setMfaExemption: "/mfa/exemption",
@@ -1109,21 +1110,25 @@ var AdminOperations = class {
1109
1110
  return this.get(path);
1110
1111
  }
1111
1112
  /**
1112
- * Set preferred MFA method for a user
1113
+ * Get MFA devices for a user
1113
1114
  *
1114
- * @param sub - User UUID
1115
- * Remove MFA devices for a user
1115
+ * Returns all active MFA devices for a user including device id, name, type, and isPreferred status.
1116
1116
  *
1117
1117
  * @param sub - User UUID
1118
- * @param method - MFA method to remove
1119
- * @returns Success message
1118
+ * @returns Response containing array of MFA devices
1120
1119
  * @throws {NAuthClientError} If operation fails
1121
1120
  *
1122
1121
  * @example
1123
1122
  * ```typescript
1124
- * await client.admin.removeMfaDevices('user-uuid', 'sms');
1123
+ * const result = await client.admin.getMfaDevices('user-uuid');
1124
+ * console.log('Devices:', result.devices);
1125
+ * // [{ id: 1, name: 'My Authenticator', type: 'totp', isPreferred: true, ... }]
1125
1126
  * ```
1126
1127
  */
1128
+ async getMfaDevices(sub) {
1129
+ const path = this.buildAdminUrl(this.adminEndpoints.getMfaDevices, { sub });
1130
+ return this.get(path);
1131
+ }
1127
1132
  /**
1128
1133
  * Remove a single MFA device by device ID (admin).
1129
1134
  *