Session Management
Deep dive into session handling, encryption, and security in DesQTA
Session Management Overview
DesQTA implements a secure session management system that stores SEQTA authentication credentials locally with encryption. Sessions are managed entirely by the Rust backend for security.
Session Structure
Session Data Model
Session Storage
File Location
Sessions are stored per profile:
Encryption (Desktop)
Desktop platforms use AES-256-GCM encryption:
Session Operations
Loading Session
Saving Session
Checking Session Existence
Tauri Commands
Check Session
Get Session
Save Session
Clear Session
Authentication Methods
Traditional Cookie-Based Auth
JWT Token Auth (QR Code)
Session Usage in Network Requests
Building Request Headers
Session Security
Encryption Details
- Algorithm: AES-256-GCM
- Key Storage: OS keychain (Windows Credential Manager, macOS Keychain, Linux Secret Service)
- Key Generation: Cryptographically secure random (32 bytes)
- Nonce: Counter-based nonce sequence
- Memory Safety: Keys zeroized after use
Security Best Practices
- Never Log Sessions: Session data never appears in logs
- Encrypted Storage: Desktop sessions encrypted at rest
- Keychain Storage: Encryption keys in OS keychain
- Memory Zeroization: Sensitive data cleared from memory
- Profile Isolation: Each profile has separate session
Session Lifecycle
1. Login Flow
2. Session Validation
3. Session Refresh
4. Logout Flow
Profile-Based Sessions
Multi-Profile Support
Profile Switching
Frontend Integration
Checking Session
Loading Session Info
Session Events
Troubleshooting
Session Not Loading
Check:
- File exists at expected path
- File permissions are correct
- Encryption key exists in keychain
- Profile is correct
Solutions:
- Verify file path
- Check keychain access
- Try clearing and re-logging in
Encryption Errors
Check:
- Keychain access permissions
- Encryption key exists
- File is not corrupted
Solutions:
- Grant keychain access
- Clear session and re-login
- Check file integrity
Next Steps
- Settings Management - Settings system
- Network Communication - HTTP client patterns
- Security Architecture - Security patterns