Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add Microsoft Edge import option (#1640)

Leendert de Borstfbf43cf09c5e
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.razor
new file mode 100644
index 000000000..9aa58f394
--- /dev/null
+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceEdge.razor
@@ -0,0 +1,25 @@
+@using AliasVault.ImportExport.Models
+@using AliasVault.ImportExport.Importers
+@using Microsoft.Extensions.Localization
+@inject NavigationManager NavigationManager
+@inject GlobalNotificationService GlobalNotificationService
+@inject IStringLocalizerFactory LocalizerFactory
+@inject ILogger<ImportServiceEdge> Logger
+
+<ImportServiceCard
+ ServiceName="Edge"
+ Description="@Localizer["EdgeDescription"]"
+ LogoUrl="img/importers/edge.svg"
+ ProcessFileCallback="ProcessFile">
+ <p class="text-gray-700 dark:text-gray-300 mb-4">@Localizer["EdgeInstructionsPart1"]</p>
+ <p class="text-gray-700 dark:text-gray-300 mb-4">@Localizer["EdgeInstructionsPart2"]</p>
+</ImportServiceCard>
+
+@code {
+ private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Settings.ImportExport.ImportServices", "AliasVault.Client");
+
+ private static async Task<List<ImportedCredential>> ProcessFile(string fileContents)
+ {
+ return await EdgeImporter.ImportFromCsvAsync(fileContents);
+ }
+}
diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor
index 33520f7ff..0d053e296 100644
--- a/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor
+++ b/apps/server/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor
@@ -27,6 +27,7 @@
<ImportServiceChrome />
<ImportServiceDashlane />
<ImportServiceDropbox />
+ <ImportServiceEdge />
<ImportServiceFirefox />
<ImportServiceKeePass />
<ImportServiceKeePassXC />
diff --git a/apps/server/AliasVault.Client/Resources/Components/Main/Settings/ImportExport/ImportServices.en.resx b/apps/server/AliasVault.Client/Resources/Components/Main/Settings/ImportExport/ImportServices.en.resx
index 4ff397494..76ed09caa 100644
--- a/apps/server/AliasVault.Client/Resources/Components/Main/Settings/ImportExport/ImportServices.en.resx
+++ b/apps/server/AliasVault.Client/Resources/Components/Main/Settings/ImportExport/ImportServices.en.resx
@@ -261,6 +261,19 @@
<value>Once you have exported the file, you can upload it below.</value>
<comment>RoboForm export instructions part 2</comment>
</data>
+ <!-- Edge -->
+ <data name="EdgeDescription" xml:space="preserve">
+ <value>Import passwords from your Microsoft Edge Password Manager</value>
+ <comment>Description for Edge import service</comment>
+ </data>
+ <data name="EdgeInstructionsPart1" xml:space="preserve">
+ <value>In order to import your Microsoft Edge passwords, you need to export them as a CSV file. You can do this by going to Menu > Settings > Password and autofill > Microsoft Password Manager > ... > Export passwords.</value>
+ <comment>Edge export instructions part 1</comment>
+ </data>
+ <data name="EdgeInstructionsPart2" xml:space="preserve">
+ <value>Once you have exported the file, you can upload it below.</value>
+ <comment>Edge export instructions part 2</comment>
+ </data>
<!-- Common text that can be reused -->
<data name="UploadFileInstructionCommon" xml:space="preserve">
<value>Once you have exported the file, you can upload it below.</value>
diff --git a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
index 5fed30ada..0d9b9afd6 100644
--- a/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
+++ b/apps/server/AliasVault.Client/wwwroot/css/tailwind.css
@@ -624,6 +624,10 @@ video {
position: relative;
}
+.sticky {
+ position: sticky;
+}
+
.inset-0 {
inset: 0px;
}
@@ -1085,14 +1089,14 @@ video {
max-height: 90vh;
}
-.min-h-\[250px\] {
- min-height: 250px;
-}
-
.min-h-\[300px\] {
min-height: 300px;
}
+.min-h-\[350px\] {
+ min-height: 350px;
+}
+
.min-h-\[40px\] {
min-height: 40px;
}
@@ -1109,10 +1113,6 @@ video {
min-height: 100vh;
}
-.min-h-\[350px\] {
- min-height: 350px;
-}
-
.w-1 {
width: 0.25rem;
}
@@ -1358,6 +1358,10 @@ video {
cursor: pointer;
}
+.resize {
+ resize: both;
+}
+
.list-inside {
list-style-position: inside;
}
@@ -1762,6 +1766,11 @@ video {
border-color: rgb(214 131 56 / var(--tw-border-opacity));
}
+.border-primary-700 {
+ --tw-border-opacity: 1;
+ border-color: rgb(184 112 47 / var(--tw-border-opacity));
+}
+
.border-red-200 {
--tw-border-opacity: 1;
border-color: rgb(254 202 202 / var(--tw-border-opacity));
@@ -1826,11 +1835,6 @@ video {
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
}
-.bg-blue-700 {
- --tw-bg-opacity: 1;
- background-color: rgb(29 78 216 / var(--tw-bg-opacity));
-}
-
.bg-gray-100 {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
@@ -2754,11 +2758,6 @@ video {
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
}
-.hover\:bg-blue-800:hover {
- --tw-bg-opacity: 1;
- background-color: rgb(30 64 175 / var(--tw-bg-opacity));
-}
-
.hover\:bg-gray-100:hover {
--tw-bg-opacity: 1;
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
@@ -3654,16 +3653,6 @@ video {
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
}
-.dark\:hover\:bg-blue-600:hover:is(.dark *) {
- --tw-bg-opacity: 1;
- background-color: rgb(37 99 235 / var(--tw-bg-opacity));
-}
-
-.dark\:hover\:bg-blue-700:hover:is(.dark *) {
- --tw-bg-opacity: 1;
- background-color: rgb(29 78 216 / var(--tw-bg-opacity));
-}
-
.dark\:hover\:bg-gray-500:hover:is(.dark *) {
--tw-bg-opacity: 1;
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
diff --git a/apps/server/AliasVault.Client/wwwroot/img/importers/edge.svg b/apps/server/AliasVault.Client/wwwroot/img/importers/edge.svg
new file mode 100644
index 000000000..b2afc8e2d
--- /dev/null
+++ b/apps/server/AliasVault.Client/wwwroot/img/importers/edge.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink" viewBox="0 0 27600 27600"><linearGradient id="a" gradientUnits="userSpaceOnUse"/><linearGradient id="b" x1="6870" x2="24704" y1="18705" y2="18705" x:href="#a"><stop offset="0" stop-color="#0c59a4"/><stop offset="1" stop-color="#114a8b"/></linearGradient><linearGradient id="c" x1="16272" x2="5133" y1="10968" y2="23102" x:href="#a"><stop offset="0" stop-color="#1b9de2"/><stop offset=".16" stop-color="#1595df"/><stop offset=".67" stop-color="#0680d7"/><stop offset="1" stop-color="#0078d4"/></linearGradient><radialGradient id="d" cx="16720" cy="18747" r="9538" x:href="#a"><stop offset=".72" stop-opacity="0"/><stop offset=".95" stop-opacity=".53"/><stop offset="1"/></radialGradient><radialGradient id="e" cx="7130" cy="19866" r="14324" gradientTransform="matrix(.14843 -.98892 .79688 .1196 -8759 25542)" x:href="#a"><stop offset=".76" stop-opacity="0"/><stop offset=".95" stop-opacity=".5"/><stop offset="1"/></radialGradient><radialGradient id="f" cx="2523" cy="4680" r="20243" gradientTransform="matrix(-.03715 .99931 -2.12836 -.07913 13579 3530)" x:href="#a"><stop offset="0" stop-color="#35c1f1"/><stop offset=".11" stop-color="#34c1ed"/><stop offset=".23" stop-color="#2fc2df"/><stop offset=".31" stop-color="#2bc3d2"/><stop offset=".67" stop-color="#36c752"/></radialGradient><radialGradient id="g" cx="24247" cy="7758" r="9734" gradientTransform="matrix(.28109 .95968 -.78353 .22949 24510 -16292)" x:href="#a"><stop offset="0" stop-color="#66eb6e"/><stop offset="1" stop-color="#66eb6e" stop-opacity="0"/></radialGradient><path id="h" d="M24105 20053a9345 9345 0 01-1053 472 10202 10202 0 01-3590 646c-4732 0-8855-3255-8855-7432 0-1175 680-2193 1643-2729-4280 180-5380 4640-5380 7253 0 7387 6810 8137 8276 8137 791 0 1984-230 2704-456l130-44a12834 12834 0 006660-5282c220-350-168-757-535-565z"/><path id="i" d="M11571 25141a7913 7913 0 01-2273-2137 8145 8145 0 01-1514-4740 8093 8093 0 013093-6395 8082 8082 0 011373-859c312-148 846-414 1554-404a3236 3236 0 012569 1297 3184 3184 0 01636 1866c0-21 2446-7960-8005-7960-4390 0-8004 4166-8004 7820 0 2319 538 4170 1212 5604a12833 12833 0 007684 6757 12795 12795 0 003908 610c1414 0 2774-233 4045-656a7575 7575 0 01-6278-803z"/><path id="j" d="M16231 15886c-80 105-330 250-330 566 0 260 170 512 472 723 1438 1003 4149 868 4156 868a5954 5954 0 003027-839 6147 6147 0 001133-850 6180 6180 0 001910-4437c26-2242-796-3732-1133-4392-2120-4141-6694-6525-11668-6525-7011 0-12703 5635-12798 12620 47-3654 3679-6605 7996-6605 350 0 2346 34 4200 1007 1634 858 2490 1894 3086 2921 618 1067 728 2415 728 2952s-271 1333-780 1990z"/><use fill="url(#b)" x:href="#h"/><use fill="url(#d)" opacity=".35" x:href="#h"/><use fill="url(#c)" x:href="#i"/><use fill="url(#e)" opacity=".4" x:href="#i"/><use fill="url(#f)" x:href="#j"/><use fill="url(#g)" x:href="#j"/></svg>
\ No newline at end of file
diff --git a/apps/server/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj b/apps/server/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj
index c29a523a1..d4597f840 100644
--- a/apps/server/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj
+++ b/apps/server/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj
@@ -75,6 +75,7 @@
<EmbeddedResource Include="TestData\Exports\nordpass.csv" />
<EmbeddedResource Include="TestData\Exports\aliasvault_mobile_app_export.csv" />
<EmbeddedResource Include="TestData\Exports\roboform.csv" />
+ <EmbeddedResource Include="TestData\Exports\edge.csv" />
</ItemGroup>
</Project>
diff --git a/apps/server/Tests/AliasVault.UnitTests/TestData/Exports/edge.csv b/apps/server/Tests/AliasVault.UnitTests/TestData/Exports/edge.csv
new file mode 100644
index 000000000..03512a534
--- /dev/null
+++ b/apps/server/Tests/AliasVault.UnitTests/TestData/Exports/edge.csv
@@ -0,0 +1,5 @@
+name,url,username,password,note
+example.app.tld,https://example.app.tld/,exampleu,examplep,
+example.com,https://example.com/,Username,password,
+google.nl,https://google.nl/,myuser,mypass,Google note here microsoft edge
+youtube.com,https://youtube.com/,youtubeuser,ytpassword,Youtubenotes
diff --git a/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs b/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
index 5e756b6a9..dd1d170a0 100644
--- a/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
+++ b/apps/server/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs
@@ -1264,6 +1264,56 @@ public class ImportExportTests
Assert.That(notesFieldValue?.Value, Is.EqualTo("Safenote content example here"));
}
+ /// <summary>
+ /// Test case for importing credentials from Edge CSV and ensuring all values are present.
+ /// </summary>
+ /// <returns>Async task.</returns>
+ [Test]
+ public async Task ImportCredentialsFromEdgeCsv()
+ {
+ // Arrange
+ var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceStringAsync("AliasVault.UnitTests.TestData.Exports.edge.csv");
+
+ // Act
+ var importedCredentials = await EdgeImporter.ImportFromCsvAsync(fileContent);
+
+ // Assert
+ Assert.That(importedCredentials, Has.Count.EqualTo(4));
+
+ // Test first entry (no notes)
+ var exampleAppCredential = importedCredentials.First(c => c.ServiceName == "example.app.tld");
+ Assert.Multiple(() =>
+ {
+ Assert.That(exampleAppCredential.ServiceName, Is.EqualTo("example.app.tld"));
+ Assert.That(exampleAppCredential.ServiceUrls?.FirstOrDefault(), Is.EqualTo("https://example.app.tld/"));
+ Assert.That(exampleAppCredential.Username, Is.EqualTo("exampleu"));
+ Assert.That(exampleAppCredential.Password, Is.EqualTo("examplep"));
+ Assert.That(exampleAppCredential.Notes, Is.Empty);
+ });
+
+ // Test entry with notes
+ var googleCredential = importedCredentials.First(c => c.ServiceName == "google.nl");
+ Assert.Multiple(() =>
+ {
+ Assert.That(googleCredential.ServiceName, Is.EqualTo("google.nl"));
+ Assert.That(googleCredential.ServiceUrls?.FirstOrDefault(), Is.EqualTo("https://google.nl/"));
+ Assert.That(googleCredential.Username, Is.EqualTo("myuser"));
+ Assert.That(googleCredential.Password, Is.EqualTo("mypass"));
+ Assert.That(googleCredential.Notes, Is.EqualTo("Google note here microsoft edge"));
+ });
+
+ // Test youtube entry
+ var youtubeCredential = importedCredentials.First(c => c.ServiceName == "youtube.com");
+ Assert.Multiple(() =>
+ {
+ Assert.That(youtubeCredential.ServiceName, Is.EqualTo("youtube.com"));
+ Assert.That(youtubeCredential.ServiceUrls?.FirstOrDefault(), Is.EqualTo("https://youtube.com/"));
+ Assert.That(youtubeCredential.Username, Is.EqualTo("youtubeuser"));
+ Assert.That(youtubeCredential.Password, Is.EqualTo("ytpassword"));
+ Assert.That(youtubeCredential.Notes, Is.EqualTo("Youtubenotes"));
+ });
+ }
+
/// <summary>
/// Helper method to add a field value to an item.
/// </summary>
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Importers/EdgeImporter.cs b/apps/server/Utilities/AliasVault.ImportExport/Importers/EdgeImporter.cs
new file mode 100644
index 000000000..74b5503db
--- /dev/null
+++ b/apps/server/Utilities/AliasVault.ImportExport/Importers/EdgeImporter.cs
@@ -0,0 +1,44 @@
+//-----------------------------------------------------------------------
+// <copyright file="EdgeImporter.cs" company="aliasvault">
+// Copyright (c) aliasvault. All rights reserved.
+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace AliasVault.ImportExport.Importers;
+
+using AliasVault.ImportExport.Models;
+using AliasVault.ImportExport.Models.Imports;
+
+/// <summary>
+/// Imports credentials from Microsoft Edge Password Manager.
+/// </summary>
+public static class EdgeImporter
+{
+ /// <summary>
+ /// Imports Edge CSV file and converts contents to list of ImportedCredential model objects.
+ /// </summary>
+ /// <param name="fileContent">The content of the CSV file.</param>
+ /// <returns>The imported list of ImportedCredential objects.</returns>
+ public static async Task<List<ImportedCredential>> ImportFromCsvAsync(string fileContent)
+ {
+ var records = await BaseImporter.ImportCsvDataAsync<EdgeCsvRecord>(fileContent);
+
+ var credentials = new List<ImportedCredential>();
+ foreach (var record in records)
+ {
+ var credential = new ImportedCredential
+ {
+ ServiceName = record.Name,
+ ServiceUrls = BaseImporter.ParseUrls(record.Url),
+ Username = record.Username,
+ Password = record.Password,
+ Notes = record.Note,
+ };
+
+ credentials.Add(credential);
+ }
+
+ return credentials;
+ }
+}
diff --git a/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/EdgeCsvRecord.cs b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/EdgeCsvRecord.cs
new file mode 100644
index 000000000..9bcabdb50
--- /dev/null
+++ b/apps/server/Utilities/AliasVault.ImportExport/Models/Imports/EdgeCsvRecord.cs
@@ -0,0 +1,46 @@
+//-----------------------------------------------------------------------
+// <copyright file="EdgeCsvRecord.cs" company="aliasvault">
+// Copyright (c) aliasvault. All rights reserved.
+// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace AliasVault.ImportExport.Models.Imports;
+
+using CsvHelper.Configuration.Attributes;
+
+/// <summary>
+/// Represents an Edge CSV record that is being imported from a Microsoft Edge Password Manager CSV export file.
+/// </summary>
+public class EdgeCsvRecord
+{
+ /// <summary>
+ /// Gets or sets the name of the item.
+ /// </summary>
+ [Name("name")]
+ public string Name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Gets or sets the URL of the item.
+ /// </summary>
+ [Name("url")]
+ public string Url { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Gets or sets the username of the item.
+ /// </summary>
+ [Name("username")]
+ public string Username { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Gets or sets the password of the item.
+ /// </summary>
+ [Name("password")]
+ public string Password { get; set; } = string.Empty;
+
+ /// <summary>
+ /// Gets or sets any additional notes.
+ /// </summary>
+ [Name("note")]
+ public string? Note { get; set; }
+}