Cross-Device Profile Sync Testing Guide
Purpose: Verify that zero-knowledge encrypted profiles sync correctly across devices using Firebase Auth + Firestore.
Time: ~20 minutes
Test Scenario
You'll create an account on Device 1, set up your profile, then log in on Device 2 and verify all data syncs correctly (including decryption).
Prerequisites
Two devices (or browser profiles):
- Device 1: Your main browser
- Device 2: Another browser, incognito window, or another physical device
Dev server running:
bashnpm run devFirebase DEV project configured (see ENVIRONMENT_SETUP.md)
Have these ready:
- Email address (e.g.,
test@example.com) - Strong passphrase (write it down!)
- Birth date (18+ years old)
- Email address (e.g.,
Test Steps
Device 1: Create Account
Open app:
http://localhost:5174Navigate to signup:
- Click "Get Started" or go to
#/signup
- Click "Get Started" or go to
Fill out signup form:
- Email:
test-sync@example.com - Birth date: Any date making you 18+
- Click "Continue"
- Email:
Create passphrase:
- Passphrase:
MyTestPassphrase123! - Confirm passphrase:
MyTestPassphrase123! - ⚠️ WRITE THIS DOWN - you'll need it on Device 2
- Click "Continue"
- Passphrase:
Agree to terms:
- Check the box confirming you understand passphrase recovery policy
- Click "Create My Account"
Verify account creation:
- Open browser DevTools → Console (F12)
- Look for:
✅ Account created with zero-knowledge encryption - Should show:javascript
{ userId: "abc123...", lanternName: "Amber Beacon", email: "test-sync@example.com" }
Set up profile (if redirected to profile creation):
- Add interests:
Coffee,Jazz,Late Night - Set mood:
Chatty - Click "Save"
- Add interests:
Go to Profile Settings:
- Navigate to
#/profile - Add more interests:
Books,Tech - Change mood to:
Exploring - Enable location tracking
- Click "Save Changes"
- Navigate to
Verify Firestore (optional):
- Go to Firebase Console → Firestore Database
- Find
userscollection - Open your user document
- Verify fields:javascript
{ email: "test-sync@example.com", lanternName: "...", encryptedBirthDate: "k2j3n4lk5j6..." // gibberish salt: "p9o8i7u6y5...", // random interests: ["Coffee", "Jazz", "Late Night", "Books", "Tech"], mood: "exploring", locationTracking: true, createdAt: "2025-01-...", updatedAt: "2025-01-..." } - ✅ Birth date is ENCRYPTED (unreadable gibberish)
Sign out:
- Click your profile → "Sign Out" (if implemented)
- Or close the browser tab
Device 2: Log In
Open app on Device 2:
- Different browser, incognito, or another device
- Go to
http://localhost:5174
Navigate to login:
- Click "Sign In" or go to
#/login
- Click "Sign In" or go to
Enter credentials:
- Email:
test-sync@example.com - Passphrase:
MyTestPassphrase123! - Click "Sign In"
- Email:
Verify login success:
- Open DevTools → Console
- Look for:
✅ Signed in successfully - Should show:javascript
{ userId: "abc123...", // Same as Device 1 lanternName: "Amber Beacon", email: "test-sync@example.com" }
Go to Profile Settings:
- Navigate to
#/profile - Verify all data synced:
- Lantern Name: Should match Device 1
- Interests:
Coffee,Jazz,Late Night,Books,Tech - Mood:
Exploring - Location Tracking: Enabled
- Navigate to
Verify encrypted data:
- Open DevTools → Console
- Birth date should be decrypted (if you log user profile)
- Not visible in UI (privacy-first design)
Test profile update from Device 2:
- Add interest:
Photography - Change mood to:
Quiet Vibes - Disable location tracking
- Click "Save Changes"
- Add interest:
Device 1: Verify Sync
Refresh Device 1 (or sign in again):
- Go back to Device 1 browser
- Refresh page or navigate to
#/profile
Verify changes from Device 2:
- Interests should now include:
Photography - Mood:
Quiet Vibes - Location Tracking: Disabled
- Interests should now include:
✅ SUCCESS: Changes from Device 2 are visible on Device 1!
What to Test
✅ Authentication
- [ ] Signup creates Firebase Auth user
- [ ] Signup creates Firestore profile
- [ ] Login authenticates with correct passphrase
- [ ] Login fails with incorrect passphrase
- [ ] Login unlocks encryption (key derived from passphrase)
✅ Encryption
- [ ] Birth date is encrypted before storage
- [ ] Birth date in Firestore is unreadable gibberish
- [ ] Birth date can be decrypted with correct passphrase
- [ ] Birth date cannot be decrypted without passphrase
- [ ] Salt is stored publicly (visible in Firestore)
✅ Profile Sync
- [ ] Profile data created on Device 1 appears on Device 2
- [ ] Profile updates on Device 1 sync to Device 2
- [ ] Profile updates on Device 2 sync to Device 1
- [ ] Public fields (interests, mood) sync instantly
- [ ] Encrypted fields (birth date) decrypt correctly on all devices
✅ Security
- [ ] Passphrase never appears in Firestore
- [ ] Encryption key never appears in Firestore
- [ ] Encrypted birth date cannot be read without login
- [ ] Security rules prevent reading other users' encrypted data
Expected Behavior
| Action | Device 1 | Device 2 | Firestore |
|---|---|---|---|
| Create account | ✅ Account created | - | ✅ User document created with encrypted birth date |
| Add interests | ✅ Saved | - | ✅ interests array updated |
| Login | - | ✅ Authenticated | ✅ Salt fetched, key derived |
| View profile | - | ✅ All data synced | ✅ No changes |
| Update mood | - | ✅ Changed to "Quiet Vibes" | ✅ mood updated, updatedAt changed |
| Refresh D1 | ✅ Sees "Quiet Vibes" | - | ✅ No changes |
Debugging
Issue: "Failed to load profile"
Possible causes:
- User not authenticated → check
getCurrentUser() - Firestore security rules blocking read → check console for permission errors
- Network issue → check DevTools → Network tab
Issue: "Failed to decrypt birth date"
Possible causes:
- Wrong passphrase entered → encryption key derivation failed
- Encryption key not cached → user must re-enter passphrase
- Corrupted encrypted data → check Firestore for
encryptedBirthDatefield
Issue: "Profile not syncing"
Possible causes:
- Firestore offline persistence not working → check browser console for warnings
- Security rules blocking update → test with Rules Playground
- Multiple accounts → verify same
userIdon both devices
Issue: "Passphrase rejected"
Possible causes:
- Typo in passphrase → case-sensitive, must match exactly
- Wrong email → Firebase Auth rejects incorrect credentials
- Account doesn't exist → check Firebase Console → Authentication
Verify in Firebase Console
Firestore Database
- Go to https://console.firebase.google.com
- Select
lantern-app-devproject - Click "Firestore Database"
- Find your user document in
userscollection - Verify:
encryptedBirthDate: Gibberish (encrypted ✅)salt: Random base64 stringinterests: Array of stringsmood: StringlocationTracking: BooleanupdatedAt: Recent timestamp
Authentication
- Click "Authentication" in Firebase Console
- Find your test user
- Verify:
- Email:
test-sync@example.com - UID matches
userIdin Firestore - Created: Recent timestamp
- Email:
Success Criteria
✅ PASS if:
- Account created on Device 1
- Login works on Device 2 with same credentials
- All profile data syncs correctly
- Encrypted birth date is unreadable in Firestore
- Encrypted birth date can be decrypted with passphrase
- Profile updates on one device appear on the other
- Security rules prevent unauthorized access
❌ FAIL if:
- Cannot create account
- Cannot log in on Device 2
- Profile data doesn't sync
- Birth date is stored in plaintext
- Birth date cannot be decrypted
- Unauthorized users can read encrypted data
Next Steps
After successful cross-device testing:
- ✅ Deploy Firestore security rules to DEV
- ✅ Test with real Firebase DEV project (not emulator)
- ✅ Audit security with Firestore Rules Playground
- ✅ Test on mobile devices (PWA)
- ✅ Deploy to production when ready
See also:
- DEPLOY_FIREBASE_RULES.md for deploying security rules
- ZERO_KNOWLEDGE_ENCRYPTION.md for encryption details
- ENVIRONMENT_SETUP.md for Firebase setup