Byndyusoft.MaskedSerialization.Annotations 3.0.0

dotnet add package Byndyusoft.MaskedSerialization.Annotations --version 3.0.0
NuGet\Install-Package Byndyusoft.MaskedSerialization.Annotations -Version 3.0.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="Byndyusoft.MaskedSerialization.Annotations" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Byndyusoft.MaskedSerialization.Annotations --version 3.0.0
#r "nuget: Byndyusoft.MaskedSerialization.Annotations, 3.0.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 Byndyusoft.MaskedSerialization.Annotations as a Cake Addin
#addin nuget:?package=Byndyusoft.MaskedSerialization.Annotations&version=3.0.0

// Install Byndyusoft.MaskedSerialization.Annotations as a Cake Tool
#tool nuget:?package=Byndyusoft.MaskedSerialization.Annotations&version=3.0.0

Byndyusoft.MaskedSerialization Nuget Downloads

A tool to mask sensitive data during serialization with the System.Text.Json package

Installing

dotnet add package Byndyusoft.MaskedSerialization

Usage

If you use System.Text.Json to serialize data, use [Masked] attribute to mark properties that should be masked. Example:

  public class CompanyDto
  {
      public string Name { get; set; } = default!;

      [Masked]
      public string SecretOwner { get; set; } = default!;

      public IncomeDto WhiteIncome { get; set; } = default!;

      [Masked]
      public IncomeDto GreyIncome { get; set; } = default!;
  }

  public class IncomeDto
  {
      public string Description { get; set; } = default!;

      [Masked]
      public long SumInDollars { get; set; }
  }

Values of properties SecretOwner and GreyIncome of class CompanyDto will be masked with value "*". Here is an example of simple usage:

  var dto = new CompanyDto
                {
                    Name = "Mega Big Company",
                    SecretOwner = "Navalov",
                    WhiteIncome = new IncomeDto
                                      {
                                          Description = "White",
                                          SumInDollars = 1000000
                                      },
                    GreyIncome = new IncomeDto
                                     {
                                         Description = "Black",
                                         SumInDollars = 1000000000
                                     }
                };

  var serialized = MaskedSerializationHelper.SerializeWithMasking(dto);

The result will be:

{
   "Name":"Mega Big Company",
   "SecretOwner":"*",
   "WhiteIncome":{
      "Description":"White",
      "SumInDollars":"*"
   },
   "GreyIncome":"*"
}

You can setup serializer options to enable masking. Another usage example:

  var options = new JsonSerializerOptions();
  MaskedSerializationHelper.SetupSettingsForMaskedSerialization(options);
  var serialized = JsonSerializer.Serialize(dto, options);

Byndyusoft.MaskedSerialization.Newtonsoft Nuget Downloads

A tool to mask sensitive data during serialization with Newtonsoft.Json

Installing

dotnet add package Byndyusoft.MaskedSerialization.Newtonsoft

Usage

If you use Newtonsoft.Json to serialize data, use [Masked] attribute to mark properties that should be masked. Usage example:

  var serialized = MaskedSerializationHelper.SerializeWithMasking(dto);
  // Another usage example
  var settings = new JsonSerializerSettings();
  MaskedSerializationHelper.SetupSettingsForMaskedSerialization(settings);
  var serialized = JsonConvert.SerializeObject(dto, settings);

Byndyusoft.MaskedSerialization.Serilog Nuget Downloads

A tool to mask sensitive destructured data in logging with Serilog

Installing

dotnet add package Byndyusoft.MaskedSerialization.Serilog

Usage

You can setup logger configuration to use destructure masking policy:

  var loggerConfiguration = new LoggerConfiguration().WithMaskingPolicy().WriteTo.Console();

Here is an example of simple usage:

public class Service
{
  private readonly ILogger<Service> _logger;

  public Service(ILogger<Service> logger)
  {
    _logger = logger;
  }

  public void LogCompany()
  {
    var dto = new CompanyDto
                  {
                      Name = "Mega Big Company",
                      SecretOwner = "Navalov",
                      WhiteIncome = new IncomeDto
                                        {
                                            Description = "White",
                                            SumInDollars = 1000000
                                        },
                      GreyIncome = new IncomeDto
                                       {
                                           Description = "Black",
                                           SumInDollars = 1000000000
                                       }
                  };
    
    _logger.LogInformation("Used company {@CompanyDto}", dto);
  }
}

The output in the console will be:

  [10:47:31 INF] Used company {"Name": "Mega Big Company", "SecretOwner": "*", "WhiteIncome": {"Description": "White", "SumInDollars": "*", "$type": "IncomeDto"}, "GreyIncome": "*", "$type": "CompanyDto"}

Contributing

To contribute, you will need to setup your local environment, see prerequisites. For a contribution and workflow guide, see package development lifecycle.

A detailed overview on how to contribute can be found in the contributing guide.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Package development lifecycle

  • Implement package logic in src
  • Add or adapt unit-tests in tests
  • Add or change the documentation as needed
  • Open pull request for a correct branch. Target the project's master branch

Maintainers

github.maintain@byndyusoft.com

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Byndyusoft.MaskedSerialization.Annotations:

Package Downloads
Byndyusoft.MaskedSerialization.Core

Package Description

Byndyusoft.MaskedSerialization.Newtonsoft

Package Description

Byndyusoft.MaskedSerialization.Serilog

Package Description

Byndyusoft.MaskedSerialization

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 881 1/26/2024
2.1.2 557 9/8/2023
2.1.1 213 9/8/2023
2.1.0 6,619 8/5/2022
2.0.0 3,568 3/3/2022
1.1.0-alpha 247 2/25/2022