Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add separate importers for KeePass, KeePassXC and Strongbox (#542)
Leendert de Borste0c11ba0f650
diff --git a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razorindex f805e199c..3a1377e3d 100644--- a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor+++ b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceCard.razor@@ -7,8 +7,8 @@@using AliasVault.ImportExport.Importers@using AliasVault.ImportExport.Models-<div class="flex flex-col p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700">- <div class="flex items-center mb-3">+<div @onclick="OpenImportModal" class="flex flex-col p-4 bg-white border border-gray-200 rounded-lg shadow-sm dark:border-gray-700 dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 cursor-pointer">+ <div class="flex items-center"><div class="w-12 h-12 mr-3 flex-shrink-0">@if (!string.IsNullOrEmpty(LogoUrl)){@@ -29,9 +29,6 @@}</div></div>- <div class="mt-auto">- <Button OnClick="@OpenImportModal">Import from @ServiceName</Button>- </div></div>@if (IsModalOpen)diff --git a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razor b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razornew file mode 100644index 000000000..23f3b1e93--- /dev/null+++ b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceKeePassXC.razor@@ -0,0 +1,21 @@+@inject ILogger<ImportServiceKeePassXC> Logger+@inject NavigationManager NavigationManager+@inject GlobalNotificationService GlobalNotificationService+@using AliasVault.ImportExport.Models+@using AliasVault.ImportExport.Importers++<ImportServiceCard+ ServiceName="KeePassXC"+ Description="Import passwords from KeePassXC"+ LogoUrl="img/importers/keepassxc.svg"+ ProcessFileCallback="ProcessFile">+ <p class="text-gray-700 dark:text-gray-300 mb-4">In order to import your KeePassXC vault, you need to export it as a CSV file. You can do this by going to the 'File' menu and selecting 'Export' (to CSV).</p>+ <p class="text-gray-700 dark:text-gray-300 mb-4">Once you have exported the file, you can upload it below.</p>+</ImportServiceCard>++@code {+ private async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ {+ return await KeePassXcImporter.ImportFromCsvAsync(fileContents);+ }+}diff --git a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razor b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razornew file mode 100644index 000000000..ae6623865--- /dev/null+++ b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/Components/ImportServiceStrongbox.razor@@ -0,0 +1,21 @@+@inject ILogger<ImportServiceStrongbox> Logger+@inject NavigationManager NavigationManager+@inject GlobalNotificationService GlobalNotificationService+@using AliasVault.ImportExport.Models+@using AliasVault.ImportExport.Importers++<ImportServiceCard+ ServiceName="Strongbox"+ Description="Import passwords from Strongbox"+ LogoUrl="img/importers/strongbox.svg"+ ProcessFileCallback="ProcessFile">+ <p class="text-gray-700 dark:text-gray-300 mb-4">In order to import your Strongbox vault, you need to export it as a CSV file. You can do this by going to the 'File' menu and selecting 'Export Database' (to CSV).</p>+ <p class="text-gray-700 dark:text-gray-300 mb-4">Once you have exported the file, you can upload it below.</p>+</ImportServiceCard>++@code {+ private async Task<List<ImportedCredential>> ProcessFile(string fileContents)+ {+ return await StrongboxImporter.ImportFromCsvAsync(fileContents);+ }+}diff --git a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razorindex 836be5589..117cf0b0a 100644--- a/src/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor+++ b/src/AliasVault.Client/Main/Pages/Settings/ImportExport/ImportExport.razor@@ -21,11 +21,13 @@Select a service to import from. If you are using a service that is not listed here and would like to see it supported, please raise an issue on <a href="https://github.com/lanedirt/AliasVault/issues" target="_blank" class="text-primary-500 hover:text-primary-700">GitHub</a> or contact us.</div><div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">- <ImportServiceBitwarden />- <ImportServiceKeePass /><ImportService1Password />+ <ImportServiceBitwarden /><ImportServiceChrome /><ImportServiceFirefox />+ <ImportServiceKeePass />+ <ImportServiceKeePassXC />+ <ImportServiceStrongbox /><ImportServiceAliasVault /></div></div>diff --git a/src/AliasVault.Client/wwwroot/img/importers/keepass.svg b/src/AliasVault.Client/wwwroot/img/importers/keepass.svgindex 27497eb37..112697036 100644--- a/src/AliasVault.Client/wwwroot/img/importers/keepass.svg+++ b/src/AliasVault.Client/wwwroot/img/importers/keepass.svg@@ -1,36 +1,112 @@-<?xml version="1.0" encoding="utf-8"?>-<!-- Generator: Adobe Illustrator 28.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"- viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">-<style type="text/css">- .st0{fill:#383838;}- .st1{fill:url(#o_00000155862794334020497050000003189922216045275819_);}- .st2{opacity:0.7;fill:url(#q_00000129203638107772236480000008775744283942422157_);enable-background:new ;}- .st3{fill:url(#v_00000129924558277521636600000005911581507005458853_);}-</style>-<path id="j" class="st0" d="M256,512C114.8,512,0,397.2,0,256S114.8,0,256,0s256,114.8,256,256S397.2,512,256,512z M256,21.5- C126.8,21.5,21.6,126.7,21.6,256S126.8,490.5,256,490.5S490.4,385.3,490.4,256S385.2,21.5,256,21.5z"/>-<radialGradient id="o_00000025430740211886504440000014243807581852556456_" cx="1138.1968" cy="-1307.2815" r="1407.5225" gradientTransform="matrix(0.3539 0 0 -0.2026 -141.9757 -166.7766)" gradientUnits="userSpaceOnUse">- <stop offset="0" style="stop-color:#2E6B26"/>- <stop offset="1" style="stop-color:#6AB536"/>-</radialGradient>-<path id="o" style="fill:url(#o_00000025430740211886504440000014243807581852556456_);" d="M256,21.5- C126.7,21.5,21.5,126.7,21.5,256S126.7,490.5,256,490.5S490.5,385.3,490.5,256S385.3,21.5,256,21.5z"/>-<radialGradient id="q_00000157308754287181408900000005457400496456124819_" cx="1127.6659" cy="-262.1674" r="274.8847" gradientTransform="matrix(0.3539 0 0 -0.3539 -141.9757 -0.3758)" gradientUnits="userSpaceOnUse">- <stop offset="0" style="stop-color:#6AB536"/>- <stop offset="1" style="stop-color:#2E6B26"/>-</radialGradient>-<path id="q" style="opacity:0.7;fill:url(#q_00000157308754287181408900000005457400496456124819_);enable-background:new ;" d="- M256,41c-38.5,0-69.8,31.3-69.8,69.8s31.3,69.8,69.8,69.8s69.8-31.3,69.8-69.8S294.5,41,256,41z"/>-<radialGradient id="v_00000091014317570371668680000015143399115130838685_" cx="1121.8108" cy="-179.5462" r="939.5499" gradientTransform="matrix(0.3539 0 0 -0.3539 -141.9757 -0.3758)" gradientUnits="userSpaceOnUse">- <stop offset="0" style="stop-color:#F5F5F5"/>- <stop offset="0.5481" style="stop-color:#F2F2F2"/>-</radialGradient>-<path id="v" style="fill:url(#v_00000091014317570371668680000015143399115130838685_);" d="M256,21.5- C126.8,21.5,21.6,126.7,21.6,256S126.8,490.5,256,490.5S490.4,385.3,490.4,256S385.2,21.5,256,21.5z M220.2,61.8- c11.8-2.1,24-3.2,35.8-3.2c12.3-0.5,24,1.1,35.8,3.2c0.5,2.7,1.1,5.3,1.1,8c0,20.3-16.6,36.9-36.9,36.9s-36.9-16.6-36.9-36.9- C219.1,67.2,219.7,64.5,220.2,61.8L220.2,61.8z M241.6,224.8v148h-15v-148L241.6,224.8L241.6,224.8z M256,453.5- c-109,0-197.6-88.2-197.6-197.7c0-69.5,36.3-133.6,96.1-169.4c-1.1,6.9-2.1,13.4-2.1,20.3c0,41.1,24,76.9,59.3,93.5v187.5L256,432- l44.3-44.3l-2.7-39l20.8-20.8l-20.8-20.8l31.5-31.5L297.7,244l2.7-43.8c34.7-16.6,59.3-52.4,59.3-93.5c0-6.9-0.5-13.4-2.1-20.3- c59.3,35.8,95.6,99.9,96.1,169.4C453.6,364.8,365.5,453.5,256,453.5z"/>+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg+ xmlns:dc="http://purl.org/dc/elements/1.1/"+ xmlns:cc="http://creativecommons.org/ns#"+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+ xmlns:svg="http://www.w3.org/2000/svg"+ xmlns="http://www.w3.org/2000/svg"+ xmlns:xlink="http://www.w3.org/1999/xlink"+ version="1.1"+ width="256"+ height="256"+ id="svg2">+ <defs+ id="defs4">+ <linearGradient+ id="linearGradient3904">+ <stop+ id="stop3906"+ style="stop-color:#ffffff;stop-opacity:1"+ offset="0" />+ <stop+ id="stop3908"+ style="stop-color:#b8caff;stop-opacity:1"+ offset="1" />+ </linearGradient>+ <linearGradient+ id="linearGradient3870">+ <stop+ id="stop3872"+ style="stop-color:#ffffff;stop-opacity:1"+ offset="0" />+ <stop+ id="stop3874"+ style="stop-color:#2a53c6;stop-opacity:1"+ offset="1" />+ </linearGradient>+ <linearGradient+ x1="371.42859"+ y1="580.93359"+ x2="500.71429"+ y2="710.21936"+ id="linearGradient3876"+ xlink:href="#linearGradient3870"+ gradientUnits="userSpaceOnUse" />+ <linearGradient+ x1="279.99066"+ y1="526.63849"+ x2="548.58081"+ y2="795.2287"+ id="linearGradient3910"+ xlink:href="#linearGradient3904"+ gradientUnits="userSpaceOnUse" />+ </defs>+ <metadata+ id="metadata7">+ <rdf:RDF>+ <cc:Work+ rdf:about="">+ <dc:format>image/svg+xml</dc:format>+ <dc:type+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />+ <dc:title></dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <g+ transform="translate(-140.28573,-560.07648)"+ id="layer1">+ <path+ d="m 542.28574,660.93359 a 128,128 0 1 1 -256,0 128,128 0 1 1 256,0 z"+ transform="matrix(0.95312501,0,0,0.95312502,-126.58036,58.124135)"+ id="path3025"+ style="fill:url(#linearGradient3910);fill-opacity:1;stroke:#000000;stroke-width:12.59016418;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />+ <path+ d="m 500.7143,645.57648 a 64.64286,64.64286 0 1 1 -129.28572,0 64.64286,64.64286 0 1 1 129.28572,0 z"+ transform="matrix(1.5701657,0,0,1.5701657,-416.41868,-325.58556)"+ id="path3795"+ style="fill:url(#linearGradient3876);fill-opacity:1;stroke:none" />+ <g+ transform="translate(-145.99777,29.127545)"+ id="g3853">+ <rect+ width="125"+ height="16"+ x="351.78574"+ y="709.14789"+ id="rect3801"+ style="fill:#000000;fill-opacity:1;stroke:none" />+ <path+ d="m 351.78125,689.15625 0,16 53,0 0,-16 -53,0 z m 72,0 0,16 53,0 0,-16 -53,0 z"+ id="rect3803"+ style="fill:#000000;fill-opacity:1;stroke:none" />+ <path+ d="m 351.78125,669.15625 0,16 53,0 0,-16 -53,0 z m 72,0 0,16 53,0 0,-16 -53,0 z"+ id="rect3807"+ style="fill:#000000;fill-opacity:1;stroke:none" />+ <rect+ width="125"+ height="16"+ x="351.78574"+ y="649.14789"+ id="rect3809"+ style="fill:#000000;fill-opacity:1;stroke:none" />+ <path+ d="m 414.28125,572.75 c -11.70527,0 -21.61153,5.4901 -28.6875,12.6875 -7.07597,7.1974 -11.87157,16.05803 -15.4375,24.625 -7.13185,17.13393 -9.28125,33.84375 -9.28125,33.84375 l -0.15625,1.25 19.15625,0 c 0.46666,-2.98621 2.59068,-15.26733 7.8125,-27.8125 2.97796,-7.1544 6.95263,-14.00013 11.46875,-18.59375 4.51612,-4.59362 9.00579,-7 15.125,-7 6.11921,0 10.64013,2.40638 15.15625,7 4.51612,4.59362 8.45954,11.43935 11.4375,18.59375 5.22182,12.54517 7.34584,24.82629 7.8125,27.8125 l 19.15625,0 -0.15625,-1.25 c 0,0 -2.11815,-16.70982 -9.25,-33.84375 -3.56593,-8.56697 -8.39278,-17.4276 -15.46875,-24.625 -7.07597,-7.1974 -16.98223,-12.6875 -28.6875,-12.6875 z"+ id="path3832"+ style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:19;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />+ </g>+ </g></svg>diff --git a/src/AliasVault.Client/wwwroot/img/importers/keepassxc.svg b/src/AliasVault.Client/wwwroot/img/importers/keepassxc.svgnew file mode 100644index 000000000..27497eb37--- /dev/null+++ b/src/AliasVault.Client/wwwroot/img/importers/keepassxc.svg@@ -0,0 +1,36 @@+<?xml version="1.0" encoding="utf-8"?>+<!-- Generator: Adobe Illustrator 28.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"+ viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">+<style type="text/css">+ .st0{fill:#383838;}+ .st1{fill:url(#o_00000155862794334020497050000003189922216045275819_);}+ .st2{opacity:0.7;fill:url(#q_00000129203638107772236480000008775744283942422157_);enable-background:new ;}+ .st3{fill:url(#v_00000129924558277521636600000005911581507005458853_);}+</style>+<path id="j" class="st0" d="M256,512C114.8,512,0,397.2,0,256S114.8,0,256,0s256,114.8,256,256S397.2,512,256,512z M256,21.5+ C126.8,21.5,21.6,126.7,21.6,256S126.8,490.5,256,490.5S490.4,385.3,490.4,256S385.2,21.5,256,21.5z"/>+<radialGradient id="o_00000025430740211886504440000014243807581852556456_" cx="1138.1968" cy="-1307.2815" r="1407.5225" gradientTransform="matrix(0.3539 0 0 -0.2026 -141.9757 -166.7766)" gradientUnits="userSpaceOnUse">+ <stop offset="0" style="stop-color:#2E6B26"/>+ <stop offset="1" style="stop-color:#6AB536"/>+</radialGradient>+<path id="o" style="fill:url(#o_00000025430740211886504440000014243807581852556456_);" d="M256,21.5+ C126.7,21.5,21.5,126.7,21.5,256S126.7,490.5,256,490.5S490.5,385.3,490.5,256S385.3,21.5,256,21.5z"/>+<radialGradient id="q_00000157308754287181408900000005457400496456124819_" cx="1127.6659" cy="-262.1674" r="274.8847" gradientTransform="matrix(0.3539 0 0 -0.3539 -141.9757 -0.3758)" gradientUnits="userSpaceOnUse">+ <stop offset="0" style="stop-color:#6AB536"/>+ <stop offset="1" style="stop-color:#2E6B26"/>+</radialGradient>+<path id="q" style="opacity:0.7;fill:url(#q_00000157308754287181408900000005457400496456124819_);enable-background:new ;" d="+ M256,41c-38.5,0-69.8,31.3-69.8,69.8s31.3,69.8,69.8,69.8s69.8-31.3,69.8-69.8S294.5,41,256,41z"/>+<radialGradient id="v_00000091014317570371668680000015143399115130838685_" cx="1121.8108" cy="-179.5462" r="939.5499" gradientTransform="matrix(0.3539 0 0 -0.3539 -141.9757 -0.3758)" gradientUnits="userSpaceOnUse">+ <stop offset="0" style="stop-color:#F5F5F5"/>+ <stop offset="0.5481" style="stop-color:#F2F2F2"/>+</radialGradient>+<path id="v" style="fill:url(#v_00000091014317570371668680000015143399115130838685_);" d="M256,21.5+ C126.8,21.5,21.6,126.7,21.6,256S126.8,490.5,256,490.5S490.4,385.3,490.4,256S385.2,21.5,256,21.5z M220.2,61.8+ c11.8-2.1,24-3.2,35.8-3.2c12.3-0.5,24,1.1,35.8,3.2c0.5,2.7,1.1,5.3,1.1,8c0,20.3-16.6,36.9-36.9,36.9s-36.9-16.6-36.9-36.9+ C219.1,67.2,219.7,64.5,220.2,61.8L220.2,61.8z M241.6,224.8v148h-15v-148L241.6,224.8L241.6,224.8z M256,453.5+ c-109,0-197.6-88.2-197.6-197.7c0-69.5,36.3-133.6,96.1-169.4c-1.1,6.9-2.1,13.4-2.1,20.3c0,41.1,24,76.9,59.3,93.5v187.5L256,432+ l44.3-44.3l-2.7-39l20.8-20.8l-20.8-20.8l31.5-31.5L297.7,244l2.7-43.8c34.7-16.6,59.3-52.4,59.3-93.5c0-6.9-0.5-13.4-2.1-20.3+ c59.3,35.8,95.6,99.9,96.1,169.4C453.6,364.8,365.5,453.5,256,453.5z"/>+</svg>diff --git a/src/AliasVault.Client/wwwroot/img/importers/strongbox.svg b/src/AliasVault.Client/wwwroot/img/importers/strongbox.svgnew file mode 100644index 000000000..15aff1395--- /dev/null+++ b/src/AliasVault.Client/wwwroot/img/importers/strongbox.svg@@ -0,0 +1 @@+<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" viewBox="0, 0, 400,400"><g id="svgg"><path id="path0" d="M192.969 62.129 C 166.313 65.446,144.986 82.011,135.404 106.839 C 131.551 116.821,130.859 122.586,130.859 144.690 L 130.859 161.996 124.121 162.228 C 109.774 162.722,101.534 168.166,97.392 179.887 L 96.289 183.008 96.289 212.500 C 96.289 244.627,96.320 245.189,98.680 255.800 C 106.554 291.204,132.819 320.651,166.797 332.167 C 231.759 354.186,299.308 308.465,303.929 239.348 C 304.616 229.064,304.226 183.969,303.427 181.340 C 299.759 169.274,290.582 162.500,277.902 162.500 C 275.292 162.500,272.340 162.388,271.344 162.252 L 269.531 162.003 269.531 145.496 C 269.531 124.450,269.045 119.538,266.015 109.961 C 256.281 79.201,224.262 58.235,192.969 62.129 M208.506 86.175 C 224.743 89.052,238.869 101.558,243.902 117.511 C 245.925 123.922,246.094 126.025,246.094 144.778 L 246.094 162.109 200.195 162.109 L 154.297 162.109 154.297 144.778 C 154.297 131.170,154.422 126.728,154.879 124.105 C 159.359 98.415,183.044 81.663,208.506 86.175 M205.608 208.041 C 221.850 212.228,227.306 232.289,215.584 244.724 C 211.360 249.205,211.229 249.699,211.947 258.491 C 212.664 267.265,212.636 268.747,211.706 271.234 C 207.724 281.877,192.667 281.877,188.685 271.234 C 187.755 268.749,187.726 267.264,188.441 258.512 C 189.157 249.757,189.051 249.321,185.217 245.183 C 169.676 228.408,183.926 202.451,205.608 208.041 " stroke="none" fill="#f4f5f5" fill-rule="evenodd"></path><path id="path1" d="M66.797 0.623 C 32.566 5.597,5.384 32.911,0.611 67.130 C -0.319 73.798,-0.319 326.202,0.611 332.870 C 5.407 367.255,32.745 394.593,67.130 399.389 C 73.798 400.319,326.202 400.319,332.870 399.389 C 367.255 394.593,394.593 367.255,399.389 332.870 C 400.319 326.202,400.319 73.798,399.389 67.130 C 394.594 32.754,367.246 5.406,332.870 0.611 C 326.655 -0.256,72.766 -0.244,66.797 0.623 M213.867 62.875 C 242.701 69.076,264.218 91.674,268.974 120.746 C 269.509 124.020,269.672 128.402,269.817 143.415 L 269.997 162.025 277.088 162.189 C 290.826 162.506,299.614 168.453,303.235 179.883 C 304.318 183.299,304.606 240.179,303.576 247.070 C 294.293 309.180,235.635 349.626,175.882 335.118 C 133.095 324.729,100.732 287.486,96.486 243.750 C 95.586 234.482,96.129 182.694,97.158 179.688 C 101.082 168.215,109.656 162.476,123.302 162.186 L 130.394 162.036 130.573 143.420 C 130.854 114.347,133.453 104.492,144.888 89.152 C 160.417 68.319,188.839 57.491,213.867 62.875 M193.359 86.141 C 175.096 88.991,160.345 102.586,155.829 120.731 C 154.669 125.391,154.310 131.711,154.303 147.559 L 154.297 162.109 200.195 162.109 L 246.094 162.109 246.088 147.559 C 246.081 131.711,245.721 125.391,244.561 120.731 C 238.799 97.577,216.520 82.527,193.359 86.141 M196.618 207.827 C 179.229 210.926,172.807 231.592,185.158 244.704 C 189.237 249.035,189.335 249.395,188.738 257.745 C 187.856 270.076,188.152 271.802,191.772 275.426 C 196.640 280.299,203.750 280.299,208.619 275.426 C 212.239 271.802,212.535 270.076,211.653 257.745 C 211.055 249.395,211.154 249.035,215.233 244.704 C 229.833 229.204,217.192 204.161,196.618 207.827 " stroke="none" fill="#1444b4" fill-rule="evenodd"></path><path id="path2" d="M273.026 307.715 L 271.680 309.180 273.145 307.834 C 273.950 307.093,274.609 306.434,274.609 306.369 C 274.609 306.070,274.279 306.351,273.026 307.715 " stroke="none" fill="#6884c7" fill-rule="evenodd"></path><path id="path3" d="M150.952 82.129 L 149.805 83.398 151.074 82.251 C 152.258 81.182,152.523 80.859,152.222 80.859 C 152.154 80.859,151.583 81.431,150.952 82.129 M130.647 146.289 C 130.647 155.098,130.698 158.757,130.761 154.421 C 130.824 150.084,130.824 142.877,130.761 138.405 C 130.699 133.933,130.647 137.480,130.647 146.289 M269.706 149.609 C 269.706 156.592,269.759 159.448,269.824 155.957 C 269.888 152.466,269.888 146.753,269.824 143.262 C 269.759 139.771,269.706 142.627,269.706 149.609 " stroke="none" fill="#4c6cc4" fill-rule="evenodd"></path><path id="path4" d="" stroke="none" fill="#809cd2" fill-rule="evenodd"></path><path id="path5" d="M274.121 162.399 C 275.464 162.475,277.661 162.475,279.004 162.399 C 280.347 162.322,279.248 162.260,276.563 162.260 C 273.877 162.260,272.778 162.322,274.121 162.399 M304.013 238.281 C 304.013 239.248,304.089 239.644,304.182 239.160 C 304.275 238.677,304.275 237.886,304.182 237.402 C 304.089 236.919,304.013 237.314,304.013 238.281 M194.043 337.776 C 194.526 337.869,195.317 337.869,195.801 337.776 C 196.284 337.683,195.889 337.606,194.922 337.606 C 193.955 337.606,193.560 337.683,194.043 337.776 M204.590 337.776 C 205.073 337.869,205.864 337.869,206.348 337.776 C 206.831 337.683,206.436 337.606,205.469 337.606 C 204.502 337.606,204.106 337.683,204.590 337.776 " stroke="none" fill="#8c9ccc" fill-rule="evenodd"></path><path id="path6" d="M269.670 133.789 C 269.669 135.723,269.735 136.563,269.817 135.656 C 269.899 134.750,269.900 133.168,269.819 132.141 C 269.738 131.114,269.671 131.855,269.670 133.789 " stroke="none" fill="#3c62ba" fill-rule="evenodd"></path><path id="path7" d="" stroke="none" fill="#4c74c4" fill-rule="evenodd"></path><path id="path8" d="" stroke="none" fill="#2c5cb4" fill-rule="evenodd"></path></g></svg>\ No newline at end of filediff --git a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csprojindex 8ed0aee60..6788a9e36 100644--- a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj+++ b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj@@ -64,7 +64,9 @@<EmbeddedResource Include="TestData\Exports\bitwarden.csv" /><EmbeddedResource Include="TestData\Exports\chrome.csv" /><EmbeddedResource Include="TestData\Exports\firefox.csv" />- <EmbeddedResource Include="TestData\Exports\keepass.kdbx.csv" />+ <EmbeddedResource Include="TestData\Exports\strongbox.csv" />+ <EmbeddedResource Include="TestData\Exports\keepass.csv" />+ <EmbeddedResource Include="TestData\Exports\keepassxc.csv" /><EmbeddedResource Include="TestData\Exports\1password_8.csv" /></ItemGroup>diff --git a/src/Tests/AliasVault.UnitTests/TestData/Exports/keepass.csv b/src/Tests/AliasVault.UnitTests/TestData/Exports/keepass.csvnew file mode 100644index 000000000..2038de379--- /dev/null+++ b/src/Tests/AliasVault.UnitTests/TestData/Exports/keepass.csv@@ -0,0 +1,3 @@+"Account","Login Name","Password","Web Site","Comments"+"Sample Entry","User Name","Password","https://keepass.info/","Notes"+"Sample Entry #2","Michael321","12345","https://keepass.info/help/kb/testform.html",""diff --git a/src/Tests/AliasVault.UnitTests/TestData/Exports/keepassxc.csv b/src/Tests/AliasVault.UnitTests/TestData/Exports/keepassxc.csvnew file mode 100644index 000000000..d1d95f2d3--- /dev/null+++ b/src/Tests/AliasVault.UnitTests/TestData/Exports/keepassxc.csv@@ -0,0 +1,3 @@+"Group","Title","Username","Password","URL","Notes","TOTP","Icon","Last Modified","Created"+"Test1","Sample Entry","User Name","Password","https://keepass.info/","Notes","","0","2025-03-29T18:29:16Z","2025-03-29T18:29:16Z"+"Test1","Sample Entry #2","Michael321","12345","https://keepass.info/help/kb/testform.html","","","0","2025-03-29T18:29:16Z","2025-03-29T18:29:16Z"diff --git a/src/Tests/AliasVault.UnitTests/TestData/Exports/keepass.kdbx.csv b/src/Tests/AliasVault.UnitTests/TestData/Exports/strongbox.csvsimilarity index 100%rename from src/Tests/AliasVault.UnitTests/TestData/Exports/keepass.kdbx.csvrename to src/Tests/AliasVault.UnitTests/TestData/Exports/strongbox.csvdiff --git a/src/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs b/src/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.csindex 69d6ba9f4..412dbc760 100644--- a/src/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs+++ b/src/Tests/AliasVault.UnitTests/Utilities/ImportExportTests.cs@@ -130,17 +130,17 @@ public class ImportExportTests}/// <summary>- /// Test case for importing credentials from KeePass CSV and ensuring all values are present.+ /// Test case for importing credentials from Strongbox CSV and ensuring all values are present./// </summary>/// <returns>Async task.</returns>[Test]- public async Task ImportCredentialsFromKeePassCsv()+ public async Task ImportCredentialsFromStrongboxCsv(){// Arrange- var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceStringAsync("AliasVault.UnitTests.TestData.Exports.keepass.kdbx.csv");+ var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceStringAsync("AliasVault.UnitTests.TestData.Exports.strongbox.csv");// Act- var importedCredentials = await KeePassImporter.ImportFromCsvAsync(fileContent);+ var importedCredentials = await StrongboxImporter.ImportFromCsvAsync(fileContent);// AssertAssert.That(importedCredentials, Has.Count.EqualTo(6));@@ -277,4 +277,82 @@ public class ImportExportTestsAssert.That(youtubeCredential.Password, Is.EqualTo("youtubepassword"));});}++ /// <summary>+ /// Test case for importing credentials from KeePass CSV and ensuring all values are present.+ /// </summary>+ /// <returns>Async task.</returns>+ [Test]+ public async Task ImportCredentialsFromKeePassCsv()+ {+ // Arrange+ var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceStringAsync("AliasVault.UnitTests.TestData.Exports.keepass.csv");++ // Act+ var importedCredentials = await KeePassImporter.ImportFromCsvAsync(fileContent);++ // Assert+ Assert.That(importedCredentials, Has.Count.EqualTo(2));++ // Test specific entries+ var sampleEntry = importedCredentials.First(c => c.ServiceName == "Sample Entry");+ Assert.Multiple(() =>+ {+ Assert.That(sampleEntry.ServiceName, Is.EqualTo("Sample Entry"));+ Assert.That(sampleEntry.ServiceUrl, Is.EqualTo("https://keepass.info/"));+ Assert.That(sampleEntry.Username, Is.EqualTo("User Name"));+ Assert.That(sampleEntry.Password, Is.EqualTo("Password"));+ Assert.That(sampleEntry.Notes, Is.EqualTo("Notes"));+ });++ var sampleEntry2 = importedCredentials.First(c => c.ServiceName == "Sample Entry #2");+ Assert.Multiple(() =>+ {+ Assert.That(sampleEntry2.ServiceName, Is.EqualTo("Sample Entry #2"));+ Assert.That(sampleEntry2.ServiceUrl, Is.EqualTo("https://keepass.info/help/kb/testform.html"));+ Assert.That(sampleEntry2.Username, Is.EqualTo("Michael321"));+ Assert.That(sampleEntry2.Password, Is.EqualTo("12345"));+ Assert.That(sampleEntry2.Notes, Is.Empty);+ });+ }++ /// <summary>+ /// Test case for importing credentials from KeePassXC CSV and ensuring all values are present.+ /// </summary>+ /// <returns>Async task.</returns>+ [Test]+ public async Task ImportCredentialsFromKeePassXcCsv()+ {+ // Arrange+ var fileContent = await ResourceReaderUtility.ReadEmbeddedResourceStringAsync("AliasVault.UnitTests.TestData.Exports.keepassxc.csv");++ // Act+ var importedCredentials = await KeePassXcImporter.ImportFromCsvAsync(fileContent);++ // Assert+ Assert.That(importedCredentials, Has.Count.EqualTo(2));++ // Test specific entries+ var sampleEntry = importedCredentials.First(c => c.ServiceName == "Sample Entry");+ Assert.Multiple(() =>+ {+ Assert.That(sampleEntry.ServiceName, Is.EqualTo("Sample Entry"));+ Assert.That(sampleEntry.ServiceUrl, Is.EqualTo("https://keepass.info/"));+ Assert.That(sampleEntry.Username, Is.EqualTo("User Name"));+ Assert.That(sampleEntry.Password, Is.EqualTo("Password"));+ Assert.That(sampleEntry.Notes, Is.EqualTo("Notes"));+ Assert.That(sampleEntry.TwoFactorSecret, Is.Empty);+ });++ var sampleEntry2 = importedCredentials.First(c => c.ServiceName == "Sample Entry #2");+ Assert.Multiple(() =>+ {+ Assert.That(sampleEntry2.ServiceName, Is.EqualTo("Sample Entry #2"));+ Assert.That(sampleEntry2.ServiceUrl, Is.EqualTo("https://keepass.info/help/kb/testform.html"));+ Assert.That(sampleEntry2.Username, Is.EqualTo("Michael321"));+ Assert.That(sampleEntry2.Password, Is.EqualTo("12345"));+ Assert.That(sampleEntry2.Notes, Is.Empty);+ Assert.That(sampleEntry2.TwoFactorSecret, Is.Empty);+ });+ }}diff --git a/src/Utilities/AliasVault.ImportExport/Importers/KeePassImporter.cs b/src/Utilities/AliasVault.ImportExport/Importers/KeePassImporter.csindex 766ad18e0..aa5053d0b 100644--- a/src/Utilities/AliasVault.ImportExport/Importers/KeePassImporter.cs+++ b/src/Utilities/AliasVault.ImportExport/Importers/KeePassImporter.cs@@ -33,12 +33,11 @@ public class KeePassImporter{var credential = new ImportedCredential{- ServiceName = record.Title,- ServiceUrl = record.URL,- Username = record.Username,+ ServiceName = record.Account,+ ServiceUrl = record.Website,+ Username = record.LoginName,Password = record.Password,- TwoFactorSecret = record.OTPAuth,- Notes = record.Notes+ Notes = record.Comments};credentials.Add(credential);diff --git a/src/Utilities/AliasVault.ImportExport/Importers/KeePassXcImporter.cs b/src/Utilities/AliasVault.ImportExport/Importers/KeePassXcImporter.csnew file mode 100644index 000000000..22a0f19ce--- /dev/null+++ b/src/Utilities/AliasVault.ImportExport/Importers/KeePassXcImporter.cs@@ -0,0 +1,54 @@+//-----------------------------------------------------------------------+// <copyright file="KeePassXcImporter.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.ImportExport.Importers;++using AliasVault.ImportExport.Models;+using AliasVault.ImportExport.Models.Imports;+using CsvHelper;+using CsvHelper.Configuration;+using System.Globalization;++/// <summary>+/// Imports credentials from KeePassXC.+/// </summary>+public class KeePassXcImporter+{+ /// <summary>+ /// Imports KeePassXC 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)+ {+ using var reader = new StringReader(fileContent);+ using var csv = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture));++ var credentials = new List<ImportedCredential>();+ await foreach (var record in csv.GetRecordsAsync<KeepassXcCsvRecord>())+ {+ var credential = new ImportedCredential+ {+ ServiceName = record.Title,+ ServiceUrl = record.URL,+ Username = record.Username,+ Password = record.Password,+ TwoFactorSecret = record.TOTP,+ Notes = record.Notes+ };++ credentials.Add(credential);+ }++ if (credentials.Count == 0)+ {+ throw new InvalidOperationException("No records found in the CSV file.");+ }++ return credentials;+ }+}\ No newline at end of filediff --git a/src/Utilities/AliasVault.ImportExport/Importers/StrongboxImporter.cs b/src/Utilities/AliasVault.ImportExport/Importers/StrongboxImporter.csnew file mode 100644index 000000000..0f1ce4e41--- /dev/null+++ b/src/Utilities/AliasVault.ImportExport/Importers/StrongboxImporter.cs@@ -0,0 +1,54 @@+//-----------------------------------------------------------------------+// <copyright file="StrongboxImporter.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.ImportExport.Importers;++using AliasVault.ImportExport.Models;+using AliasVault.ImportExport.Models.Imports;+using CsvHelper;+using CsvHelper.Configuration;+using System.Globalization;++/// <summary>+/// Imports credentials from Strongbox.+/// </summary>+public class StrongboxImporter+{+ /// <summary>+ /// Imports KeePass 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)+ {+ using var reader = new StringReader(fileContent);+ using var csv = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture));++ var credentials = new List<ImportedCredential>();+ await foreach (var record in csv.GetRecordsAsync<StrongboxCsvRecord>())+ {+ var credential = new ImportedCredential+ {+ ServiceName = record.Title,+ ServiceUrl = record.URL,+ Username = record.Username,+ Password = record.Password,+ TwoFactorSecret = record.OTPAuth,+ Notes = record.Notes+ };++ credentials.Add(credential);+ }++ if (credentials.Count == 0)+ {+ throw new InvalidOperationException("No records found in the CSV file.");+ }++ return credentials;+ }+}\ No newline at end of filediff --git a/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassCsvRecord.cs b/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassCsvRecord.csindex a8b7c8d2f..54bc9aa1a 100644--- a/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassCsvRecord.cs+++ b/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassCsvRecord.cs@@ -7,6 +7,8 @@namespace AliasVault.ImportExport.Models.Imports;+using CsvHelper.Configuration.Attributes;+/// <summary>/// Represents a KeePass CSV record that is being imported from a KeePass CSV export file./// </summary>@@ -15,35 +17,30 @@ public class KeePassCsvRecord/// <summary>/// Gets or sets the title/service name (e.g., "Facebook", "Gmail")./// </summary>- public string Title { get; set; } = string.Empty;-- /// <summary>- /// Gets or sets the username.- /// </summary>- public string? Username { get; set; }+ [Name("Account")]+ public string Account { get; set; } = string.Empty;/// <summary>- /// Gets or sets the email address.+ /// Gets or sets the login name./// </summary>- public string? Email { get; set; }+ [Name("Login Name")]+ public string? LoginName { get; set; }/// <summary>/// Gets or sets the password./// </summary>+ [Name("Password")]public string? Password { get; set; }/// <summary>- /// Gets or sets the service URL.- /// </summary>- public string? URL { get; set; }-- /// <summary>- /// Gets or sets the OTP (One-Time Password) authentication secret.+ /// Gets or sets the web site./// </summary>- public string? OTPAuth { get; set; }+ [Name("Web Site")]+ public string? Website { get; set; }/// <summary>- /// Gets or sets any additional notes.+ /// Gets or sets the comments./// </summary>- public string? Notes { get; set; }+ [Name("Comments")]+ public string? Comments { get; set; }}diff --git a/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassXcCsvRecord.cs b/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassXcCsvRecord.csnew file mode 100644index 000000000..220cd6207--- /dev/null+++ b/src/Utilities/AliasVault.ImportExport/Models/Imports/KeePassXcCsvRecord.cs@@ -0,0 +1,76 @@+//-----------------------------------------------------------------------+// <copyright file="KeepassXcCsvRecord.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.ImportExport.Models.Imports;++using CsvHelper.Configuration.Attributes;++/// <summary>+/// Represents a KeePassXC CSV record that is being imported from a KeePassXC CSV export file.+/// </summary>+public class KeepassXcCsvRecord+{+ /// <summary>+ /// Gets or sets the group.+ /// </summary>+ [Name("Group")]+ public string Group { get; set; } = string.Empty;++ /// <summary>+ /// Gets or sets the title.+ /// </summary>+ [Name("Title")]+ public string Title { get; set; } = string.Empty;++ /// <summary>+ /// Gets or sets the username.+ /// </summary>+ [Name("Username")]+ public string? Username { get; set; }++ /// <summary>+ /// Gets or sets the password.+ /// </summary>+ [Name("Password")]+ public string? Password { get; set; }++ /// <summary>+ /// Gets or sets the web site.+ /// </summary>+ [Name("URL")]+ public string? URL { get; set; }++ /// <summary>+ /// Gets or sets the notes.+ /// </summary>+ [Name("Notes")]+ public string? Notes { get; set; }++ /// <summary>+ /// Gets or sets the TOTP (Time-based One-Time Password).+ /// </summary>+ [Name("TOTP")]+ public string? TOTP { get; set; }++ /// <summary>+ /// Gets or sets the icon (integer value representing built-in KeePassXC icon index)+ /// </summary>+ [Name("Icon")]+ public string? Icon { get; set; }++ /// <summary>+ /// Gets or sets the last modified date.+ /// </summary>+ [Name("Last Modified")]+ public string? LastModified { get; set; }++ /// <summary>+ /// Gets or sets the created date.+ /// </summary>+ [Name("Created")]+ public string? Created { get; set; }+}diff --git a/src/Utilities/AliasVault.ImportExport/Models/Imports/StrongboxCsvRecord.cs b/src/Utilities/AliasVault.ImportExport/Models/Imports/StrongboxCsvRecord.csnew file mode 100644index 000000000..96efd1eef--- /dev/null+++ b/src/Utilities/AliasVault.ImportExport/Models/Imports/StrongboxCsvRecord.cs@@ -0,0 +1,49 @@+//-----------------------------------------------------------------------+// <copyright file="StrongboxCsvRecord.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.ImportExport.Models.Imports;++/// <summary>+/// Represents a Strongbox CSV record that is being imported from a Strongbox CSV export file.+/// </summary>+public class StrongboxCsvRecord+{+ /// <summary>+ /// Gets or sets the title/service name (e.g., "Facebook", "Gmail").+ /// </summary>+ public string Title { get; set; } = string.Empty;++ /// <summary>+ /// Gets or sets the username.+ /// </summary>+ public string? Username { get; set; }++ /// <summary>+ /// Gets or sets the email address.+ /// </summary>+ public string? Email { get; set; }++ /// <summary>+ /// Gets or sets the password.+ /// </summary>+ public string? Password { get; set; }++ /// <summary>+ /// Gets or sets the service URL.+ /// </summary>+ public string? URL { get; set; }++ /// <summary>+ /// Gets or sets the OTP (One-Time Password) authentication secret.+ /// </summary>+ public string? OTPAuth { get; set; }++ /// <summary>+ /// Gets or sets any additional notes.+ /// </summary>+ public string? Notes { get; set; }+}