Metadata-Version: 2.4
Name: neuroguard
Version: 0.1.0
Summary: Privacy infrastructure library for protecting neural and biometric data on-device
Author: NeuroGuard
License-Expression: BUSL-1.1
Project-URL: Repository, https://github.com/neuroguardcloud-sys/neuroguard-sdk
Keywords: privacy,neural,biometric,encryption,consent,audit
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
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
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42.0.0
Requires-Dist: fastapi>=0.109.0
Requires-Dist: httpx>=0.26.0
Requires-Dist: uvicorn[standard]>=0.27.0
Requires-Dist: reportlab>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: httpx>=0.26.0; extra == "dev"
Dynamic: license-file

# NeuroGuard

Privacy infrastructure for neural, biometric, and cognitive data.

NeuroGuard protects sensitive data **before it leaves the device** — with on-device encryption, consent enforcement, and tamper-evident audit logging built into your application at the code level.

## Install
```bash
pip install git+https://github.com/neuroguardcloud-sys/neuroguard-sdk.git
```

## Quickstart
```python
from neuroguard import NeuralDataCipher, ConsentManager, AuditLogger
from neuroguard.consent import ConsentScope
from neuroguard.audit import AuditAction

# Encrypt on-device before anything else touches the data
cipher = NeuralDataCipher(secret="user-passphrase")
encrypted = cipher.encrypt(b"neural or biometric payload")

# Enforce consent before processing
consent = ConsentManager()
consent.grant(ConsentScope.PROCESSING)
consent.require_consent(ConsentScope.PROCESSING)

# Tamper-evident audit log
audit = AuditLogger()
audit.log(AuditAction.ENCRYPT, actor="app", resource="payload", outcome="success")
```

## Why NeuroGuard

Traditional security protects data after it reaches servers. Neural and biometric data is too sensitive for that model.

NeuroGuard enforces privacy at the point of collection — before any network, framework, or server can see raw data.

## Architecture

| Component | Purpose |
|-----------|---------|
| `NeuralDataCipher` | On-device AES-128-CBC + HMAC encryption. Key or passphrase-derived via PBKDF2. |
| `ConsentManager` | Grant, revoke, and enforce consent by scope. Blocks operations if consent is not active. |
| `ConsentLedger` | Append-only, hash-chained log of every consent event. Tamper-evident. Exportable for auditors. |
| `AuditLogger` | Structured log entries for every sensitive action — actor, resource, outcome, timestamp. |
| Local REST API | FastAPI server: health, vault, consent, and compliance endpoints. Run locally, integrate anywhere. |

## Local API
```bash
python -m neuroguard.api
```

Server runs at `http://127.0.0.1:8000`. API docs at `http://127.0.0.1:8000/docs`.

## Consent Ledger
```python
from neuroguard.consent import ConsentManager, ConsentLedger, ConsentScope

ledger = ConsentLedger()
consent = ConsentManager(consent_ledger=ledger, ledger_user_id="user_123")
consent.grant(ConsentScope.PROCESSING)
consent.revoke(ConsentScope.PROCESSING)

assert ledger.verify_chain() is True
print(ledger.export_json(user_id="user_123"))
```

## Run Tests
```bash
pip install -e ".[dev]"
pytest tests/ -v
```

## Project Structure
```
neuroguard/
├── encryption/    # NeuralDataCipher — AES-128-CBC + HMAC
├── consent/       # ConsentManager, ConsentScope, ConsentLedger
├── audit/         # AuditLogger, AuditEvent, AuditAction
└── api/           # FastAPI local REST API

examples/
└── encrypted_neural_processing.py

tests/
├── test_encryption.py
├── test_consent.py
└── test_audit.py
```

## License

NeuroGuard is released under the [Business Source License 1.1](LICENSE).

Free for non-commercial and internal business use. Commercial use requires a license.
On 2029-01-01 this software converts to MIT.
