maskify-py


Namemaskify-py JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/ferronicardoso/maskify-py
SummaryMaskify is a lightweight, efficient, and flexible library designed to help developers securely mask sensitive data such as Brazilian documents (CPF, CNPJ), emails, credit cards, mobile and residential phones, and more. It provides out-of-the-box masking for common data types and customizable masking options for any other sensitive information, ensuring compliance with data protection regulations like LGPD.
upload_time2024-10-26 18:08:39
maintainerNone
docs_urlNone
authorRaphael Augusto Ferroni Cardoso
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Maskify - Sensitive Data Masking Library for Python

**Maskify** is a lightweight, flexible library for Python, inspired by the [Maskify.Core](https://github.com/djesusnet/Maskify.Core) library for .NET. It helps developers securely mask sensitive data, such as Brazilian documents (CPF, CNPJ), emails, credit cards, and phone numbers. This library provides built-in masking for common data types, along with customizable masking options to ensure compliance with data protection regulations.

## Features

- **Mask CPF and CNPJ**: Easily mask Brazilian CPF and CNPJ numbers.
- **Email Masking**: Partially mask email addresses.
- **Credit Card Masking**: Mask credit card numbers while preserving the last few digits.
- **Phone Number Masking**: Support for mobile and residential phone numbers.
- **Custom Masking**: Mask any string by specifying a start position, length, and masking character.

## Installation

To install Maskify, run:

```bash
pip install maskify-py
```

## Usage

Below are examples of using Maskify for different types of sensitive data.

### 1. Masking CPF

The CPF format consists of 11 digits. Maskify will retain the last two digits and mask the middle portion:

```python
from maskify.masker import Masker

cpf = "123.456.789-01"
masked_cpf = Masker.mask_cpf(cpf, "X")
print(masked_cpf)  

# Output: "123.***.**9-01"
```

### 2. Masking CNPJ

The CNPJ format consists of 14 digits. Maskify will retain the first two and last two digits, masking the middle portion:

```python
from maskify import mask_cnpj

cnpj = "12.345.678/0001-99"
masked_cnpj = Masker.mask_cnpj(cnpj, "X")
print(masked_cnpj)  

# Output: "12.XXX.XXX/XX01-99"
```

### 3. Masking Email

The email masking function hides a portion of the local part of the email (before `@`), leaving the first and last characters visible:

```python
from maskify import mask_email

email = "usuario@exemplo.com"
masked_email = Masker.mask_email(email, "*")
print(masked_email)  

# Output: "u*****o@exemplo.com"
```

### 4. Masking Credit Card

Maskify supports multiple credit card formats, including standard 16-digit cards, American Express (15 digits), and Diners Club (14 digits). It retains only the last four digits, masking the rest:

```python
from maskify import mask_credit_card

credit_card = "1234 1234 1234 1234"
masked_credit_card = Masker.mask_credit_card(credit_card, "*")
print(masked_card)  

# Output: "**** **** **** 1234"
```

### 5. Masking Mobile Phone Numbers

Mobile phone numbers with 11 digits are masked to display only the area code, first digit, and last four digits:

```python
from maskify import mask_mobile_phone

mobile_phone = "(11) 91234-5678"
masked_mobile_phone = Masker.mask_mobile_phone(mobile_phone)
print(masked_phone)  

# Output: "(11) *****-5678"
```

### 6. Masking Residential Phone Numbers

Residential phone numbers with 10 digits are masked to display only the area code, first two digits, and last four digits:

```python
from maskify import mask_residential_phone

residential_phone = "(11) 1234-5678"
masked_residential_phone = Masker.mask_residential_phone(residential_phone)
print(masked_phone)  

# Output: "(11) ****-5678"
```

### 7. Custom Masking

Maskify provides a general `mask` function to apply a mask to any string. Specify the start position, length of the mask, and masking character:

```python
from maskify import mask

text = "1234567890"
masked_text = mask(text, start_position=2, length=4)
print(masked_text)  

# Output: "12****7890"
```

## Error Handling

If input values do not meet format requirements, Maskify functions raise a `ValueError` with a descriptive message. Ensure that inputs are in the expected format (e.g., 11 digits for CPF, 14 digits for CNPJ) to avoid exceptions.

## Contributing

We welcome contributions to enhance Maskify! Feel free to submit issues or pull requests. For major changes, please open a discussion first to share your proposed changes.

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ferronicardoso/maskify-py",
    "name": "maskify-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Raphael Augusto Ferroni Cardoso",
    "author_email": "raphaelcardoso@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/64/f3/15cc3675768eb1515b04e89f574a7989f1e0a9d625662f38557ee41c7701/maskify-py-0.1.0.tar.gz",
    "platform": null,
    "description": "# Maskify - Sensitive Data Masking Library for Python\n\n**Maskify** is a lightweight, flexible library for Python, inspired by the [Maskify.Core](https://github.com/djesusnet/Maskify.Core) library for .NET. It helps developers securely mask sensitive data, such as Brazilian documents (CPF, CNPJ), emails, credit cards, and phone numbers. This library provides built-in masking for common data types, along with customizable masking options to ensure compliance with data protection regulations.\n\n## Features\n\n- **Mask CPF and CNPJ**: Easily mask Brazilian CPF and CNPJ numbers.\n- **Email Masking**: Partially mask email addresses.\n- **Credit Card Masking**: Mask credit card numbers while preserving the last few digits.\n- **Phone Number Masking**: Support for mobile and residential phone numbers.\n- **Custom Masking**: Mask any string by specifying a start position, length, and masking character.\n\n## Installation\n\nTo install Maskify, run:\n\n```bash\npip install maskify-py\n```\n\n## Usage\n\nBelow are examples of using Maskify for different types of sensitive data.\n\n### 1. Masking CPF\n\nThe CPF format consists of 11 digits. Maskify will retain the last two digits and mask the middle portion:\n\n```python\nfrom maskify.masker import Masker\n\ncpf = \"123.456.789-01\"\nmasked_cpf = Masker.mask_cpf(cpf, \"X\")\nprint(masked_cpf)  \n\n# Output: \"123.***.**9-01\"\n```\n\n### 2. Masking CNPJ\n\nThe CNPJ format consists of 14 digits. Maskify will retain the first two and last two digits, masking the middle portion:\n\n```python\nfrom maskify import mask_cnpj\n\ncnpj = \"12.345.678/0001-99\"\nmasked_cnpj = Masker.mask_cnpj(cnpj, \"X\")\nprint(masked_cnpj)  \n\n# Output: \"12.XXX.XXX/XX01-99\"\n```\n\n### 3. Masking Email\n\nThe email masking function hides a portion of the local part of the email (before `@`), leaving the first and last characters visible:\n\n```python\nfrom maskify import mask_email\n\nemail = \"usuario@exemplo.com\"\nmasked_email = Masker.mask_email(email, \"*\")\nprint(masked_email)  \n\n# Output: \"u*****o@exemplo.com\"\n```\n\n### 4. Masking Credit Card\n\nMaskify supports multiple credit card formats, including standard 16-digit cards, American Express (15 digits), and Diners Club (14 digits). It retains only the last four digits, masking the rest:\n\n```python\nfrom maskify import mask_credit_card\n\ncredit_card = \"1234 1234 1234 1234\"\nmasked_credit_card = Masker.mask_credit_card(credit_card, \"*\")\nprint(masked_card)  \n\n# Output: \"**** **** **** 1234\"\n```\n\n### 5. Masking Mobile Phone Numbers\n\nMobile phone numbers with 11 digits are masked to display only the area code, first digit, and last four digits:\n\n```python\nfrom maskify import mask_mobile_phone\n\nmobile_phone = \"(11) 91234-5678\"\nmasked_mobile_phone = Masker.mask_mobile_phone(mobile_phone)\nprint(masked_phone)  \n\n# Output: \"(11) *****-5678\"\n```\n\n### 6. Masking Residential Phone Numbers\n\nResidential phone numbers with 10 digits are masked to display only the area code, first two digits, and last four digits:\n\n```python\nfrom maskify import mask_residential_phone\n\nresidential_phone = \"(11) 1234-5678\"\nmasked_residential_phone = Masker.mask_residential_phone(residential_phone)\nprint(masked_phone)  \n\n# Output: \"(11) ****-5678\"\n```\n\n### 7. Custom Masking\n\nMaskify provides a general `mask` function to apply a mask to any string. Specify the start position, length of the mask, and masking character:\n\n```python\nfrom maskify import mask\n\ntext = \"1234567890\"\nmasked_text = mask(text, start_position=2, length=4)\nprint(masked_text)  \n\n# Output: \"12****7890\"\n```\n\n## Error Handling\n\nIf input values do not meet format requirements, Maskify functions raise a `ValueError` with a descriptive message. Ensure that inputs are in the expected format (e.g., 11 digits for CPF, 14 digits for CNPJ) to avoid exceptions.\n\n## Contributing\n\nWe welcome contributions to enhance Maskify! Feel free to submit issues or pull requests. For major changes, please open a discussion first to share your proposed changes.\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Maskify is a lightweight, efficient, and flexible library designed to help developers securely mask sensitive data such as Brazilian documents (CPF, CNPJ), emails, credit cards, mobile and residential phones, and more. It provides out-of-the-box masking for common data types and customizable masking options for any other sensitive information, ensuring compliance with data protection regulations like LGPD.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/ferronicardoso/maskify-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c120223bc009d85403047751dd3176837bd9cbcdfe385b3616982d742520ab46",
                "md5": "4483ad021c7a8c3d05b129a2c016158d",
                "sha256": "2ff02bcb6f80ee0082def50f441ca85ae01d838ade2a4ff6dd40233f89052106"
            },
            "downloads": -1,
            "filename": "maskify_py-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4483ad021c7a8c3d05b129a2c016158d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6920,
            "upload_time": "2024-10-26T18:08:37",
            "upload_time_iso_8601": "2024-10-26T18:08:37.460633Z",
            "url": "https://files.pythonhosted.org/packages/c1/20/223bc009d85403047751dd3176837bd9cbcdfe385b3616982d742520ab46/maskify_py-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64f315cc3675768eb1515b04e89f574a7989f1e0a9d625662f38557ee41c7701",
                "md5": "bbc9f5dc432e92129a9688fad5fa3a25",
                "sha256": "1fa5d9c665668141f890860ddee0dd194804cc7627473a283d54d2f173652135"
            },
            "downloads": -1,
            "filename": "maskify-py-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bbc9f5dc432e92129a9688fad5fa3a25",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6001,
            "upload_time": "2024-10-26T18:08:39",
            "upload_time_iso_8601": "2024-10-26T18:08:39.424692Z",
            "url": "https://files.pythonhosted.org/packages/64/f3/15cc3675768eb1515b04e89f574a7989f1e0a9d625662f38557ee41c7701/maskify-py-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-26 18:08:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ferronicardoso",
    "github_project": "maskify-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "maskify-py"
}
        
Elapsed time: 0.37327s