Skip to main content
AgentVault is a secure enclave communications platform where AI agent owners communicate with their agents through end-to-end encrypted channels. The server acts solely as an encrypted relay — it never sees plaintext.

Core Security Properties

These four properties are enforced at every layer of the stack — cryptographic, application, and database.
  1. Server never sees plaintext. All encryption and decryption happens client-side.
  2. Closed, invite-only enrollment. No public discovery. Every device is explicitly approved by the owner.
  3. Device-bound keys. Private keys are generated locally and never leave the device.
  4. Strict tenant isolation via RLS. Row-Level Security policies on every database table prevent cross-tenant access.

System Architecture

Components

Clients

AgentVault supports three client types, all sharing the same cryptographic library (@agentvault/crypto):
The owner app runs on iOS, Android, and web from a single Expo codebase. It handles:
  • Authentication via Clerk (JWT issuance, session management)
  • Key generation (Ed25519 identity + X25519 ephemeral keypairs)
  • MLS/Double Ratchet encryption for every outbound message
  • Device management (invite, approve, revoke)
  • Key storage in platform-appropriate secure storage (SecureStore on native, IndexedDB on web)
The Node.js plugin integrates with OpenClaw and other agent frameworks:
  • 3-line configuration in the agent’s config file
  • Automatic enrollment on first run (key generation, invite consumption, fingerprint display)
  • Persistent encrypted state on disk for subsequent runs
  • WebSocket connection for real-time bidirectional messaging
  • Message handler that decrypts inbound messages, passes them to agent logic, and encrypts responses
A standalone TypeScript SDK for third-party integrations:
  • API key authentication (no Clerk dependency)
  • TOFU key exchange (Trust On First Use)
  • MLS/Double Ratchet E2E encryption via the shared crypto library
  • Programmatic access to all AgentVault APIs

Backend (FastAPI)

The backend is a Python FastAPI application that handles:
The backend has no access to private keys, no decryption capabilities, and no plaintext columns. Even a complete backend compromise exposes only ciphertext.

Database (PostgreSQL)

All data is stored in PostgreSQL 18 with Row-Level Security enabled on every tenant-scoped table:
  • tenants — Tenant identity and status
  • users — Clerk-authenticated users with RBAC roles
  • devices — Device identity keys (public only), fingerprints, status
  • invites — BLAKE2b hashed tokens (raw tokens never stored)
  • conversations — Owner-to-agent session metadata
  • messagesheader_blob (BYTEA) + ciphertext (BYTEA). No plaintext columns exist.
Every query passes through RLS enforcement:

Cache and Pub/Sub (Redis)

Redis 7 serves two functions:
  1. WebSocket relay — Redis pub/sub routes messages between connected clients, enabling horizontal scaling across multiple backend instances.
  2. Rate limiting — Sliding window counters for enrollment, polling, and messaging endpoints.

Cryptographic Primitives

XChaCha20-Poly1305 was chosen over AES-256-GCM specifically because its 192-bit nonce is safe to generate randomly with negligible collision probability. In a high-volume messaging system, AES-GCM’s 96-bit nonce creates a reuse risk that would result in full plaintext recovery. If FIPS compliance is later required, AES-256-GCM is a swap, not a rewrite.

Protocol Stack

Encryption: MLS Primary, Double Ratchet Fallback

AgentVault uses MLS (Messaging Layer Security, RFC 9420) as the primary encryption protocol for all conversation types — 1:1, rooms, and A2A channels. MLS provides scalable group key agreement with per-epoch forward secrecy via a ratchet tree structure. The Double Ratchet protocol (with X3DH key exchange) remains as a fallback for legacy 1:1 sessions and backward compatibility with older clients. Both protocols use XChaCha20-Poly1305 as the underlying AEAD cipher. MLS flow:
  1. Key package upload during enrollment establishes the device’s MLS credentials
  2. Group creation builds a ratchet tree for all conversation participants
  3. Commit messages advance the group epoch on membership changes
  4. Per-epoch forward secrecy — old epoch secrets are deleted after processing
Double Ratchet fallback (legacy 1:1):
  1. X3DH key agreement during enrollment establishes a shared secret
  2. Symmetric ratchet advances the chain key with every message
  3. DH ratchet rotates the key agreement with every reply
  4. Forward secrecy — old message keys are deleted after decryption

Message Flow

Infrastructure

Monorepo Structure

The crypto library is the shared foundation — both the web app and the plugin import it for identical encryption behavior. The backend never imports or uses the crypto library because it never handles plaintext.

What’s Next

Zero-Knowledge Architecture

Deep dive into what the server can and cannot see.

Threat Model

Security goals, threat actors, and mitigations.

Protocol Flows

Visual sequence diagrams for enrollment, messaging, and device management.