Microsoft.Extensions.Compliance.Redaction 8.4.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Microsoft.Extensions.Compliance.Redaction --version 8.4.0
NuGet\Install-Package Microsoft.Extensions.Compliance.Redaction -Version 8.4.0
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="Microsoft.Extensions.Compliance.Redaction" Version="8.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.Extensions.Compliance.Redaction --version 8.4.0
#r "nuget: Microsoft.Extensions.Compliance.Redaction, 8.4.0"
#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.
// Install Microsoft.Extensions.Compliance.Redaction as a Cake Addin
#addin nuget:?package=Microsoft.Extensions.Compliance.Redaction&version=8.4.0

// Install Microsoft.Extensions.Compliance.Redaction as a Cake Tool
#tool nuget:?package=Microsoft.Extensions.Compliance.Redaction&version=8.4.0

Microsoft.Extensions.Compliance.Redaction

A redaction engine and canonical redactors.

Install the package

From the command-line:

dotnet add package Microsoft.Extensions.Compliance.Redaction

Or directly in the C# project file:

<ItemGroup>
  <PackageReference Include="Microsoft.Extensions.Compliance.Redaction" Version="[CURRENTVERSION]" />
</ItemGroup>

Usage Example

Registering the services

The services can be registered using one of the AddRedaction overloads:

public static IServiceCollection AddRedaction(this IServiceCollection services)
public static IServiceCollection AddRedaction(this IServiceCollection services, Action<IRedactionBuilder> configure)

Configuring a redactor

Redactors are fetched at runtime using an IRedactorProvider. You can choose to implement your own provider and register it inside the AddRedaction call, or alternatively you can just use the default provider. Redactors can be configured using one of these IRedactionBuilder extension methods:

// Using the default redactor provider:
builder.Services.AddRedaction(redactionBuilder =>
{
    // Assigns a redactor to use for a set of data classifications.
    redactionBuilder.SetRedactor<MyRedactor>(MySensitiveDataClassification);
    // Assigns a fallback redactor to use when processing classified data for which no specific redactor has been registered. 
    // The `ErasingRedactor` is the default fallback redactor. If no redactor is configured for a data classification then the data will be erased.
    redactionBuilder.SetFallbackRedactor<MyFallbackRedactor>();
});

// Using a custom redactor provider:
builder.Services.AddSingleton<IRedactorProvider, MyRedactorProvider>();
builder.Services.AddRedaction(redactionBuilder => { });

Configuring the HMAC redactor

The HMAC redactor can be configured using one these IRedactionBuilder extension methods:

public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, Action<HmacRedactorOptions> configure, params DataClassificationSet[] classifications)
public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, IConfigurationSection section, params DataClassificationSet[] classifications)

The HmacRedactorOptions requires its KeyId and Key properties to be set. The HmacRedactor is still in the experimental phase, which means that the above two methods will show warning EXTEXP0002 notifying you that the HmacRedactor is not yet stable. In order to use it, you will need to either add <NoWarn>$(NoWarn);EXTEXP0002</NoWarn> to your project file or add #pragma warning disable EXTEXP0002 around the calls to SetHmacRedactor.

Feedback & Contributing

We welcome feedback and contributions in our GitHub repo.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Microsoft.Extensions.Compliance.Redaction:

Package Downloads
Reliance.Titan.Core

Package designed by Reliance Consultoria that provides support for handling cross-cutting concerns in our Microservices.

Core.Runtime.DataProtection

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0-preview.3.24209.3 202 4/11/2024
9.0.0-preview.2.24157.4 243 3/12/2024
9.0.0-preview.1.24108.1 91 2/13/2024
8.4.0 4,377 4/9/2024
8.3.0 3,772 3/12/2024
8.2.0 7,219 2/13/2024
8.1.0 4,494 1/9/2024
8.0.0 8,820 11/14/2023
8.0.0-rc.2.23510.2 101 10/10/2023
8.0.0-rc.1.23453.1 120 9/12/2023
8.0.0-preview.7.23407.5 93 8/8/2023
8.0.0-preview.6.23360.2 86 7/12/2023
8.0.0-preview.5.23308.3 79 6/14/2023
8.0.0-preview.4.23273.7 85 5/23/2023