@ackplus/nest-auth 1.1.31-beta.10 → 1.1.31-beta.5

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.
@@ -5238,7 +5238,7 @@ export class OnboardingService {
5238
5238
  - Header mode (default): Returns new tokens in response body
5239
5239
  - Cookie mode: Sets new tokens in HTTP-only cookies and returns success message`,operationId:"AuthController_refreshToken",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthRefreshTokenRequestDto"}}}},responses:{200:{description:"Header mode: Returns message + tokens in body",content:{"application/json":{schema:{$ref:"#/components/schemas/AuthWithTokensResponseDto"}}}}},summary:"Refresh Token",tags:["Auth"]}},"/auth/mfa/challenge":{post:{operationId:"MfaController_challenge",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthSendMfaCodeRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaCodeSentResponseDto"}}}}},summary:"Send MFA code for setup/verification",tags:["Mfa"]}},"/auth/mfa/verify":{post:{description:`Verify multi-factor authentication. Response format depends on accessTokenType configuration:
5240
5240
  - Header mode (default): Returns tokens in response body
5241
- - Cookie mode: Sets tokens in HTTP-only cookies and returns success message`,operationId:"AuthController_verify2fa",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerify2faRequestDto"}}}},responses:{200:{description:"Header mode: Returns message + tokens in body",content:{"application/json":{schema:{$ref:"#/components/schemas/Verify2faWithTokensResponseDto"}}}}},summary:"Verify MFA",tags:["Auth"]}},"/auth/logout":{post:{operationId:"AuthController_logout",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthLogoutResponseDto"}}}}},summary:"Logout",tags:["Auth"]}},"/auth/logout-all":{post:{operationId:"AuthController_logoutAll",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthLogoutAllResponseDto"}}}}},summary:"Logout All",tags:["Auth"]}},"/auth/change-password":{post:{operationId:"AuthController_changePassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthChangePasswordRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/AuthWithTokensResponseDto"}}}}},summary:"Change Password",tags:["Auth"]}},"/auth/forgot-password":{post:{operationId:"AuthController_forgotPassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthForgotPasswordRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthPasswordResetLinkSentResponseDto"}}}}},summary:"Forgot password",tags:["Auth"]}},"/auth/verify-forgot-password-otp":{post:{operationId:"AuthController_verifyForgotPasswordOtp",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyForgotPasswordOtpRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/VerifyOtpResponseDto"}}}}},summary:"Verify Forgot Password OTP and get reset token",tags:["Auth"]}},"/auth/reset-password":{post:{operationId:"AuthController_resetPassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthResetPasswordWithTokenRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthPasswordResetResponseDto"}}}}},summary:"Reset password",tags:["Auth"]}},"/auth/user":{get:{operationId:"AuthController_getUser",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/UserResponseDto"}}}}},summary:"Get Logged In User",tags:["Auth"]}},"/auth/verify-session":{get:{description:"Lightweight endpoint to verify if the current session is valid. Returns minimal information without fetching full user data.",operationId:"AuthController_verifySession",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{properties:{valid:{type:"boolean",example:!0},userId:{type:"string",example:"123e4567-e89b-12d3-a456-426614174000"},expiresAt:{type:"string",example:"2024-01-01T12:00:00.000Z"}}}}}}},summary:"Verify Session",tags:["Auth"]}},"/auth/send-email-verification":{post:{operationId:"AuthController_sendEmailVerification",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthSendEmailVerificationRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthEmailVerificationSentResponseDto"}}}}},summary:"Send email verification",tags:["Auth"]}},"/auth/verify-email":{post:{operationId:"AuthController_verifyEmail",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyEmailRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthEmailVerifiedResponseDto"}}}}},summary:"Verify Email",tags:["Auth"]}},"/auth/client-config":{get:{description:"Returns backend configuration for frontend clients. Includes enabled auth methods, registration settings, MFA options, tenant configuration, and SSO providers. Can be customized via clientConfig.factory in AuthModuleOptions.",operationId:"AuthController_getClientConfig",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/ClientConfigResponseDto"}}}}},summary:"Get Client Configuration",tags:["Auth"]}},"/auth/callback/{provider}":{get:{description:"OAuth callback endpoint for SSO providers. Exchanges authorization code for access token and returns raw SSO user info. Returns HTML page that posts SSO data to parent window and auto-closes.",operationId:"AuthController_ssoCallback",parameters:[{name:"provider",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:""}},summary:"SSO Callback",tags:["Auth"]}},"/auth/mfa/status":{get:{operationId:"MfaController_getStatus",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/MfaStatusResponseDto"}}}}},summary:"Get MFA status for the current user",tags:["Mfa"]}},"/auth/mfa/toggle":{post:{operationId:"MfaController_toggleMfa",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthToggleMfaRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaToggleResponseDto"}}}}},summary:"Enable or disable MFA for the current user",tags:["Mfa"]}},"/auth/mfa/devices":{get:{operationId:"MfaController_listDevices",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/MfaDeviceDto"}}}}}},summary:"List registered MFA devices",tags:["Mfa"]}},"/auth/mfa/devices/{deviceId}":{delete:{operationId:"MfaController_removeDevice",parameters:[{name:"deviceId",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaDeviceRemovedResponseDto"}}}}},summary:"Remove a registered MFA device",tags:["Mfa"]}},"/auth/mfa/setup-totp":{post:{operationId:"MfaController_setupTotp",parameters:[],responses:{200:{description:""}},summary:"Setup TOTP Device",tags:["Mfa"]}},"/auth/mfa/verify-totp-setup":{post:{operationId:"MfaController_verifyTotpSetup",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyTotpSetupRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaDeviceVerifiedResponseDto"}}}}},summary:"Verify TOTP Setup",tags:["Mfa"]}},"/auth/mfa/generate-recovery-code":{post:{operationId:"MfaController_generateRecoveryCodes",parameters:[],responses:{200:{description:""}},summary:"Generate Recovery Codes",tags:["Mfa"]}},"/auth/mfa/reset-totp":{post:{operationId:"MfaController_resetTotp",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaResetResponseDto"}}}}},summary:"Reset TOTP Device",tags:["Mfa"]}}},uSt={title:"@ackplus/nest-auth API",description:"OpenAPI specification generated from the Nest Auth module",version:"1.1.31-beta.10",contact:{}},dSt=[],fSt=[],pSt={securitySchemes:{bearer:{scheme:"bearer",bearerFormat:"JWT",type:"http"}},schemas:{NestAuthSignupRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["password"]},UserResponseDto:{type:"object",properties:{id:{type:"string",description:"User unique identifier",example:"123e4567-e89b-12d3-a456-426614174000"},email:{type:"string",description:"User email address",example:"user@example.com"},phone:{type:"string",description:"User phone number",example:"+1234567890"},isVerified:{type:"boolean",description:"Email verification status",example:!0},metadata:{type:"object",description:"Additional user metadata",example:{firstName:"John",lastName:"Doe"}}},required:["id","isVerified"]},AuthWithTokensResponseDto:{type:"object",properties:{accessToken:{type:"string",description:"JWT access token (short-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"},refreshToken:{type:"string",description:"JWT refresh token (long-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"},message:{type:"string",description:"Success message (added by controller based on configuration)",example:"Login successful"},isRequiresMfa:{type:"boolean",description:"Whether multi-factor authentication is required",example:!1},mfaMethods:{type:"array",description:"Available MFA methods when isRequiresMfa is true",example:["email","totp"],items:{type:"string",enum:["email","sms","totp"]}},defaultMfaMethod:{type:"string",description:"Default/recommended MFA method",example:"email",enum:["email","sms","totp"]},user:{description:"User information",allOf:[{$ref:"#/components/schemas/UserResponseDto"}]}},required:["accessToken","refreshToken","isRequiresMfa"]},EmailCredentialsDto:{type:"object",properties:{email:{type:"string",description:"User email address",example:"user@example.com"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8}},required:["email","password"]},PhoneCredentialsDto:{type:"object",properties:{phone:{type:"string",description:"User phone number",example:"+1234567890"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8}},required:["phone","password"]},SocialCredentialsDto:{type:"object",properties:{token:{type:"string",description:"OAuth token or ID token from social provider",example:"ya29.a0AfH6SMBx1234567890abcdefghijklmnop"}},required:["token"]},NestAuthLoginRequestDto:{type:"object",properties:{providerName:{type:"string",description:"Authentication provider name",example:"email",enum:["email","phone","google","facebook","apple","github"],default:"email"},credentials:{description:"Login credentials - type varies by provider",examples:{emailLogin:{summary:"Email Login",value:{email:"user@example.com",password:"SecurePass123!"}},phoneLogin:{summary:"Phone Login",value:{phone:"+1234567890",password:"SecurePass123!"}},socialLogin:{summary:"Social Login (Google/Facebook/etc)",value:{token:"ya29.a0AfH6SMBx...",type:"idToken"}}},oneOf:[{$ref:"#/components/schemas/EmailCredentialsDto"},{$ref:"#/components/schemas/PhoneCredentialsDto"},{$ref:"#/components/schemas/SocialCredentialsDto"}]},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"},createUserIfNotExists:{type:"boolean",description:"Auto-create user if not exists (for social auth)",default:!1}},required:["credentials"]},NestAuthRefreshTokenRequestDto:{type:"object",properties:{refreshToken:{type:"string",description:"Refresh token to obtain new access token",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCJ9.abc123"}},required:["refreshToken"]},NestAuthMfaCodeSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA code sent successfully"}},required:["message"]},NestAuthMFAMethodEnum:{type:"string",enum:["email","sms","totp"]},NestAuthVerify2faRequestDto:{type:"object",properties:{method:{description:"MFA method used",example:"totp",allOf:[{$ref:"#/components/schemas/NestAuthMFAMethodEnum"}]},otp:{type:"string",description:"One-time password code",example:"123456",minLength:6,maxLength:8},rememberDevice:{type:"boolean",description:"Whether to trust this device for future logins",example:!0}},required:["method","otp"]},Verify2faWithTokensResponseDto:{type:"object",properties:{accessToken:{type:"string",description:"JWT access token (short-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"},refreshToken:{type:"string",description:"JWT refresh token (long-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"},message:{type:"string",description:"Verification success message (added by controller)",example:"2FA verification successful"}},required:["accessToken","refreshToken"]},NestAuthLogoutResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Logged out successfully"}},required:["message"]},NestAuthLogoutAllResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Logged out from all devices"}},required:["message"]},NestAuthChangePasswordRequestDto:{type:"object",properties:{currentPassword:{type:"string",description:"Current password",example:"DemoOwner1!",minLength:8},newPassword:{type:"string",description:"New password",example:"DemoOwner1!New",minLength:8}},required:["currentPassword","newPassword"]},NestAuthForgotPasswordRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}}},NestAuthPasswordResetLinkSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"If your email is registered, you will receive a password reset link"}},required:["message"]},NestAuthVerifyForgotPasswordOtpRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},otp:{type:"string",description:"One-time password code received via email or SMS",example:"123456",minLength:6,maxLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["otp"]},VerifyOtpResponseDto:{type:"object",properties:{message:{type:"string",description:"Success message"},resetToken:{type:"string",description:"Password reset token - use this to reset password"}},required:["message"]},NestAuthResetPasswordWithTokenRequestDto:{type:"object",properties:{token:{type:"string",description:"Password reset token (JWT) received after OTP verification",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoicGFzc3dvcmQtcmVzZXQifQ.xyz"},newPassword:{type:"string",description:"New password",example:"NewSecurePass123!",minLength:8}},required:["token","newPassword"]},NestAuthPasswordResetResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Password has been reset successfully"}},required:["message"]},NestAuthSendEmailVerificationRequestDto:{type:"object",properties:{tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}}},NestAuthEmailVerificationSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Verification email sent"}},required:["message"]},NestAuthVerifyEmailRequestDto:{type:"object",properties:{otp:{type:"string",description:"One-time password code received via email",example:"123456",minLength:6,maxLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["otp"]},NestAuthEmailVerifiedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Email verified successfully"}},required:["message"]},EmailAuthConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0}},required:["enabled"]},PhoneAuthConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!1}},required:["enabled"]},RegistrationConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0,description:"Whether user registration is enabled"},requireInvitation:{type:"boolean",example:!1,description:"Whether registration requires an invitation"},collectProfileFields:{type:"array",description:"Additional profile fields to collect during registration",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},required:{type:"boolean"},type:{type:"string",enum:["text","email","phone","select","checkbox","password"]},placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}}}}}}},required:["enabled"]},MfaConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0},methods:{example:["email","totp"],type:"array",items:{type:"array"}},allowUserToggle:{type:"boolean",example:!0},allowMethodSelection:{type:"boolean",example:!0}},required:["enabled"]},TenantOptionDto:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},isActive:{type:"boolean"},metadata:{type:"object"}},required:["id","name","slug","isActive"]},TenantsConfigDto:{type:"object",properties:{mode:{type:"string",example:"single",enum:["single","multi"]},defaultTenantId:{type:"string",nullable:!0},options:{type:"array",items:{$ref:"#/components/schemas/TenantOptionDto"}}},required:["mode"]},SsoProviderConfigDto:{type:"object",properties:{id:{type:"string"},name:{type:"string"},logoUrl:{type:"string"},authorizationUrl:{type:"string"},clientId:{type:"string"},hint:{type:"string"}},required:["id","name"]},SsoConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!1},providers:{type:"array",items:{$ref:"#/components/schemas/SsoProviderConfigDto"}}},required:["enabled"]},UiConfigDto:{type:"object",properties:{brandName:{type:"string"},brandColor:{type:"string"},logoUrl:{type:"string"},backgroundImageUrl:{type:"string"}}},ClientConfigResponseDto:{type:"object",properties:{emailAuth:{$ref:"#/components/schemas/EmailAuthConfigDto"},phoneAuth:{$ref:"#/components/schemas/PhoneAuthConfigDto"},registration:{$ref:"#/components/schemas/RegistrationConfigDto"},mfa:{$ref:"#/components/schemas/MfaConfigDto"},tenants:{$ref:"#/components/schemas/TenantsConfigDto"},sso:{$ref:"#/components/schemas/SsoConfigDto"},ui:{$ref:"#/components/schemas/UiConfigDto"}},required:["emailAuth","phoneAuth","registration","mfa","tenants","sso"]},MfaDeviceDto:{type:"object",properties:{id:{type:"string",description:"Unique identifier of the MFA device",example:"4b3c9c9c-9a9d-4d1e-8d9f-123456789abc"},deviceName:{type:"string",description:"Friendly name of the registered device",example:"Work laptop"},method:{type:"string",description:"MFA method this device supports",enum:["email","sms","totp"],example:"totp"},lastUsedAt:{format:"date-time",type:"string",description:"Timestamp of when the device was last used",example:"2024-05-20T12:34:56.000Z"},verified:{type:"boolean",description:"Whether the device setup has been verified",example:!0},createdAt:{format:"date-time",type:"string",description:"Timestamp of when the device was registered",example:"2024-05-18T10:15:00.000Z"}},required:["id","deviceName","method","verified"]},MfaStatusResponseDto:{type:"object",properties:{isEnabled:{type:"boolean",description:"Whether MFA is currently enabled for the user",example:!0},verifiedMethods:{type:"array",description:"MFA methods the user has verified and can currently use (includes EMAIL/SMS if configured, and TOTP if user has verified device)",example:["email","totp"],items:{type:"string",enum:["email","sms","totp"]}},configuredMethods:{type:"array",description:"All MFA methods configured and available in the application (methods user can potentially set up)",example:["email","totp","sms"],items:{type:"string",enum:["email","sms","totp"]}},allowUserToggle:{type:"boolean",description:"Indicates if MFA toggling is allowed for the user",example:!0},allowMethodSelection:{type:"boolean",description:"Indicates if users can choose their preferred MFA method",example:!0},totpDevices:{description:"Registered TOTP devices for the user",type:"array",items:{$ref:"#/components/schemas/MfaDeviceDto"}},hasRecoveryCode:{type:"boolean",description:"Whether a recovery code has been generated for the user",example:!1}},required:["isEnabled","verifiedMethods","configuredMethods","allowUserToggle","allowMethodSelection","totpDevices","hasRecoveryCode"]},NestAuthToggleMfaRequestDto:{type:"object",properties:{enabled:{type:"boolean",description:"Whether MFA should be enabled for the current user",example:!0}},required:["enabled"]},NestAuthMfaToggleResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA enabled successfully"}},required:["message"]},NestAuthMfaDeviceRemovedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Device removed successfully"}},required:["message"]},NestAuthSendMfaCodeRequestDto:{type:"object",properties:{method:{description:"MFA delivery method",example:"email",examples:{email:{value:"email",description:"Send OTP via email"},sms:{value:"sms",description:"Send OTP via SMS"},totp:{value:"totp",description:"Use authenticator app (TOTP)"}},allOf:[{$ref:"#/components/schemas/NestAuthMFAMethodEnum"}]}},required:["method"]},NestAuthVerifyTotpSetupRequestDto:{type:"object",properties:{otp:{type:"string",description:"The TOTP code from authenticator app",example:"123456",minLength:6,maxLength:6},secret:{type:"string",description:"Secret key from TOTP setup",example:"JBSWY3DPEHPK3PXP"}},required:["otp","secret"]},NestAuthMfaDeviceVerifiedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Device setup successfully"}},required:["message"]},NestAuthMfaResetResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA reset successfully"}},required:["message"]}}},mSt={openapi:lSt,paths:cSt,info:uSt,tags:dSt,servers:fSt,components:pSt},B2=({content:e})=>T.jsx(Cyt,{remarkPlugins:[MC],components:{code({node:t,inline:n,className:r,children:a,...i}){const o=/language-(\w+)/.exec(r||"");return!n&&o?T.jsx(Ive,{...i,style:nSt,language:o[1],PreTag:"div",customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},children:String(a).replace(/\n$/,"")}):T.jsx("code",{...i,className:`${r} bg-gray-100 text-gray-800 rounded px-1 py-0.5 text-sm font-mono`,children:a})},table({children:t}){return T.jsx("div",{className:"overflow-x-auto my-4 border border-gray-200 rounded-lg",children:T.jsx("table",{className:"min-w-full divide-y divide-gray-200",children:t})})},thead({children:t}){return T.jsx("thead",{className:"bg-gray-50",children:t})},th({children:t}){return T.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:t})},td({children:t}){return T.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 border-t border-gray-200",children:t})},a({href:t,children:n}){return T.jsx("a",{href:t,className:"text-primary-600 hover:text-primary-800 hover:underline",target:"_blank",rel:"noopener noreferrer",children:n})},h2({children:t}){return T.jsx("h2",{className:"text-2xl font-bold text-gray-900 mt-8 mb-4 pb-2 border-b border-gray-200",children:t})},h3({children:t}){return T.jsx("h3",{className:"text-xl font-semibold text-gray-900 mt-6 mb-3",children:t})},p({children:t}){return T.jsx("p",{className:"text-gray-700 leading-relaxed mb-4",children:t})},ul({children:t}){return T.jsx("ul",{className:"list-disc list-inside space-y-1 mb-4 text-gray-700",children:t})},li({children:t}){return T.jsx("li",{className:"ml-4",children:t})},blockquote({children:t}){return T.jsx("blockquote",{className:"border-l-4 border-primary-500 pl-4 py-1 my-4 bg-primary-50 text-gray-700 italic rounded-r",children:t})}},children:e}),hSt=()=>{const[e,t]=te.useState(!1),[n,r]=te.useState(null),[a,i]=te.useState("api");te.useEffect(()=>{const l=mSt||{};!l||!l.paths||Object.keys(l.paths||{}).length===0?t(!0):r(l)},[]);const o=()=>{if(!n)return;const l=JSON.stringify(n,null,2),c=new Blob([l],{type:"application/json"}),u=URL.createObjectURL(c),d=document.createElement("a");d.href=u,d.download="nest-auth-api.json",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(u)},s=[{id:"api",label:"API Explorer",icon:d7},{id:"config",label:"Configuration",icon:TFe},{id:"examples",label:"Examples",icon:YJ},{id:"events",label:"Events",icon:NFe},{id:"api-reference",label:"API Reference",icon:bFe},{id:"services",label:"Services",icon:YJ}];return T.jsxs("div",{className:"space-y-6",children:[T.jsx(Iv,{title:"API Documentation",description:"Comprehensive guide and interactive API documentation.",action:a==="api"&&T.jsxs("button",{onClick:o,className:"btn-secondary flex items-center gap-2",disabled:e,children:[T.jsx(wFe,{className:"w-4 h-4"}),"Download JSON"]})}),T.jsx("div",{className:"border-b border-gray-200",children:T.jsx("nav",{className:"-mb-px flex space-x-8","aria-label":"Tabs",children:s.map(l=>{const c=l.icon;return T.jsxs("button",{onClick:()=>i(l.id),className:`
5241
+ - Cookie mode: Sets tokens in HTTP-only cookies and returns success message`,operationId:"AuthController_verify2fa",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerify2faRequestDto"}}}},responses:{200:{description:"Header mode: Returns message + tokens in body",content:{"application/json":{schema:{$ref:"#/components/schemas/Verify2faWithTokensResponseDto"}}}}},summary:"Verify MFA",tags:["Auth"]}},"/auth/logout":{post:{operationId:"AuthController_logout",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthLogoutResponseDto"}}}}},summary:"Logout",tags:["Auth"]}},"/auth/logout-all":{post:{operationId:"AuthController_logoutAll",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthLogoutAllResponseDto"}}}}},summary:"Logout All",tags:["Auth"]}},"/auth/change-password":{post:{operationId:"AuthController_changePassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthChangePasswordRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/AuthWithTokensResponseDto"}}}}},summary:"Change Password",tags:["Auth"]}},"/auth/forgot-password":{post:{operationId:"AuthController_forgotPassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthForgotPasswordRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthPasswordResetLinkSentResponseDto"}}}}},summary:"Forgot password",tags:["Auth"]}},"/auth/verify-forgot-password-otp":{post:{operationId:"AuthController_verifyForgotPasswordOtp",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyForgotPasswordOtpRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/VerifyOtpResponseDto"}}}}},summary:"Verify Forgot Password OTP and get reset token",tags:["Auth"]}},"/auth/reset-password":{post:{operationId:"AuthController_resetPassword",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthResetPasswordWithTokenRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthPasswordResetResponseDto"}}}}},summary:"Reset password",tags:["Auth"]}},"/auth/user":{get:{operationId:"AuthController_getUser",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/UserResponseDto"}}}}},summary:"Get Logged In User",tags:["Auth"]}},"/auth/verify-session":{get:{description:"Lightweight endpoint to verify if the current session is valid. Returns minimal information without fetching full user data.",operationId:"AuthController_verifySession",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{properties:{valid:{type:"boolean",example:!0},userId:{type:"string",example:"123e4567-e89b-12d3-a456-426614174000"},expiresAt:{type:"string",example:"2024-01-01T12:00:00.000Z"}}}}}}},summary:"Verify Session",tags:["Auth"]}},"/auth/send-email-verification":{post:{operationId:"AuthController_sendEmailVerification",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthSendEmailVerificationRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthEmailVerificationSentResponseDto"}}}}},summary:"Send email verification",tags:["Auth"]}},"/auth/verify-email":{post:{operationId:"AuthController_verifyEmail",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyEmailRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthEmailVerifiedResponseDto"}}}}},summary:"Verify Email",tags:["Auth"]}},"/auth/client-config":{get:{description:"Returns backend configuration for frontend clients. Includes enabled auth methods, registration settings, MFA options, tenant configuration, and SSO providers. Can be customized via clientConfig.factory in AuthModuleOptions.",operationId:"AuthController_getClientConfig",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/ClientConfigResponseDto"}}}}},summary:"Get Client Configuration",tags:["Auth"]}},"/auth/callback/{provider}":{get:{description:"OAuth callback endpoint for SSO providers. Exchanges authorization code for access token and returns raw SSO user info. Returns HTML page that posts SSO data to parent window and auto-closes.",operationId:"AuthController_ssoCallback",parameters:[{name:"provider",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:""}},summary:"SSO Callback",tags:["Auth"]}},"/auth/mfa/status":{get:{operationId:"MfaController_getStatus",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/MfaStatusResponseDto"}}}}},summary:"Get MFA status for the current user",tags:["Mfa"]}},"/auth/mfa/toggle":{post:{operationId:"MfaController_toggleMfa",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthToggleMfaRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaToggleResponseDto"}}}}},summary:"Enable or disable MFA for the current user",tags:["Mfa"]}},"/auth/mfa/devices":{get:{operationId:"MfaController_listDevices",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/MfaDeviceDto"}}}}}},summary:"List registered MFA devices",tags:["Mfa"]}},"/auth/mfa/devices/{deviceId}":{delete:{operationId:"MfaController_removeDevice",parameters:[{name:"deviceId",required:!0,in:"path",schema:{type:"string"}}],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaDeviceRemovedResponseDto"}}}}},summary:"Remove a registered MFA device",tags:["Mfa"]}},"/auth/mfa/setup-totp":{post:{operationId:"MfaController_setupTotp",parameters:[],responses:{200:{description:""}},summary:"Setup TOTP Device",tags:["Mfa"]}},"/auth/mfa/verify-totp-setup":{post:{operationId:"MfaController_verifyTotpSetup",parameters:[],requestBody:{required:!0,content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthVerifyTotpSetupRequestDto"}}}},responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaDeviceVerifiedResponseDto"}}}}},summary:"Verify TOTP Setup",tags:["Mfa"]}},"/auth/mfa/generate-recovery-code":{post:{operationId:"MfaController_generateRecoveryCodes",parameters:[],responses:{200:{description:""}},summary:"Generate Recovery Codes",tags:["Mfa"]}},"/auth/mfa/reset-totp":{post:{operationId:"MfaController_resetTotp",parameters:[],responses:{200:{description:"",content:{"application/json":{schema:{$ref:"#/components/schemas/NestAuthMfaResetResponseDto"}}}}},summary:"Reset TOTP Device",tags:["Mfa"]}}},uSt={title:"@ackplus/nest-auth API",description:"OpenAPI specification generated from the Nest Auth module",version:"1.1.31-beta.5",contact:{}},dSt=[],fSt=[],pSt={securitySchemes:{bearer:{scheme:"bearer",bearerFormat:"JWT",type:"http"}},schemas:{NestAuthSignupRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["password"]},UserResponseDto:{type:"object",properties:{id:{type:"string",description:"User unique identifier",example:"123e4567-e89b-12d3-a456-426614174000"},email:{type:"string",description:"User email address",example:"user@example.com"},phone:{type:"string",description:"User phone number",example:"+1234567890"},isVerified:{type:"boolean",description:"Email verification status",example:!0},metadata:{type:"object",description:"Additional user metadata",example:{firstName:"John",lastName:"Doe"}}},required:["id","isVerified"]},AuthWithTokensResponseDto:{type:"object",properties:{accessToken:{type:"string",description:"JWT access token (short-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"},refreshToken:{type:"string",description:"JWT refresh token (long-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"},message:{type:"string",description:"Success message (added by controller based on configuration)",example:"Login successful"},isRequiresMfa:{type:"boolean",description:"Whether multi-factor authentication is required",example:!1},mfaMethods:{type:"array",description:"Available MFA methods when isRequiresMfa is true",example:["email","totp"],items:{type:"string",enum:["email","sms","totp"]}},defaultMfaMethod:{type:"string",description:"Default/recommended MFA method",example:"email",enum:["email","sms","totp"]},user:{description:"User information",allOf:[{$ref:"#/components/schemas/UserResponseDto"}]}},required:["accessToken","refreshToken","isRequiresMfa"]},EmailCredentialsDto:{type:"object",properties:{email:{type:"string",description:"User email address",example:"user@example.com"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8}},required:["email","password"]},PhoneCredentialsDto:{type:"object",properties:{phone:{type:"string",description:"User phone number",example:"+1234567890"},password:{type:"string",description:"User password",example:"SecurePass123!",minLength:8}},required:["phone","password"]},SocialCredentialsDto:{type:"object",properties:{token:{type:"string",description:"OAuth token or ID token from social provider",example:"ya29.a0AfH6SMBx1234567890abcdefghijklmnop"}},required:["token"]},NestAuthLoginRequestDto:{type:"object",properties:{providerName:{type:"string",description:"Authentication provider name",example:"email",enum:["email","phone","google","facebook","apple","github"],default:"email"},credentials:{description:"Login credentials - type varies by provider",examples:{emailLogin:{summary:"Email Login",value:{email:"user@example.com",password:"SecurePass123!"}},phoneLogin:{summary:"Phone Login",value:{phone:"+1234567890",password:"SecurePass123!"}},socialLogin:{summary:"Social Login (Google/Facebook/etc)",value:{token:"ya29.a0AfH6SMBx...",type:"idToken"}}},oneOf:[{$ref:"#/components/schemas/EmailCredentialsDto"},{$ref:"#/components/schemas/PhoneCredentialsDto"},{$ref:"#/components/schemas/SocialCredentialsDto"}]},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"},createUserIfNotExists:{type:"boolean",description:"Auto-create user if not exists (for social auth)",default:!1}},required:["credentials"]},NestAuthRefreshTokenRequestDto:{type:"object",properties:{refreshToken:{type:"string",description:"Refresh token to obtain new access token",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCJ9.abc123"}},required:["refreshToken"]},NestAuthMfaCodeSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA code sent successfully"}},required:["message"]},NestAuthMFAMethodEnum:{type:"string",enum:["email","sms","totp"]},NestAuthVerify2faRequestDto:{type:"object",properties:{method:{description:"MFA method used",example:"totp",allOf:[{$ref:"#/components/schemas/NestAuthMFAMethodEnum"}]},otp:{type:"string",description:"One-time password code",example:"123456",minLength:6,maxLength:8},rememberDevice:{type:"boolean",description:"Whether to trust this device for future logins",example:!0}},required:["method","otp"]},Verify2faWithTokensResponseDto:{type:"object",properties:{accessToken:{type:"string",description:"JWT access token (short-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJpYXQiOjE2OTk5OTk5OTksImV4cCI6MTY5OTk5OTk5OX0.xyz"},refreshToken:{type:"string",description:"JWT refresh token (long-lived)",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMjMiLCJ0eXBlIjoicmVmcmVzaCIsImlhdCI6MTY5OTk5OTk5OX0.abc"},message:{type:"string",description:"Verification success message (added by controller)",example:"2FA verification successful"}},required:["accessToken","refreshToken"]},NestAuthLogoutResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Logged out successfully"}},required:["message"]},NestAuthLogoutAllResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Logged out from all devices"}},required:["message"]},NestAuthChangePasswordRequestDto:{type:"object",properties:{currentPassword:{type:"string",description:"Current password",example:"DemoOwner1!",minLength:8},newPassword:{type:"string",description:"New password",example:"DemoOwner1!New",minLength:8}},required:["currentPassword","newPassword"]},NestAuthForgotPasswordRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}}},NestAuthPasswordResetLinkSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"If your email is registered, you will receive a password reset link"}},required:["message"]},NestAuthVerifyForgotPasswordOtpRequestDto:{type:"object",properties:{email:{type:"string",description:"User email address (required if phone not provided)",example:"user@example.com"},phone:{type:"string",description:"User phone number (required if email not provided)",example:"+1234567890"},otp:{type:"string",description:"One-time password code received via email or SMS",example:"123456",minLength:6,maxLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["otp"]},VerifyOtpResponseDto:{type:"object",properties:{message:{type:"string",description:"Success message"},resetToken:{type:"string",description:"Password reset token - use this to reset password"}},required:["message"]},NestAuthResetPasswordWithTokenRequestDto:{type:"object",properties:{token:{type:"string",description:"Password reset token (JWT) received after OTP verification",example:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoicGFzc3dvcmQtcmVzZXQifQ.xyz"},newPassword:{type:"string",description:"New password",example:"NewSecurePass123!",minLength:8}},required:["token","newPassword"]},NestAuthPasswordResetResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Password has been reset successfully"}},required:["message"]},NestAuthSendEmailVerificationRequestDto:{type:"object",properties:{tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}}},NestAuthEmailVerificationSentResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Verification email sent"}},required:["message"]},NestAuthVerifyEmailRequestDto:{type:"object",properties:{otp:{type:"string",description:"One-time password code received via email",example:"123456",minLength:6,maxLength:8},tenantId:{type:"string",description:"Tenant ID for multi-tenant applications",example:"123e4567-e89b-12d3-a456-426614174000"}},required:["otp"]},NestAuthEmailVerifiedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Email verified successfully"}},required:["message"]},EmailAuthConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0}},required:["enabled"]},PhoneAuthConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!1}},required:["enabled"]},RegistrationConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0,description:"Whether user registration is enabled"},requireInvitation:{type:"boolean",example:!1,description:"Whether registration requires an invitation"},collectProfileFields:{type:"array",description:"Additional profile fields to collect during registration",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},required:{type:"boolean"},type:{type:"string",enum:["text","email","phone","select","checkbox","password"]},placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}}}}}}},required:["enabled"]},MfaConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!0},methods:{example:["email","totp"],type:"array",items:{type:"array"}},allowUserToggle:{type:"boolean",example:!0},allowMethodSelection:{type:"boolean",example:!0}},required:["enabled"]},TenantOptionDto:{type:"object",properties:{id:{type:"string"},name:{type:"string"},slug:{type:"string"},isActive:{type:"boolean"},metadata:{type:"object"}},required:["id","name","slug","isActive"]},TenantsConfigDto:{type:"object",properties:{mode:{type:"string",example:"single",enum:["single","multi"]},defaultTenantId:{type:"string",nullable:!0},options:{type:"array",items:{$ref:"#/components/schemas/TenantOptionDto"}}},required:["mode"]},SsoProviderConfigDto:{type:"object",properties:{id:{type:"string"},name:{type:"string"},logoUrl:{type:"string"},authorizationUrl:{type:"string"},clientId:{type:"string"},hint:{type:"string"}},required:["id","name"]},SsoConfigDto:{type:"object",properties:{enabled:{type:"boolean",example:!1},providers:{type:"array",items:{$ref:"#/components/schemas/SsoProviderConfigDto"}}},required:["enabled"]},UiConfigDto:{type:"object",properties:{brandName:{type:"string"},brandColor:{type:"string"},logoUrl:{type:"string"},backgroundImageUrl:{type:"string"}}},ClientConfigResponseDto:{type:"object",properties:{emailAuth:{$ref:"#/components/schemas/EmailAuthConfigDto"},phoneAuth:{$ref:"#/components/schemas/PhoneAuthConfigDto"},registration:{$ref:"#/components/schemas/RegistrationConfigDto"},mfa:{$ref:"#/components/schemas/MfaConfigDto"},tenants:{$ref:"#/components/schemas/TenantsConfigDto"},sso:{$ref:"#/components/schemas/SsoConfigDto"},ui:{$ref:"#/components/schemas/UiConfigDto"}},required:["emailAuth","phoneAuth","registration","mfa","tenants","sso"]},MfaDeviceDto:{type:"object",properties:{id:{type:"string",description:"Unique identifier of the MFA device",example:"4b3c9c9c-9a9d-4d1e-8d9f-123456789abc"},deviceName:{type:"string",description:"Friendly name of the registered device",example:"Work laptop"},method:{type:"string",description:"MFA method this device supports",enum:["email","sms","totp"],example:"totp"},lastUsedAt:{format:"date-time",type:"string",description:"Timestamp of when the device was last used",example:"2024-05-20T12:34:56.000Z"},verified:{type:"boolean",description:"Whether the device setup has been verified",example:!0},createdAt:{format:"date-time",type:"string",description:"Timestamp of when the device was registered",example:"2024-05-18T10:15:00.000Z"}},required:["id","deviceName","method","verified"]},MfaStatusResponseDto:{type:"object",properties:{isEnabled:{type:"boolean",description:"Whether MFA is currently enabled for the user",example:!0},verifiedMethods:{type:"array",description:"MFA methods the user has verified and can currently use (includes EMAIL/SMS if configured, and TOTP if user has verified device)",example:["email","totp"],items:{type:"string",enum:["email","sms","totp"]}},configuredMethods:{type:"array",description:"All MFA methods configured and available in the application (methods user can potentially set up)",example:["email","totp","sms"],items:{type:"string",enum:["email","sms","totp"]}},allowUserToggle:{type:"boolean",description:"Indicates if MFA toggling is allowed for the user",example:!0},allowMethodSelection:{type:"boolean",description:"Indicates if users can choose their preferred MFA method",example:!0},totpDevices:{description:"Registered TOTP devices for the user",type:"array",items:{$ref:"#/components/schemas/MfaDeviceDto"}},hasRecoveryCode:{type:"boolean",description:"Whether a recovery code has been generated for the user",example:!1}},required:["isEnabled","verifiedMethods","configuredMethods","allowUserToggle","allowMethodSelection","totpDevices","hasRecoveryCode"]},NestAuthToggleMfaRequestDto:{type:"object",properties:{enabled:{type:"boolean",description:"Whether MFA should be enabled for the current user",example:!0}},required:["enabled"]},NestAuthMfaToggleResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA enabled successfully"}},required:["message"]},NestAuthMfaDeviceRemovedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Device removed successfully"}},required:["message"]},NestAuthSendMfaCodeRequestDto:{type:"object",properties:{method:{description:"MFA delivery method",example:"email",examples:{email:{value:"email",description:"Send OTP via email"},sms:{value:"sms",description:"Send OTP via SMS"},totp:{value:"totp",description:"Use authenticator app (TOTP)"}},allOf:[{$ref:"#/components/schemas/NestAuthMFAMethodEnum"}]}},required:["method"]},NestAuthVerifyTotpSetupRequestDto:{type:"object",properties:{otp:{type:"string",description:"The TOTP code from authenticator app",example:"123456",minLength:6,maxLength:6},secret:{type:"string",description:"Secret key from TOTP setup",example:"JBSWY3DPEHPK3PXP"}},required:["otp","secret"]},NestAuthMfaDeviceVerifiedResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"Device setup successfully"}},required:["message"]},NestAuthMfaResetResponseDto:{type:"object",properties:{message:{type:"string",description:"Response message",example:"MFA reset successfully"}},required:["message"]}}},mSt={openapi:lSt,paths:cSt,info:uSt,tags:dSt,servers:fSt,components:pSt},B2=({content:e})=>T.jsx(Cyt,{remarkPlugins:[MC],components:{code({node:t,inline:n,className:r,children:a,...i}){const o=/language-(\w+)/.exec(r||"");return!n&&o?T.jsx(Ive,{...i,style:nSt,language:o[1],PreTag:"div",customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem"},children:String(a).replace(/\n$/,"")}):T.jsx("code",{...i,className:`${r} bg-gray-100 text-gray-800 rounded px-1 py-0.5 text-sm font-mono`,children:a})},table({children:t}){return T.jsx("div",{className:"overflow-x-auto my-4 border border-gray-200 rounded-lg",children:T.jsx("table",{className:"min-w-full divide-y divide-gray-200",children:t})})},thead({children:t}){return T.jsx("thead",{className:"bg-gray-50",children:t})},th({children:t}){return T.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:t})},td({children:t}){return T.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 border-t border-gray-200",children:t})},a({href:t,children:n}){return T.jsx("a",{href:t,className:"text-primary-600 hover:text-primary-800 hover:underline",target:"_blank",rel:"noopener noreferrer",children:n})},h2({children:t}){return T.jsx("h2",{className:"text-2xl font-bold text-gray-900 mt-8 mb-4 pb-2 border-b border-gray-200",children:t})},h3({children:t}){return T.jsx("h3",{className:"text-xl font-semibold text-gray-900 mt-6 mb-3",children:t})},p({children:t}){return T.jsx("p",{className:"text-gray-700 leading-relaxed mb-4",children:t})},ul({children:t}){return T.jsx("ul",{className:"list-disc list-inside space-y-1 mb-4 text-gray-700",children:t})},li({children:t}){return T.jsx("li",{className:"ml-4",children:t})},blockquote({children:t}){return T.jsx("blockquote",{className:"border-l-4 border-primary-500 pl-4 py-1 my-4 bg-primary-50 text-gray-700 italic rounded-r",children:t})}},children:e}),hSt=()=>{const[e,t]=te.useState(!1),[n,r]=te.useState(null),[a,i]=te.useState("api");te.useEffect(()=>{const l=mSt||{};!l||!l.paths||Object.keys(l.paths||{}).length===0?t(!0):r(l)},[]);const o=()=>{if(!n)return;const l=JSON.stringify(n,null,2),c=new Blob([l],{type:"application/json"}),u=URL.createObjectURL(c),d=document.createElement("a");d.href=u,d.download="nest-auth-api.json",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(u)},s=[{id:"api",label:"API Explorer",icon:d7},{id:"config",label:"Configuration",icon:TFe},{id:"examples",label:"Examples",icon:YJ},{id:"events",label:"Events",icon:NFe},{id:"api-reference",label:"API Reference",icon:bFe},{id:"services",label:"Services",icon:YJ}];return T.jsxs("div",{className:"space-y-6",children:[T.jsx(Iv,{title:"API Documentation",description:"Comprehensive guide and interactive API documentation.",action:a==="api"&&T.jsxs("button",{onClick:o,className:"btn-secondary flex items-center gap-2",disabled:e,children:[T.jsx(wFe,{className:"w-4 h-4"}),"Download JSON"]})}),T.jsx("div",{className:"border-b border-gray-200",children:T.jsx("nav",{className:"-mb-px flex space-x-8","aria-label":"Tabs",children:s.map(l=>{const c=l.icon;return T.jsxs("button",{onClick:()=>i(l.id),className:`
5242
5242
  whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm flex items-center gap-2 transition-colors
5243
5243
  ${a===l.id?"border-primary-500 text-primary-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}
5244
5244
  `,children:[T.jsx(c,{className:"w-4 h-4"}),l.label]},l.id)})})}),a==="api"&&(e?T.jsx("div",{className:"card",children:T.jsx("div",{className:"p-6 text-center",children:T.jsxs("div",{className:"p-4 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-3 mb-4",children:[T.jsx(Sf,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),T.jsxs("div",{className:"text-left",children:[T.jsx("p",{className:"font-semibold text-amber-900 mb-1",children:"API Documentation Not Available"}),T.jsx("p",{className:"text-sm text-amber-800",children:"The OpenAPI specification file could not be loaded. Make sure the OpenAPI spec has been generated by running the build process."})]})]})})}):T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"card bg-blue-50 border-blue-200",children:T.jsxs("div",{className:"p-4 flex items-start gap-3",children:[T.jsx(d7,{className:"w-5 h-5 text-blue-600 flex-shrink-0 mt-0.5"}),T.jsxs("div",{className:"flex-1",children:[T.jsx("p",{className:"text-sm font-medium text-blue-900 mb-1",children:"Interactive API Documentation"}),T.jsx("p",{className:"text-sm text-blue-800",children:'This documentation is auto-generated from the OpenAPI specification. You can test endpoints directly from this page. Click "Download JSON" to get the raw OpenAPI specification file for importing into Postman or other API tools.'})]})]})}),n&&T.jsx(c0t,{spec:n})]})),a==="config"&&T.jsx("div",{className:"card p-8",children:T.jsx("div",{className:"prose prose-blue max-w-none",children:T.jsx(B2,{content:rSt})})}),a==="examples"&&T.jsx("div",{className:"card p-8",children:T.jsx("div",{className:"prose prose-blue max-w-none",children:T.jsx(B2,{content:aSt})})}),a==="events"&&T.jsx("div",{className:"card p-8",children:T.jsx("div",{className:"prose prose-blue max-w-none",children:T.jsx(B2,{content:iSt})})}),a==="api-reference"&&T.jsx("div",{className:"card p-8",children:T.jsx("div",{className:"prose prose-blue max-w-none",children:T.jsx(B2,{content:oSt})})}),a==="services"&&T.jsx("div",{className:"card p-8",children:T.jsx("div",{className:"prose prose-blue max-w-none",children:T.jsx(B2,{content:sSt})})})]})},bh=({children:e,authenticated:t})=>t===null?T.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:T.jsxs("div",{className:"text-center",children:[T.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-4 border-primary-600 mx-auto mb-4"}),T.jsx("p",{className:"text-gray-600 font-medium",children:"Verifying authentication..."})]})}):t?T.jsx(T.Fragment,{children:e}):T.jsx(p1,{to:"/login",replace:!0}),gSt=()=>{const[e,t]=te.useState(null),[n,r]=te.useState(null),[a,i]=te.useState(!1),[o,s]=te.useState(null);te.useEffect(()=>{l()},[]);const l=async()=>{try{await cn.get("/me"),t(!0);const d=await cn.get("/config");r(d)}catch(d){console.error("Auth check failed:",d),t(!1);try{const f=await cn.get("/config");r(f)}catch(f){console.error("Failed to load config:",f),r({allowAdminManagement:!1})}}finally{i(!0)}},c=async d=>{s(null);try{await cn.post("/login",d),t(!0),await l()}catch(f){throw t(!1),s((f==null?void 0:f.message)||"Login failed"),f}},u=async()=>{try{await cn.post("/logout",{})}catch(d){console.error("Logout failed:",d)}t(!1)};return!a||n===null?T.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 via-blue-50 to-purple-50 flex items-center justify-center",children:T.jsxs("div",{className:"text-center",children:[T.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-primary-600 rounded-full mb-4 shadow-lg",children:T.jsxs("svg",{className:"w-8 h-8 text-white animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[T.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),T.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),T.jsx("p",{className:"text-gray-700 font-medium text-lg",children:"Loading Nest Auth Dashboard..."}),T.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Verifying authentication"})]})}):T.jsx(mFe,{children:T.jsx(iFe,{children:T.jsxs(Yje,{children:[T.jsx(dc,{path:"/login",element:e?T.jsx(p1,{to:"/dashboard",replace:!0}):T.jsx(cBe,{onLogin:c,error:o})}),T.jsx(dc,{path:"/dashboard",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(Rht,{})})})}),T.jsx(dc,{path:"/users",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(zht,{})})})}),T.jsx(dc,{path:"/roles",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(Qht,{})})})}),T.jsx(dc,{path:"/tenants",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(Yht,{})})})}),T.jsx(dc,{path:"/permissions",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(i0t,{})})})}),T.jsx(dc,{path:"/api",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(hSt,{})})})}),n.allowAdminManagement&&T.jsx(dc,{path:"/admins",element:T.jsx(bh,{authenticated:e,children:T.jsx(dh,{config:n,onLogout:u,children:T.jsx(t0t,{})})})}),T.jsx(dc,{path:"/",element:e?T.jsx(p1,{to:"/dashboard",replace:!0}):T.jsx(p1,{to:"/login",replace:!0})}),T.jsx(dc,{path:"*",element:e?T.jsx(p1,{to:"/dashboard",replace:!0}):T.jsx(p1,{to:"/login",replace:!0})})]})})})},kie=document.getElementById("root");kie&&mD.createRoot(kie).render(T.jsx(fe.StrictMode,{children:T.jsx(gSt,{})}));/**
@@ -705,7 +705,7 @@
705
705
  "info": {
706
706
  "title": "@ackplus/nest-auth API",
707
707
  "description": "OpenAPI specification generated from the Nest Auth module",
708
- "version": "1.1.31-beta.10",
708
+ "version": "1.1.31-beta.5",
709
709
  "contact": {}
710
710
  },
711
711
  "tags": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ackplus/nest-auth",
3
- "version": "1.1.31-beta.10",
3
+ "version": "1.1.31-beta.5",
4
4
  "description": "Powerful CRUD operations for NestJS with TypeORM - automatic REST endpoints, advanced filtering, relations, pagination, and more",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "qrcode": "^1.5.0",
40
40
  "qs": "^6.11.2",
41
41
  "speakeasy": "^2.0.0",
42
- "@ackplus/nest-auth-contracts": "1.1.31-beta.10"
42
+ "@ackplus/nest-auth-contracts": "1.1.31-beta.5"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@nestjs/common": "^10 || ^11",