diff --git a/bitwarden-crypto-agent.sln b/bitwarden-key-connector.sln similarity index 86% rename from bitwarden-crypto-agent.sln rename to bitwarden-key-connector.sln index b589def..e4401ab 100644 --- a/bitwarden-crypto-agent.sln +++ b/bitwarden-key-connector.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31205.134 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CryptoAgent", "src\CryptoAgent\CryptoAgent.csproj", "{CAD440BF-93C9-4DEC-B083-99FD49B50429}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeyConnector", "src\KeyConnector\KeyConnector.csproj", "{CAD440BF-93C9-4DEC-B083-99FD49B50429}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/CryptoAgent/.dockerignore b/src/KeyConnector/.dockerignore similarity index 100% rename from src/CryptoAgent/.dockerignore rename to src/KeyConnector/.dockerignore diff --git a/src/CryptoAgent/Controllers/MiscController.cs b/src/KeyConnector/Controllers/MiscController.cs similarity index 89% rename from src/CryptoAgent/Controllers/MiscController.cs rename to src/KeyConnector/Controllers/MiscController.cs index 3e0391d..a0e17be 100644 --- a/src/CryptoAgent/Controllers/MiscController.cs +++ b/src/KeyConnector/Controllers/MiscController.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc; using System; -namespace Bit.CryptoAgent.Controllers +namespace Bit.KeyConnector.Controllers { public class MiscController : Controller { diff --git a/src/CryptoAgent/Controllers/UserKeysController.cs b/src/KeyConnector/Controllers/UserKeysController.cs similarity index 95% rename from src/CryptoAgent/Controllers/UserKeysController.cs rename to src/KeyConnector/Controllers/UserKeysController.cs index f92a97d..ff455d4 100644 --- a/src/CryptoAgent/Controllers/UserKeysController.cs +++ b/src/KeyConnector/Controllers/UserKeysController.cs @@ -1,6 +1,6 @@ -using Bit.CryptoAgent.Models; -using Bit.CryptoAgent.Repositories; -using Bit.CryptoAgent.Services; +using Bit.KeyConnector.Models; +using Bit.KeyConnector.Repositories; +using Bit.KeyConnector.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -10,7 +10,7 @@ using System; using System.Security.Claims; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Controllers +namespace Bit.KeyConnector.Controllers { [Authorize("Application")] [Route("user-keys")] @@ -47,7 +47,7 @@ namespace Bit.CryptoAgent.Controllers var response = new UserKeyResponseModel { Key = await _cryptoService.AesDecryptToB64Async(user.Key) - }; + }; return new JsonResult(response); } diff --git a/src/CryptoAgent/Dockerfile b/src/KeyConnector/Dockerfile similarity index 100% rename from src/CryptoAgent/Dockerfile rename to src/KeyConnector/Dockerfile diff --git a/src/CryptoAgent/HostedServices/DatabaseMigrationHostedService.cs b/src/KeyConnector/HostedServices/DatabaseMigrationHostedService.cs similarity index 95% rename from src/CryptoAgent/HostedServices/DatabaseMigrationHostedService.cs rename to src/KeyConnector/HostedServices/DatabaseMigrationHostedService.cs index 9f6ff09..0639084 100644 --- a/src/CryptoAgent/HostedServices/DatabaseMigrationHostedService.cs +++ b/src/KeyConnector/HostedServices/DatabaseMigrationHostedService.cs @@ -1,13 +1,13 @@ using System; using System.Threading; using System.Threading.Tasks; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -namespace Bit.CryptoAgent.HostedServices +namespace Bit.KeyConnector.HostedServices { public class DatabaseMigrationHostedService : IHostedService, IDisposable { diff --git a/src/CryptoAgent/CryptoAgent.csproj b/src/KeyConnector/KeyConnector.csproj similarity index 95% rename from src/CryptoAgent/CryptoAgent.csproj rename to src/KeyConnector/KeyConnector.csproj index 4c2bdc7..bb42476 100644 --- a/src/CryptoAgent/CryptoAgent.csproj +++ b/src/KeyConnector/KeyConnector.csproj @@ -2,8 +2,8 @@ net5.0 - Bit.CryptoAgent - bitwarden-CryptoAgent + Bit.KeyConnector + bitwarden-KeyConnector True diff --git a/src/CryptoAgent/CryptoAgentSettings.cs b/src/KeyConnector/KeyConnectorSettings.cs similarity index 98% rename from src/CryptoAgent/CryptoAgentSettings.cs rename to src/KeyConnector/KeyConnectorSettings.cs index 6a4d368..278033a 100644 --- a/src/CryptoAgent/CryptoAgentSettings.cs +++ b/src/KeyConnector/KeyConnectorSettings.cs @@ -1,6 +1,6 @@ -namespace Bit.CryptoAgent +namespace Bit.KeyConnector { - public class CryptoAgentSettings + public class KeyConnectorSettings { public string WebVaultUri { get; set; } public string IdentityServerUri { get; set; } diff --git a/src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.Designer.cs b/src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.Designer.cs similarity index 85% rename from src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.Designer.cs rename to src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.Designer.cs index 1ad903d..a1d7db8 100644 --- a/src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.Designer.cs +++ b/src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.Designer.cs @@ -1,12 +1,12 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.MySql +namespace Bit.KeyConnector.Migrations.MySql { [DbContext(typeof(MySqlDatabaseContext))] [Migration("20210820155954_InitialCreate")] @@ -19,7 +19,7 @@ namespace Bit.CryptoAgent.Migrations.MySql .HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "5.0.9"); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -33,7 +33,7 @@ namespace Bit.CryptoAgent.Migrations.MySql b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.cs b/src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.cs similarity index 98% rename from src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.cs rename to src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.cs index 3836464..dbc64c3 100644 --- a/src/CryptoAgent/Migrations/MySql/20210820155954_InitialCreate.cs +++ b/src/KeyConnector/Migrations/MySql/20210820155954_InitialCreate.cs @@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; -namespace Bit.CryptoAgent.Migrations.MySql +namespace Bit.KeyConnector.Migrations.MySql { public partial class InitialCreate : Migration { diff --git a/src/CryptoAgent/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs b/src/KeyConnector/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs similarity index 85% rename from src/CryptoAgent/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs rename to src/KeyConnector/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs index 6dbe314..a0f1e54 100644 --- a/src/CryptoAgent/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs +++ b/src/KeyConnector/Migrations/MySql/MySqlDatabaseContextModelSnapshot.cs @@ -1,11 +1,11 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.MySql +namespace Bit.KeyConnector.Migrations.MySql { [DbContext(typeof(MySqlDatabaseContext))] partial class MySqlDatabaseContextModelSnapshot : ModelSnapshot @@ -17,7 +17,7 @@ namespace Bit.CryptoAgent.Migrations.MySql .HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "5.0.9"); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -31,7 +31,7 @@ namespace Bit.CryptoAgent.Migrations.MySql b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs b/src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs similarity index 87% rename from src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs rename to src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs index 9ceb1d8..376171f 100644 --- a/src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs +++ b/src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.Designer.cs @@ -1,13 +1,13 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Bit.CryptoAgent.Migrations.PostgreSql +namespace Bit.KeyConnector.Migrations.PostgreSql { [DbContext(typeof(PostgreSqlDatabaseContext))] [Migration("20210820160016_InitialCreate")] @@ -21,7 +21,7 @@ namespace Bit.CryptoAgent.Migrations.PostgreSql .HasAnnotation("ProductVersion", "5.0.9") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -36,7 +36,7 @@ namespace Bit.CryptoAgent.Migrations.PostgreSql b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.cs b/src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.cs similarity index 97% rename from src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.cs rename to src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.cs index e9463b9..1cc626f 100644 --- a/src/CryptoAgent/Migrations/PostgreSql/20210820160016_InitialCreate.cs +++ b/src/KeyConnector/Migrations/PostgreSql/20210820160016_InitialCreate.cs @@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Bit.CryptoAgent.Migrations.PostgreSql +namespace Bit.KeyConnector.Migrations.PostgreSql { public partial class InitialCreate : Migration { diff --git a/src/CryptoAgent/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs b/src/KeyConnector/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs similarity index 87% rename from src/CryptoAgent/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs rename to src/KeyConnector/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs index 2acc427..be60b15 100644 --- a/src/CryptoAgent/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs +++ b/src/KeyConnector/Migrations/PostgreSql/PostgreSqlDatabaseContextModelSnapshot.cs @@ -1,12 +1,12 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -namespace Bit.CryptoAgent.Migrations.PostgreSql +namespace Bit.KeyConnector.Migrations.PostgreSql { [DbContext(typeof(PostgreSqlDatabaseContext))] partial class PostgreSqlDatabaseContextModelSnapshot : ModelSnapshot @@ -19,7 +19,7 @@ namespace Bit.CryptoAgent.Migrations.PostgreSql .HasAnnotation("ProductVersion", "5.0.9") .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -34,7 +34,7 @@ namespace Bit.CryptoAgent.Migrations.PostgreSql b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs b/src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs similarity index 87% rename from src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs rename to src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs index 833c54a..60ee043 100644 --- a/src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs +++ b/src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.Designer.cs @@ -1,13 +1,13 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.SqlServer +namespace Bit.KeyConnector.Migrations.SqlServer { [DbContext(typeof(SqlServerDatabaseContext))] [Migration("20210820154908_InitialCreate")] @@ -21,7 +21,7 @@ namespace Bit.CryptoAgent.Migrations.SqlServer .HasAnnotation("ProductVersion", "5.0.9") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -36,7 +36,7 @@ namespace Bit.CryptoAgent.Migrations.SqlServer b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.cs b/src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.cs similarity index 97% rename from src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.cs rename to src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.cs index ad7ea28..3d08618 100644 --- a/src/CryptoAgent/Migrations/SqlServer/20210820154908_InitialCreate.cs +++ b/src/KeyConnector/Migrations/SqlServer/20210820154908_InitialCreate.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace Bit.CryptoAgent.Migrations.SqlServer +namespace Bit.KeyConnector.Migrations.SqlServer { public partial class InitialCreate : Migration { diff --git a/src/CryptoAgent/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs b/src/KeyConnector/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs similarity index 87% rename from src/CryptoAgent/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs rename to src/KeyConnector/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs index bcc92d2..2c84e49 100644 --- a/src/CryptoAgent/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs +++ b/src/KeyConnector/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs @@ -1,12 +1,12 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.SqlServer +namespace Bit.KeyConnector.Migrations.SqlServer { [DbContext(typeof(SqlServerDatabaseContext))] partial class SqlServerDatabaseContextModelSnapshot : ModelSnapshot @@ -19,7 +19,7 @@ namespace Bit.CryptoAgent.Migrations.SqlServer .HasAnnotation("ProductVersion", "5.0.9") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -34,7 +34,7 @@ namespace Bit.CryptoAgent.Migrations.SqlServer b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs b/src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs similarity index 85% rename from src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs rename to src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs index 945ce68..2fd350c 100644 --- a/src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs +++ b/src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.Designer.cs @@ -1,12 +1,12 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.Sqlite +namespace Bit.KeyConnector.Migrations.Sqlite { [DbContext(typeof(SqliteDatabaseContext))] [Migration("20210820155938_InitialCreate")] @@ -18,7 +18,7 @@ namespace Bit.CryptoAgent.Migrations.Sqlite modelBuilder .HasAnnotation("ProductVersion", "5.0.9"); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -32,7 +32,7 @@ namespace Bit.CryptoAgent.Migrations.Sqlite b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.cs b/src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.cs similarity index 97% rename from src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.cs rename to src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.cs index 96d17f9..feee124 100644 --- a/src/CryptoAgent/Migrations/Sqlite/20210820155938_InitialCreate.cs +++ b/src/KeyConnector/Migrations/Sqlite/20210820155938_InitialCreate.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace Bit.CryptoAgent.Migrations.Sqlite +namespace Bit.KeyConnector.Migrations.Sqlite { public partial class InitialCreate : Migration { diff --git a/src/CryptoAgent/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs b/src/KeyConnector/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs similarity index 84% rename from src/CryptoAgent/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs rename to src/KeyConnector/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs index 993391c..69c3baf 100644 --- a/src/CryptoAgent/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs +++ b/src/KeyConnector/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs @@ -1,11 +1,11 @@ // using System; -using Bit.CryptoAgent.Repositories.EntityFramework; +using Bit.KeyConnector.Repositories.EntityFramework; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Bit.CryptoAgent.Migrations.Sqlite +namespace Bit.KeyConnector.Migrations.Sqlite { [DbContext(typeof(SqliteDatabaseContext))] partial class SqliteDatabaseContextModelSnapshot : ModelSnapshot @@ -16,7 +16,7 @@ namespace Bit.CryptoAgent.Migrations.Sqlite modelBuilder .HasAnnotation("ProductVersion", "5.0.9"); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.ApplicationData", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.ApplicationData", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -30,7 +30,7 @@ namespace Bit.CryptoAgent.Migrations.Sqlite b.ToTable("ApplicationDatas"); }); - modelBuilder.Entity("Bit.CryptoAgent.Repositories.EntityFramework.UserKey", b => + modelBuilder.Entity("Bit.KeyConnector.Repositories.EntityFramework.UserKey", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/src/CryptoAgent/Models/IStoredItem.cs b/src/KeyConnector/Models/IStoredItem.cs similarity index 80% rename from src/CryptoAgent/Models/IStoredItem.cs rename to src/KeyConnector/Models/IStoredItem.cs index 6099ed9..a5e7255 100644 --- a/src/CryptoAgent/Models/IStoredItem.cs +++ b/src/KeyConnector/Models/IStoredItem.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.CryptoAgent.Models +namespace Bit.KeyConnector.Models { public interface IStoredItem where TId : IEquatable { diff --git a/src/CryptoAgent/Models/UserKeyModel.cs b/src/KeyConnector/Models/UserKeyModel.cs similarity index 92% rename from src/CryptoAgent/Models/UserKeyModel.cs rename to src/KeyConnector/Models/UserKeyModel.cs index aed2eeb..036ab0b 100644 --- a/src/CryptoAgent/Models/UserKeyModel.cs +++ b/src/KeyConnector/Models/UserKeyModel.cs @@ -1,6 +1,6 @@ using System; -namespace Bit.CryptoAgent.Models +namespace Bit.KeyConnector.Models { public class UserKeyModel : BaseUserKeyModel, IStoredItem { diff --git a/src/CryptoAgent/Models/UserKeyRequestModel.cs b/src/KeyConnector/Models/UserKeyRequestModel.cs similarity index 71% rename from src/CryptoAgent/Models/UserKeyRequestModel.cs rename to src/KeyConnector/Models/UserKeyRequestModel.cs index 94cafbe..36f20ad 100644 --- a/src/CryptoAgent/Models/UserKeyRequestModel.cs +++ b/src/KeyConnector/Models/UserKeyRequestModel.cs @@ -1,4 +1,4 @@ -namespace Bit.CryptoAgent.Models +namespace Bit.KeyConnector.Models { public class UserKeyRequestModel { diff --git a/src/CryptoAgent/Models/UserKeyResponseModel.cs b/src/KeyConnector/Models/UserKeyResponseModel.cs similarity index 71% rename from src/CryptoAgent/Models/UserKeyResponseModel.cs rename to src/KeyConnector/Models/UserKeyResponseModel.cs index 0bcfc48..e5baabc 100644 --- a/src/CryptoAgent/Models/UserKeyResponseModel.cs +++ b/src/KeyConnector/Models/UserKeyResponseModel.cs @@ -1,4 +1,4 @@ -namespace Bit.CryptoAgent.Models +namespace Bit.KeyConnector.Models { public class UserKeyResponseModel { diff --git a/src/CryptoAgent/Program.cs b/src/KeyConnector/Program.cs similarity index 94% rename from src/CryptoAgent/Program.cs rename to src/KeyConnector/Program.cs index 41e621c..6a8c631 100644 --- a/src/CryptoAgent/Program.cs +++ b/src/KeyConnector/Program.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.Hosting; using Serilog; -namespace Bit.CryptoAgent +namespace Bit.KeyConnector { public class Program { diff --git a/src/CryptoAgent/Properties/launchSettings.json b/src/KeyConnector/Properties/launchSettings.json similarity index 100% rename from src/CryptoAgent/Properties/launchSettings.json rename to src/KeyConnector/Properties/launchSettings.json diff --git a/src/CryptoAgent/Repositories/EntityFramework/ApplicationDataRepository.cs b/src/KeyConnector/Repositories/EntityFramework/ApplicationDataRepository.cs similarity index 95% rename from src/CryptoAgent/Repositories/EntityFramework/ApplicationDataRepository.cs rename to src/KeyConnector/Repositories/EntityFramework/ApplicationDataRepository.cs index 2bc3b55..8cefbf7 100644 --- a/src/CryptoAgent/Repositories/EntityFramework/ApplicationDataRepository.cs +++ b/src/KeyConnector/Repositories/EntityFramework/ApplicationDataRepository.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -namespace Bit.CryptoAgent.Repositories.EntityFramework +namespace Bit.KeyConnector.Repositories.EntityFramework { public class ApplicationDataRepository : BaseRepository, IApplicationDataRepository { diff --git a/src/CryptoAgent/Repositories/EntityFramework/BaseRepository.cs b/src/KeyConnector/Repositories/EntityFramework/BaseRepository.cs similarity index 90% rename from src/CryptoAgent/Repositories/EntityFramework/BaseRepository.cs rename to src/KeyConnector/Repositories/EntityFramework/BaseRepository.cs index e617762..299e674 100644 --- a/src/CryptoAgent/Repositories/EntityFramework/BaseRepository.cs +++ b/src/KeyConnector/Repositories/EntityFramework/BaseRepository.cs @@ -1,7 +1,7 @@ using System; using Microsoft.Extensions.DependencyInjection; -namespace Bit.CryptoAgent.Repositories.EntityFramework +namespace Bit.KeyConnector.Repositories.EntityFramework { public abstract class BaseRepository { diff --git a/src/CryptoAgent/Repositories/EntityFramework/DatabaseContext.cs b/src/KeyConnector/Repositories/EntityFramework/DatabaseContext.cs similarity index 80% rename from src/CryptoAgent/Repositories/EntityFramework/DatabaseContext.cs rename to src/KeyConnector/Repositories/EntityFramework/DatabaseContext.cs index 9ee31cc..628cf69 100644 --- a/src/CryptoAgent/Repositories/EntityFramework/DatabaseContext.cs +++ b/src/KeyConnector/Repositories/EntityFramework/DatabaseContext.cs @@ -1,8 +1,8 @@ using System.Linq; -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using Microsoft.EntityFrameworkCore; -namespace Bit.CryptoAgent.Repositories.EntityFramework +namespace Bit.KeyConnector.Repositories.EntityFramework { public abstract class DatabaseContext : DbContext { @@ -12,9 +12,9 @@ namespace Bit.CryptoAgent.Repositories.EntityFramework public class SqlServerDatabaseContext : DatabaseContext { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public SqlServerDatabaseContext(CryptoAgentSettings settings) + public SqlServerDatabaseContext(KeyConnectorSettings settings) { _settings = settings; } @@ -25,9 +25,9 @@ namespace Bit.CryptoAgent.Repositories.EntityFramework public class PostgreSqlDatabaseContext : DatabaseContext { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public PostgreSqlDatabaseContext(CryptoAgentSettings settings) + public PostgreSqlDatabaseContext(KeyConnectorSettings settings) { _settings = settings; } @@ -38,9 +38,9 @@ namespace Bit.CryptoAgent.Repositories.EntityFramework public class SqliteDatabaseContext : DatabaseContext { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public SqliteDatabaseContext(CryptoAgentSettings settings) + public SqliteDatabaseContext(KeyConnectorSettings settings) { _settings = settings; } @@ -51,9 +51,9 @@ namespace Bit.CryptoAgent.Repositories.EntityFramework public class MySqlDatabaseContext : DatabaseContext { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public MySqlDatabaseContext(CryptoAgentSettings settings) + public MySqlDatabaseContext(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Repositories/EntityFramework/DatabaseContextFactory.cs b/src/KeyConnector/Repositories/EntityFramework/DatabaseContextFactory.cs similarity index 85% rename from src/CryptoAgent/Repositories/EntityFramework/DatabaseContextFactory.cs rename to src/KeyConnector/Repositories/EntityFramework/DatabaseContextFactory.cs index 8b68fb4..3466741 100644 --- a/src/CryptoAgent/Repositories/EntityFramework/DatabaseContextFactory.cs +++ b/src/KeyConnector/Repositories/EntityFramework/DatabaseContextFactory.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore.Design; using Microsoft.Extensions.Configuration; -namespace Bit.CryptoAgent.Repositories.EntityFramework +namespace Bit.KeyConnector.Repositories.EntityFramework { public class SqlServerDatabaseContextFactory : IDesignTimeDbContextFactory { @@ -37,13 +37,13 @@ namespace Bit.CryptoAgent.Repositories.EntityFramework public static class SettingsFactory { - public static CryptoAgentSettings Settings { get; } = new CryptoAgentSettings(); + public static KeyConnectorSettings Settings { get; } = new KeyConnectorSettings(); static SettingsFactory() { var configBuilder = new ConfigurationBuilder().AddUserSecrets(); var config = configBuilder.Build(); - ConfigurationBinder.Bind(config.GetSection("CryptoAgentSettings"), Settings); + ConfigurationBinder.Bind(config.GetSection("KeyConnectorSettings"), Settings); } } } diff --git a/src/CryptoAgent/Repositories/EntityFramework/UserKeyRepository.cs b/src/KeyConnector/Repositories/EntityFramework/UserKeyRepository.cs similarity index 95% rename from src/CryptoAgent/Repositories/EntityFramework/UserKeyRepository.cs rename to src/KeyConnector/Repositories/EntityFramework/UserKeyRepository.cs index b2d5bf5..7f54bd6 100644 --- a/src/CryptoAgent/Repositories/EntityFramework/UserKeyRepository.cs +++ b/src/KeyConnector/Repositories/EntityFramework/UserKeyRepository.cs @@ -1,9 +1,9 @@ -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using Microsoft.Extensions.DependencyInjection; using System; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.EntityFramework +namespace Bit.KeyConnector.Repositories.EntityFramework { public class UserKeyRepository : BaseRepository, IUserKeyRepository { diff --git a/src/CryptoAgent/Repositories/IApplicationDataRepository.cs b/src/KeyConnector/Repositories/IApplicationDataRepository.cs similarity index 82% rename from src/CryptoAgent/Repositories/IApplicationDataRepository.cs rename to src/KeyConnector/Repositories/IApplicationDataRepository.cs index 4416854..3f9dee4 100644 --- a/src/CryptoAgent/Repositories/IApplicationDataRepository.cs +++ b/src/KeyConnector/Repositories/IApplicationDataRepository.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories +namespace Bit.KeyConnector.Repositories { public interface IApplicationDataRepository { diff --git a/src/CryptoAgent/Repositories/IRepository.cs b/src/KeyConnector/Repositories/IRepository.cs similarity index 85% rename from src/CryptoAgent/Repositories/IRepository.cs rename to src/KeyConnector/Repositories/IRepository.cs index 189385f..5d74959 100644 --- a/src/CryptoAgent/Repositories/IRepository.cs +++ b/src/KeyConnector/Repositories/IRepository.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories +namespace Bit.KeyConnector.Repositories { public interface IRepository { diff --git a/src/CryptoAgent/Repositories/IUserKeyRepository.cs b/src/KeyConnector/Repositories/IUserKeyRepository.cs similarity index 58% rename from src/CryptoAgent/Repositories/IUserKeyRepository.cs rename to src/KeyConnector/Repositories/IUserKeyRepository.cs index 0f3dcfc..35907ac 100644 --- a/src/CryptoAgent/Repositories/IUserKeyRepository.cs +++ b/src/KeyConnector/Repositories/IUserKeyRepository.cs @@ -1,7 +1,7 @@ -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using System; -namespace Bit.CryptoAgent.Repositories +namespace Bit.KeyConnector.Repositories { public interface IUserKeyRepository : IRepository { diff --git a/src/CryptoAgent/Repositories/JsonFile/ApplicationDataRepository.cs b/src/KeyConnector/Repositories/JsonFile/ApplicationDataRepository.cs similarity index 93% rename from src/CryptoAgent/Repositories/JsonFile/ApplicationDataRepository.cs rename to src/KeyConnector/Repositories/JsonFile/ApplicationDataRepository.cs index cca2b35..39e1373 100644 --- a/src/CryptoAgent/Repositories/JsonFile/ApplicationDataRepository.cs +++ b/src/KeyConnector/Repositories/JsonFile/ApplicationDataRepository.cs @@ -1,7 +1,7 @@ using JsonFlatFileDataStore; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.JsonFile +namespace Bit.KeyConnector.Repositories.JsonFile { public class ApplicationDataRepository : IApplicationDataRepository { diff --git a/src/CryptoAgent/Repositories/JsonFile/Repository.cs b/src/KeyConnector/Repositories/JsonFile/Repository.cs similarity index 94% rename from src/CryptoAgent/Repositories/JsonFile/Repository.cs rename to src/KeyConnector/Repositories/JsonFile/Repository.cs index 98f717b..5e165dc 100644 --- a/src/CryptoAgent/Repositories/JsonFile/Repository.cs +++ b/src/KeyConnector/Repositories/JsonFile/Repository.cs @@ -1,10 +1,10 @@ -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using JsonFlatFileDataStore; using System; using System.Linq; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.JsonFile +namespace Bit.KeyConnector.Repositories.JsonFile { public class Repository : IRepository where TId : IEquatable diff --git a/src/CryptoAgent/Repositories/JsonFile/UserKeyRepository.cs b/src/KeyConnector/Repositories/JsonFile/UserKeyRepository.cs similarity index 93% rename from src/CryptoAgent/Repositories/JsonFile/UserKeyRepository.cs rename to src/KeyConnector/Repositories/JsonFile/UserKeyRepository.cs index 15b1558..7dabd40 100644 --- a/src/CryptoAgent/Repositories/JsonFile/UserKeyRepository.cs +++ b/src/KeyConnector/Repositories/JsonFile/UserKeyRepository.cs @@ -1,9 +1,9 @@ -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using JsonFlatFileDataStore; using System; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.JsonFile +namespace Bit.KeyConnector.Repositories.JsonFile { public class UserKeyRepository : Repository, IUserKeyRepository { diff --git a/src/CryptoAgent/Repositories/Mongo/ApplicationDataRepository.cs b/src/KeyConnector/Repositories/Mongo/ApplicationDataRepository.cs similarity index 90% rename from src/CryptoAgent/Repositories/Mongo/ApplicationDataRepository.cs rename to src/KeyConnector/Repositories/Mongo/ApplicationDataRepository.cs index 9be2f13..3dc97d2 100644 --- a/src/CryptoAgent/Repositories/Mongo/ApplicationDataRepository.cs +++ b/src/KeyConnector/Repositories/Mongo/ApplicationDataRepository.cs @@ -2,12 +2,12 @@ using MongoDB.Driver; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.Mongo +namespace Bit.KeyConnector.Repositories.Mongo { public class ApplicationDataRepository : BaseRepository, IApplicationDataRepository { - public ApplicationDataRepository(CryptoAgentSettings settings) + public ApplicationDataRepository(KeyConnectorSettings settings) : base(settings, "ApplicationData") { } diff --git a/src/CryptoAgent/Repositories/Mongo/BaseRepository.cs b/src/KeyConnector/Repositories/Mongo/BaseRepository.cs similarity index 79% rename from src/CryptoAgent/Repositories/Mongo/BaseRepository.cs rename to src/KeyConnector/Repositories/Mongo/BaseRepository.cs index 6099d7d..1dd03da 100644 --- a/src/CryptoAgent/Repositories/Mongo/BaseRepository.cs +++ b/src/KeyConnector/Repositories/Mongo/BaseRepository.cs @@ -1,10 +1,10 @@ using MongoDB.Driver; -namespace Bit.CryptoAgent.Repositories.Mongo +namespace Bit.KeyConnector.Repositories.Mongo { public abstract class BaseRepository { - public BaseRepository(CryptoAgentSettings settings, string collectionName) + public BaseRepository(KeyConnectorSettings settings, string collectionName) { Client = new MongoClient(settings.Database.MongoConnectionString); Database = Client.GetDatabase(settings.Database.MongoDatabaseName); diff --git a/src/CryptoAgent/Repositories/Mongo/UserKeyRepository.cs b/src/KeyConnector/Repositories/Mongo/UserKeyRepository.cs similarity index 84% rename from src/CryptoAgent/Repositories/Mongo/UserKeyRepository.cs rename to src/KeyConnector/Repositories/Mongo/UserKeyRepository.cs index 6f6d662..5866551 100644 --- a/src/CryptoAgent/Repositories/Mongo/UserKeyRepository.cs +++ b/src/KeyConnector/Repositories/Mongo/UserKeyRepository.cs @@ -1,13 +1,13 @@ -using Bit.CryptoAgent.Models; +using Bit.KeyConnector.Models; using MongoDB.Driver; using System; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Repositories.Mongo +namespace Bit.KeyConnector.Repositories.Mongo { public class UserKeyRepository : BaseRepository, IUserKeyRepository { - public UserKeyRepository(CryptoAgentSettings settings) + public UserKeyRepository(KeyConnectorSettings settings) : base(settings, "UserKey") { } diff --git a/src/CryptoAgent/Services/AwsKmsRsaKeyService.cs b/src/KeyConnector/Services/AwsKmsRsaKeyService.cs similarity index 95% rename from src/CryptoAgent/Services/AwsKmsRsaKeyService.cs rename to src/KeyConnector/Services/AwsKmsRsaKeyService.cs index 1cd32ad..fa1c957 100644 --- a/src/CryptoAgent/Services/AwsKmsRsaKeyService.cs +++ b/src/KeyConnector/Services/AwsKmsRsaKeyService.cs @@ -5,15 +5,15 @@ using System.IO; using System.Security.Cryptography; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class AwsKmsRsaKeyService : IRsaKeyService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; private readonly AmazonKeyManagementServiceClient _kmsClient; public AwsKmsRsaKeyService( - CryptoAgentSettings settings) + KeyConnectorSettings settings) { _settings = settings; _kmsClient = new AmazonKeyManagementServiceClient(settings.RsaKey.AwsAccessKeyId, diff --git a/src/CryptoAgent/Services/AzureKeyVaultCertificateProviderService.cs b/src/KeyConnector/Services/AzureKeyVaultCertificateProviderService.cs similarity index 92% rename from src/CryptoAgent/Services/AzureKeyVaultCertificateProviderService.cs rename to src/KeyConnector/Services/AzureKeyVaultCertificateProviderService.cs index 9db3a59..34cb714 100644 --- a/src/CryptoAgent/Services/AzureKeyVaultCertificateProviderService.cs +++ b/src/KeyConnector/Services/AzureKeyVaultCertificateProviderService.cs @@ -5,13 +5,13 @@ using System; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class AzureKeyVaultCertificateProviderService : ICertificateProviderService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public AzureKeyVaultCertificateProviderService(CryptoAgentSettings settings) + public AzureKeyVaultCertificateProviderService(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Services/AzureKeyVaultRsaKeyService.cs b/src/KeyConnector/Services/AzureKeyVaultRsaKeyService.cs similarity index 95% rename from src/CryptoAgent/Services/AzureKeyVaultRsaKeyService.cs rename to src/KeyConnector/Services/AzureKeyVaultRsaKeyService.cs index 291916b..4cd560e 100644 --- a/src/CryptoAgent/Services/AzureKeyVaultRsaKeyService.cs +++ b/src/KeyConnector/Services/AzureKeyVaultRsaKeyService.cs @@ -4,18 +4,18 @@ using Azure.Security.KeyVault.Keys.Cryptography; using System; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class AzureKeyVaultRsaKeyService : IRsaKeyService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; private readonly ClientSecretCredential _credential; private KeyVaultKey _key; private CryptographyClient _cryptographyClient; public AzureKeyVaultRsaKeyService( - CryptoAgentSettings settings) + KeyConnectorSettings settings) { _settings = settings; _credential = new ClientSecretCredential(_settings.RsaKey.AzureKeyvaultAdTenantId, diff --git a/src/CryptoAgent/Services/AzureStorageCertificateProviderService.cs b/src/KeyConnector/Services/AzureStorageCertificateProviderService.cs similarity index 85% rename from src/CryptoAgent/Services/AzureStorageCertificateProviderService.cs rename to src/KeyConnector/Services/AzureStorageCertificateProviderService.cs index 91a557c..526a5fd 100644 --- a/src/CryptoAgent/Services/AzureStorageCertificateProviderService.cs +++ b/src/KeyConnector/Services/AzureStorageCertificateProviderService.cs @@ -3,13 +3,13 @@ using System.IO; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class AzureStorageCertificateProviderService : ICertificateProviderService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public AzureStorageCertificateProviderService(CryptoAgentSettings settings) + public AzureStorageCertificateProviderService(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Services/CryptoFunctionService.cs b/src/KeyConnector/Services/CryptoFunctionService.cs similarity index 99% rename from src/CryptoAgent/Services/CryptoFunctionService.cs rename to src/KeyConnector/Services/CryptoFunctionService.cs index ab115cd..1e69834 100644 --- a/src/CryptoAgent/Services/CryptoFunctionService.cs +++ b/src/KeyConnector/Services/CryptoFunctionService.cs @@ -2,7 +2,7 @@ using System.Security.Cryptography; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class CryptoFunctionService : ICryptoFunctionService { diff --git a/src/CryptoAgent/Services/CryptoService.cs b/src/KeyConnector/Services/CryptoService.cs similarity index 98% rename from src/CryptoAgent/Services/CryptoService.cs rename to src/KeyConnector/Services/CryptoService.cs index 682ef71..a0979cc 100644 --- a/src/CryptoAgent/Services/CryptoService.cs +++ b/src/KeyConnector/Services/CryptoService.cs @@ -1,8 +1,8 @@ -using Bit.CryptoAgent.Repositories; +using Bit.KeyConnector.Repositories; using System; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class CryptoService : ICryptoService { diff --git a/src/CryptoAgent/Services/FilesystemCertificateProviderService.cs b/src/KeyConnector/Services/FilesystemCertificateProviderService.cs similarity index 74% rename from src/CryptoAgent/Services/FilesystemCertificateProviderService.cs rename to src/KeyConnector/Services/FilesystemCertificateProviderService.cs index 75e78dd..afc2a17 100644 --- a/src/CryptoAgent/Services/FilesystemCertificateProviderService.cs +++ b/src/KeyConnector/Services/FilesystemCertificateProviderService.cs @@ -1,13 +1,13 @@ using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class FilesystemCertificateProviderService : ICertificateProviderService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public FilesystemCertificateProviderService(CryptoAgentSettings settings) + public FilesystemCertificateProviderService(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Services/GoogleCloudKmsRsaKeyService.cs b/src/KeyConnector/Services/GoogleCloudKmsRsaKeyService.cs similarity index 97% rename from src/CryptoAgent/Services/GoogleCloudKmsRsaKeyService.cs rename to src/KeyConnector/Services/GoogleCloudKmsRsaKeyService.cs index 0a585cf..3d88e8a 100644 --- a/src/CryptoAgent/Services/GoogleCloudKmsRsaKeyService.cs +++ b/src/KeyConnector/Services/GoogleCloudKmsRsaKeyService.cs @@ -4,7 +4,7 @@ using System; using System.Security.Cryptography; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class GoogleCloudKmsRsaKeyService : IRsaKeyService { @@ -13,7 +13,7 @@ namespace Bit.CryptoAgent.Services private readonly CryptoKeyVersionName _cryptoKeyVersionName; public GoogleCloudKmsRsaKeyService( - CryptoAgentSettings settings) + KeyConnectorSettings settings) { _keyManagementServiceClient = KeyManagementServiceClient.Create(); _cryptoKeyName = new CryptoKeyName(settings.RsaKey.GoogleCloudProjectId, diff --git a/src/CryptoAgent/Services/HashicorpVaultCertificateProviderService.cs b/src/KeyConnector/Services/HashicorpVaultCertificateProviderService.cs similarity index 88% rename from src/CryptoAgent/Services/HashicorpVaultCertificateProviderService.cs rename to src/KeyConnector/Services/HashicorpVaultCertificateProviderService.cs index a317dc7..a03e641 100644 --- a/src/CryptoAgent/Services/HashicorpVaultCertificateProviderService.cs +++ b/src/KeyConnector/Services/HashicorpVaultCertificateProviderService.cs @@ -4,13 +4,13 @@ using System.Threading.Tasks; using VaultSharp; using VaultSharp.V1.AuthMethods.Token; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class HashicorpVaultCertificateProviderService : ICertificateProviderService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public HashicorpVaultCertificateProviderService(CryptoAgentSettings settings) + public HashicorpVaultCertificateProviderService(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Services/ICertificateProviderService.cs b/src/KeyConnector/Services/ICertificateProviderService.cs similarity index 85% rename from src/CryptoAgent/Services/ICertificateProviderService.cs rename to src/KeyConnector/Services/ICertificateProviderService.cs index f2c17e8..e63c347 100644 --- a/src/CryptoAgent/Services/ICertificateProviderService.cs +++ b/src/KeyConnector/Services/ICertificateProviderService.cs @@ -1,7 +1,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public interface ICertificateProviderService { diff --git a/src/CryptoAgent/Services/ICryptoFunctionService.cs b/src/KeyConnector/Services/ICryptoFunctionService.cs similarity index 95% rename from src/CryptoAgent/Services/ICryptoFunctionService.cs rename to src/KeyConnector/Services/ICryptoFunctionService.cs index 81b4d86..2b0f93c 100644 --- a/src/CryptoAgent/Services/ICryptoFunctionService.cs +++ b/src/KeyConnector/Services/ICryptoFunctionService.cs @@ -1,7 +1,7 @@ using System.Security.Cryptography; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public interface ICryptoFunctionService { diff --git a/src/CryptoAgent/Services/ICryptoService.cs b/src/KeyConnector/Services/ICryptoService.cs similarity index 94% rename from src/CryptoAgent/Services/ICryptoService.cs rename to src/KeyConnector/Services/ICryptoService.cs index 2e1664d..a83fe43 100644 --- a/src/CryptoAgent/Services/ICryptoService.cs +++ b/src/KeyConnector/Services/ICryptoService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public interface ICryptoService { diff --git a/src/CryptoAgent/Services/IRsaKeyService.cs b/src/KeyConnector/Services/IRsaKeyService.cs similarity index 89% rename from src/CryptoAgent/Services/IRsaKeyService.cs rename to src/KeyConnector/Services/IRsaKeyService.cs index d7d345f..9c245b7 100644 --- a/src/CryptoAgent/Services/IRsaKeyService.cs +++ b/src/KeyConnector/Services/IRsaKeyService.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public interface IRsaKeyService { diff --git a/src/CryptoAgent/Services/LocalCertificateRsaKeyService.cs b/src/KeyConnector/Services/LocalCertificateRsaKeyService.cs similarity index 98% rename from src/CryptoAgent/Services/LocalCertificateRsaKeyService.cs rename to src/KeyConnector/Services/LocalCertificateRsaKeyService.cs index ebd2acf..5666077 100644 --- a/src/CryptoAgent/Services/LocalCertificateRsaKeyService.cs +++ b/src/KeyConnector/Services/LocalCertificateRsaKeyService.cs @@ -1,7 +1,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class LocalCertificateRsaKeyService : IRsaKeyService { diff --git a/src/CryptoAgent/Services/Pkcs11RsaKeyService.cs b/src/KeyConnector/Services/Pkcs11RsaKeyService.cs similarity index 98% rename from src/CryptoAgent/Services/Pkcs11RsaKeyService.cs rename to src/KeyConnector/Services/Pkcs11RsaKeyService.cs index e741c28..5895e64 100644 --- a/src/CryptoAgent/Services/Pkcs11RsaKeyService.cs +++ b/src/KeyConnector/Services/Pkcs11RsaKeyService.cs @@ -5,20 +5,20 @@ using System.Threading.Tasks; using Net.Pkcs11Interop.Common; using Net.Pkcs11Interop.HighLevelAPI; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class Pkcs11RsaKeyService : IRsaKeyService { private readonly ICertificateProviderService _certificateProviderService; private readonly ICryptoFunctionService _cryptoFunctionService; - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; private X509Certificate2 _certificate; public Pkcs11RsaKeyService( ICertificateProviderService certificateProviderService, ICryptoFunctionService cryptoFunctionService, - CryptoAgentSettings settings) + KeyConnectorSettings settings) { _certificateProviderService = certificateProviderService; _cryptoFunctionService = cryptoFunctionService; diff --git a/src/CryptoAgent/Services/StoreCertificateProviderService.cs b/src/KeyConnector/Services/StoreCertificateProviderService.cs similarity index 88% rename from src/CryptoAgent/Services/StoreCertificateProviderService.cs rename to src/KeyConnector/Services/StoreCertificateProviderService.cs index 4220be5..58abc4f 100644 --- a/src/CryptoAgent/Services/StoreCertificateProviderService.cs +++ b/src/KeyConnector/Services/StoreCertificateProviderService.cs @@ -2,13 +2,13 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; -namespace Bit.CryptoAgent.Services +namespace Bit.KeyConnector.Services { public class StoreCertificateProviderService : ICertificateProviderService { - private readonly CryptoAgentSettings _settings; + private readonly KeyConnectorSettings _settings; - public StoreCertificateProviderService(CryptoAgentSettings settings) + public StoreCertificateProviderService(KeyConnectorSettings settings) { _settings = settings; } diff --git a/src/CryptoAgent/Startup.cs b/src/KeyConnector/Startup.cs similarity index 95% rename from src/CryptoAgent/Startup.cs rename to src/KeyConnector/Startup.cs index 2eb2655..905473e 100644 --- a/src/CryptoAgent/Startup.cs +++ b/src/KeyConnector/Startup.cs @@ -1,5 +1,5 @@ -using Bit.CryptoAgent.Repositories; -using Bit.CryptoAgent.Services; +using Bit.KeyConnector.Repositories; +using Bit.KeyConnector.Services; using IdentityModel; using IdentityServer4.AccessTokenValidation; using JsonFlatFileDataStore; @@ -14,7 +14,7 @@ using System; using System.Globalization; using System.Security.Claims; -namespace Bit.CryptoAgent +namespace Bit.KeyConnector { public class Startup { @@ -34,8 +34,8 @@ namespace Bit.CryptoAgent public void ConfigureServices(IServiceCollection services) { - var settings = new CryptoAgentSettings(); - ConfigurationBinder.Bind(Configuration.GetSection("CryptoAgentSettings"), settings); + var settings = new KeyConnectorSettings(); + ConfigurationBinder.Bind(Configuration.GetSection("KeyConnectorSettings"), settings); services.AddSingleton(s => settings); AddAuthentication(services, settings); @@ -54,7 +54,7 @@ namespace Bit.CryptoAgent } } - public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CryptoAgentSettings settings) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, KeyConnectorSettings settings) { if (env.IsDevelopment()) { @@ -72,7 +72,7 @@ namespace Bit.CryptoAgent app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute()); } - private bool AddDatabase(IServiceCollection services, CryptoAgentSettings settings) + private bool AddDatabase(IServiceCollection services, KeyConnectorSettings settings) { var databaseProvider = settings.Database.Provider?.ToLowerInvariant(); var efDatabaseProvider = databaseProvider == "sqlserver" || databaseProvider == "postgresql" || @@ -125,7 +125,7 @@ namespace Bit.CryptoAgent return efDatabaseProvider; } - private void AddRsaKeyProvider(IServiceCollection services, CryptoAgentSettings settings) + private void AddRsaKeyProvider(IServiceCollection services, KeyConnectorSettings settings) { var rsaKeyProvider = settings.RsaKey.Provider?.ToLowerInvariant(); if (rsaKeyProvider == "certificate" || rsaKeyProvider == "pkcs11") @@ -183,7 +183,7 @@ namespace Bit.CryptoAgent } } - private void AddAuthentication(IServiceCollection services, CryptoAgentSettings settings) + private void AddAuthentication(IServiceCollection services, KeyConnectorSettings settings) { services.Configure(options => { diff --git a/src/CryptoAgent/appsettings.Development.json b/src/KeyConnector/appsettings.Development.json similarity index 91% rename from src/CryptoAgent/appsettings.Development.json rename to src/KeyConnector/appsettings.Development.json index 82fdd4d..6cf7620 100644 --- a/src/CryptoAgent/appsettings.Development.json +++ b/src/KeyConnector/appsettings.Development.json @@ -13,7 +13,7 @@ "FromLogContext" ] }, - "cryptoAgentSettings": { + "keyConnectorSettings": { "webVaultUri": "https://localhost:8080/", "identityServerUri": "http://localhost:33656/" } diff --git a/src/CryptoAgent/appsettings.json b/src/KeyConnector/appsettings.json similarity index 96% rename from src/CryptoAgent/appsettings.json rename to src/KeyConnector/appsettings.json index 6144c85..ea1f0d6 100644 --- a/src/CryptoAgent/appsettings.json +++ b/src/KeyConnector/appsettings.json @@ -26,7 +26,7 @@ ] }, "AllowedHosts": "*", - "cryptoAgentSettings": { + "keyConnectorSettings": { "webVaultUri": "https://vault.bitwarden.com/", "identityServerUri": "https://identity.bitwarden.com/", "database": { diff --git a/src/CryptoAgent/build.sh b/src/KeyConnector/build.sh similarity index 51% rename from src/CryptoAgent/build.sh rename to src/KeyConnector/build.sh index 824f293..86e62dc 100644 --- a/src/CryptoAgent/build.sh +++ b/src/KeyConnector/build.sh @@ -8,12 +8,12 @@ echo -e "\n## Building Crypto Agent" echo -e "\nBuilding app" echo ".NET Core version $(dotnet --version)" echo "Restore" -dotnet restore "$DIR/CryptoAgent.csproj" +dotnet restore "$DIR/KeyConnector.csproj" echo "Clean" -dotnet clean "$DIR/CryptoAgent.csproj" -c "Release" -o "$DIR/obj/build-output/publish" +dotnet clean "$DIR/KeyConnector.csproj" -c "Release" -o "$DIR/obj/build-output/publish" echo "Publish" -dotnet publish "$DIR/CryptoAgent.csproj" -c "Release" -o "$DIR/obj/build-output/publish" +dotnet publish "$DIR/KeyConnector.csproj" -c "Release" -o "$DIR/obj/build-output/publish" echo -e "\nBuilding docker image" docker --version -docker build -t bitwarden/crypto-agent "$DIR/." +docker build -t bitwarden/key-connector "$DIR/." diff --git a/src/CryptoAgent/entrypoint.sh b/src/KeyConnector/entrypoint.sh similarity index 93% rename from src/CryptoAgent/entrypoint.sh rename to src/KeyConnector/entrypoint.sh index 39e915c..7a82afe 100644 --- a/src/CryptoAgent/entrypoint.sh +++ b/src/KeyConnector/entrypoint.sh @@ -37,4 +37,4 @@ chown -R $USERNAME:$GROUPNAME /etc/bitwarden cp /etc/bitwarden/ca-certificates/*.crt /usr/local/share/ca-certificates/ >/dev/null 2>&1 \ && update-ca-certificates -exec gosu $USERNAME:$GROUPNAME dotnet /app/CryptoAgent.dll +exec gosu $USERNAME:$GROUPNAME dotnet /app/KeyConnector.dll