Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add CSV import/export and DB loader (#84)
Leendert de Borst4abc6749707b
diff --git a/aliasvault.sln b/aliasvault.slnindex 32df43f5d..34575fa73 100644--- a/aliasvault.sln+++ b/aliasvault.sln@@ -29,10 +29,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AliasServerDb", "src\DatabaEndProjectProject("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AliasClientDb", "src\Databases\AliasClientDb\AliasClientDb.csproj", "{FE10F294-817F-477E-A24F-8597A15AF0B5}"EndProject-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliasVault.E2ETests.WebApp.Server", "src\Tests\Server\AliasVault.E2ETests.WebApp.Server\AliasVault.E2ETests.WebApp.Server.csproj", "{DD1F496F-CF10-47D1-A57F-5FA256479332}"+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AliasVault.E2ETests.WebApp.Server", "src\Tests\Server\AliasVault.E2ETests.WebApp.Server\AliasVault.E2ETests.WebApp.Server.csproj", "{DD1F496F-CF10-47D1-A57F-5FA256479332}"EndProjectProject("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{607945F3-9896-4544-99EC-F3496CF4D36B}"EndProject+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsvImportExport", "src\Utilities\CsvImportExport\CsvImportExport.csproj", "{A9C9A606-C87E-4298-AB32-09B1884D7487}"+EndProjectGlobalGlobalSection(SolutionConfigurationPlatforms) = preSolutionDebug|Any CPU = Debug|Any CPU@@ -83,6 +85,10 @@ Global{DD1F496F-CF10-47D1-A57F-5FA256479332}.Debug|Any CPU.Build.0 = Debug|Any CPU{DD1F496F-CF10-47D1-A57F-5FA256479332}.Release|Any CPU.ActiveCfg = Release|Any CPU{DD1F496F-CF10-47D1-A57F-5FA256479332}.Release|Any CPU.Build.0 = Release|Any CPU+ {A9C9A606-C87E-4298-AB32-09B1884D7487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU+ {A9C9A606-C87E-4298-AB32-09B1884D7487}.Debug|Any CPU.Build.0 = Debug|Any CPU+ {A9C9A606-C87E-4298-AB32-09B1884D7487}.Release|Any CPU.ActiveCfg = Release|Any CPU+ {A9C9A606-C87E-4298-AB32-09B1884D7487}.Release|Any CPU.Build.0 = Release|Any CPUEndGlobalSectionGlobalSection(SolutionProperties) = preSolutionHideSolutionNode = FALSE@@ -96,6 +102,7 @@ Global{FE10F294-817F-477E-A24F-8597A15AF0B5} = {5F7417F6-4388-49CC-9511-ED63C4A6488A}{DD1F496F-CF10-47D1-A57F-5FA256479332} = {607945F3-9896-4544-99EC-F3496CF4D36B}{607945F3-9896-4544-99EC-F3496CF4D36B} = {29DE523D-EEF2-41E9-AC12-F20D8D02BEBB}+ {A9C9A606-C87E-4298-AB32-09B1884D7487} = {01AB9389-2F89-4F8E-A688-BF4BF1FC42C8}EndGlobalSectionGlobalSection(ExtensibilityGlobals) = postSolutionSolutionGuid = {FEE82475-C009-4762-8113-A6563D9DC49E}diff --git a/src/AliasVault.WebApp/AliasVault.WebApp.csproj b/src/AliasVault.WebApp/AliasVault.WebApp.csprojindex c725fdf63..5517f835c 100644--- a/src/AliasVault.WebApp/AliasVault.WebApp.csproj+++ b/src/AliasVault.WebApp/AliasVault.WebApp.csproj@@ -74,6 +74,7 @@<ProjectReference Include="..\AliasGenerators\AliasGenerators.csproj" /><ProjectReference Include="..\AliasVault.Shared\AliasVault.Shared.csproj" /><ProjectReference Include="..\Utilities\Cryptography\Cryptography.csproj" />+ <ProjectReference Include="..\Utilities\CsvImportExport\CsvImportExport.csproj" /><ProjectReference Include="..\Utilities\FaviconExtractor\FaviconExtractor.csproj" /></ItemGroup>diff --git a/src/AliasVault.WebApp/Layout/DbStatusIndicator.razor b/src/AliasVault.WebApp/Layout/DbStatusIndicator.razorindex e9759e235..2906b1c8e 100644--- a/src/AliasVault.WebApp/Layout/DbStatusIndicator.razor+++ b/src/AliasVault.WebApp/Layout/DbStatusIndicator.razor@@ -21,10 +21,13 @@ elseprivate bool Loading { get; set; } = false;private string Message { get; set; } = "";private string LoadingIndicatorMessage { get; set; } = "";+ private bool DatabaseLoading { get; set; } = false;/// <inheritdoc />- protected override void OnInitialized()+ protected override async Task OnInitializedAsync(){+ await base.OnInitializedAsync();+DbService.GetState().StateChanged += OnDatabaseStateChanged;}diff --git a/src/AliasVault.WebApp/Layout/MainLayout.razor b/src/AliasVault.WebApp/Layout/MainLayout.razorindex 8a8ad4e36..e4a588cf2 100644--- a/src/AliasVault.WebApp/Layout/MainLayout.razor+++ b/src/AliasVault.WebApp/Layout/MainLayout.razor@@ -1,14 +1,139 @@@inherits LayoutComponentBase+@implements IDisposable+@inject DbService DbService+@inject AuthenticationStateProvider AuthStateProvider+@inject NavigationManager NavigationManager+@using Microsoft.AspNetCore.Components.Authorization+@using AliasVault.WebApp.Auth.Providers-<TopMenu />+<CascadingAuthenticationState>+ <AuthorizeView>+ <Authorized>+ <TopMenu />+ <div class="flex pt-16 overflow-hidden bg-gray-50 dark:bg-gray-900">+ <div id="main-content" class="relative w-full max-w-screen-2xl mx-auto h-full overflow-y-auto bg-gray-50 dark:bg-gray-900">+ @if (IsDbInitialized)+ {+ <main>+ @Body+ </main>+ <Footer />+ }+ else+ {+ <div class="fixed inset-0 overflow-y-auto h-full w-full flex items-center justify-center">+ <div class="relative p-8 bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md mx-auto">+ <div class="text-center">+ <svg class="mx-auto animate-spin h-12 w-12 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>+ </svg>+ <h2 class="mt-4 text-xl font-semibold text-gray-900 dark:text-white">Vault decryption in progress</h2>+ <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">Please wait while your vault is initialized. This may take a moment.</p>+ </div>+ </div>+ </div>+ }+ </div>+ </div>+ </Authorized>+ <NotAuthorized>+ <main>+ @Body+ </main>+ </NotAuthorized>+ </AuthorizeView>+</CascadingAuthenticationState>-<div class="flex pt-16 overflow-hidden bg-gray-50 dark:bg-gray-900">+@code {+ private bool IsDbInitialized { get; set; } = false;+ private const int MinimumLoadingTimeMs = 800;- <div id="main-content" class="relative w-full max-w-screen-2xl mx-auto h-full overflow-y-auto bg-gray-50 dark:bg-gray-900">- <main>- @Body+ [CascadingParameter] private Task<AuthenticationState>? AuthState { get; set; }- </main>- <Footer />- </div>-</div>+ protected override async Task OnInitializedAsync()+ {+ await base.OnInitializedAsync();++ DbService.GetState().StateChanged += OnDatabaseStateChanged;+ AuthStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;++ await CheckAndInitializeDatabase();+ }++ protected override async Task OnParametersSetAsync()+ {+ if (AuthState != null)+ {+ var authState = await AuthState;+ if (authState.User.Identity?.IsAuthenticated == true)+ {+ await CheckAndInitializeDatabase();+ }+ }+ }++ private async void OnAuthenticationStateChanged(Task<AuthenticationState> task)+ {+ var authState = await task;+ if (authState.User.Identity?.IsAuthenticated == true)+ {+ await CheckAndInitializeDatabase();+ }+ StateHasChanged();+ }++ private async Task CheckAndInitializeDatabase()+ {+ var currentState = DbService.GetState().CurrentState;+ if (currentState.Status == DbServiceState.DatabaseStatus.Uninitialized)+ {+ await InitializeDatabaseWithProgress();+ }+ else if (currentState.Status == DbServiceState.DatabaseStatus.Initialized)+ {+ IsDbInitialized = true;+ StateHasChanged();+ }+ }++ private async void OnDatabaseStateChanged(object? sender, DbServiceState.DatabaseState newState)+ {+ if (newState.Status == DbServiceState.DatabaseStatus.Uninitialized)+ {+ await InitializeDatabaseWithProgress();+ }+ else if (newState.Status == DbServiceState.DatabaseStatus.Initialized)+ {+ IsDbInitialized = true;+ }+ StateHasChanged();+ }++ private async Task InitializeDatabaseWithProgress()+ {+ IsDbInitialized = false;+ StateHasChanged();++ var stopwatch = System.Diagnostics.Stopwatch.StartNew();++ await DbService.InitializeDatabaseAsync();++ stopwatch.Stop();+ var elapsedMs = (int)stopwatch.ElapsedMilliseconds;++ if (elapsedMs < MinimumLoadingTimeMs)+ {+ await Task.Delay(MinimumLoadingTimeMs - elapsedMs);+ }++ IsDbInitialized = true;+ StateHasChanged();+ }++ public void Dispose()+ {+ DbService.GetState().StateChanged -= OnDatabaseStateChanged;+ AuthStateProvider.AuthenticationStateChanged -= OnAuthenticationStateChanged;+ }+}diff --git a/src/AliasVault.WebApp/Layout/TopMenu.razor b/src/AliasVault.WebApp/Layout/TopMenu.razorindex 756262c5b..97dd53f45 100644--- a/src/AliasVault.WebApp/Layout/TopMenu.razor+++ b/src/AliasVault.WebApp/Layout/TopMenu.razor@@ -48,6 +48,9 @@<li><a href="#" class="block py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-400 dark:hover:text-white">Account settings</a></li>+ <li>+ <a href="settings/vault" class="block py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-400 dark:hover:text-white">Vault settings</a>+ </li></ul><ul class="py-1 font-light text-gray-500 dark:text-gray-400" aria-labelledby="dropdown"><li>diff --git a/src/AliasVault.WebApp/Pages/Credentials/AddEdit.razor b/src/AliasVault.WebApp/Pages/Credentials/AddEdit.razorindex 5c445bfee..37a7f7885 100644--- a/src/AliasVault.WebApp/Pages/Credentials/AddEdit.razor+++ b/src/AliasVault.WebApp/Pages/Credentials/AddEdit.razor@@ -301,17 +301,6 @@ elseIsSaving = true;StateHasChanged();- // Try to extract favicon from service URL- if (Obj.ServiceUrl != null && !string.IsNullOrEmpty(Obj.ServiceUrl) && Obj.ServiceUrl.Contains("http"))- {- // Request favicon from from service URL via WebApi- var apiReturn = await HttpClient.GetFromJsonAsync<FaviconExtractModel>("api/v1/Favicon/Extract?url=" + Obj.ServiceUrl);- if (apiReturn != null && apiReturn.Image != null)- {- Obj.ServiceLogo = apiReturn.Image;- }- }-// Sanity check for unittest. Delete later if not needed.// Try to parse birthdate as datetime. if it fails, set it to empty.if (EditMode)diff --git a/src/AliasVault.WebApp/Pages/Settings/Vault.razor b/src/AliasVault.WebApp/Pages/Settings/Vault.razornew file mode 100644index 000000000..232c4ad5f--- /dev/null+++ b/src/AliasVault.WebApp/Pages/Settings/Vault.razor@@ -0,0 +1,132 @@+@page "/settings/vault"+@inherits PageBase+@inject HttpClient HttpClient+@inject CredentialService CredentialService++<LayoutPageTitle>Vault settings</LayoutPageTitle>++<div class="grid grid-cols-1 px-4 pt-6 xl:grid-cols-3 xl:gap-4 dark:bg-gray-900">+ <div class="mb-4 col-span-full xl:mb-2">+ <Breadcrumb BreadcrumbItems="BreadcrumbItems" />+ <div class="flex items-center justify-between">+ <h1 class="text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white">Vault settings</h1>+ </div>+ <p>On this page you can configure your vault settings.</p>+ </div>+</div>++<div>+ <button @onclick="ExportVaultSqlite" type="button" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">+ Export vault to unencrypted SQLite file+ </button>+</div>+<div class="mt-2">+ <button @onclick="ExportVaultCsv" type="button" class="px-4 py-2 text-white bg-primary-600 rounded-lg hover:bg-primary-700 focus:ring-4 focus:ring-primary-300 dark:bg-primary-500 dark:hover:bg-primary-600 dark:focus:ring-primary-800">+ Export vault to unencrypted CSV file+ </button>+</div>++<div class="mt-2">+ Import unencrypted CSV file:+ <InputFile OnChange="@LoadFiles" />+</div>++@if (IsImporting)+{+ <p>Loading...</p>+}+else if (!string.IsNullOrEmpty(ImportErrorMessage))+{+ <p class="text-danger">@ImportErrorMessage</p>+}+else if (!string.IsNullOrEmpty(ImportSuccessMessage))+{+ <p class="text-success">@ImportSuccessMessage</p>+}++@code {+ private bool IsLoading { get; set; } = true;+ private bool IsImporting = false;+ private string ImportErrorMessage = string.Empty;+ private string ImportSuccessMessage = string.Empty;++ private async Task ExportVaultSqlite()+ {+ try+ {+ // Decode the base64 string to a byte array+ byte[] fileBytes = Convert.FromBase64String(await DbService.ExportSqliteToBase64Async());++ // Create a memory stream from the byte array+ using (MemoryStream memoryStream = new MemoryStream(fileBytes))+ {+ // Invoke JavaScript to initiate the download+ await Js.InvokeVoidAsync("downloadFileFromStream", "aliasvault-client.sqlite", memoryStream.ToArray());+ }+ }+ catch (Exception ex)+ {+ Console.WriteLine($"Error downloading file: {ex.Message}");+ }+ }++ private async Task ExportVaultCsv()+ {+ try+ {+ var credentials = await CredentialService.LoadAllAsync();++ var csvBytes = CsvImportExport.CredentialCsvService.ExportCredentialsToCsv(credentials);++ // Create a memory stream from the byte array+ using (MemoryStream memoryStream = new MemoryStream(csvBytes))+ {+ // Invoke JavaScript to initiate the download+ await Js.InvokeVoidAsync("downloadFileFromStream", "aliasvault-client.csv", memoryStream.ToArray());+ }++ }+ catch (Exception ex)+ {+ Console.WriteLine($"Error downloading file: {ex.Message}");+ }+ }++ private async Task LoadFiles(InputFileChangeEventArgs e)+ {+ IsImporting = true;+ StateHasChanged();+ ImportErrorMessage = string.Empty;+ ImportSuccessMessage = string.Empty;++ try+ {+ var file = e.File;+ var buffer = new byte[file.Size];+ await file.OpenReadStream().ReadAsync(buffer);+ var fileContent = System.Text.Encoding.UTF8.GetString(buffer);++ var importedCredentials = CsvImportExport.CredentialCsvService.ImportCredentialsFromCsv(fileContent);++ // Loop through the imported credentials and actually add them to the database+ foreach (var importedCredential in importedCredentials)+ {+ await CredentialService.InsertEntryAsync(importedCredential, false);+ }++ // Save the database.+ await DbService.SaveDatabaseAsync();++ ImportSuccessMessage = $"Succesfully imported {importedCredentials.Count} credentials.";+ }+ catch (Exception ex)+ {+ ImportErrorMessage = $"Error importing file: {ex.Message}";+ }+ finally+ {+ IsImporting = false;+ StateHasChanged();+ }+ }+}diff --git a/src/AliasVault.WebApp/Services/CredentialService.cs b/src/AliasVault.WebApp/Services/CredentialService.csindex 0d57e1dd1..bc3b2ef86 100644--- a/src/AliasVault.WebApp/Services/CredentialService.cs+++ b/src/AliasVault.WebApp/Services/CredentialService.cs@@ -9,6 +9,7 @@ namespace AliasVault.WebApp.Services;using System.Net.Http.Json;using AliasClientDb;+using AliasVault.Shared.Models;using AliasVault.WebApp.Models;using AliasVault.WebApp.Services.Database;using Microsoft.EntityFrameworkCore;@@ -38,11 +39,15 @@ public class CredentialService(HttpClient httpClient, DbService dbService)/// Insert new entry into database./// </summary>/// <param name="loginObject">Login object to insert.</param>+ /// <param name="saveToDb">Whether to commit changes to database. Defaults to true, but can be set to false if entries are added in bulk by caller.</param>/// <returns>Guid of inserted entry.</returns>- public async Task<Guid> InsertEntryAsync(Credential loginObject)+ public async Task<Guid> InsertEntryAsync(Credential loginObject, bool saveToDb = true){var context = await dbService.GetDbContextAsync();+ // Try to extract favicon from service URL+ await ExtractFaviconAsync(loginObject);+var login = new Credential{CreatedAt = DateTime.UtcNow,@@ -107,6 +112,9 @@ public class CredentialService(HttpClient httpClient, DbService dbService){var context = await dbService.GetDbContextAsync();+ // Try to extract favicon from service URL+ await ExtractFaviconAsync(loginObject);+// Get the existing entry.var login = await context.Credentials.Include(x => x.Alias)@@ -163,6 +171,23 @@ public class CredentialService(HttpClient httpClient, DbService dbService)return loginObject;}+ /// <summary>+ /// Load all entries from database.+ /// </summary>+ /// <returns>Alias object.</returns>+ public async Task<List<Credential>> LoadAllAsync()+ {+ var context = await dbService.GetDbContextAsync();++ var loginObject = await context.Credentials+ .Include(x => x.Passwords)+ .Include(x => x.Alias)+ .Include(x => x.Service)+ .ToListAsync();++ return loginObject;+ }+/// <summary>/// Get list with all login entries./// </summary>@@ -202,4 +227,24 @@ public class CredentialService(HttpClient httpClient, DbService dbService)await context.SaveChangesAsync();await dbService.SaveDatabaseAsync();}++ /// <summary>+ /// Extract favicon from service URL if available in object. If successful the passed object itself will be updated with the bytes.+ /// </summary>+ /// <param name="credentialObject">The Credential object to extract the favicon for.</param>+ /// <returns>Task.</returns>+ private async Task ExtractFaviconAsync(Credential credentialObject)+ {+ // Try to extract favicon from service URL+ var url = credentialObject.Service.Url;+ if (url != null && !string.IsNullOrEmpty(url) && url.Contains("http"))+ {+ // Request favicon from from service URL via WebApi+ var apiReturn = await httpClient.GetFromJsonAsync<FaviconExtractModel>("api/v1/Favicon/Extract?url=" + url);+ if (apiReturn != null && apiReturn.Image != null)+ {+ credentialObject.Service.Logo = apiReturn.Image;+ }+ }+ }}diff --git a/src/AliasVault.WebApp/Services/Database/DbService.cs b/src/AliasVault.WebApp/Services/Database/DbService.csindex daff525c4..b0ba0bc14 100644--- a/src/AliasVault.WebApp/Services/Database/DbService.cs+++ b/src/AliasVault.WebApp/Services/Database/DbService.cs@@ -28,7 +28,6 @@ public class DbService : IDisposableprivate readonly DbServiceState _state = new();private SqliteConnection _sqlConnection;private AliasClientDbContext _dbContext;- private Task _initializationTask;private bool _isSuccessfullyInitialized;private int _retryCount;private bool _disposed;@@ -46,13 +45,10 @@ public class DbService : IDisposable_httpClient = httpClient;// Set the initial state of the database service.- _state.UpdateState(DbServiceState.DatabaseStatus.Idle);+ _state.UpdateState(DbServiceState.DatabaseStatus.Uninitialized);// Create an in-memory SQLite database connection which stays open for the lifetime of the service.(_sqlConnection, _dbContext) = InitializeEmptyDatabase();-- // Initialize the database asynchronously- _initializationTask = InitializeDatabaseAsync();}/// <summary>@@ -65,12 +61,37 @@ public class DbService : IDisposable}/// <summary>- /// Ensures that the service initialization is complete before proceeding.+ /// Initializes the database, either by creating a new one or loading an existing one from the server./// </summary>/// <returns>Task.</returns>- public async Task EnsureInitializedAsync()+ public async Task InitializeDatabaseAsync(){- await _initializationTask;+ Console.WriteLine("init db called svc");++ // Check that encryption key is set. If not, do nothing.+ if (!_authService.IsEncryptionKeySet())+ {+ return;+ }++ _state.UpdateState(DbServiceState.DatabaseStatus.Loading);++ // Ensure the in-memory database representation is created and has the necessary tables.+ await _dbContext.Database.EnsureCreatedAsync();++ // Attempt to fill the local database with a previously saved database stored on the server.+ var loaded = await LoadDatabaseFromServerAsync();+ if (loaded)+ {+ _isSuccessfullyInitialized = true;+ _state.UpdateState(DbServiceState.DatabaseStatus.Initialized);+ Console.WriteLine("Database succesfully loaded from server.");+ }+ else+ {+ _state.UpdateState(DbServiceState.DatabaseStatus.Error);+ Console.WriteLine("Failed to load database from server.");+ }}/// <summary>@@ -79,15 +100,13 @@ public class DbService : IDisposable/// <returns>AliasClientDbContext.</returns>public async Task<AliasClientDbContext> GetDbContextAsync(){- await EnsureInitializedAsync();if (!_isSuccessfullyInitialized){// Retry initialization up to 5 times before giving up.if (_retryCount < 5){_retryCount++;- _initializationTask = InitializeDatabaseAsync();- await EnsureInitializedAsync();+ await InitializeDatabaseAsync();}else{@@ -104,8 +123,6 @@ public class DbService : IDisposable/// <returns>Task.</returns>public async Task SaveDatabaseAsync(){- await EnsureInitializedAsync();-// Set the initial state of the database service._state.UpdateState(DbServiceState.DatabaseStatus.Saving);@@ -122,7 +139,7 @@ public class DbService : IDisposableif (success){Console.WriteLine("Database succesfully saved to server.");- _state.UpdateState(DbServiceState.DatabaseStatus.Idle);+ _state.UpdateState(DbServiceState.DatabaseStatus.Initialized);}else{@@ -137,6 +154,8 @@ public class DbService : IDisposable/// <returns>Base64 encoded string that represents SQLite database.</returns>public async Task<string> ExportSqliteToBase64Async(){+ Console.WriteLine("Awaited database initialize...");+var tempFileName = Path.GetRandomFileName();// Export SQLite memory database to a temp file.@@ -205,37 +224,6 @@ public class DbService : IDisposable_disposed = true;}- /// <summary>- /// Initializes the database, either by creating a new one or loading an existing one from the server.- /// </summary>- private async Task InitializeDatabaseAsync()- {- // Check that encryption key is set. If not, do nothing.- if (!_authService.IsEncryptionKeySet())- {- return;- }-- _state.UpdateState(DbServiceState.DatabaseStatus.Loading);-- // Ensure the in-memory database representation is created and has the necessary tables.- await _dbContext.Database.EnsureCreatedAsync();-- // Attempt to fill the local database with a previously saved database stored on the server.- var loaded = await LoadDatabaseFromServerAsync();- if (loaded)- {- _isSuccessfullyInitialized = true;- _state.UpdateState(DbServiceState.DatabaseStatus.Idle);- Console.WriteLine("Database succesfully loaded from server.");- }- else- {- _state.UpdateState(DbServiceState.DatabaseStatus.Error);- Console.WriteLine("Failed to load database from server.");- }- }-/// <summary>/// Loads a SQLite database from a base64 string which represents a .sqlite file./// </summary>diff --git a/src/AliasVault.WebApp/Services/Database/DbServiceState.cs b/src/AliasVault.WebApp/Services/Database/DbServiceState.csindex 8f35343ba..18686b4a3 100644--- a/src/AliasVault.WebApp/Services/Database/DbServiceState.cs+++ b/src/AliasVault.WebApp/Services/Database/DbServiceState.cs@@ -25,9 +25,14 @@ public class DbServiceStatepublic enum DatabaseStatus{/// <summary>- /// No database operation is in progress.+ /// Database not initialized (yet)./// </summary>- Idle,+ Uninitialized,++ /// <summary>+ /// Database is initialized but no task is currently in progress.+ /// </summary>+ Initialized,/// <summary>/// Database is loading from server.@@ -107,7 +112,7 @@ public class DbServiceState/// <summary>/// Gets or sets the current status of the database./// </summary>- public DatabaseStatus Status { get; set; } = DatabaseStatus.Idle;+ public DatabaseStatus Status { get; set; } = DatabaseStatus.Uninitialized;/// <summary>/// Gets or sets the message associated with the current status.diff --git a/src/AliasVault.WebApp/wwwroot/css/tailwind.css b/src/AliasVault.WebApp/wwwroot/css/tailwind.cssindex 2ee757947..a1502818c 100644--- a/src/AliasVault.WebApp/wwwroot/css/tailwind.css+++ b/src/AliasVault.WebApp/wwwroot/css/tailwind.css@@ -582,6 +582,10 @@ video {position: relative;}+.inset-0 {+ inset: 0px;+}+.inset-y-0 {top: 0px;bottom: 0px;@@ -706,6 +710,10 @@ video {margin-top: 0px;}+.mt-2 {+ margin-top: 0.5rem;+}+.mt-4 {margin-top: 1rem;}@@ -754,8 +762,8 @@ video {height: 2.5rem;}-.h-28 {- height: 7rem;+.h-12 {+ height: 3rem;}.h-4 {@@ -794,6 +802,10 @@ video {width: 2.5rem;}+.w-12 {+ width: 3rem;+}+.w-28 {width: 7rem;}@@ -834,6 +846,10 @@ video {min-width: 100%;}+.max-w-md {+ max-width: 28rem;+}+.max-w-screen-2xl {max-width: 1536px;}@@ -876,6 +892,10 @@ video {grid-template-columns: repeat(2, minmax(0, 1fr));}+.grid-cols-3 {+ grid-template-columns: repeat(3, minmax(0, 1fr));+}+.grid-cols-4 {grid-template-columns: repeat(4, minmax(0, 1fr));}@@ -888,10 +908,6 @@ video {grid-template-columns: repeat(7, minmax(0, 1fr));}-.grid-cols-3 {- grid-template-columns: repeat(3, minmax(0, 1fr));-}-.flex-col {flex-direction: column;}@@ -1073,6 +1089,11 @@ video {background-color: rgb(249 250 251 / var(--tw-bg-opacity));}+.bg-gray-600 {+ --tw-bg-opacity: 1;+ background-color: rgb(75 85 99 / var(--tw-bg-opacity));+}+.bg-gray-700 {--tw-bg-opacity: 1;background-color: rgb(55 65 81 / var(--tw-bg-opacity));@@ -1147,6 +1168,10 @@ video {padding: 1.5rem;}+.p-8 {+ padding: 2rem;+}+.px-2 {padding-left: 0.5rem;padding-right: 0.5rem;@@ -1290,6 +1315,11 @@ video {letter-spacing: 0.05em;}+.text-blue-500 {+ --tw-text-opacity: 1;+ color: rgb(59 130 246 / var(--tw-text-opacity));+}+.text-blue-700 {--tw-text-opacity: 1;color: rgb(29 78 216 / var(--tw-text-opacity));@@ -1345,15 +1375,23 @@ video {color: rgb(255 255 255 / var(--tw-text-opacity));}-.text-blue-500 {+.text-primary-500 {--tw-text-opacity: 1;- color: rgb(59 130 246 / var(--tw-text-opacity));+ color: rgb(244 149 65 / var(--tw-text-opacity));}.opacity-0 {opacity: 0;}+.opacity-25 {+ opacity: 0.25;+}++.opacity-75 {+ opacity: 0.75;+}+.shadow {--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);@@ -1372,6 +1410,12 @@ video {box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);}+.shadow-xl {+ --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);+ --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);+}+.outline-0 {outline-width: 0px;}@@ -1590,6 +1634,11 @@ video {--tw-bg-opacity: 0.8;}+.dark\:text-blue-400:is(.dark *) {+ --tw-text-opacity: 1;+ color: rgb(96 165 250 / var(--tw-text-opacity));+}+.dark\:text-blue-500:is(.dark *) {--tw-text-opacity: 1;color: rgb(59 130 246 / var(--tw-text-opacity));@@ -1635,11 +1684,6 @@ video {color: rgb(255 255 255 / var(--tw-text-opacity));}-.dark\:text-blue-400:is(.dark *) {- --tw-text-opacity: 1;- color: rgb(96 165 250 / var(--tw-text-opacity));-}-.dark\:placeholder-gray-400:is(.dark *)::-moz-placeholder {--tw-placeholder-opacity: 1;color: rgb(156 163 175 / var(--tw-placeholder-opacity));diff --git a/src/AliasVault.WebApp/wwwroot/index.template.html b/src/AliasVault.WebApp/wwwroot/index.template.htmlindex adae62ea4..813918837 100644--- a/src/AliasVault.WebApp/wwwroot/index.template.html+++ b/src/AliasVault.WebApp/wwwroot/index.template.html@@ -49,6 +49,7 @@<script src="js/dark-mode.js?v=@CacheBuster"></script><script src="js/cryptoInterop.js?v=@CacheBuster"></script>+ <script src="js/utilities.js?v=@CacheBuster"></script><script>window.initTopMenu = function() {diff --git a/src/AliasVault.WebApp/wwwroot/js/utilities.js b/src/AliasVault.WebApp/wwwroot/js/utilities.jsnew file mode 100644index 000000000..71cfb5479--- /dev/null+++ b/src/AliasVault.WebApp/wwwroot/js/utilities.js@@ -0,0 +1,11 @@+function downloadFileFromStream(fileName, contentStreamReference) {+ const arrayBuffer = new Uint8Array(contentStreamReference).buffer;+ const blob = new Blob([arrayBuffer]);+ const url = URL.createObjectURL(blob);+ const anchorElement = document.createElement('a');+ anchorElement.href = url;+ anchorElement.download = fileName ?? '';+ anchorElement.click();+ anchorElement.remove();+ URL.revokeObjectURL(url);+}diff --git a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csprojindex 74bfbfd46..3f6a682f6 100644--- a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj+++ b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj@@ -31,9 +31,9 @@<PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>- <PackageReference Include="NUnit" Version="4.1.0"/>- <PackageReference Include="NUnit3TestAdapter" Version="4.5.0"/>+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />+ <PackageReference Include="NUnit" Version="4.1.0" />+ <PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /><PackageReference Include="NUnit.Analyzers" Version="4.2.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>@@ -50,9 +50,11 @@<ItemGroup><ProjectReference Include="..\..\AliasVault.Api\AliasVault.Api.csproj" />+ <ProjectReference Include="..\..\Databases\AliasClientDb\AliasClientDb.csproj" /><ProjectReference Include="..\..\Databases\AliasServerDb\AliasServerDb.csproj" />- <ProjectReference Include="..\..\Utilities\Cryptography\Cryptography.csproj"/>- <ProjectReference Include="..\..\Utilities\FaviconExtractor\FaviconExtractor.csproj"/>+ <ProjectReference Include="..\..\Utilities\Cryptography\Cryptography.csproj" />+ <ProjectReference Include="..\..\Utilities\CsvImportExport\CsvImportExport.csproj" />+ <ProjectReference Include="..\..\Utilities\FaviconExtractor\FaviconExtractor.csproj" /></ItemGroup></Project>diff --git a/src/Tests/AliasVault.UnitTests/Utilities/CsvImportExportTests.cs b/src/Tests/AliasVault.UnitTests/Utilities/CsvImportExportTests.csnew file mode 100644index 000000000..1c08d1f2d--- /dev/null+++ b/src/Tests/AliasVault.UnitTests/Utilities/CsvImportExportTests.cs@@ -0,0 +1,118 @@+//-----------------------------------------------------------------------+// <copyright file="CsvImportExportTests.cs" company="lanedirt">+// Copyright (c) lanedirt. All rights reserved.+// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace AliasVault.Tests;++using AliasClientDb;+using CsvImportExport;++/// <summary>+/// Tests for the CsvImportExport class.+/// </summary>+public class CsvImportExportTests+{+ /// <summary>+ /// Test case for importing credentials from CSV and ensuring all values are present.+ /// </summary>+ [Test]+ public void ImportCredentialsFromCsv()+ {+ // Arrange+ var credential = new Credential+ {+ Id = new Guid("00000000-0000-0000-0000-000000000001"),+ Username = "testuser",+ Notes = "Test notes",+ CreatedAt = DateTime.Now,+ UpdatedAt = DateTime.Now,+ AliasId = new Guid("00000000-0000-0000-0000-000000000002"),+ Alias = new Alias+ {+ Id = new Guid("00000000-0000-0000-0000-000000000002"),+ Gender = "Male",+ FirstName = "John",+ LastName = "Doe",+ NickName = "JD",+ BirthDate = new DateTime(1990, 1, 1, 0, 0, 0, DateTimeKind.Utc),+ AddressStreet = "123 Main St",+ AddressCity = "New York",+ AddressState = "NY",+ AddressZipCode = "12345",+ AddressCountry = "USA",+ Hobbies = "Reading, Writing",+ EmailPrefix = "johndoe",+ PhoneMobile = "123-456-7890",+ BankAccountIBAN = "US1234567890",+ CreatedAt = DateTime.Now,+ UpdatedAt = DateTime.Now,+ },+ ServiceId = new Guid("00000000-0000-0000-0000-000000000003"),+ Service = new Service+ {+ Id = new Guid("00000000-0000-0000-0000-000000000003"),+ Name = "Test Service",+ Url = "https://testservice.com",+ },+ Passwords = new List<Password>+ {+ new Password+ {+ Value = "password123",+ CreatedAt = DateTime.Now,+ UpdatedAt = DateTime.Now,+ },+ },+ };++ var csvContent = CredentialCsvService.ExportCredentialsToCsv(new List<Credential> { credential });+ var csvString = System.Text.Encoding.Default.GetString(csvContent);++ // Act+ var importedCredentials = CredentialCsvService.ImportCredentialsFromCsv(csvString);++ // Assert+ Assert.That(importedCredentials.Count, Is.EqualTo(1));++ var importedCredential = importedCredentials[0];++ Assert.That(importedCredential.Id, Is.EqualTo(credential.Id));+ Assert.That(importedCredential.Username, Is.EqualTo(credential.Username));+ Assert.That(importedCredential.Notes, Is.EqualTo(credential.Notes));+ Assert.That(importedCredential.CreatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(credential.CreatedAt.ToString("yyyy-MM-dd")));+ Assert.That(importedCredential.UpdatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(credential.UpdatedAt.ToString("yyyy-MM-dd")));+ Assert.That(importedCredential.AliasId, Is.EqualTo(credential.AliasId));+ Assert.That(importedCredential.Alias.Id, Is.EqualTo(credential.Alias.Id));+ Assert.That(importedCredential.Alias.Gender, Is.EqualTo(credential.Alias.Gender));+ Assert.That(importedCredential.Alias.FirstName, Is.EqualTo(credential.Alias.FirstName));+ Assert.That(importedCredential.Alias.LastName, Is.EqualTo(credential.Alias.LastName));+ Assert.That(importedCredential.Alias.NickName, Is.EqualTo(credential.Alias.NickName));+ Assert.That(importedCredential.Alias.BirthDate, Is.EqualTo(credential.Alias.BirthDate));+ Assert.That(importedCredential.Alias.AddressStreet, Is.EqualTo(credential.Alias.AddressStreet));+ Assert.That(importedCredential.Alias.AddressCity, Is.EqualTo(credential.Alias.AddressCity));+ Assert.That(importedCredential.Alias.AddressState, Is.EqualTo(credential.Alias.AddressState));+ Assert.That(importedCredential.Alias.AddressZipCode, Is.EqualTo(credential.Alias.AddressZipCode));+ Assert.That(importedCredential.Alias.AddressCountry, Is.EqualTo(credential.Alias.AddressCountry));+ Assert.That(importedCredential.Alias.Hobbies, Is.EqualTo(credential.Alias.Hobbies));+ Assert.That(importedCredential.Alias.EmailPrefix, Is.EqualTo(credential.Alias.EmailPrefix));+ Assert.That(importedCredential.Alias.PhoneMobile, Is.EqualTo(credential.Alias.PhoneMobile));+ Assert.That(importedCredential.Alias.BankAccountIBAN, Is.EqualTo(credential.Alias.BankAccountIBAN));+ Assert.That(importedCredential.Alias.CreatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(credential.Alias.CreatedAt.ToString("yyyy-MM-dd")));+ Assert.That(importedCredential.Alias.UpdatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(credential.Alias.UpdatedAt.ToString("yyyy-MM-dd")));+ Assert.That(importedCredential.ServiceId, Is.EqualTo(credential.ServiceId));+ Assert.That(importedCredential.Service.Id, Is.EqualTo(credential.Service.Id));+ Assert.That(importedCredential.Service.Name, Is.EqualTo(credential.Service.Name));+ Assert.That(importedCredential.Service.Url, Is.EqualTo(credential.Service.Url));+ Assert.That(importedCredential.Passwords.Count, Is.EqualTo(credential.Passwords.Count));++ var importedPassword = importedCredential.Passwords.First();+ var originalPassword = credential.Passwords.First();++ Assert.That(importedPassword.Value, Is.EqualTo(originalPassword.Value));+ Assert.That(importedPassword.CreatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(originalPassword.CreatedAt.ToString("yyyy-MM-dd")));+ Assert.That(importedPassword.UpdatedAt.ToString("yyyy-MM-dd"), Is.EqualTo(originalPassword.UpdatedAt.ToString("yyyy-MM-dd")));+ }+}diff --git a/src/Tests/AliasVault.UnitTests/Utilities/EncryptionTests.cs b/src/Tests/AliasVault.UnitTests/Utilities/EncryptionTests.csindex 00b6ede3e..e559d218d 100644--- a/src/Tests/AliasVault.UnitTests/Utilities/EncryptionTests.cs+++ b/src/Tests/AliasVault.UnitTests/Utilities/EncryptionTests.cs@@ -16,14 +16,6 @@ using SecureRemotePassword;/// </summary>public class EncryptionTests{- /// <summary>- /// Common setup for all tests.- /// </summary>- [SetUp]- public void Setup()- {- }-/// <summary>/// Test basic encryption and decryption using default encryption logic (Argon2id and AES-256)./// </summary>diff --git a/src/Utilities/CsvImportExport/CredentialCsvService.cs b/src/Utilities/CsvImportExport/CredentialCsvService.csnew file mode 100644index 000000000..bdc489e21--- /dev/null+++ b/src/Utilities/CsvImportExport/CredentialCsvService.cs@@ -0,0 +1,185 @@+//-----------------------------------------------------------------------+// <copyright file="CredentialCsvService.cs" company="lanedirt">+// Copyright (c) lanedirt. All rights reserved.+// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.+// </copyright>+//-----------------------------------------------------------------------++namespace CsvImportExport;++using AliasClientDb;+using CsvHelper;+using CsvHelper.Configuration;+using System.Globalization;++/// <summary>+/// Exports and imports Credential objects to and from CSV files.+/// </summary>+public static class CredentialCsvService+{+ private const string CsvVersionIdentifier = "1.0.0";++ /// <param name="filePath">The file path of the CSV file.</param>+ public static byte[] ExportCredentialsToCsv(List<Credential> credentials)+ {+ var records = new List<CredentialCsvRecord>();++ foreach (var credential in credentials)+ {+ var record = new CredentialCsvRecord+ {+ Version = CsvVersionIdentifier,+ Id = credential.Id,+ Username = credential.Username,+ Notes = credential.Notes ?? string.Empty,+ CreatedAt = credential.CreatedAt,+ UpdatedAt = credential.UpdatedAt,+ AliasId = credential.AliasId,+ AliasGender = credential.Alias?.Gender ?? string.Empty,+ AliasFirstName = credential.Alias?.FirstName ?? string.Empty,+ AliasLastName = credential.Alias?.LastName ?? string.Empty,+ AliasNickName = credential.Alias?.NickName ?? string.Empty,+ AliasBirthDate = credential.Alias?.BirthDate,+ AliasAddressStreet = credential.Alias?.AddressStreet ?? string.Empty,+ AliasAddressCity = credential.Alias?.AddressCity ?? string.Empty,+ AliasAddressState = credential.Alias?.AddressState ?? string.Empty,+ AliasAddressZipCode = credential.Alias?.AddressZipCode ?? string.Empty,+ AliasAddressCountry = credential.Alias?.AddressCountry ?? string.Empty,+ AliasHobbies = credential.Alias?.Hobbies ?? string.Empty,+ AliasEmailPrefix = credential.Alias?.EmailPrefix ?? string.Empty,+ AliasPhoneMobile = credential.Alias?.PhoneMobile ?? string.Empty,+ AliasBankAccountIBAN = credential.Alias?.BankAccountIBAN ?? string.Empty,+ AliasCreatedAt = credential.Alias?.CreatedAt,+ AliasUpdatedAt = credential.Alias?.UpdatedAt,+ ServiceId = credential.ServiceId,+ ServiceName = credential.Service?.Name ?? string.Empty,+ ServiceUrl = credential.Service?.Url ?? string.Empty,+ CurrentPassword = credential.Passwords.OrderByDescending(p => p.CreatedAt).FirstOrDefault()?.Value ?? string.Empty+ };++ records.Add(record);+ }++ using (var memoryStream = new MemoryStream())+ using (var writer = new StreamWriter(memoryStream))+ using (var csv = new CsvWriter(writer, new CsvConfiguration(CultureInfo.InvariantCulture)))+ {+ csv.WriteRecords(records);+ writer.Flush();+ return memoryStream.ToArray();+ }+ }++ /// <summary>+ /// Imports Credential objects from a CSV file.+ /// </summary>+ /// <param name="fileContent">The content of the CSV file.</param>+ /// <returns>The imported list of Credential objects.</returns>+ public static List<Credential> ImportCredentialsFromCsv(string fileContent)+ {+ using (var reader = new StringReader(fileContent))+ using (var csv = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture)))+ {+ var records = csv.GetRecords<CredentialCsvRecord>().ToList();++ if (records.Count == 0)+ {+ throw new InvalidOperationException("No records found in the CSV file.");+ }++ if (records[0].Version != CsvVersionIdentifier)+ {+ throw new InvalidOperationException("Invalid CSV file version.");+ }++ var credentials = new List<Credential>();++ foreach (var record in records)+ {+ var credential = new Credential+ {+ Id = record.Id,+ Username = record.Username,+ Notes = record.Notes,+ CreatedAt = record.CreatedAt,+ UpdatedAt = record.UpdatedAt,+ AliasId = record.AliasId,+ Alias = new Alias+ {+ Id = record.AliasId,+ Gender = record.AliasGender,+ FirstName = record.AliasFirstName,+ LastName = record.AliasLastName,+ NickName = record.AliasNickName,+ BirthDate = record.AliasBirthDate ?? DateTime.MinValue,+ AddressStreet = record.AliasAddressStreet,+ AddressCity = record.AliasAddressCity,+ AddressState = record.AliasAddressState,+ AddressZipCode = record.AliasAddressZipCode,+ AddressCountry = record.AliasAddressCountry,+ Hobbies = record.AliasHobbies,+ EmailPrefix = record.AliasEmailPrefix,+ PhoneMobile = record.AliasPhoneMobile,+ BankAccountIBAN = record.AliasBankAccountIBAN,+ CreatedAt = record.AliasCreatedAt ?? DateTime.UtcNow,+ UpdatedAt = record.AliasUpdatedAt ?? DateTime.UtcNow+ },+ ServiceId = record.ServiceId,+ Service = new Service+ {+ Id = record.ServiceId,+ Name = record.ServiceName,+ Url = record.ServiceUrl+ },+ Passwords = new List<Password>+ {+ new Password+ {+ Value = record.CurrentPassword,+ CreatedAt = DateTime.UtcNow,+ UpdatedAt = DateTime.UtcNow+ }+ }+ };++ credentials.Add(credential);+ }++ return credentials;+ }+ }+}++/// <summary>+/// CSV record for Credential objects.+/// </summary>+public class CredentialCsvRecord+{+ public string Version { get; set; } = "1.0.0";+ public Guid Id { get; set; } = Guid.Empty;+ public string Username { get; set; } = string.Empty;+ public string Notes { get; set; } = string.Empty;+ public DateTime CreatedAt { get; set; } = DateTime.MinValue;+ public DateTime UpdatedAt { get; set; } = DateTime.MinValue;+ public Guid AliasId { get; set; } = Guid.Empty;+ public string AliasGender { get; set; } = string.Empty;+ public string AliasFirstName { get; set; } = string.Empty;+ public string AliasLastName { get; set; } = string.Empty;+ public string AliasNickName { get; set; } = string.Empty;+ public DateTime? AliasBirthDate { get; set; } = null;+ public string AliasAddressStreet { get; set; } = string.Empty;+ public string AliasAddressCity { get; set; } = string.Empty;+ public string AliasAddressState { get; set; } = string.Empty;+ public string AliasAddressZipCode { get; set; } = string.Empty;+ public string AliasAddressCountry { get; set; } = string.Empty;+ public string AliasHobbies { get; set; } = string.Empty;+ public string AliasEmailPrefix { get; set; } = string.Empty;+ public string AliasPhoneMobile { get; set; } = string.Empty;+ public string AliasBankAccountIBAN { get; set; } = string.Empty;+ public DateTime? AliasCreatedAt { get; set; } = null;+ public DateTime? AliasUpdatedAt { get; set; } = null;+ public Guid ServiceId { get; set; } = Guid.Empty;+ public string ServiceName { get; set; } = string.Empty;+ public string ServiceUrl { get; set; } = string.Empty;+ public string CurrentPassword { get; set; } = string.Empty;+}diff --git a/src/Utilities/CsvImportExport/CsvImportExport.csproj b/src/Utilities/CsvImportExport/CsvImportExport.csprojnew file mode 100644index 000000000..1795c021b--- /dev/null+++ b/src/Utilities/CsvImportExport/CsvImportExport.csproj@@ -0,0 +1,21 @@+<Project Sdk="Microsoft.NET.Sdk">++ <PropertyGroup>+ <TargetFramework>net8.0</TargetFramework>+ <ImplicitUsings>enable</ImplicitUsings>+ <Nullable>enable</Nullable>+ </PropertyGroup>++ <ItemGroup>+ <AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" />+ </ItemGroup>++ <ItemGroup>+ <PackageReference Include="CsvHelper" Version="33.0.1" />+ </ItemGroup>++ <ItemGroup>+ <ProjectReference Include="..\..\Databases\AliasClientDb\AliasClientDb.csproj" />+ </ItemGroup>++</Project>