Overview
Trust codes are recovery keys that provide emergency access to your account when you lose access to your passkeys or devices. Each trust code can decrypt your master key backup, allowing you to regain access to your encrypted data.What Are Trust Codes?
Trust codes are 25-character codes formatted asXXXXX-XXXXX-XXXXX-XXXXX-XXXXX. They are:
- Reusable: Unlike many recovery codes, Ave trust codes can be used multiple times
- Limited quantity: You receive 2 trust codes per account by default
- Encrypted storage: Only hashed versions are stored on the server
- Master key access: Each code can decrypt your encrypted master key backup
Trust Code Format
Trust codes use a human-readable format:- 5 segments of 5 characters each
- Separated by hyphens:
XXXXX-XXXXX-XXXXX-XXXXX-XXXXX - Characters exclude confusing symbols (no 0, O, I, or 1)
- Case-insensitive when entering
- Whitespace and separators are ignored during verification
ave-server/src/lib/crypto.ts:17-33
When You Receive Trust Codes
During Registration
When you create your Ave account, you’ll receive 2 trust codes after setting up security questions:- Complete identity creation
- Set up your first passkey
- Answer 3 security questions (now deprecated)
- Save your 2 trust codes - displayed once
- Check the confirmation box to proceed
TESTING.md:57-63
After Regeneration
You can regenerate trust codes from the Security dashboard. This will:- Invalidate all existing trust codes
- Generate 2 new codes
- Re-encrypt your master key backup with the new codes
- Display the new codes once (save them immediately)
ave-server/src/routes/security.ts:399-428
Using Trust Codes
For Full Account Recovery
If you lose access to all your passkeys and devices:- Go to the login page
- Enter your handle
- Click “Use a trust code”
- Enter one of your trust codes
- Complete device information
- You’ll be logged in with access to your encrypted data
ave-server/src/routes/login.ts:517-659
For Master Key Recovery
If you’re logged in via passkey but don’t have the master key locally (e.g., new device without PRF support):- System will prompt for master key recovery
- Enter a trust code when prompted
- Your master key backup is decrypted client-side
- Master key is stored locally for future use
ave-server/src/routes/login.ts:663-739
How Trust Codes Work
Generation Process
ave-server/src/routes/security.ts:407-413
Verification Process
ave-server/src/lib/crypto.ts:36-45
Master Key Decryption
- User enters trust code
- Server verifies the hash matches
- Server returns encrypted master key backup
- Client-side: Trust code derives decryption key
- Client-side: Master key is decrypted and stored locally
The trust code itself is never stored on the server. Only a SHA-256 hash is persisted. The actual decryption happens entirely client-side.
Security Properties
What’s Protected
- Hash-only storage: Server stores
SHA-256(normalized_code), not plaintext - Client-side decryption: Master key decryption never happens on server
- Normalization: Uppercase, strip separators to prevent timing attacks
- Reusable design: No single-use limitation reduces lockout risk
ave-server/src/lib/crypto.ts:36-40
Activity Logging
Trust code usage is logged as a warning-level event:ave-server/src/routes/login.ts:616-624 and ave-server/src/routes/login.ts:573-580
Regenerating Trust Codes
From the Dashboard
- Navigate to Dashboard → Security
- View current trust code count
- Click “Regenerate trust codes”
- Confirm the warning (old codes will be invalidated)
- Save the 2 new codes immediately
TESTING.md:384-387
API Endpoint
ave-server/src/routes/security.ts:399-428
Best Practices
Storage Recommendations
- Write them down physically - Store in a safe or lockbox
- Use a password manager - Encrypted vault with family sharing
- Separate locations - Keep the 2 codes in different secure places
- Never email or text - Avoid digital transmission unless encrypted
When to Regenerate
- Compromised storage: If your code storage may be exposed
- Shared accidentally: If you showed a code to someone unintentionally
- Regular rotation: Consider annual regeneration for high-security accounts
- Before major changes: When changing primary email or security setup
Recovery Planning
- Test recovery flow: Verify you can actually use a trust code
- Document location: Note where each code is stored (without storing the code itself)
- Backup plan: Have multiple recovery methods (passkeys + trust codes)
- Trusted contact: Consider secure sharing with a family member or executor
Troubleshooting
”Invalid trust code” Error
Possible causes:- Typo in code - Trust codes are case-insensitive, but characters must match
- Code already regenerated - Old codes are invalidated when new ones are created
- No codes registered - Account may not have trust codes set up
ave-server/src/routes/login.ts:570-584
Solution:
- Double-check each character
- Hyphens are optional when entering
- If all codes fail, use device approval or contact support
”No trust codes found” Error
This means no trust codes are registered for your account. Solution:- Log in using a passkey or device approval
- Go to Dashboard → Security
- Click “Regenerate trust codes”
- Save the new codes securely
ave-server/src/routes/login.ts:552-557
Trust Code Not Working After Login
If logged in but master key decryption fails:- Ensure you’re entering the same code used during registration
- Check that
encryptedMasterKeyBackupexists in your user record - Verify client-side decryption logic is working (check browser console)
TESTING.md:507-511
Related Topics
- Recovery Methods - Alternative account recovery options
- Session Management - Understanding session security
- Best Practices - Comprehensive security guidance