Metadata-Version: 2.4
Name: shadow_data
Version: 1.0.1
Summary: A sensitive data handler python library
License: MIT
License-File: LICENSE
Author: Adler Medrado
Author-email: adler@adlermedrado.com.br
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: spacy
Requires-Dist: cryptography (>=44.0.3,<45.0.0)
Requires-Dist: spacy (>=3.8,<4.0) ; (platform_system == "Darwin" and platform_machine == "arm64" or platform_system == "Darwin" and platform_machine == "x86_64" or platform_system == "Linux" or platform_system == "Windows") and (extra == "spacy")
Description-Content-Type: text/markdown

![Build Status](https://github.com/spacexnu/ShadowData/actions/workflows/main.yml/badge.svg)

# ShadowData
A Python library for anonymizing, masking, and encrypting sensitive data with a small, focused API.

## What it does today
- Text and pattern anonymization (free-form text replacement, IPv4, email, phone)
- Localized identifiers (US SSN, Brazil CPF/CNPJ)
- Symmetric encryption and decryption (Fernet)
- PII detection via spaCy (optional extra)

Planned: richer masking helpers and reversible transforms.

## Installation

```bash
pip install shadow_data
```

Optional spaCy support:

```bash
pip install shadow_data[spacy]
```

spaCy models must be installed before use:

```bash
python -m spacy download en_core_web_trf
```

## Quickstart

```python
from shadow_data.anonymization import (
    EmailAnonymization,
    Ipv4Anonymization,
    PhoneNumberAnonymization,
    TextProcessor,
)
from shadow_data.cryptohash.symmetric_cipher import Symmetric
from shadow_data.l10n.usa import IdentifierAnonymizer

text = "Contact me at user@example.com or 415-555-0199. Server: 10.0.0.1"
anonymized_text = Ipv4Anonymization.anonymize_ipv4(text)
anonymized_text = TextProcessor.replace_text("Contact", "Reach", anonymized_text)
email = EmailAnonymization.anonymize_email("user@example.com")
phone = PhoneNumberAnonymization.anonymize_phone_number("415-555-0199")
print(anonymized_text, email, phone)

ssn = "Billy's SSN is 479-92-5042."
ssn_anonymizer = IdentifierAnonymizer(ssn)
ssn_anonymizer.anonymize()
print(ssn_anonymizer.cleaned_content)

symmetric = Symmetric()
key = symmetric.create_key()
ciphertext = symmetric.encrypt("hello")
plaintext = symmetric.decrypt(ciphertext)
print(ciphertext, plaintext)
```

## Docs
- `docs/README.md`
- `docs/usage.md`
- `docs/cryptography.md`
- `docs/pii.md`

## Examples
- `examples/quickstart.py`
- `examples/anonymization.md`
- `examples/i10n_us.md`
- `examples/i10n_brazil.md`
- `examples/pii_nlp.md`
- `examples/symmetric_cipher.md`

## Testing

```bash
poetry run pytest -vvv
```

## Contributing

1. Fork the repository.
2. Create a new branch for your feature (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add new feature'`).
4. Push the branch (`git push origin my-new-feature`).
5. Open a pull request.

## License
This project is licensed under the MIT License - see `LICENSE` for details.

