ChallengeResponseData
Package: @nauth-toolkit/core
Type: Type (TypeScript Interface)
Discriminated union types for responding to authentication challenges. Provides type-safe challenge handling.
- NestJS
- Express
- Fastify
import { ChallengeResponseData } from '@nauth-toolkit/nestjs';
import { ChallengeResponseData } from '@nauth-toolkit/core';
import { ChallengeResponseData } from '@nauth-toolkit/core';
Types
Discriminated union of challenge response interfaces:
VerifyEmailResponse- Email verification with codeCollectPhoneResponse- Phone number collection (first step)VerifyPhoneResponse- Phone verification with code (second step)VerifyMFACodeResponse- MFA verification with code (SMS/TOTP/Backup). OptionaldeviceId?: numberfield for methods with multiple devices.VerifyMFAPasskeyResponse- MFA verification with passkey. OptionaldeviceId?: numberfield for multiple passkey devices.ForceChangePasswordResponse- Forced password changeMFASetupResponse- MFA setup during challenge
Example
Email Verification:
const response: ChallengeResponseData = {
session: 'a21b654c-2746-4168-acee-c175083a65cd',
type: 'VERIFY_EMAIL',
code: '123456'
};
MFA with Passkey:
const response: ChallengeResponseData = {
session: 'a21b654c-2746-4168-acee-c175083a65cd',
type: 'MFA_REQUIRED',
method: 'passkey',
credential: { id: '...', rawId: '...', response: {...} }
};
Used By
- AuthService.respondToChallenge() - Accepts this type