Byndyusoft.MaskedSerialization.Newtonsoft 3.0.0

dotnet add package Byndyusoft.MaskedSerialization.Newtonsoft --version 3.0.0                
NuGet\Install-Package Byndyusoft.MaskedSerialization.Newtonsoft -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.Newtonsoft" 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.Newtonsoft --version 3.0.0                
#r "nuget: Byndyusoft.MaskedSerialization.Newtonsoft, 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.Newtonsoft as a Cake Addin
#addin nuget:?package=Byndyusoft.MaskedSerialization.Newtonsoft&version=3.0.0

// Install Byndyusoft.MaskedSerialization.Newtonsoft as a Cake Tool
#tool nuget:?package=Byndyusoft.MaskedSerialization.Newtonsoft&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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Byndyusoft.MaskedSerialization.Newtonsoft:

Package Downloads
Byndyusoft.AspNetCore.Instrumentation.Tracing

ASP.NET Core MVC tracing.

Byndyusoft.Tracing

Package Description

Byndyusoft.Net.Kafka

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 186 1/26/2024
2.1.2 142 9/8/2023
2.1.1 127 9/8/2023
2.1.0 8,621 8/5/2022
2.0.0 2,175 3/3/2022
1.1.0-alpha 226 2/25/2022
1.0.1 1,783 5/24/2021