Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Refactor all importers function signatures (#773)
Leendert de Borst062b3a8b5c78
diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportService1Password.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportService1Password.razorindex 8c8e54076..835232b02 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportService1Password.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportService1Password.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await OnePasswordImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceAliasVault.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceAliasVault.razorindex b3fcbf147..7bddf53e0 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceAliasVault.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceAliasVault.razor@@ -14,7 +14,7 @@Description="@Localizer["AliasVaultDescription"]"LogoUrl="img/logo.svg"AcceptedFileTypes=".csv,.avux,.avex"- ProcessFileWithAutoDetectionCallback="ProcessFile">+ ProcessFileCallback="ProcessFile"><p class="text-gray-700 dark:text-gray-300 mb-4">@Localizer["AliasVaultInstructionsPart1"]</p><p class="text-sm text-gray-600 dark:text-gray-400 mb-4">@Localizer["AliasVaultSupportedFormatsInfo"]@@ -27,11 +27,11 @@/// <summary>/// Processes files with auto-detection based on file extension.- /// Returns AvuxImportResult for .avux files, or List of ImportedCredential for CSV files.+ /// Returns a list of ImportedCredential objects with logos embedded in FaviconBytes./// </summary>/// <param name="filename">The name of the uploaded file.</param>/// <param name="fileBytes">The file content as bytes.</param>- /// <returns>AvuxImportResult for .avux files, or List<ImportedCredential> for CSV files.</returns>+ /// <returns>A list of ImportedCredential objects.</returns>private async Task<object> ProcessFile(string filename, byte[] fileBytes){trydiff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceBitwarden.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceBitwarden.razorindex ce0df4863..ada172fd2 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceBitwarden.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceBitwarden.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await BitwardenImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razorindex 150add9d8..1c23c5c9b 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor@@ -177,13 +177,10 @@@if (ImportedCredentials.Count > 0){<div class="mb-4 space-y-2">- @if (!IsAvuxImport)- {- <label class="flex items-center">- <input type="checkbox" @bind="ExtractFavicons" class="form-checkbox h-4 w-4 text-primary-600 rounded border-gray-300 dark:border-gray-600 dark:bg-gray-700">- <span class="ml-2 text-gray-700 dark:text-gray-300">@Localizer["ExtractFaviconsLabel"]</span>- </label>- }+ <label class="flex items-center">+ <input type="checkbox" @bind="ExtractFavicons" class="form-checkbox h-4 w-4 text-primary-600 rounded border-gray-300 dark:border-gray-600 dark:bg-gray-700">+ <span class="ml-2 text-gray-700 dark:text-gray-300">@Localizer["ExtractFaviconsLabel"]</span>+ </label>@if (DetectedFolderCount > 0){<label class="flex items-center">@@ -239,7 +236,7 @@else {<div class="mb-4"><p class="mb-4 text-gray-700 dark:text-gray-300">@string.Format(Localizer["ConfirmImportText"], ImportedCredentials.Count)</p>- @if (ExtractFavicons && !IsAvuxImport)+ @if (ExtractFavicons){<div class="p-4 mb-4 text-amber-700 bg-amber-100 rounded-lg dark:bg-amber-800/30 dark:text-amber-300" role="alert"><p>@Localizer["FaviconExtractionNote"]</p>@@ -296,19 +293,12 @@public EventCallback OnImportConfirmed { get; set; }/// <summary>- /// The callback for processing text-based CSV files (accepts file contents as string).- /// Returns List of ImportedCredential.- /// </summary>- [Parameter]- public Func<string, Task<List<ImportedCredential>>>? ProcessFileCallback { get; set; }-- /// <summary>- /// The callback for auto-detecting and processing files (accepts filename and bytes).+ /// The callback for processing files (accepts filename and bytes)./// This callback should determine whether to process as text or binary based on the file extension.- /// Returns credentials for CSV files, or full AvuxImportResult for .avux files.+ /// Returns either a List<ImportedCredential> or an AvuxImportResult for .avux files./// </summary>[Parameter]- public Func<string, byte[], Task<object>>? ProcessFileWithAutoDetectionCallback { get; set; }+ public Func<string, byte[], Task<object>>? ProcessFileCallback { get; set; }/// <summary>/// Gets or sets the accepted file types (e.g., ".csv", ".avux").@@ -348,15 +338,6 @@private int TotalCredentialsToSave { get; set; }private bool IsSyncingVault { get; set; }private Dictionary<string, Guid> ImportSessionLogoIds { get; set; } = new();- /// <summary>- /// Gets or sets the .avux logos for import. Public to allow external setting.- /// </summary>- public Dictionary<Guid, (string Source, byte[] FileData)> AvuxLogos { get; set; } = new();-- /// <summary>- /// Gets or sets whether this is an .avux import. Public to allow external setting.- /// </summary>- public bool IsAvuxImport { get; set; } = false;private int DuplicateCredentialsCount { get; set; } = 0;@@ -366,6 +347,10 @@private string? _pendingAvexFilename;private bool _requiresPassword = false;+ // Fields for .avux import handling+ private bool IsAvuxImport { get; set; } = false;+ private Dictionary<Guid, (string Source, byte[] FileData)> AvuxLogos { get; set; } = new();+/// <summary>/// Sets the imported credentials and continues to the preview step./// </summary>@@ -514,7 +499,7 @@// Process via the normal file handler as if it was an .avux upload// This ensures consistent handling and avoids EF tracking issues- var result = await ProcessFileWithAutoDetectionCallback!("decrypted.avux", avuxBytes);+ var result = await ProcessFileCallback!("decrypted.avux", avuxBytes);if (result is AvuxImportResult avuxResult){@@ -570,8 +555,8 @@try{- // Skip favicon extraction for .avux imports (they already have logos)- if (ExtractFavicons && !IsAvuxImport)+ // Extract favicons for credentials that don't already have them+ if (ExtractFavicons){await ExtractFaviconsForCredentials();if (FaviconExtractionCancellation?.Token.IsCancellationRequested == true)@@ -632,7 +617,10 @@FaviconExtractionCancellation = new CancellationTokenSource();StateHasChanged();- var credentialsWithUrls = ImportedCredentials.Where(c => c.ServiceUrls?.FirstOrDefault() != null).ToList();+ // Only extract favicons for credentials that don't already have them and have URLs+ var credentialsWithUrls = ImportedCredentials+ .Where(c => c.FaviconBytes == null && c.ServiceUrls?.FirstOrDefault() != null)+ .ToList();// Group credentials by normalized domain to avoid duplicate fetchesvar processedDomains = new HashSet<string>();@@ -735,9 +723,6 @@// Clear logo tracking for this import sessionImportSessionLogoIds.Clear();- // Import logos from .avux first (before processing items)- await ImportAvuxLogos();-// Show saving credentials progressIsSavingCredentials = true;CredentialSaveProgress = 0;@@ -806,99 +791,81 @@}/// <summary>- /// Imports logos from .avux file and creates a mapping of old IDs to new IDs.+ /// Processes a single item and handles logo/favicon assignment./// </summary>- private async Task ImportAvuxLogos()+ /// <param name="item">The item to process.</param>+ private async Task ProcessSingleItem(Item item){- if (!IsAvuxImport || AvuxLogos.Count == 0)- {- return;- }-- var context = await DbService.GetDbContextAsync();+ // Find the corresponding imported credential+ var importedCredential = ImportedCredentials.FirstOrDefault(c => c.ServiceName == item.Name);- foreach (var (logoId, logoData) in AvuxLogos)+ // Check if the credential has embedded favicon bytes (from .avux or other sources)+ if (importedCredential?.FaviconBytes != null){- try+ // Get URL domain for deduplication key+ var url = ItemService.GetFieldValue(item, FieldKey.LoginUrl);+ string domain;++ if (!string.IsNullOrEmpty(url)){- // Check if logo already exists by Source- var existingLogo = await context.Logos.FirstOrDefaultAsync(l => l.Source == logoData.Source);- if (existingLogo != null)- {- // Map old ID to existing ID- ImportSessionLogoIds[logoData.Source] = existingLogo.Id;- }- else+ try{- // Check if a logo with this exact ID already exists- var logoWithSameId = await context.Logos.FirstOrDefaultAsync(l => l.Id == logoId);- if (logoWithSameId != null)- {- // ID conflict - create with new ID- var newLogoId = Guid.NewGuid();- var logo = new Logo- {- Id = newLogoId,- Source = logoData.Source,- FileData = logoData.FileData,- MimeType = "image/png",- FetchedAt = DateTime.UtcNow,- CreatedAt = DateTime.UtcNow,- UpdatedAt = DateTime.UtcNow,- };- context.Logos.Add(logo);- ImportSessionLogoIds[logoData.Source] = newLogoId;- }- else+ domain = new Uri(url).Host.ToLowerInvariant();+ if (domain.StartsWith("www.")){- // Use original ID from .avux- var logo = new Logo- {- Id = logoId,- Source = logoData.Source,- FileData = logoData.FileData,- MimeType = "image/png",- FetchedAt = DateTime.UtcNow,- CreatedAt = DateTime.UtcNow,- UpdatedAt = DateTime.UtcNow,- };- context.Logos.Add(logo);- ImportSessionLogoIds[logoData.Source] = logoId;+ domain = domain[4..];}}+ catch+ {+ // Invalid URL, use item name as fallback+ domain = (item.Name ?? "unknown").ToLowerInvariant();+ }}- catch (Exception ex)+ else{- Logger.LogWarning(ex, "Failed to import logo with source {Source}", logoData.Source);+ // No URL, use item name as fallback+ domain = (item.Name ?? "unknown").ToLowerInvariant();}- }- // Save all logos at once- await context.SaveChangesAsync();- }-- /// <summary>- /// Processes a single item.- /// </summary>- /// <param name="item">The item to process.</param>- private async Task ProcessSingleItem(Item item)- {- // For .avux imports, map the LogoId using the imported logos- if (IsAvuxImport)- {- var importedCredential = ImportedCredentials.FirstOrDefault(c => c.ServiceName == item.Name);- if (importedCredential?.LogoId != null && AvuxLogos.ContainsKey(importedCredential.LogoId.Value))+ // Check if we already created a logo for this domain in this import session+ if (ImportSessionLogoIds.TryGetValue(domain, out var sessionLogoId))+ {+ item.LogoId = sessionLogoId;+ }+ else{- var logoData = AvuxLogos[importedCredential.LogoId.Value];- if (ImportSessionLogoIds.TryGetValue(logoData.Source, out var mappedLogoId))+ var context = await DbService.GetDbContextAsync();++ // Check if logo already exists by source+ var existingLogo = await context.Logos.FirstOrDefaultAsync(l => l.Source == domain);+ if (existingLogo != null)+ {+ item.LogoId = existingLogo.Id;+ ImportSessionLogoIds[domain] = existingLogo.Id;+ }+ else{- item.LogoId = mappedLogoId;+ // Create new logo from embedded bytes+ var logo = new Logo+ {+ Id = Guid.NewGuid(),+ Source = domain,+ FileData = importedCredential.FaviconBytes,+ MimeType = "image/png",+ FetchedAt = DateTime.UtcNow,+ CreatedAt = DateTime.UtcNow,+ UpdatedAt = DateTime.UtcNow,+ };+ context.Logos.Add(logo);+ item.LogoId = logo.Id;+ ImportSessionLogoIds[domain] = logo.Id;}}}else{- // Standard favicon extraction flow+ // No embedded favicon - try to use extracted faviconsvar url = ItemService.GetFieldValue(item, FieldKey.LoginUrl);if (!string.IsNullOrEmpty(url)){@@ -929,7 +896,7 @@}else if (ExtractedFavicons.TryGetValue(domain, out var favicon)){- // Create new logo+ // Create new logo from extracted faviconvar logo = new Logo{Id = Guid.NewGuid(),@@ -951,7 +918,7 @@catch (Exception ex){// Log error but continue import - favicon is not critical- Logger.LogWarning(ex, "Failed to extract favicon for item {ItemName}", item.Name);+ Logger.LogWarning(ex, "Failed to process favicon for item {ItemName}", item.Name);}}}@@ -991,68 +958,50 @@await using var stream = e.File.OpenReadStream(maxAllowedSize: maxFileSize);- if (ProcessFileWithAutoDetectionCallback != null)+ if (ProcessFileCallback == null){- // Read file bytes for auto-detection- using var memoryStream = new MemoryStream();- await stream.CopyToAsync(memoryStream);- var fileBytes = memoryStream.ToArray();+ ImportError = "No file processor configured";+ return;+ }- // Check if this is an encrypted .avex file- if (e.File.Name.EndsWith(".avex", StringComparison.OrdinalIgnoreCase))- {- // Encrypted file - trigger password input step- SetPendingEncryptedFile(fileBytes, e.File.Name);- return; // Password step will handle the rest- }+ // Read file bytes+ using var memoryStream = new MemoryStream();+ await stream.CopyToAsync(memoryStream);+ var fileBytes = memoryStream.ToArray();- // Call auto-detection callback for regular files- var processingTask = ProcessFileWithAutoDetectionCallback(e.File.Name, fileBytes);- var delayTask = Task.Delay(500);- await Task.WhenAll(processingTask, delayTask);+ // Check if this is an encrypted .avex file+ if (e.File.Name.EndsWith(".avex", StringComparison.OrdinalIgnoreCase))+ {+ // Encrypted file - trigger password input step+ SetPendingEncryptedFile(fileBytes, e.File.Name);+ return; // Password step will handle the rest+ }- var result = await processingTask;+ // Call callback for file processing+ var processingTask = ProcessFileCallback(e.File.Name, fileBytes);+ var delayTask = Task.Delay(500);+ await Task.WhenAll(processingTask, delayTask);- // Handle result based on type- if (result is AvuxImportResult avuxResult)- {- // .avux import with logos- ImportedCredentials = avuxResult.Credentials;- IsAvuxImport = true;+ var result = await processingTask;- // Store logo data for later use during import- AvuxLogos = avuxResult.Logos;- }- else if (result is List<ImportedCredential> credentials)- {- // CSV import- ImportedCredentials = credentials;- IsAvuxImport = false;- }- else- {- ImportError = "Invalid result type from file processor";- return;- }+ // Handle different result types+ if (result is AvuxImportResult avuxResult)+ {+ // .avux file with logos+ IsAvuxImport = true;+ AvuxLogos = avuxResult.Logos;+ ImportedCredentials = avuxResult.Credentials;}- else if (ProcessFileCallback != null)+ else if (result is List<ImportedCredential> credentials){- // Read file as text for text-based CSV processing- using var reader = new StreamReader(stream);- var fileContents = await reader.ReadToEndAsync();-- // Call text-based callback- var processingTask = ProcessFileCallback(fileContents);- var delayTask = Task.Delay(500);- await Task.WhenAll(processingTask, delayTask);-- ImportedCredentials = await processingTask;+ // Regular importIsAvuxImport = false;+ AvuxLogos = new();+ ImportedCredentials = credentials;}else{- ImportError = "No file processor configured";- return;+ throw new InvalidOperationException($"Unexpected result type: {result?.GetType().Name ?? "null"}");}// If password is required, the callback will handle setting the step to PasswordInputdiff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceChrome.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceChrome.razorindex c93d4cebb..c15a65349 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceChrome.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceChrome.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await ChromeImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDashlane.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDashlane.razorindex 4149cc5cf..00a4b304a 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDashlane.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDashlane.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await DashlaneImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDropbox.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDropbox.razorindex d9c3e8d49..49c4e7a81 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDropbox.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceDropbox.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await DropboxImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEdge.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEdge.razorindex 9aa58f394..704ef7722 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEdge.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEdge.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await EdgeImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEnpass.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEnpass.razorindex b11c2d7e1..c396da03c 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEnpass.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEnpass.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await EnpassImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceFirefox.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceFirefox.razorindex 5bb261bb5..61d7ede30 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceFirefox.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceFirefox.razor@@ -1,6 +1,7 @@@using AliasVault.ImportExport.Models@using AliasVault.ImportExport.Importers@using Microsoft.Extensions.Localization+@using System.Text@inject NavigationManager NavigationManager@inject GlobalNotificationService GlobalNotificationService@inject IStringLocalizerFactory LocalizerFactory@@ -18,8 +19,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = Encoding.UTF8.GetString(fileBytes);return await FirefoxImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceGenericCsv.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceGenericCsv.razorindex 0cd92f99e..c5425b937 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceGenericCsv.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceGenericCsv.razor@@ -36,8 +36,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await GenericCsvImporter.ImportFromCsvAsync(fileContents);}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePass.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePass.razorindex 10562b495..5b47ff393 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePass.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePass.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await KeePassImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razorindex 2beaab819..fa2df2619 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await KeePassXcImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceLastPass.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceLastPass.razorindex a6dd1c494..0339112ee 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceLastPass.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceLastPass.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await LastPassImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceNordPass.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceNordPass.razorindex 35d473751..797283a62 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceNordPass.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceNordPass.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await NordPassImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceProtonPass.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceProtonPass.razorindex 6f197295a..7edc2a134 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceProtonPass.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceProtonPass.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await ProtonPassImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceRoboform.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceRoboform.razorindex 7884876ed..d8cd02db6 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceRoboform.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceRoboform.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await RoboformImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razorindex eee4fe175..b9503c276 100644--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razor+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razor@@ -18,8 +18,9 @@@code {private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");- private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ private static async Task<object> ProcessFile(string filename, byte[] fileBytes){+ var fileContents = System.Text.Encoding.UTF8.GetString(fileBytes);return await StrongboxImporter.ImportFromCsvAsync(fileContents);}}diff --git a/apps/server/Utilities/AliasVault.ImportExport/Models/ImportedCredential.cs b/apps/server/Utilities/AliasVault.ImportExport/Models/ImportedCredential.csindex 1c6b5103a..6f3ec6fe9 100644--- a/apps/server/Utilities/AliasVault.ImportExport/Models/ImportedCredential.cs+++ b/apps/server/Utilities/AliasVault.ImportExport/Models/ImportedCredential.cs@@ -61,15 +61,10 @@ public class ImportedCredential/// <summary>/// Gets or sets the favicon bytes.+ /// This can be populated from .avux imports or other sources that provide logo data./// </summary>public byte[]? FaviconBytes { get; set; }- /// <summary>- /// Gets or sets the logo ID from .avux import (for deduplication).- /// When importing from .avux files, this ID links to logos already in the manifest.- /// </summary>- public Guid? LogoId { get; set; }-/// <summary>/// Gets or sets the alias information./// </summary>diff --git a/apps/server/Utilities/AliasVault.ImportExport/VaultImportService.cs b/apps/server/Utilities/AliasVault.ImportExport/VaultImportService.csindex 80c8d942f..0a21baa82 100644--- a/apps/server/Utilities/AliasVault.ImportExport/VaultImportService.cs+++ b/apps/server/Utilities/AliasVault.ImportExport/VaultImportService.cs@@ -20,10 +20,11 @@ public static class VaultImportService/// <summary>/// Imports vault data from .avux (AliasVault Unencrypted eXport) format./// This parses a ZIP archive containing a manifest.json file, all attachments, and logos.+ /// Logos are embedded directly into the FaviconBytes property of each credential./// </summary>/// <param name="zipBytes">The .avux file as a byte array.</param>- /// <returns>An AvuxImportResult containing credentials and logo data.</returns>- public static async Task<AvuxImportResult> ImportFromAvuxAsync(byte[] zipBytes)+ /// <returns>A list of ImportedCredential objects with embedded logo data.</returns>+ public static async Task<List<ImportedCredential>> ImportFromAvuxAsync(byte[] zipBytes){using var zipStream = new MemoryStream(zipBytes);using var archive = new ZipArchive(zipStream, ZipArchiveMode.Read);@@ -64,24 +65,20 @@ public static class VaultImportService// Extract logosvar logoMap = ExtractLogosFromZip(archive);- // Convert to ImportedCredential format- var credentials = ConvertManifestToImportedCredentials(manifest, attachmentMap, logoMap);-- // Build logo dictionary: ID -> (Source, FileData)- var logoData = new Dictionary<Guid, (string Source, byte[] FileData)>();+ // Build logo ID -> file data lookup+ var logoDataById = new Dictionary<Guid, byte[]>();foreach (var logo in manifest.Logos){if (logoMap.TryGetValue(logo.RelativePath, out var fileData)){- logoData[logo.Id] = (logo.Source, fileData);+ logoDataById[logo.Id] = fileData;}}- return new AvuxImportResult- {- Credentials = credentials,- Logos = logoData,- };+ // Convert to ImportedCredential format with embedded logos+ var credentials = ConvertManifestToImportedCredentials(manifest, attachmentMap, logoDataById);++ return credentials;}/// <summary>@@ -128,12 +125,11 @@ public static class VaultImportService/// <summary>/// Converts the manifest and attachments to ImportedCredential objects.- /// This maintains compatibility with the existing import flow./// </summary>private static List<ImportedCredential> ConvertManifestToImportedCredentials(AvuxManifest manifest,Dictionary<string, byte[]> attachmentMap,- Dictionary<string, byte[]> logoMap)+ Dictionary<Guid, byte[]> logoDataById){var credentials = new List<ImportedCredential>();var folderMap = manifest.Folders.ToDictionary(f => f.Id, f => f.Name);@@ -146,9 +142,13 @@ public static class VaultImportServiceCreatedAt = item.CreatedAt,UpdatedAt = item.UpdatedAt,ItemType = MapItemType(item.ItemType),- LogoId = item.LogoId,};+ if (item.LogoId.HasValue && logoDataById.TryGetValue(item.LogoId.Value, out var logoBytes))+ {+ credential.FaviconBytes = logoBytes;+ }+// Get folder pathif (item.FolderId.HasValue && folderMap.TryGetValue(item.FolderId.Value, out var folderName)){