import { MFADeviceMethod } from '../enums/mfa-method.enum'; /** * DTO for updating user attributes * * Security: * - All fields validated against DB constraints * - Input sanitization applied automatically * - Email uniqueness checked in service layer * - Phone uniqueness checked in service layer * - Username uniqueness checked in service layer * * @example * ```typescript * const updateData: UserUpdateDTO = { * firstName: 'John', * lastName: 'Doe', * email: 'john.doe@example.com', * phone: '+61444567890' * }; * ``` */ export declare class UserUpdateDTO { /** * Optional username update * * Validation: * - 3-50 characters * - Alphanumeric, underscores, and hyphens only * - Max 255 characters (DB limit) * - Uniqueness checked in service layer * * Sanitization: * - Trimmed * - Case preserved (username can be case-sensitive per config) */ username?: string; /** * Optional first name update * * Validation: * - 1-100 characters * - Max 100 characters (DB limit) * * Sanitization: * - Trimmed * - Title case preserved */ firstName?: string; /** * Optional last name update * * Validation: * - 1-100 characters * - Max 100 characters (DB limit) * * Sanitization: * - Trimmed * - Title case preserved */ lastName?: string; /** * Optional email address update * * Validation: * - Valid email format (RFC 5322) * - Max 255 characters (matches DB limit) * - Uniqueness checked in service layer * * Sanitization: * - Trimmed and lowercased */ email?: string; /** * Optional phone number update * * Validation: * - E.164 format (international standard) * - MUST start with + (required for security) * - Max 20 characters (DB limit) * - Uniqueness checked in service layer * * Sanitization: * - Whitespace removed * - Only digits and leading + preserved * * Security: * - Strict E.164 validation prevents SQL injection * - Max length prevents oversized inputs */ phone?: string; /** * Optional metadata update (custom fields) * * Behavior: * - Existing metadata is merged with new values * - To delete a metadata key, set it to null * - To update a value, provide the new value * - To add a new key, include it in the object * * Security: * - Validated in service layer if used * - Max depth/size limits should be enforced * * @example * ```typescript * // Add or update keys * await authService.updateUserAttributes({ * sub: 'user-123', * metadata: { newKey: 'value', existingKey: 'updated' } * }); * * // Delete a key by setting it to null * await authService.updateUserAttributes({ * sub: 'user-123', * metadata: { keyToDelete: null } * }); * ``` */ metadata?: Record; /** * Optional preferred MFA method * * Sets the user's preferred MFA method for authentication. * Must be one of the MFA device methods the user has configured. * * Validation: * - Must be one of: totp, sms, email, passkey * - Max 50 characters (matches typical method name length) * * @example * ```typescript * await authService.updateUserAttributes(userId, { * preferredMfaMethod: 'totp' * }); * ``` */ preferredMfaMethod?: MFADeviceMethod; /** * Optional flag to retain verification status when updating email/phone * * When true: * - Email verification status is preserved when email is updated * - Phone verification status is preserved when phone is updated * - Useful when verification was done externally or outside nauth-toolkit * * When false or undefined (default): * - Email verification is reset to false when email is updated * - Phone verification is reset to false when phone is updated * - User must re-verify the new email/phone * * @example * ```typescript * // Update email but keep verification status (external verification) * await authService.updateUserAttributes(userId, { * email: 'new@example.com', * retainVerification: true * }); * ``` */ retainVerification?: boolean; } //# sourceMappingURL=user-update.dto.d.ts.map