@nauth-toolkit/client 0.6.0 → 0.7.0

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
@@ -93,6 +93,31 @@ declare enum AuthChallenge {
93
93
  FORCE_CHANGE_PASSWORD = "FORCE_CHANGE_PASSWORD"
94
94
  }
95
95
 
96
+ /**
97
+ * MFA grace period information returned in auth responses.
98
+ *
99
+ * Present only while MFA setup is pending but not yet being demanded - MFA is enforced
100
+ * (`REQUIRED` or `ADAPTIVE`), the user has not set it up, and either the grace window is
101
+ * still open or setup was skipped to keep signup frictionless.
102
+ *
103
+ * Typical use: after signup, offer an optional MFA setup flow instead of waiting for a
104
+ * later login to force it.
105
+ */
106
+ interface MfaGracePeriod {
107
+ /** Always true when this object is present. */
108
+ active: boolean;
109
+ /**
110
+ * ISO 8601 timestamp at which MFA setup becomes mandatory.
111
+ * Absent when the grace covers only the signup flow - see `requiredAtNextLogin`.
112
+ */
113
+ endsAt?: string;
114
+ /** Whole days remaining (rounded up); `0` when the grace covers only the signup flow. */
115
+ daysRemaining: number;
116
+ /** Enforcement policy that applies once the grace period ends. */
117
+ enforcement: 'REQUIRED' | 'ADAPTIVE';
118
+ /** True when the very next login will demand MFA setup. */
119
+ requiredAtNextLogin?: boolean;
120
+ }
96
121
  interface AuthResponse {
97
122
  user?: AuthUserSummary;
98
123
  accessToken?: string;
@@ -115,6 +140,13 @@ interface AuthResponse {
115
140
  session?: string;
116
141
  challengeParameters?: Record<string, unknown>;
117
142
  sub?: string;
143
+ /**
144
+ * MFA grace period status.
145
+ *
146
+ * Present on challenge and success responses alike whenever MFA setup is pending
147
+ * within a grace period. Absent otherwise.
148
+ */
149
+ mfaGracePeriod?: MfaGracePeriod;
118
150
  }
119
151
  /**
120
152
  * Minimal user information returned inside auth responses.
@@ -4421,4 +4453,4 @@ declare class FetchAdapter implements HttpAdapter {
4421
4453
  request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
4422
4454
  }
4423
4455
 
4424
- export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, 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 AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, 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 OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
4456
+ export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, 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 AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, 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 OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
package/dist/index.d.ts CHANGED
@@ -93,6 +93,31 @@ declare enum AuthChallenge {
93
93
  FORCE_CHANGE_PASSWORD = "FORCE_CHANGE_PASSWORD"
94
94
  }
95
95
 
96
+ /**
97
+ * MFA grace period information returned in auth responses.
98
+ *
99
+ * Present only while MFA setup is pending but not yet being demanded - MFA is enforced
100
+ * (`REQUIRED` or `ADAPTIVE`), the user has not set it up, and either the grace window is
101
+ * still open or setup was skipped to keep signup frictionless.
102
+ *
103
+ * Typical use: after signup, offer an optional MFA setup flow instead of waiting for a
104
+ * later login to force it.
105
+ */
106
+ interface MfaGracePeriod {
107
+ /** Always true when this object is present. */
108
+ active: boolean;
109
+ /**
110
+ * ISO 8601 timestamp at which MFA setup becomes mandatory.
111
+ * Absent when the grace covers only the signup flow - see `requiredAtNextLogin`.
112
+ */
113
+ endsAt?: string;
114
+ /** Whole days remaining (rounded up); `0` when the grace covers only the signup flow. */
115
+ daysRemaining: number;
116
+ /** Enforcement policy that applies once the grace period ends. */
117
+ enforcement: 'REQUIRED' | 'ADAPTIVE';
118
+ /** True when the very next login will demand MFA setup. */
119
+ requiredAtNextLogin?: boolean;
120
+ }
96
121
  interface AuthResponse {
97
122
  user?: AuthUserSummary;
98
123
  accessToken?: string;
@@ -115,6 +140,13 @@ interface AuthResponse {
115
140
  session?: string;
116
141
  challengeParameters?: Record<string, unknown>;
117
142
  sub?: string;
143
+ /**
144
+ * MFA grace period status.
145
+ *
146
+ * Present on challenge and success responses alike whenever MFA setup is pending
147
+ * within a grace period. Absent otherwise.
148
+ */
149
+ mfaGracePeriod?: MfaGracePeriod;
118
150
  }
119
151
  /**
120
152
  * Minimal user information returned inside auth responses.
@@ -4421,4 +4453,4 @@ declare class FetchAdapter implements HttpAdapter {
4421
4453
  request<T>(config: HttpRequest): Promise<HttpResponse<T>>;
4422
4454
  }
4423
4455
 
4424
- export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, 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 AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, 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 OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };
4456
+ export { type AdminAuditHistoryRequest, type AdminCreateApiKeyRequest, AdminOperations, type AdminResetPasswordRequest, type AdminResetPasswordResponse, type AdminSignupRequest, type AdminSignupResponse, type AdminSignupSocialRequest, type AdminSignupSocialResponse, type ApiKeyInfo, ApiKeyOperations, 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 AvailableMfaMethodsResponse, type BackupCodesResponse, type BaseChallengeResponse, BrowserStorage, type CanSetPasswordResponse, type ChallengeResponse, ChallengeRouter, type ChangePasswordRequest, type ConfirmForgotPasswordRequest, type ConfirmForgotPasswordResponse, type CreateApiKeyRequest, type CreateApiKeyResult, DEFAULT_INTERACTION_ROUTE, type DateFilter, type DeleteApiKeyResponse, type DeleteUserResponse, type DisableUserResponse, type EnableUserResponse, EventEmitter, FetchAdapter, type ForceChangePasswordResponse, type ForgotPasswordRequest, type ForgotPasswordResponse, type GetChallengeDataRequest, type GetChallengeDataResponse, type GetEventsByTypeRequest, type GetMFADevicesResponse, type GetRiskAssessmentHistoryRequest, type GetSetupDataRequest, type GetSetupDataResponse, type GetSuspiciousActivityRequest, type GetUserByEmailRequest, type GetUserSessionsResponse, type GetUsersRequest, type GetUsersResponse, type HttpAdapter, type HttpRequest, type HttpResponse, InMemoryStorage, type LinkedAccountsResponse, type ListApiKeysResponse, type ListTrustedDevicesResponse, type LoginRequest, type LogoutAllRequest, type LogoutRequest, type LogoutSessionResponse, type MFAChallengeMethod, type MFACodeResponse, type MFADevice, type MFADeviceMethod, type MFAMethod, type MFAPasskeyResponse, type MFASetupData, type MFASetupResponse, type MFAStatus, type MfaGracePeriod, 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 OIDCConsentDecision, type OIDCGateStatus, type OIDCInteractionClient, type OIDCInteractionRedirect, type OIDCInteractionState, OIDCOperations, PENDING_INTERACTION_KEY, type RecaptchaConfig, type RecaptchaVersion, type RemoveMFADeviceResponse, type ResendCodeRequest, type ResetPasswordWithCodeRequest, type ResetPasswordWithCodeResponse, type ResolvedNAuthClientConfig, type RevokeAllTrustedDevicesResponse, type RevokeApiKeyResponse, type RevokeTrustedDeviceResponse, type SetPasswordResponse, type SignupRequest, type SocialLoginOptions, type SocialProvider, type SocialVerifyRequest, type TokenDeliveryMode, type TokenResponse, type TrustedDeviceInfo, type UpdateApiKeyRequest, type UpdateProfileRequest, type UpdateVerifiedStatusRequest, type UserSessionInfo, type VerifyEmailResponse, type VerifyPhoneCodeResponse, type VerifyPhoneCollectResponse, apiKeyHeader, defaultAdminEndpoints, defaultEndpoints, getChallengeInstructions, getMFAMethod, getMaskedDestination, isOTPChallenge, requiresPhoneCollection, resolveConfig };