Refactor EmailAccountDto and improve encryption logic

Refactored `EmailAccountDto` to focus on SMTP-related properties, removing unused fields. Updated `DependencyInjection` to configure data protection with a new key storage path. Simplified `DataProtectionEncryptionService` by removing redundant checks and error handling for encryption and decryption methods.
This commit is contained in:
2026-07-23 13:06:42 +02:00
parent 0ee6e4f96e
commit 6a5e0a6086
3 changed files with 14 additions and 31 deletions

View File

@@ -2,6 +2,7 @@ using DigitalData.EmailProfiler.Application.Common.Interfaces;
using DigitalData.EmailProfiler.Infrastructure.Messaging;
using DigitalData.EmailProfiler.Infrastructure.Queue;
using DigitalData.EmailProfiler.Infrastructure.Services;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@@ -43,9 +44,9 @@ public static class DependencyInjection
services.AddHostedService<RabbitMqCommandConsumer>();
// --- Data Protection (for encryption) ---
services.AddDataProtection();
// .PersistKeysToFileSystem(new DirectoryInfo(@"C:\ProgramData\EmailProfiler\Keys"))
// .SetApplicationName("EmailProfiler");
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(@"C:\ProgramData\EmailService\Keys"))
.SetApplicationName("EmailProfiler");
return services;
}