Privora supports dual encryption where values are encrypted both with TFHE (for homomorphic computation) and with the user’s X25519 key (for local recovery). This allows users to view their own data without requiring MPC decryption.Documentation Index
Fetch the complete documentation index at: https://docs.privora.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Why Dual Encryption?
Standard FHE decryption requires the network’s private key, which is distributed across MPC nodes. This means:- Decryption requires a threshold of MPC nodes to participate
- Users must wait for the decryption protocol to complete
- Each decryption request has network overhead
How It Works
When submitting encrypted data with dual encryption:- TFHE encryption: Value is encrypted with the network’s FHE public key
- X25519 encryption: Same value is encrypted with user’s X25519 public key
- Submission: Both ciphertexts are submitted together
- Recovery: User can decrypt the X25519 ciphertext locally anytime
Client Implementation
Rust Client
TypeScript Client
X25519 Key Derivation
Privora derives X25519 keys from Solana ed25519 keypairs:- Same Solana keypair always produces same X25519 keypair
- Compatible with standard ed25519-to-X25519 conversion
Encryption Details
Encryption Scheme
User recovery uses XSalsa20-Poly1305 authenticated encryption:| Component | Description |
|---|---|
| Algorithm | XSalsa20-Poly1305 (crypto_box) |
| Key Exchange | X25519 ECDH |
| Nonce | 24 bytes, randomly generated |
| Authentication | Poly1305 MAC |
Data Format
Use Cases
1. Portfolio Display
Users can view their encrypted balances locally:2. Order History
Users can review their order details:3. Receipt Generation
Generate receipts without network requests:When to Use Dual Encryption
Use Dual Encryption
- User’s own data they’ll want to view
- Balances, orders, positions
- Data that doesn’t need to be hidden from the user
Skip Dual Encryption
- Third-party data (e.g., counterparty’s order)
- Computed results that should remain private
- System-generated values
Security Considerations
What Users Can See
With dual encryption, users can decrypt:- Values they encrypted themselves
- Only their own recovery data
What Users Cannot See
Users cannot decrypt:- Other users’ encrypted values
- FHE computation results (unless authorized)
- System-encrypted values
Key Security
- X25519 private key is derived from Solana private key
- Same security model as Solana keypair management
- Recovery data should be stored securely (e.g., encrypted storage)
Comparison: MPC vs User Recovery
| Aspect | MPC Decryption | User Recovery |
|---|---|---|
| Latency | Network round-trip | Instant (local) |
| Authorization | Requires auth PDA | Always available to owner |
| Trust | Threshold trust (k-of-n) | User’s own key |
| Use Case | Cross-party reveals | Viewing own data |
Implementation Notes
Storage Trade-offs
Dual encryption increases storage:| Data | Size |
|---|---|
| FHE ciphertext only | ~10-80KB |
| User recovery data | ~50 bytes |
| Total increase | Negligible |
Performance
User recovery is fast:- X25519 ECDH: ~microseconds
- XSalsa20-Poly1305: ~microseconds
- No network requests
Next Steps
User Recovery Guide
Implement user recovery in your client
Authorization PDAs
Learn about MPC decryption authorization