mawlaia

PII Vault

Hosted token vault for your AI pipelines.

Quick start — SDK proxy

pip install "mawlaia-pii-vault>=0.2.0"

from pii_vault import SafeOpenAI, HostedVault

client = SafeOpenAI(
    api_key="sk-...",
    vault_key="your-hmac-secret",
    vault=HostedVault(api_key="mwl_live_..."),
)
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Summarize for John Smith, john@acme.com"}],
)
# John Smith / john@acme.com never reached OpenAI — stored in your vault.

Quick start — hosted API with FPE

import httpx

client = httpx.Client(
    base_url="https://api.mawlaia.com",
    headers={"Authorization": "Bearer mwl_live_..."},
)

# Tokenize: detect PII → replace with format-preserving fakes
result = client.post("/v1/pii-vault/tokenize", json={
    "text": "Invoice for John Smith, john@acme.com. Card: 4111111111111111",
    "format_preserving": True,
    "subject_id": "user_42",          # optional — for DSAR deletion
}).json()

print(result["text"])
# "Invoice for Laura Torres, coolbear847@mailbox.net. Card: 4827364918273647"

print(result["entities"])
# [{"entity_type": "PERSON", "original": "John Smith",
#   "replacement": "Laura Torres", ...}, ...]

# Send result["text"] to your LLM — no real PII transmitted.

# Restore original values later
original = client.post("/v1/pii-vault/detokenize", json={
    "text": result["text"],
}).json()["text"]
# "Invoice for John Smith, john@acme.com. Card: 4111111111111111"