Releases: djesusnet/Maskify.Core
1.4.1
1.4.0
What's Changed
Mask RG
Mask Brazilian RG numbers (7 to 9 digits), formatted or unformatted:
using Maskify.Core;
// RG formatado
string rgFormatted = "46.546.987-3";
string maskedRgFormatted = Masker.MaskRG(rgFormatted);
Console.WriteLine(maskedRgFormatted); // Output: **.***.***-3
// RG não formatado
string rgUnformatted = "465469873";
string maskedRgUnformatted = Masker.MaskRG(rgUnformatted);
Console.WriteLine(maskedRgUnformatted); // Output: *******3
// RG com 7 dígitos
string rgShort = "1234567";
string maskedRgShort = Masker.MaskRG(rgShort);
Console.WriteLine(maskedRgShort); // Output: *****67
1.3.3
What's Changed
Mask License Plate
Mask Brazilian license plates (old and Mercosul formats), showing only the first 3 characters:
using Maskify.Core;
string licensePlate = "BRA2E19";
string maskedLicensePlate = Masker.MaskLicensePlate(licensePlate);
Console.WriteLine(maskedLicensePlate); // Output: BRA****
New Contributors
Full Changelog: 1.0.0...1.3.3
1.0.0
Maskify - Sensitive Data Masking Library
A simple, powerful, and efficient way to mask sensitive data.
Maskify is a powerful and easy-to-use library for masking sensitive data such as Brazilian documents (CPF, CNPJ) and emails. It also allows you to mask any other type of information through highly customizable, generic methods.
Features
- CPF Masking: Masks CPF numbers, with or without formatting.
- CNPJ Masking: Supports CNPJ formatting, allowing input with or without mask.
- Email Masking: Partially hides email addresses, preserving domain integrity.
- Generic Masking Method: Allows you to mask any type of sensitive data, such as phone numbers, addresses, and more.
Installation
You can install the package directly from NuGet:
dotnet add package Maskify
Or visit the NuGet package page: Maskify.Core on NuGet
Usage
1. Mask CPF
using Maskify.Core.Libray;
string cpf = "000.000.000-00";
string maskedCpf = Masker.MaskCPF(cpf);
Console.WriteLine(maskedCpf); // Output: ***.***.***-00
2. Mask CNPJ
using Maskify.Core.Libray;
string cnpj = "00.000.000/0000-00";
string maskedCnpj = Masker.MaskCNPJ(cnpj);
Console.WriteLine(maskedCnpj); // Output: **.***.***/****-00
3. Mask Email
using Maskify.Core.Libray;
string email = "[email protected]";
string maskedEmail = Masker.MaskEmail(email);
Console.WriteLine(maskedEmail); // Output: use****@example.com
4. Mask Any Other Data
In addition to specific methods for CPF, CNPJ, and email, you can mask any type of data using the generic method:
using Maskify.Core.Libray;
string sensitiveData = "My confidential info";
string maskedData = Masker.Mask(sensitiveData, 5, 3, '*');
Console.WriteLine(maskedData); // Output: ***** confidential ****
Parameters:
char
: Character used for masking (e.g.,*
or#
).startPosition
: Number of characters to keep visible at the start.length
: Number of characters to mask after the start position.
1.3.2
What's Changed
Language Update: Adjusted texts and properties to English for better internationalization.
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.3.2
New Contributors
- @thiagocorreanet made their first contribution in #7
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.3.2
1.3.1
What's Changed
Bug Fixes: Mobile Phone Masking Fix: Corrected an issue with the masking of Brazilian mobile phone numbers to ensure accurate formatting.
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.3.1
1.3.0
New Features:
- DataAnnotations Support: Easily mask fields like CPF, CNPJ, credit cards, emails, and phone numbers (mobile and residential) directly in your models using MaskSensitiveData.
- Flexible Masking: Customize the masking character and define error messages for invalid data.
- Mobile & Residential Phone Masking: Supports Brazilian phone numbers (both mobile and residential).
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.3.0
1.2.1
Bug Fix
Fixed an issue where the DataType
was not being correctly found within the MaskSensitiveDataAttribute
. This resolves compatibility issues and ensures smoother integration when applying the DataAnnotation to properties.
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.2.1
1.2.0
What's Changed
Version 1.2.0 introduces a powerful new feature: the MaskSensitiveData DataAnnotation. This allows developers to apply masking directly to properties within their classes, making it easier to protect sensitive information such as CPF, CNPJ, Credit Card numbers, and Emails.
Features
- DataAnnotations Support: Mask sensitive data fields directly with the
MaskSensitiveData
attribute. - Flexible Masking: Customize the masking character and define error messages.
- Data Types Supported: CPF, CNPJ, Credit Card, Email, with more to come.
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.2.0
1.1.1
New Features:
- Credit Card Masking: Supports standard 16-digit, Amex 15-digit, and Diners Club 14-digit card formats.
Improvements:
- Improved handling of CPF and CNPJ inputs, now accepting both formatted and unformatted data.
Bug Fixes:
- Fixed inconsistencies in email masking patterns for various formats.
New Contributors
- @ferronicardoso made their first contribution in #1
Full Changelog: https://github.com/djesusnet/Maskify.Core/commits/1.1.1