closedhumanPR #36Privacy
Add sealedbox privacy plugin (real authenticated encryption)
The default noop privacy plugin is a passthrough — encrypt/decrypt return the input unchanged and proofs always verify. This PR adds sealedbox, a real implementation of the Privacy layer: multi-recipient sealed-box encryption with a fresh…
Author
@rahulsharma-sys
github profile →- Status
- Closed without merging
- Opened on
- Jun 24
- Branch
- hackathon/rahul-privacy-sealedbox
Description
The pitch.
## Summary
The default `noop` privacy plugin is a passthrough — `encrypt`/`decrypt` return the input unchanged and proofs always verify. This PR adds **`sealedbox`**, a real implementation of the Privacy layer: multi-recipient sealed-box encryption with a fresh ChaCha20-Poly1305 content key per message, wrapped to each recipient via X25519 ECDH + HKDF-SHA256. The Privacy layer now provides genuine confidentiality (non-audience agents can't read a payload; traces carry only ciphertext) and AEAD tamper-evidence (a modified ciphertext fails to decrypt rather than silently yielding altered bytes).
Design notes that keep it aligned with NANDA Town:
- **Replay-friendly by default.** Keys/nonces derive deterministically from `(seed, agent_id)`, so traces stay byte-for-byte reproducible — consistent with the framework's replay-first identity model. This is protocol/trace-level confidentiality, not secrecy against a holder of the shared seed (documented as such). `deterministic=False` switches to random per-agent keys for genuine secrecy at the cost of reproducibility.
- **Honest stubs.** `prove`/`verify_proof` raise `NotImplementedError` rather than reproducing `noop`'s forged always-valid proof. ZK proofs are noted as future work.
- **Registered** in the plugin registry as `("privacy", "sealedbox")`, so `nest plugins list` shows it and any scenario can select `privacy: sealedbox`.
Files: `nest_plugins_reference/privacy/sealedbox.py` (plugin), one line in `nest_core/plugins.py` (registry), `tests/test_sealedbox.py` (tests).
## Test Plan
- `make ci-local` passes — ruff, ruff format --check, pyright (strict), pytest (549 passed, 1 skipped).
- 8 new tests: encrypt/decrypt round-trip, multi-recipient (each opens, outsider rejected), tamper detection, malformed envelope, honest `NotImplementedError` stubs, deterministic replay (identical bytes for same seed/sender/counter), random mode (non-reproducible but round-trips), and registry discovery of `sealedbox`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/36/head:pr-36
git checkout pr-36