![]() |
VOOZH | about |
dotnet add package Byndyusoft.MaskedSerialization.Newtonsoft --version 3.1.0
NuGet\Install-Package Byndyusoft.MaskedSerialization.Newtonsoft -Version 3.1.0
<PackageReference Include="Byndyusoft.MaskedSerialization.Newtonsoft" Version="3.1.0" />
<PackageVersion Include="Byndyusoft.MaskedSerialization.Newtonsoft" Version="3.1.0" />Directory.Packages.props
<PackageReference Include="Byndyusoft.MaskedSerialization.Newtonsoft" />Project file
paket add Byndyusoft.MaskedSerialization.Newtonsoft --version 3.1.0
#r "nuget: Byndyusoft.MaskedSerialization.Newtonsoft, 3.1.0"
#:package Byndyusoft.MaskedSerialization.Newtonsoft@3.1.0
#addin nuget:?package=Byndyusoft.MaskedSerialization.Newtonsoft&version=3.1.0Install as a Cake Addin
#tool nuget:?package=Byndyusoft.MaskedSerialization.Newtonsoft&version=3.1.0Install as a Cake Tool
A tool to mask sensitive data during serialization with the System.Text.Json package
dotnet add package Byndyusoft.MaskedSerialization
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);
A tool to mask sensitive data during serialization with Newtonsoft.Json
dotnet add package Byndyusoft.MaskedSerialization.Newtonsoft
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);
A tool to mask sensitive destructured data in logging with Serilog
dotnet add package Byndyusoft.MaskedSerialization.Serilog
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"}
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 .
Make sure you have installed all of the following prerequisites on your development machine:
srctestsmaster branch| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Byndyusoft.MaskedSerialization.Newtonsoft:
| Package | Downloads |
|---|---|
|
Byndyusoft.Tracing
Package Description |
|
|
Byndyusoft.Net.Kafka
Package Description |
This package is not used by any popular GitHub repositories.