Skip to main content

MFADeviceResponseDTO

Package: @nauth-toolkit/core Type: DTO (Response)

Outward-facing MFA device information. Maps the internal device entity to the public API shape, translating the internal isPrimary field to the external isPreferred field.

import { MFADeviceResponseDTO } from '@nauth-toolkit/nestjs';

Properties

PropertyTypeDescription
idnumberUnique device identifier
typeMFADeviceMethodMFA method type (totp, sms, email, passkey)
namestringDevice name (user-assigned)
isPreferredbooleanWhether this is the preferred device for this method
isActivebooleanWhether the device is currently active
createdAtDateDevice creation timestamp

Static Methods

fromEntity()

static fromEntity(device: IMFADevice): MFADeviceResponseDTO

Converts an internal IMFADevice entity to an outward-facing MFADeviceResponseDTO.

fromEntities()

static fromEntities(devices: IMFADevice[]): MFADeviceResponseDTO[]

Converts an array of internal IMFADevice entities to an array of MFADeviceResponseDTO objects.

Example

{
"id": 1,
"type": "totp",
"name": "Google Authenticator",
"isPreferred": true,
"isActive": true,
"createdAt": "2024-01-01T00:00:00.000Z"
}

Used By