How to build an encrypted secrets vault for agents
A local secrets vault for coding agents can be built as a single encrypted Turso database. The agent reaches it only through MCP tools that list secret names without values and run commands with secrets injected as environment variables into a child process. Output is scrubbed of secret values before the model sees it, and read-write or production secrets require a native approval dialog. Turso's built-in AES-256-GCM/AEGIS page encryption and its multiprocess_wal flag handle encryption at rest and safe concurrent access from several agent sessions without a daemon, leaving plain SQL tables for secrets and the audit log. The design is not a sandbox, and extensions such as per-binary policies, team RBAC via sync, and keychain- or KMS-held keys are left as next steps.
Related posts
- Why we chose Turso to secure AI credentials
Turso mediumAdeptEden, a gateway and control plane for database, API and AI traffic, uses Turso's in-process SQLite-compatible storage with AES-256-GCM whole-database encryption so a single Rust binary can run beside the workloads it governs without a separate Postgres. Whole-database encryption was chosen over column-level encryption, which is fragile across migrations and still leaks schema and row counts. To avoid forking the product, a compatibility layer (TursoPool, TursoConnection) mimics the tokio_postgres client surface and rewrites Postgres SQL at the connection boundary: bind parameters, NOW(), row locks, INTERVAL arithmetic, casts, JSON aggregation and ON CONFLICT predicates. File-backed deployments refuse to start without a 64-hex-character key and run with WAL and synchronous=NORMAL, and tests assert the on-disk file has no plaintext SQLite header.
- How Alien uses Turso to make BYOC deployments reliable
Turso mediumAdeptAlien's pull-mode BYOC operator, which runs inside customer cloud accounts and must survive restarts, network loss and half-applied deployments, replaced hand-rolled JSON state files with an embedded, encrypted Turso database. JSON files worked for a single deployment-state document but broke down once the operator had to handle approvals, buffered telemetry, command routing context and schema migrations, all needing transactional and partial updates across independent loops. A small schema (key/value state, approvals, telemetry buffer) opened from Rust with AEGIS-256 encryption at rest now serves as the durable coordination point between the sync, deployment, telemetry and command loops, with no extra service for customers to run.
- Encrypting SQLite Databases with Turso: Local, Cloud, and BYOK
Turso mediumAdeptTurso offers two SQLite encryption models: native, open-source page-level encryption in its Rust rewrite of SQLite (still behind an --experimental-encryption flag, hex keys) and production-ready BYOK on Turso Cloud, where a base64 key is supplied per connection and never persisted by Turso. Both use AEAD ciphers (AEGIS, AES-GCM, plus ChaCha20-Poly1305 in Cloud only) and encrypt every page and the WAL. AEGIS-256 benchmarks show 0.5–2.8% mixed-workload overhead and roughly 9–14% write overhead. The guide recommends aes256gcm when compliance needs a NIST-approved cipher and aegis256 otherwise, and shows per-tenant databases with separate keys for cryptographic multi-tenant isolation. Native rekeying isn't supported yet, so key rotation means a dump-and-reimport into a new database.
- Introducing BYOK Encryption in Turso Cloud
Turso mediumAdeptBring-Your-Own-Key encryption, previously Enterprise-only, is now available to self-service Turso Cloud customers starting on the Pro Plan. The database file and WAL are encrypted on disk and in S3, with each 4 KiB page encrypted individually under a unique nonce using AEAD ciphers (AEGIS, AES-GCM, ChaCha20-Poly1305). Keys are supplied per connection, held only in memory and never stored by Turso, so a lost key means a lost database. Encrypted databases are created and opened via CLI flags and support branching and point-in-time recovery with the same key and cipher.
- Building AI Agent Databases: A Complete Guide to Database-per-Agent Architecture
Turso mediumAdeptGiving each AI agent its own SQLite-style database, instead of sharing tables keyed by tenant_id or using schema-per-tenant, makes isolation, debugging and cleanup trivial: deleting an agent is a single API call. Four patterns are shown on Turso: a cloud database per agent, embedded on-device databases, embedded databases synced to the cloud via push/pull, and hub-and-spoke with a shared coordination database, plus native F32_BLOB vectors with cosine-distance search for per-agent semantic memory. Per-request billing means idle or nearly idle agent databases cost little beyond storage. The main tradeoffs are cross-agent analytics, which need fan-out queries or a separate aggregate store, and the lack of ACID guarantees across agents, so the pattern suits many agents with independent state rather than a few with heavy cross-agent queries.