Metadata-Version: 2.5
Name: dut-vault-sdk
Version: 0.1.0
Summary: In-memory dynamic configuration SDK, mTLS gateway client, and CLI runner for DUT-AI Vault & Gateway
License: MIT
Keywords: configuration,gateway,hot-reload,mtls,secrets,vault
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 :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Description-Content-Type: text/markdown

# dut-vault-sdk

Client SDK and CLI process runner for **DUT-AI Dynamic Vault & Zero-Trust Gateway**:
- **100% In-Memory RAM storage** (`os.environ`) — zero plaintext `.env` disk artifacts
- **Auto-discovery mTLS** (`~/.dut-vault/client.crt`, `~/.dut-vault/client.key`) & `X_VIRTUAL_KEY`
- **Real-Time SSE Hot-Reload** (< 5s latency)
- **Pre-configured Gateway HTTP client** (`vault.gateway_client("<service_slug>")`)

## Installation

```bash
# Using pip
pip install dut-vault-sdk

# Using uv
uv add dut-vault-sdk
```

## Quick Start

### 1. Load Vault Secrets in Python

```python
import os
from dut_vault_sdk import VaultClient

# Automatically loads ~/.dut-vault/client.crt, client.key & X_VIRTUAL_KEY from env
vault = VaultClient(
    base_url="https://gateway.dutai.io.vn",
    project_id="<PROJECT_ID>",
    scope="Common",
    inject_environ=True,
)

vault.connect(wait_for_stream=True)

openai_key = vault.get("OPENAI_API_KEY", default="")
db_url = os.getenv("DATABASE_URL")
```

### 2. Call Upstream Services via Zero-Trust Gateway

```python
from dut_vault_sdk import VaultClient

vault = VaultClient(base_url="https://gateway.dutai.io.vn")

with vault.gateway_client("llm") as client:
    res = client.post("/chat/completions", json={"model": "...", "messages": [...]})
```

### 3. CLI Process Runner (Any Language)

```bash
X_VIRTUAL_KEY=<VIRTUAL_KEY> dut-vault run \
  --project <PROJECT_ID> \
  --api-url https://gateway.dutai.io.vn \
  -- python main.py
```
