Skip to content

feat: Add field-level encryption for sensitive properties#18

Open
PieterjanDeClippel wants to merge 1 commit into
masterfrom
feat/field-level-encryption
Open

feat: Add field-level encryption for sensitive properties#18
PieterjanDeClippel wants to merge 1 commit into
masterfrom
feat/field-level-encryption

Conversation

@PieterjanDeClippel

Copy link
Copy Markdown
Member

Summary

  • Adds MintPlayer.Spark.Encryption.Abstractions project with [Encrypted] attribute and SparkEncryptionOptions (OwnKey + ModuleKeys)
  • Adds MintPlayer.Spark.Encryption project with AES-256-GCM encrypt/decrypt, hooking into IDocumentStore.OnBeforeStore / OnAfterConversionToEntity events
  • Encrypted values stored as opaque ENC:v1:{iv}:{ciphertext}:{tag} blobs — safe for RavenDB ETL replication between modules
  • Cross-module key resolution via [Replicated(SourceModule)] attribute — consuming modules decrypt with the source module's key
  • Startup validation throws if [Encrypted] is used on non-string properties
  • Auto-generates a dev key in Development mode when OwnKey is not configured
  • Demo: Fleet Car.VinNumber encrypted at rest, replicated as encrypted blob to HR, decrypted on read in both modules

Test plan

  • dotnet build MintPlayer.Spark.sln compiles with no errors
  • Temporarily add [Encrypted] to an int property → confirm startup throws InvalidOperationException
  • Start Fleet app, create a Car with VinNumber → verify RavenDB document shows ENC:v1:... blob
  • Load Car via Fleet API → confirm plaintext VinNumber is returned
  • Start both Fleet + HR → create Car in Fleet → verify encrypted VinNumber blob replicates to HR database → load Car in HR → confirm decrypted VinNumber

🤖 Generated with Claude Code

…rties

Introduces AES-256-GCM encryption for string properties marked with
[Encrypted]. Encrypted values are stored as opaque ENC:v1:{iv}:{ct}:{tag}
blobs, enabling safe replication via RavenDB ETL between modules. Each
module uses its own key, with cross-module keys for decrypting replicated
data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant