Skip to content

Commit 18bbdc9

Browse files
Review/public surface (#21)
* Add CI workflow and v1 roadmap * Narrow EF public surface before v1
1 parent df06f10 commit 18bbdc9

9 files changed

Lines changed: 13 additions & 26 deletions

File tree

src/Proteos.Encryption.EntityFrameworkCore/Interceptors/DecryptingMaterializationInterceptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Proteos.Encryption.EntityFrameworkCore;
1414
/// Decryption happens before the change-tracking snapshot is taken, so the decrypted values become
1515
/// the entity's original values and a freshly loaded entity is not seen as modified.
1616
/// </summary>
17-
public sealed class DecryptingMaterializationInterceptor : IMaterializationInterceptor
17+
internal sealed class DecryptingMaterializationInterceptor : IMaterializationInterceptor
1818
{
1919
private readonly ITenantResolver _tenantResolver;
2020
private readonly AesGcmValueEncryptionService _encryptionService;

src/Proteos.Encryption.EntityFrameworkCore/Interceptors/EncryptingSaveChangesInterceptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Proteos.Encryption.EntityFrameworkCore;
1515
/// later. Encryption happens only for added entities and for the actually-modified properties of
1616
/// modified entities, so calling SaveChanges twice never produces ciphertext of ciphertext.
1717
/// </summary>
18-
public sealed class EncryptingSaveChangesInterceptor : SaveChangesInterceptor
18+
internal sealed class EncryptingSaveChangesInterceptor : SaveChangesInterceptor
1919
{
2020
private readonly ITenantResolver _tenantResolver;
2121
private readonly AesGcmValueEncryptionService _encryptionService;

src/Proteos.Encryption.EntityFrameworkCore/Metadata/BlindIndexNormalizerResolver.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace Proteos.Encryption.EntityFrameworkCore;
44

55
/// <summary>
6-
/// Maps a <see cref="BlindIndexNormalizerKind"/> to the concrete crypto-core normalizer. This is
7-
/// the stable bridge the later EF Core integration will use; it performs no EF runtime work.
6+
/// Maps a <see cref="BlindIndexNormalizerKind"/> to the concrete crypto-core normalizer. Internal
7+
/// helper used by the EF integration; not part of the public API.
88
/// </summary>
9-
public static class BlindIndexNormalizerResolver
9+
internal static class BlindIndexNormalizerResolver
1010
{
1111
public static IBlindIndexNormalizer Resolve(BlindIndexNormalizerKind kind) => kind switch
1212
{

src/Proteos.Encryption.EntityFrameworkCore/Migration/EncryptionMigrationPlanner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Proteos.Encryption.EntityFrameworkCore;
88
/// stored envelope (Base64 for a string property, raw bytes for a <c>byte[]</c> property), reads
99
/// <c>Header.KeyId</c> and compares it with the tenant's current key id — no decryption, no plaintext.
1010
/// </summary>
11-
public sealed class EncryptionMigrationPlanner : IEncryptionMigrationPlanner
11+
internal sealed class EncryptionMigrationPlanner : IEncryptionMigrationPlanner
1212
{
1313
private readonly ICiphertextEnvelopeCodec _codec;
1414
private readonly IKeyMaterialProvider _keyProvider;

src/Proteos.Encryption.EntityFrameworkCore/Migration/EncryptionMigrationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Proteos.Encryption.EntityFrameworkCore;
1212
/// both steps are done. It reuses the same encryption and blind index services the interceptors use,
1313
/// so a migrated value is indistinguishable from a freshly written one.
1414
/// </summary>
15-
public sealed class EncryptionMigrationService : IEncryptionMigrationService
15+
internal sealed class EncryptionMigrationService : IEncryptionMigrationService
1616
{
1717
private readonly AesGcmValueEncryptionService _encryptionService;
1818
private readonly IBlindIndexProvider _blindIndexProvider;

src/Proteos.Encryption.EntityFrameworkCore/Proteos.Encryption.EntityFrameworkCore.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@
3939
<AdditionalFiles Include="PublicAPI.Unshipped.txt" />
4040
</ItemGroup>
4141

42+
<ItemGroup>
43+
<InternalsVisibleTo Include="Proteos.Encryption.EntityFrameworkCore.Tests" />
44+
</ItemGroup>
45+
4246
</Project>

src/Proteos.Encryption.EntityFrameworkCore/PublicAPI.Shipped.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Microsoft.EntityFrameworkCore.ProteosEncryptionModelBuilderExtensions
77
Microsoft.EntityFrameworkCore.ProteosEncryptionPropertyBuilderExtensions
88
Microsoft.EntityFrameworkCore.ProteosEncryptionQueryableExtensions
99
Microsoft.Extensions.DependencyInjection.ProteosEncryptionServiceCollectionExtensions
10-
override Proteos.Encryption.EntityFrameworkCore.EncryptingSaveChangesInterceptor.SavingChanges(Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData! eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result) -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>
11-
override Proteos.Encryption.EntityFrameworkCore.EncryptingSaveChangesInterceptor.SavingChangesAsync(Microsoft.EntityFrameworkCore.Diagnostics.DbContextEventData! eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
1210
override Proteos.Encryption.EntityFrameworkCore.EncryptionAuditReport.ToString() -> string!
1311
override Proteos.Encryption.EntityFrameworkCore.ReEncryptResumeToken.Equals(object? obj) -> bool
1412
override Proteos.Encryption.EntityFrameworkCore.ReEncryptResumeToken.GetHashCode() -> int
@@ -20,10 +18,6 @@ Proteos.Encryption.EntityFrameworkCore.AlreadyEncryptedValueException.PropertyNa
2018
Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind
2119
Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind.Default = 0 -> Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind
2220
Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind.Email = 1 -> Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind
23-
Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerResolver
24-
Proteos.Encryption.EntityFrameworkCore.DecryptingMaterializationInterceptor
25-
Proteos.Encryption.EntityFrameworkCore.DecryptingMaterializationInterceptor.DecryptingMaterializationInterceptor(Proteos.Encryption.EntityFrameworkCore.ITenantResolver! tenantResolver, Proteos.Encryption.Core.AesGcmValueEncryptionService! encryptionService, System.IServiceProvider! serviceProvider) -> void
26-
Proteos.Encryption.EntityFrameworkCore.DecryptingMaterializationInterceptor.InitializedInstance(Microsoft.EntityFrameworkCore.Diagnostics.MaterializationInterceptionData materializationData, object! instance) -> object!
2721
Proteos.Encryption.EntityFrameworkCore.EncryptedAttribute
2822
Proteos.Encryption.EntityFrameworkCore.EncryptedAttribute.EncryptedAttribute() -> void
2923
Proteos.Encryption.EntityFrameworkCore.EncryptedAttribute.EncryptedAttribute(string! name) -> void
@@ -85,8 +79,6 @@ Proteos.Encryption.EntityFrameworkCore.EncryptedSearchableAttribute.IndexPropert
8579
Proteos.Encryption.EntityFrameworkCore.EncryptedSearchableAttribute.IndexProperty.set -> void
8680
Proteos.Encryption.EntityFrameworkCore.EncryptedSearchableAttribute.Normalizer.get -> Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind
8781
Proteos.Encryption.EntityFrameworkCore.EncryptedSearchableAttribute.Normalizer.set -> void
88-
Proteos.Encryption.EntityFrameworkCore.EncryptingSaveChangesInterceptor
89-
Proteos.Encryption.EntityFrameworkCore.EncryptingSaveChangesInterceptor.EncryptingSaveChangesInterceptor(Proteos.Encryption.EntityFrameworkCore.ITenantResolver! tenantResolver, Proteos.Encryption.Core.AesGcmValueEncryptionService! encryptionService, Proteos.Encryption.Abstractions.IBlindIndexProvider! blindIndexProvider, Proteos.Encryption.Core.ICiphertextEnvelopeCodec! codec, System.IServiceProvider! serviceProvider) -> void
9082
Proteos.Encryption.EntityFrameworkCore.EncryptionAuditEntry
9183
Proteos.Encryption.EntityFrameworkCore.EncryptionAuditEntry.Classification.get -> Proteos.Encryption.EntityFrameworkCore.EncryptionClassification
9284
Proteos.Encryption.EntityFrameworkCore.EncryptionAuditEntry.Classification.init -> void
@@ -109,14 +101,6 @@ Proteos.Encryption.EntityFrameworkCore.EncryptionClassification.Encrypted = 0 ->
109101
Proteos.Encryption.EntityFrameworkCore.EncryptionClassification.EncryptedSearchable = 1 -> Proteos.Encryption.EntityFrameworkCore.EncryptionClassification
110102
Proteos.Encryption.EntityFrameworkCore.EncryptionClassification.Plaintext = 2 -> Proteos.Encryption.EntityFrameworkCore.EncryptionClassification
111103
Proteos.Encryption.EntityFrameworkCore.EncryptionClassification.Unclassified = 3 -> Proteos.Encryption.EntityFrameworkCore.EncryptionClassification
112-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationPlanner
113-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationPlanner.CreatePlan(Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMetadata! metadata, System.Collections.Generic.IReadOnlyDictionary<string!, object?>! storedValues, Proteos.Encryption.Abstractions.TenantId! tenant) -> Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMigrationPlan!
114-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationPlanner.EncryptionMigrationPlanner(Proteos.Encryption.Core.ICiphertextEnvelopeCodec! codec, Proteos.Encryption.Core.IKeyMaterialProvider! keyProvider) -> void
115-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationPlanner.NeedsReEncryption(System.Type! propertyType, object? storedValue, Proteos.Encryption.Abstractions.KeyId! currentKeyId) -> bool
116-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationPlanner.ReadStoredKeyId(System.Type! propertyType, object? storedValue) -> Proteos.Encryption.Abstractions.KeyId?
117-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationService
118-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationService.EncryptionMigrationService(Proteos.Encryption.Core.AesGcmValueEncryptionService! encryptionService, Proteos.Encryption.Abstractions.IBlindIndexProvider! blindIndexProvider) -> void
119-
Proteos.Encryption.EntityFrameworkCore.EncryptionMigrationService.ReEncrypt(Proteos.Encryption.EntityFrameworkCore.EncryptedPropertyDescriptor! descriptor, object! storedValue, Proteos.Encryption.Abstractions.TenantId! tenant) -> Proteos.Encryption.EntityFrameworkCore.MigratedEncryptedProperty!
120104
Proteos.Encryption.EntityFrameworkCore.IEncryptionMigrationPlanner
121105
Proteos.Encryption.EntityFrameworkCore.IEncryptionMigrationPlanner.CreatePlan(Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMetadata! metadata, System.Collections.Generic.IReadOnlyDictionary<string!, object?>! storedValues, Proteos.Encryption.Abstractions.TenantId! tenant) -> Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMigrationPlan!
122106
Proteos.Encryption.EntityFrameworkCore.IEncryptionMigrationPlanner.NeedsReEncryption(System.Type! propertyType, object? storedValue, Proteos.Encryption.Abstractions.KeyId! currentKeyId) -> bool
@@ -186,7 +170,6 @@ static Microsoft.EntityFrameworkCore.ProteosEncryptionQueryableExtensions.WhereE
186170
static Microsoft.EntityFrameworkCore.ProteosEncryptionQueryableExtensions.WhereEncryptedEquals<TEntity>(this System.Linq.IQueryable<TEntity!>! source, Microsoft.EntityFrameworkCore.DbContext! dbContext, System.Linq.Expressions.Expression<System.Func<TEntity!, string?>!>! propertySelector, string? value) -> System.Linq.IQueryable<TEntity!>!
187171
static Microsoft.EntityFrameworkCore.ProteosEncryptionQueryableExtensions.WhereEncryptedIn<TEntity>(this System.Linq.IQueryable<TEntity!>! source, Microsoft.EntityFrameworkCore.DbContext! dbContext, System.Linq.Expressions.Expression<System.Func<TEntity!, string?>!>! propertySelector, System.Collections.Generic.IEnumerable<string!>! values) -> System.Linq.IQueryable<TEntity!>!
188172
static Microsoft.Extensions.DependencyInjection.ProteosEncryptionServiceCollectionExtensions.AddProteosEncryption(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Proteos.Encryption.EntityFrameworkCore.ProteosEncryptionOptions!>! configure) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
189-
static Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerResolver.Resolve(Proteos.Encryption.EntityFrameworkCore.BlindIndexNormalizerKind kind) -> Proteos.Encryption.Core.IBlindIndexNormalizer!
190173
static Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMetadataScanner.Scan(System.Type! entityType) -> Proteos.Encryption.EntityFrameworkCore.EncryptedEntityMetadata!
191174
static Proteos.Encryption.EntityFrameworkCore.EncryptionAuditReport.Create(Microsoft.EntityFrameworkCore.Metadata.IReadOnlyModel! model) -> Proteos.Encryption.EntityFrameworkCore.EncryptionAuditReport!
192175
static Proteos.Encryption.EntityFrameworkCore.ReEncryptBatchOptions.Default.get -> Proteos.Encryption.EntityFrameworkCore.ReEncryptBatchOptions!

tests/Proteos.Encryption.AwsKms.Tests/AwsKmsKeyProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void AddProteosAwsKms_InvalidKeyId_Throws()
144144

145145
[Theory]
146146
[InlineData(typeof(AesGcmValueEncryptionService))] // Proteos.Encryption.Core
147-
[InlineData(typeof(EncryptingSaveChangesInterceptor))] // Proteos.Encryption.EntityFrameworkCore
147+
[InlineData(typeof(EncryptedAttribute))] // Proteos.Encryption.EntityFrameworkCore
148148
[InlineData(typeof(AzureKeyVaultKeyProvider))] // Proteos.Encryption.AzureKeyVault
149149
public void CoreEfAndAzure_DoNotReferenceAws(Type typeFromAssembly)
150150
{

tests/Proteos.Encryption.AzureKeyVault.Tests/AzureKeyVaultKeyProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void AddProteosAzureKeyVault_InvalidKeyIdentifier_Throws()
153153

154154
[Theory]
155155
[InlineData(typeof(AesGcmValueEncryptionService))] // Proteos.Encryption.Core
156-
[InlineData(typeof(EncryptingSaveChangesInterceptor))] // Proteos.Encryption.EntityFrameworkCore
156+
[InlineData(typeof(EncryptedAttribute))] // Proteos.Encryption.EntityFrameworkCore
157157
public void CoreAndEf_DoNotReferenceAzure(Type typeFromAssembly)
158158
{
159159
var referenced = typeFromAssembly.Assembly.GetReferencedAssemblies();

0 commit comments

Comments
 (0)