MongoDbRepository.Extensions.Audit.Cryptography 6.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package MongoDbRepository.Extensions.Audit.Cryptography --version 6.3.2
                    
NuGet\Install-Package MongoDbRepository.Extensions.Audit.Cryptography -Version 6.3.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MongoDbRepository.Extensions.Audit.Cryptography" Version="6.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MongoDbRepository.Extensions.Audit.Cryptography" Version="6.3.2" />
                    
Directory.Packages.props
<PackageReference Include="MongoDbRepository.Extensions.Audit.Cryptography" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MongoDbRepository.Extensions.Audit.Cryptography --version 6.3.2
                    
#r "nuget: MongoDbRepository.Extensions.Audit.Cryptography, 6.3.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MongoDbRepository.Extensions.Audit.Cryptography@6.3.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MongoDbRepository.Extensions.Audit.Cryptography&version=6.3.2
                    
Install as a Cake Addin
#tool nuget:?package=MongoDbRepository.Extensions.Audit.Cryptography&version=6.3.2
                    
Install as a Cake Tool

MongoDbRepository.Extensions.Audit.Cryptography

Exposes decoupled corporate compliance features for security-hardened environments, providing field-level encryption at rest and structural forensic modification history tracking.

🌟 Features

  • Transparent Column Cryptography: Attaches an encrypted BSON mapping convention via the [ProtectedString] attribute to encrypt strings transparently before they exit the network socket.
  • Anti-Pattern Proof DI Configuration: Utilizes an modern IConfigureOptions<MongoDbOptions> interceptor pipeline to defer static convention mappings until the container is fully constructed, completely eliminating premature BuildServiceProvider() crashes.
  • Forensic Differential Tracking: A rapid, light reflection engine that computes clean JSON delta mutations (old value vs. new value) across your domain models to generate audit logs.

🚀 Quick Start

1. Annotate Secured Entity Fields

Mark sensitive plain-text strings with the [ProtectedString] attribute. Identifier keys and audit properties are automatically passed safely up via standard constructor initialization chaining rules:

using MongoDB.Bson;
using MongoDbRepository.Core.Models;
using MongoDbRepository.Extensions.Audit.Cryptography.Attributes;

public class EmployeeContract : ObjectIdDocument
{
    public string CorporateId { get; init; } = string.Empty;

    [ProtectedString] // Encrypted/Decrypted transparently at the driver socket layer
    public string TaxIdentifier { get; set; } = string.Empty;
}

2. Activate the Cryptography Pipeline (Program.cs)

C#
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDataProtection(); // Required for machine/cluster crypto keys
builder.Services.AddMongoDbRepositoryCore(builder.Configuration.GetSection("MongoDb"));

// Safely registers the cryptographic serialization convention pack
builder.Services.AddMongoDbFieldEncryption(); 

3. Generate Structural Audit History Deltas

C#
// Deeply compares two instances to generate a queryable audit tracking string
string changesJson = MongoDbRepository.Extensions.Audit.Engine.AuditDiffEngine.ComputeDelta(originalContract, modifiedContract);

// Output schema: {"TaxIdentifier":{"OldValue":"123-45","NewValue":"987-65"}}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.4.3 106 8/14/2026
6.4.2 100 8/7/2026
6.4.0 101 8/5/2026
6.3.2 115 8/1/2026
6.3.1 104 8/1/2026
6.3.0 107 7/24/2026
6.1.1 105 7/1/2026
6.1.0 117 7/1/2026