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.
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.
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 Layer | Design Specification | Mitigated Threat |
|---|---|---|
| Sealed Metadata Envelopes | Issuer names, usernames, secrets, URLs, notes, folders, and custom fields are serialized and encrypted inside one opaque blob | Even a leaked database cannot reveal which services a user relies on |
| 24-Char Unescrowed Recovery Key | Unambiguous 32-char alphabet (excluding 0/O/1/I/L) locally wraps the Master Key | Self-service password recovery with zero server custody |
| OS Hardware Keystore Binding | Native secure storage (Keychain, Android Keystore, HUKS, DPAPI, Secret Service) wraps local credentials | Biometric 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.