Metadata-Version: 2.4
Name: omna-pii-mask
Version: 0.2.3
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Rust
Classifier: Topic :: Security
Classifier: Topic :: Text Processing :: Linguistic
Summary: Omna unified PII/secret detection engine (L1–L6) — compiled Rust kernel with in-process on-device AI. Binary-only.
Keywords: pii,redaction,privacy,ner,secrets,rust,detection
Author-email: gaurav <gaurjin@gmail.com>
License: Proprietary
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/gaurjin/omna

# omna-pii-mask

The compiled detection engine behind [Omna](https://github.com/gaurjin/omna)'s
PII features. This is the same unified Rust kernel that ships in the Omna Mac
app and browser extension, exposed to Python as a single self-contained wheel.

It is the backend for `pip install "omna[pii]"` — you normally don't install it
directly; the `omna` package depends on it.

## What it does

A six-layer (L1–L6) detection pipeline over text:

- **Regex + rule layers** — emails, phone numbers, cards, URLs, and 220+ secret
  rules (AWS keys, GitHub tokens, JWTs, …) with entropy checks.
- **Checksum-validated IDs** — Luhn, IBAN, Verhoeff, NHS, and 30+ international
  formats, so a string that merely *looks* like an ID isn't flagged unless it
  validates.
- **On-device AI (L3)** — an optional ONNX model that catches contextual PII
  regex can't (e.g. a bare prose name). Runs **in-process** on the same ONNX
  Runtime the wheel already links; downloads once on first use.

## API

```python
import omna_pii_mask

omna_pii_mask.mask("Email john@acme.com", model=False)   # -> {"masked": "...", "tokens": {...}}
omna_pii_mask.detect("SSN 123-45-6789")                   # -> [{"entity": ..., "confidence": ...}, ...]
omna_pii_mask.restore(masked_text, tokens)                # reverse the reversible tokens
omna_pii_mask.download_model()                            # pre-fetch the L3 model
omna_pii_mask.version()                                   # engine fingerprint (version+gitsha)
```

Reversible PII is replaced with stable tokens (`[PERSON_1]`, `[EMAIL_1]`, …).
Secrets/credentials are **always** redacted irreversibly (`[REDACTED:<KIND>]`)
and never written to the reversible token map.

## Distribution

Binary-only, proprietary. Wheels are built `abi3` (one wheel per platform covers
Python 3.9+). No source distribution is published — the Rust source is closed.

