Recovery Key
The recovery key is the master encryption key for your data.
Format
Section titled “Format”ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ23-4567-ABCD-EFGH-IJKL-MNOP-Q- 52 characters (excluding dashes)
- Base32-like alphabet (A-Z, 2-7)
- ~256 bits of entropy
- Human-readable (no confusable chars like 0/O, 1/I)
Properties
Section titled “Properties”| Property | Value |
|---|---|
| User-controlled | Only you know it |
| Not transmitted | Never sent to server |
| Not recoverable | Server cannot help if lost |
| Portable | Works across devices |
Generating a Key
Section titled “Generating a Key”import { generateRecoveryKey } from "@zod-vault/crypto";
const recoveryKey = generateRecoveryKey();Uses crypto.getRandomValues() for cryptographic randomness.
Validating a Key
Section titled “Validating a Key”import { validateRecoveryKey } from "@zod-vault/crypto";
if (validateRecoveryKey(userInput)) { // Valid format}Storage Recommendations
Section titled “Storage Recommendations”Password Manager
Section titled “Password Manager”Store in your password manager (1Password, Bitwarden, etc).
Printed Backup
Section titled “Printed Backup”Print and store in a safe location:
╔═══════════════════════════════════════════════════╗║ zod-vault Recovery Key ║║ ║║ ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ23-4567 ║║ ABCD-EFGH-IJKL-MNOP-Q ║║ ║║ Store this safely. It's the only way to ║║ decrypt your data. ║╚═══════════════════════════════════════════════════╝Split Storage
Section titled “Split Storage”For high security, split the key:
const key = "ABCD-EFGH-IJKL-MNOP-QRST-UVWX-YZ23-4567-ABCD-EFGH-IJKL-MNOP-Q";
// Store separatelyconst part1 = key.slice(0, 26); // First halfconst part2 = key.slice(26); // Second halfWhat NOT to Do
Section titled “What NOT to Do”- Store unencrypted on cloud storage
- Email to yourself
- Share via unencrypted chat
- Use a weak/guessable key
- Reuse across different vaults
Key Per Vault
Section titled “Key Per Vault”Consider separate keys for different vaults:
const personalKey = generateRecoveryKey();const workKey = generateRecoveryKey();
// Personal vaultvault(config, { name: "personal", recoveryKey: personalKey });
// Work vaultvault(config, { name: "work", recoveryKey: workKey });Compromise of one key doesn’t affect the other.
Lost Key
Section titled “Lost Key”If you lose your recovery key:
- Your data cannot be recovered
- The server cannot help (zero-knowledge)
- Create a new vault with a new key
- Start fresh
This is by design — true E2EE means no backdoors.
Rotating Keys
Section titled “Rotating Keys”To change your recovery key:
- Generate new key
- Decrypt data with old key
- Re-encrypt with new key
- Update vault on server
// Manual rotationconst oldData = await useStore.vault.pull();const newKey = generateRecoveryKey();
// Create new store with new keyconst newStore = create( vault(config, { name: "migrated-store", recoveryKey: newKey }));
newStore.setState(oldData);await newStore.vault.push();
// Clear old vaultawait useStore.vault.clearStorage();