UpdateVerifiedStatusRequestDTO
Package: @nauth-toolkit/core
Type: DTO (Request)
Data transfer object for updating email and/or phone verification status. Intended for admin use cases such as migration or offline validation.
- NestJS
- Express
- Fastify
import { UpdateVerifiedStatusRequestDTO } from '@nauth-toolkit/nestjs';
import { UpdateVerifiedStatusRequestDTO } from '@nauth-toolkit/core';
import { UpdateVerifiedStatusRequestDTO } from '@nauth-toolkit/core';
Properties
| Property | Type | Required | Description |
|---|---|---|---|
sub | string | Yes | User identifier. UUID v4 format. Trimmed and lowercased. |
isEmailVerified | boolean | No | Email verification status. If true, user must have an email address. If false, can be set even if email doesn't exist (default state). |
isPhoneVerified | boolean | No | Phone verification status. If true, user must have a phone number. If false, can be set even if phone doesn't exist (default state). |
Validation Rules
Email Verification
- Setting to
true: User must have an email address. ThrowsVALIDATION_FAILEDif email is missing. - Setting to
false: Allowed even if user has no email address (default state).
Phone Verification
- Setting to
true: User must have a phone number. ThrowsVALIDATION_FAILEDif phone is missing. - Setting to
false: Allowed even if user has no phone number (default state).
Partial Updates
- Only provided fields are updated (partial update).
- If only
isEmailVerifiedis provided, only email verification is updated. - If only
isPhoneVerifiedis provided, only phone verification is updated. - If neither field is provided, no update occurs (returns current user).
Example
{
"sub": "a21b654c-2746-4168-acee-c175083a65cd",
"isEmailVerified": true
}
{
"sub": "a21b654c-2746-4168-acee-c175083a65cd",
"isEmailVerified": true,
"isPhoneVerified": false
}
Use Cases
This DTO is intended for administrative operations:
- Migration: Importing users from external systems with pre-verified emails/phones
- Offline Validation: Manual verification status corrections
- Bulk Updates: Updating verification status for multiple users programmatically
Audit Trail
All verification status updates are recorded in the audit log:
- Event Type:
EMAIL_VERIFIEDorPHONE_VERIFIED - Event Status:
SUCCESS(when set totrue) orINFO(when set tofalse) - Reason:
admin_verification_update - Metadata:
previousStatus- Previous verification statusnewStatus- New verification statusupdateMethod: 'admin_direct'- Indicates admin-initiated update
- performedBy: Automatically populated from authenticated admin context
Errors
Throws NAuthException with the following codes:
| Code | When | Details |
|---|---|---|
NOT_FOUND | User not found (by sub identifier) or user not found after update | undefined |
VALIDATION_FAILED | Trying to set isEmailVerified: true when user has no email, or isPhoneVerified: true when user has no phone | undefined |