Security Architecture · Zero-Knowledge 9 min read Updated 2026-11-16

When the Cloud Is Just a Blind Wall: Designing a Zero-Knowledge E2EE Credential Vault

How can multiple devices stay automatically synchronized without duplicating tokens, while guaranteeing mathematically that a full server breach yields zero readable user secrets? Here are the core cryptographic boundaries and sync patterns.

Local Client Crypto Boundary PBKDF2 (60k, Off-Thread) -> 256-bit MasterKey AES-256-CBC + HMAC iv : mac : ciphertext One-Way AuthHash Split Zero-Knowledge Server Opaque Ciphertext Blobs Zero Plaintext Access 🔒 Mathematically Blind SHA-256(MasterKey||tag) Multi-Device Sync & Merge Mobile Devices (iOS / Android) Desktop (macOS / Win / Linux) Browser Extension & Web Client Merge Engine Constant-Time MAC -> Deduplicate 1. Client Crypto Boundary PBKDF2 60,000 -> MasterKey AES-256-CBC + HMAC Encrypt-then-MAC 2. Blind Cloud Server 🔒 Stores Opaque Ciphertext + AuthHash Server mathematically blind 3. Multi-Device Decrypt & Merge Mobile · Desktop · Browser Extension Deterministic Secret Deduplication
Key derivation, authenticated encryption, and deduplication run inside trusted client boundaries—leaving the cloud mathematically blind

1. The Fundamental Invariant: Verify Authentication Without Gaining Decryption Power

Many cloud password apps merely apply HTTPS in transit and server-side database encryption at rest—meaning the platform still holds decryption keys. A server compromise exposes user vaults outright.

True zero-knowledge E2EE never transmits raw master passphrases. Clients combine the passphrase with a 16-byte cryptographic random salt locally through PBKDF2-HMAC-SHA256 (60,000+ iterations) to derive a 256-bit Master Key. A second one-way domain-separated hash computes AuthHash = SHA-256(MasterKey || DomainTag || Salt) for server verification. Because SHA-256 is non-invertible, the backend validates login possession without ever learning the Master Key.

Trusted Client Boundary (Off-Thread / WebCrypto) Master Password + 16B Random Salt PBKDF2-HMAC-SHA256 (60,000 rounds) -> MasterKey Encrypt-then-MAC (PKCS7 + 16B IV) iv : hmac(iv||cipher) : aes256cbc(json) AuthHash: SHA256(MasterKey || tag || Salt) Zero-Knowledge Blind Server Ciphertext Blobs + AuthHash 0 Plaintext Secrets Stored 🔒 Mathematically Blind Cannot invert SHA-256 AuthHash Other Clients Sync macOS · Windows · Linux iOS · Android Browser Extension & Web Client Merge Engine Constant-Time MAC -> Deduplicate Client-Side Encryption Boundary PBKDF2 60,000 + 16B Salt -> MasterKey iv : hmac(iv||cipher) : aes256cbc(json) Zero-Knowledge Blind Cloud 🔒 Opaque Ciphertext + One-Way AuthHash Impossible to derive MasterKey Other Devices Verify HMAC & Merge Mobile · Desktop · Browser Extension Lossless Client Secret Deduplication
Animated Flow: Local KDF -> One-way AuthHash boundary -> Encrypt-then-MAC blobs across blind cloud sync

2. Why Off-Thread KDF + Encrypt-then-MAC Matter in Practice

  • Off-Thread Key Derivation: Running tens of thousands of PBKDF2 iterations directly on UI threads causes dropped frames. Production clients isolate KDF derivation inside background worker threads / native Web Crypto C++ bindings to balance brute-force cost with smooth UI;
  • Strict Encrypt-then-MAC with Constant-Time Verification: Using CBC mode without proper MAC ordering exposes padding-oracle vulnerabilities. Clients must generate a unique 16-byte CSPRNG IV per record, encrypt plaintext, then sign HMAC-SHA256 over (IV || Ciphertext). Prior to decrypting, MAC verification must use constant-time bitwise comparison to prevent timing side-channels.
Authenticated Encrypt-then-MAC Pattern
const iv = csprngBytes(16);
const ciphertext = aes256CbcEncrypt(plaintextJson, masterKey, iv);

// Authenticate (IV || Ciphertext) post-encryption; constant-time verify on decrypt
const mac = hmacSha256(masterKey, concat(iv, ciphertext));
const sealedEnvelope = `${base64(iv)}:${base64(mac)}:${base64(ciphertext)}`;

if (!constantTimeEquals(hmacSha256(masterKey, concat(iv, ciphertext)), mac)) {
  throw new IntegrityError('Ciphertext tampered or invalid key');
}

3. Full Metadata Shielding, Unescrowed Recovery & Hardware Keystores

Architecture LayerDesign SpecificationMitigated Threat
Sealed Metadata EnvelopesIssuer names, usernames, secrets, URLs, notes, folders, and custom fields are serialized and encrypted inside one opaque blobEven a leaked database cannot reveal which services a user relies on
24-Char Unescrowed Recovery KeyUnambiguous 32-char alphabet (excluding 0/O/1/I/L) locally wraps the Master KeySelf-service password recovery with zero server custody
OS Hardware Keystore BindingNative secure storage (Keychain, Android Keystore, HUKS, DPAPI, Secret Service) wraps local credentialsBiometric convenience without plaintext secret files on disk

4. Solving Sync Conflicts Behind a Blind Server

When the server only stores opaque encrypted blobs, it cannot detect duplicate tokens added offline on two separate devices.

Client-side merge engines resolve this cleanly post-decryption: once blobs pass HMAC validation and decrypt in memory, deterministic matchers reconcile entries by unique ID, normalized Base32 secret + issuer/account identity, and website domain—merging complementary fields (e.g., browser-captured credentials + mobile-scanned TOTP) and converging redundant remote blobs cleanly.

Core Architecture Rules

  • Strictly separate AuthHash authentication proofs from local Master Keys via one-way domain separation.
  • Enforce Encrypt-then-MAC with per-record IVs, constant-time MAC checks, and encrypted metadata envelopes.
  • Run conflict resolution and deduplication strictly client-side after decryption so blind cloud sync remains clean.

Experience Real Zero-Knowledge Multi-Platform Sync

Every architectural principle above powers LazyCoffee across desktop, mobile, Chrome Extension, and Web Vault.