Metadata-Version: 2.4
Name: nxd
Version: 0.2.0
Summary: Encrypted compute layer for AI agents
Author: Nexplora Labs
License: Nexplora Labs Proprietary License
        
        Copyright 2026 Nexplora Labs. All rights reserved.
        
        NXD is proprietary software owned by Nexplora Labs.
        
        Permission is granted to use this software in any internal or external project,
        including commercial projects, subject to the restrictions below.
        
        You may not:
        
        1. Modify, adapt, translate, reverse engineer, or create derivative works of
           the software or its source code.
        2. Redistribute, sublicense, sell, lease, rent, publish, or otherwise make the
           source code available to any third party.
        3. Use the software, source code, or any derivative knowledge from the source
           code to build, train, offer, or support a competing encryption, privacy, or
           agent-protection product or service.
        4. Remove or alter any copyright, trademark, or proprietary notice contained in
           the software.
        
        This license grants use of the software only. It does not grant ownership,
        source redistribution rights, patent rights, trademark rights, or any right to
        operate a competing product based on the source code.
        
        The software is provided "as is", without warranty of any kind, express or
        implied, including but not limited to the warranties of merchantability,
        fitness for a particular purpose, and noninfringement. In no event shall
        Nexplora Labs be liable for any claim, damages, or other liability, whether in
        an action of contract, tort, or otherwise, arising from, out of, or in
        connection with the software or the use of the software.
        
Project-URL: Homepage, https://github.com/Nexploraai/nxd
Project-URL: Repository, https://github.com/Nexploraai/nxd
Project-URL: Issues, https://github.com/Nexploraai/nxd/issues
Keywords: fhe,encryption,ai-agents,privacy,homomorphic-encryption
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries
Requires-Python: <3.12,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: concrete-ml==1.9.0
Requires-Dist: cryptography>=42.0.0
Requires-Dist: mcp>=1.28.1
Requires-Dist: numpy>=1.26.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: scikit-learn>=1.5.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# NXD

NXD is an encrypted compute layer for AI agents. It wraps fully homomorphic encryption, credential vaulting, and privacy primitives behind a single Python import — so developers can run agents on sensitive data without exposing client records, credentials, or proprietary code to models, clouds, or MCP servers.

## Three guarantees

1. **The agent works fully** — capability unchanged; scores, matches, charges, and aggregates complete normally.
2. **The agent sees nothing** — sensitive values stay encrypted; agents handle opaque tokens and references only.
3. **The operator holds the keys** — keys stay local, auditable, and revocable.

## Install

```bash
pip install nxd
```

Requires Python 3.10 or 3.11 (Concrete ML FHE dependency).

## Quick start

```python
import nxd

# FHE compute on encrypted data
results = nxd.score(model, clients)
matched  = nxd.match(model, record_a, record_b)
average  = nxd.aggregate(model, records)

# Credentials — agent never sees plaintext keys
vault = nxd.Vault(agent_id="billing-agent")
vault.store("stripe_key", "sk_live_xxxx")
result = vault.use("stripe_key", stripe_charge_fn)
vault.audit_log()

# Agent-to-agent encrypted context
handoff = nxd.Handoff()
token = handoff.pack(clients)
scores = nxd.receive(model, token, handoff)

# Code and text privacy before any AI call
protected = nxd.shield(source_code)
original = nxd.unshield(protected)

# Encrypted search, identity, tokenization, PII redaction
index = nxd.build_index(records)
token, hits = nxd.search(index, "diabetes")
nxd.register("user_123", "credential")
nxd.verify("user_123", candidate)
safe = nxd.redact("Patient John Smith, SSN 432-12-6789")
token = nxd.tokenize("4532-1234-5678-9010")

# Documents, channels, state, signatures
nxd.seal("contract.pdf")
ch = nxd.channel("agent-a", "agent-b")
nxd.checkpoint.save("agent-123", state)
nxd.sign("agent-a", "approve payment")

# Privacy analytics, key control, audit
nxd.blur(47230.0, sensitivity=1000, epsilon=1.0)
shares = nxd.split("master_key", n=5, m=3)
locked = nxd.bind(data, recipient="agent-compliance-7")
nxd.audit.verify()
```

## Benchmarks (MacBook Air, Python 3.11, Concrete ML 1.9.0)

| Operation | Latency | Notes |
|-----------|---------|-------|
| FHE score (1 record) | ~183 ms | First-call cold start |
| FHE score (1k records, parallel) | **1.6 s** | 8 cores, ~1.6 ms/record |
| FHE match (single pair) | **352 ms** | Cross-system comparison |
| FHE aggregate (1k records, parallel) | **1.8 s** | ~0.009% quantization error |
| Credential vault use | <1 ms | Decrypt in memory only |
| Proof suite | **85/85 passed** | `python3 prove.py` |

## What NXD does not protect against

NXD protects credentials and sensitive data from AI providers, model context, and ordinary cloud exposure. It does not remove the need for normal endpoint security and key management discipline.

If your local machine is compromised, `master.key` can be stolen. NXD protects credentials in transit and keeps them out of agent-visible plaintext, but it does not protect against local machine compromise.

NXD can prevent a model from seeing plaintext inputs. It does not control what a model does with the encrypted or redacted results it receives, so output handling still matters.

NXD uses FHE for specific compute operations such as `score`, `match`, and `aggregate`. It does not run the full LLM context window under FHE. For prompt and code protection, use `redact()` and `shield()`.

The local `master.key` model is suitable for development and small deployments. Production systems should use a managed key system such as HashiCorp Vault or AWS KMS. Hosted key management is on the NXD roadmap.

NXD helps protect against external providers and cloud exposure. It does not protect against a trusted operator with physical access, because that operator holds the keys by design.

Current encryption choices are not presented as quantum-resistant. Post-quantum primitives are on the roadmap, but they are not part of the current release.

## Development

```bash
git clone https://github.com/Nexploraai/nxd
cd nxd
pip install -e ".[dev]"
python3 prove.py
python3 agent.py
python3 demo.py
```

## License

Proprietary — Nexplora Labs. Free to use in projects, but the source may not be
modified, redistributed, resold, or used to build a competing encryption or
agent-protection product. See [LICENSE](LICENSE).
