Skip to main content

Conceal sensitive data — strings, emails, phones, numbers, cards, payloads, and free text — with a single clean API.

Project description

validata-py

Conceal sensitive data in Python — strings, emails, phone numbers, IDs, cards, payloads, and free text — with one import and one clean API.

Python PyPI Version License


Installation

pip install validata-py

Why validata-py?

Most masking libraries solve only one problem:

  • Email masking
  • Card masking
  • Regex scrubbing
  • Payload anonymization

You end up combining multiple libraries with inconsistent APIs.

validata-py keeps everything in one lightweight package:

  • One import
  • One class
  • Consistent API
  • Zero dependencies
  • Production-ready utilities
  • Preserves formatting automatically

Quick Start

from validata_py import Veil

# Generic string masking
Veil.cover("order-REF-99812", from_index=10)
# "order-REF-*****"

# Email masking
Veil.shield_email("alice@example.com")
# "a****@e******.com"

# Phone masking
Veil.shield_phone("+91 98765-43210", expose_last=4)
# "+91 *****-3210"

# Number masking
Veil.shield_number(987654321, expose_first=3)
# "987******"

# Card masking
Veil.shield_card("4111 1111 1111 1111")
# "**** **** **** 1111"

# CPF masking
Veil.shield_cpf("123.456.789-01")
# "123.***.789-01"

# CNPJ masking
Veil.shield_cnpj("12.345.678/0001-99")
# "12.***.***/**01-99"

Dictionary Payload Masking

from validata_py import Veil

payload = {
    "name":   "Priya Sharma",
    "email":  "priya@example.com",
    "mobile": "+91-98765-43210",
    "salary": 950000,
    "pan":    "ABCDE1234F",
}

blueprint = {
    "name":   "text",
    "email":  "email",
    "mobile": "phone",
    "salary": "zero",
    "pan":    "drop",
}

Veil.shield_payload(payload, blueprint)

Output:

{
    "name":   "P**********a",
    "email":  "p****@e******.com",
    "mobile": "+91-*****-3210",
    "salary": 0,
    "pan":    "**********",
}

Free Text PII Scrubbing

from validata_py import Veil

Veil.scrub_text(
    "Reach me at dev@example.com or +91 9876543210"
)

# "Reach me at [EMAIL] or [PHONE]"

Features

  • Generic string concealment
  • Email masking
  • Phone masking
  • Card masking
  • Integer masking
  • CPF masking
  • CNPJ masking
  • Payload anonymization
  • Regex-based PII detection
  • Free-text scrubbing
  • Preserves formatting characters
  • No external dependencies
  • Lightweight and fast

Full API

Veil.cover(text, char="*", from_index=0, length=None)

Mask part of any string.

Veil.cover("secret-token", from_index=3)
# "sec*********"

Veil.shield_email(email, char="*", reveal_user=1, reveal_host=1)

Mask email addresses.

Veil.shield_email("alice@example.com")
# "a****@e******.com"

Veil.shield_phone(phone, char="*", expose_last=4)

Mask phone numbers while preserving formatting.

Veil.shield_phone("+91 98765-43210")
# "+91 *****-3210"

Veil.shield_number(value, char="*", expose_first=2)

Mask integers.

Veil.shield_number(987654321)
# "98*******"

Veil.shield_card(card_number, char="*", expose_last=4)

Mask card numbers.

Veil.shield_card("4111 1111 1111 1111")
# "**** **** **** 1111"

Veil.shield_cpf(cpf, char="*")

Mask Brazilian CPF numbers.


Veil.shield_cnpj(cnpj, char="*")

Mask Brazilian CNPJ numbers.


Veil.shield_payload(data, blueprint, in_place=False)

Mask selected fields in dictionaries.

Blueprint strategies

Strategy Description
"text" Conceal middle text
"email" Apply email masking
"phone" Apply phone masking
"card" Apply card masking
"zero" Replace value with zero
"scramble" Randomize digits
"drop" Replace entire value

Veil.scrub_text(text, ...)

Automatically detect and scrub:

  • Emails
  • Phone numbers
  • Card numbers

Project Structure

validata-py/
│
├── pyproject.toml
├── README.md
├── LICENSE
│
├── validata_py/
│   ├── __init__.py
│   └── veil.py
│
└── tests/
    └── test_veil.py

Running Tests

Install development dependencies:

pip install pytest

Run tests:

pytest

Requirements

  • Python 3.8+

License

MIT License


Author

Vishnu Sharma

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

validata_py-1.0.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

validata_py-1.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file validata_py-1.0.2.tar.gz.

File metadata

  • Download URL: validata_py-1.0.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for validata_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c558e696dd583372d208ae3c1587462f5304e0ce46811ee7454c7da5d17d90d9
MD5 cdf402b6d24a17869588f74fd416be63
BLAKE2b-256 04d39f6238d8d852b208213017b75546bee17c65a86a5f18cf5feba7cc1eccb4

See more details on using hashes here.

File details

Details for the file validata_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: validata_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for validata_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dc604089b2046ec1aa1e1cbbb9ad5d263b59a9003091d89bc9ac3ee711d62b62
MD5 04ae67ef2b03463933d2878e2181ff4a
BLAKE2b-256 526a00d1aefe689d9130b18d791c6e81cff6fc0a52079bc190a311ff97e93cfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page