Metadata-Version: 2.4
Name: digitrust-sdk
Version: 0.1.0
Summary: Trust Infrastructure SDK for Enterprise AI - Evidence Packets, Tokenization, and Governance
Project-URL: Homepage, https://github.com/DigiTrans-App/digitrust-sdk
Project-URL: Documentation, https://docs.digitranshq.com/sdk
Project-URL: Specification, https://evidencepacket.org/spec/v1.0
Author-email: DigiTrans Trust Infrastructure <sdk@digitranshq.com>
License-Expression: MIT
License-File: LICENSE
Keywords: ai-governance,evidence-packet,prai,tokenization,trust-infrastructure
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# DigiTrust SDK

**Trust Infrastructure for Enterprise AI** — Govern every AI workflow with verifiable Evidence Packets.

## Quick Start

```bash
pip install digitrust-sdk
```

### 3-Line Integration

```python
from digitrust_sdk import DigiTrustClient

client = DigiTrustClient(endpoint="https://controlplane.digitranshq.com")

packet = client.govern(
    workflow="claims-triage",
    model="anthropic.claude-3-5-sonnet",
    payload={"claim_id": "CLM-9921", "patient_note": "Follow-up requested"},
    purpose="Classify insurance claim priority",
    actor="user:analyst@company.com",
)

print(packet.status)        # "complete"
print(packet.packet_hash)   # "sha256:a1b2c3..."
print(packet.decision)      # "allow"
```

### What Happens in Those 3 Lines

1. **Classify** — Payload is scanned for sensitive data (PII, PHI, financial)
2. **Decide** — Policy engine evaluates risk and determines action
3. **Transform** — Sensitive values are tokenized (never sent raw to the model)
4. **Approve** — Human review triggered if required by policy
5. **Route** — Request routed through approved model path with guardrails
6. **Prove** — Evidence Packet sealed with SHA-256 hash chain

The returned `packet` is a complete, verifiable proof of governance.

## Core Operations

### Protect Data (Tokenize)

```python
protected = client.protect(
    payload={"name": "Alice Smith", "ssn": "123-45-6789"},  # digitrust:allow-sensitive-pattern-example
    workflow="data-pipeline",
)

print(protected.token_refs)       # ["dtok_a1b2_c3d4_e5f6"]
print(protected.contains_pii)    # True
print(protected.raw_stored)      # False (always)
```

### Verify a Packet

```python
report = client.verify(packet)

print(report.status)             # "verified"
print(report.integrity_valid)    # True
print(report.completeness)       # 100.0
```

### Batch Tokenization

```python
results = client.batch_protect(
    records=[
        {"id": "r1", "payload": {"email": "user@example.com"}},
        {"id": "r2", "payload": {"phone": "555-0100"}},
    ],
    workflow="etl-pipeline",
)
```

### Check Trust Posture

```python
posture = client.posture()

print(posture.status)            # "compliant"
print(posture.compliance_rate)   # 98.5
print(posture.prai_level)        # "L2"
```

## Verification CLI

```bash
# Verify a packet from file
digitrust verify evidence-packet.json

# Verify against a remote endpoint
digitrust verify evidence-packet.json --endpoint https://controlplane.digitranshq.com
```

## Evidence Packet Standard

This SDK implements the [Evidence Packet Open Standard v1.0](https://evidencepacket.org/spec/v1.0). Any tool producing conforming packets is interoperable.

## Links

- [Evidence Packet Specification](https://evidencepacket.org/spec/v1.0)
- [API Documentation](https://docs.digitranshq.com/api)
- [Trust Center](https://controlplane.digitranshq.com/api/trust-center/posture)
