# Inside Liso 2: Libsodium, Cloudflare Edge Sync & MCP

> Published: 2026-12-03 | Updated: 2026-12-03 | Author: Stackwares Engineering | Canonical URL: https://lisovault.com/blog/inside-liso-2-architecture-libsodium-cloudflare-mcp

Liso 2 is a complete cryptographic and architectural rewrite designed around three engineering invariants: one C libsodium core verified identically across Dart and TypeScript test vectors, a serverless zero-knowledge sync protocol built on Cloudflare SQLite Durable Objects that self-hosts on the free tier, and native developer tooling (CLI, declarative data-only Packs, and a 36-tool approval-gated MCP server).

## 1. One cryptographic spec, one C libsodium core, zero custom ciphers

Cross-platform password managers often accumulate subtle drift between mobile, browser extension, and CLI crypto implementations. In Liso 2, `packages/crypto-spec/SPEC.md` is normative: every record and key wrap uses XChaCha20-Poly1305-IETF (192-bit random nonces, canonical length-prefixed tuple AAD binding domain label, vault_id, record_id, record_type, key_epoch, and rev) and Argon2id v1.3 (64 MiB default, t=3, p=1) via libsodium.

Both Dart (`dart/liso_crypto` via `sodium`) and TypeScript (`packages/liso-crypto-ts` via `libsodium-wrappers-sumo`) run the exact same JSON test vectors—including tamper, AAD mismatch, chunk truncation, chunk reordering, and quarantined read-only Liso v1 migration vectors.

## 2. 64 KiB chunked streaming AEAD for encrypted files with in-RAM previews

Storing large PDFs or videos inside a monolithic vault database slows down every sync. Liso 2 gives each encrypted file a random 256-bit DEK and a binary header (`LISO2F\x00\x01 || file_id || chunk_size`), splitting files into 64 KiB authenticated chunks where every chunk's AAD binds `('liso/v2/file', file_id, chunk_idx_u64, is_final_u8, SHA256(header))`.

That prevents a compromised server from truncating a file, swapping chunks across files, or reordering bytes—while allowing apps to decrypt and preview PDFs, images, Office docs, archives, Markdown, and code locally in memory.

## 3. Serverless edge sync on Cloudflare Durable Objects + D1 + optional R2

Instead of running a central Postgres cluster or asking self-hosters to patch a Linux VPS, `server/sync` (AGPL-3.0-only) shards state cleanly onto Cloudflare's edge: `AccountDO` holds wrapped key slots, Ed25519 device keys, 5-minute HMAC access tokens, and 1 hibernated WebSocket per device; `VaultDO` holds SQLite ciphertext records with 20-version / 90-day revisions and optimistic locking; `PairingDO` runs an ephemeral 120-second X25519 QR pairing channel; D1 stores only global lookup indexes; and R2 optionally streams encrypted file chunks.

Because WebSocket hibernation incurs zero idle duration charges and personal/family traffic fits inside 100,000 requests/day, anyone can deploy the exact same open-source sync server on Cloudflare Workers Free with zero billing code and every Liso feature unlocked.

## 4. Declarative Packs, hardened autofill & zero client telemetry

Third-party plugin ecosystems inside password managers are a dangerous code-execution surface. Liso 2's Packs (`packs/`) are strictly schema-validated, data-only JSON/YAML definitions for item templates, 12+ password importers, password policies, health audits, wordlists, and themes—zero third-party code ever runs inside your vault.

Across all native Flutter apps, the Chrome/Firefox MV3 extension (using exact Public Suffix List matching and cross-origin/hidden-field refusal), `app.lisovault.com`, and the `liso` CLI/MCP binary, zero analytics, advertising, or crash-reporting SDKs are compiled in.

## Article FAQ

### Where can I inspect Liso 2's cryptography specification and test vectors?

The full Apache-2.0 specification is public at github.com/Liso-Vault/liso/blob/main/packages/crypto-spec/SPEC.md alongside cross-platform JSON test vectors under packages/crypto-spec/vectors/.

### How is Liso 2 licensed between open source and Liso Cloud?

All Flutter apps, the MV3 browser extension, and the server/sync Cloudflare Worker are AGPL-3.0-only. The crypto spec, Dart & TypeScript SDKs, liso CLI/MCP server, packs, and selfhost deployment scripts are Apache-2.0. Only Liso Cloud's hosted billing/quota PolicyHook lives outside the public export.

### When will the independent external security audit be published?

An independent third-party audit of packages/crypto-spec and server/sync is scheduled before general availability, and the complete report will be published publicly on lisovault.com/security and GitHub.
