Overview
Ave provides multiple recovery methods to ensure you never lose access to your account, even if you lose a device or passkey. Each method balances security with convenience.Available Recovery Methods
Ave supports three primary recovery methods:- Passkey Authentication - Standard login with biometrics/PIN
- Trust Codes - Emergency recovery with 25-character codes
- Device Approval - Login via another trusted device (requires existing session)
Security questions were removed from Ave (see
ave-server/src/routes/security.ts:431-439). Only passkeys, trust codes, and device approval are supported.1. Passkey Authentication
Standard Login Flow
Passkeys are the primary authentication method:- Navigate to login page
- Enter your handle
- Click “Continue with passkey”
- Authenticate using biometrics (Touch ID, Face ID, Windows Hello) or device PIN
- System verifies signature and creates session
ave-server/src/routes/login.ts:163-316
With PRF Support (Preferred)
If your passkey supports PRF (Pseudo-Random Function):- Master key is encrypted with PRF output during registration
- On login, PRF output decrypts master key automatically
- No trust code needed for master key recovery
- Seamless experience across devices with synced passkeys
ave-server/src/routes/security.ts:100 and ave-server/src/routes/login.ts:305-310
Without PRF Support
If your passkey doesn’t support PRF:- Session is created successfully
- You’ll be prompted to recover master key using trust code
- Enter a trust code to decrypt your master key backup
- Master key is stored locally for future sessions
TESTING.md:70-96
Adding Additional Passkeys
You can register multiple passkeys for redundancy:- Log in to Dashboard
- Navigate to Security
- Click “Add a new passkey”
- Follow browser prompts to create new passkey
- Name it descriptively (e.g., “MacBook Pro Touch ID”)
ave-server/src/routes/security.ts:56-192 and TESTING.md:374-382
2. Trust Code Recovery
What Are Trust Codes?
Trust codes are 25-character recovery keys in formatXXXXX-XXXXX-XXXXX-XXXXX-XXXXX.
Properties:
- Provided during registration (2 codes)
- Reusable (not consumed on use)
- Decrypt your master key backup
- Stored as SHA-256 hashes server-side
When to Use Trust Codes
Scenario 1: Lost all passkeys- Device stolen/broken
- Passkeys not synced to other devices
- Need full account access immediately
- Logged in via passkey without PRF
- Need to decrypt existing data
- Don’t have master key stored locally
- Setting up first device in a new location
- No other active sessions to approve from
- Want to avoid waiting for approval timeout
TESTING.md:99-126
Using Trust Codes
- Start login flow with your handle
- Click “Use a trust code”
- Enter one of your saved codes (hyphens optional)
- Provide device information
- Master key backup is decrypted client-side
- Session created with full access
ave-server/src/routes/login.ts:517-659
3. Device Approval (Multi-Device Login)
How It Works
Device approval allows you to log in to a new device using an existing trusted session:- New device generates ephemeral ECDH key pair
- New device requests approval via WebSocket/polling
- Trusted device receives real-time notification
- User reviews device info and approves/denies
- Trusted device encrypts master key with shared secret
- New device decrypts master key and creates session
TESTING.md:156-233
Security Features
End-to-end encryption:- Ephemeral ECDH key exchange (P-256 curve)
- Master key never transmitted in plaintext
- Only encrypted with short-lived shared secret
ave-server/src/routes/login.ts:318-405
Request expiration:
- Login requests expire after 5 minutes
- Prevents stale approval attempts
- Reduces attack window
ave-server/src/routes/login.ts:355
Device information disclosure:
- Device name and type
- Browser and operating system
- IP address and timestamp
- Allows informed approval decision
ave-server/src/routes/login.ts:360-366
Step-by-Step Process
On the New Device
- Go to login page
- Enter your handle
- Click “Confirm on a trusted device”
- Screen shows “Waiting for approval…”
- Device subscribes to WebSocket updates
- Falls back to polling if WebSocket unavailable
TESTING.md:183-195
On a Trusted Device
- Receive real-time notification (red badge on “Login Requests”)
- Navigate to Dashboard → Login Requests
- Review device information:
- Device icon (computer/phone/tablet)
- Browser and OS
- IP address
- Time of request
- Click “Approve” or “Deny”
TESTING.md:197-220
After Approval
- New device receives encrypted master key
- Master key decrypted with ephemeral shared secret
- Session created automatically
- Both devices now have full access
- Login request deleted from database
ave-server/src/routes/login.ts:425-504 and TESTING.md:221-232
Denial and Expiration
If request is denied:- New device shows “Request denied” immediately
- Option to try another method
- Request deleted from database
TESTING.md:235-247
If request expires (5 minutes):
- Status changes to “expired”
- User must start a new login attempt
- Request remains in database until cleanup
TESTING.md:249-257 and ave-server/src/routes/login.ts:421-423
WebSocket vs Polling
Ave uses WebSocket for real-time updates with polling fallback: WebSocket (preferred):- Instant notifications on both devices
- Lower latency for approval flow
- Connection-aware status
TESTING.md:198
Polling (fallback):
- 2-second intervals via HTTP GET
- Works when WebSocket blocked/unavailable
- Reliable but higher latency
TESTING.md:259-273 and ave-server/src/routes/login.ts:408-514
Recovery Method Comparison
| Method | Use Case | Requires | Speed | Security |
|---|---|---|---|---|
| Passkey | Standard login | Registered passkey | Instant | High |
| Passkey + PRF | Standard login with auto key recovery | PRF-capable passkey | Instant | Highest |
| Trust Code | Emergency access, lost passkeys | Written/stored code | Fast | High |
| Device Approval | New device with existing session | Active session elsewhere | 5-30s | High |
Choosing the Right Method
For Daily Use
Use passkey authentication:- Fastest and most convenient
- Biometric/PIN protected
- Syncs across your devices (via iCloud Keychain, Google Password Manager, etc.)
TESTING.md:70-96
For Account Recovery
Use trust codes when:- All passkeys are lost/inaccessible
- Setting up from completely new environment
- Device approval not available (no active sessions)
TESTING.md:99-126
For Adding New Devices
Use device approval when:- You have another device with active session
- Want to review device info before approving
- Prefer not to retrieve stored trust codes
TESTING.md:156-233
Recovery Planning
Before You Need Recovery
- Register multiple passkeys on different devices
- Save trust codes in secure offline storage
- Keep one active session on a device you control
- Test recovery flow at least once to verify it works
TESTING.md:374-393
Creating a Recovery Kit
Store the following securely (physical safe, password manager, etc.):Testing Your Recovery
- Test passkey login - Log out and back in using biometric
- Test trust code recovery - Use a trust code to log in from new browser
- Test device approval - Request approval from incognito window
- Verify master key access - Confirm you can decrypt existing data
TESTING.md:99-298
Troubleshooting
Cannot Access Any Recovery Method
If you’ve lost access to all passkeys, trust codes, and active sessions:- Check if passkeys synced to another device (iCloud, Google account)
- Search for trust codes in password manager, notes, or physical storage
- Check email for account creation confirmation (may include recovery info)
- Contact Ave support with identity verification
Trust Code Not Working
See Trust Codes Troubleshooting for:- Invalid code errors
- No codes found errors
- Master key decryption failures
Device Approval Stuck
If approval request is not appearing:- Refresh the trusted device
- Navigate manually to Dashboard → Login Requests
- Check browser console for WebSocket errors
- Try polling fallback (wait 5-10 seconds)
- Request may have expired - try again
TESTING.md:276-297
Passkey Not Recognized
If browser doesn’t show your passkey:- Ensure you’re on correct domain/localhost port
- Check if passkey synced to this device
- Verify browser supports WebAuthn (Chrome, Edge, Safari, Firefox)
- Try different browser or device
- Use trust code recovery as fallback
ave-server/src/routes/login.ts:192-206
Security Considerations
Activity Logging
All recovery attempts are logged:ave-server/src/routes/login.ts:272-280
Failed Attempt Monitoring
Failed recovery attempts are logged as warnings:ave-server/src/routes/login.ts:573-580 and ave-server/src/routes/login.ts:702-709
Rate Limiting Recommendations
While not currently implemented, production deployments should add:- Limit trust code attempts per IP/handle
- Exponential backoff for failed passkey verifications
- CAPTCHA after multiple failed attempts
TESTING.md:566-569
Related Topics
- Trust Codes - Detailed trust code documentation
- Session Management - Session tokens and cookies
- Best Practices - Security recommendations