How devbynaveen/ciphervault works
1) Overall shape
CipherVault is a Java 21 desktop application built with JavaFX 21. It is not networked: all state stays on the user’s machine. The main runtime path is a UI-driven client that talks to a local application service, which in turn coordinates crypto, filesystem storage, and a SQLite database.
2) Top-level application boundary
com.ciphervault.app contains the launch boundary:
• Launcher is the executable entry point.
• CipherVaultApp is the JavaFX application class.
This is the UI shell that starts the desktop app and hands off to the rest of the system.
3) Presentation layer
The UI is a JavaFX dashboard with styling in src/main/resources/styles/app.css. The repo structure suggests the UI is thin and delegates business actions outward rather than embedding storage or cryptography logic directly.
4) Orchestration layer
com.ciphervault.service.AppService is the main coordination layer. It likely owns the user-facing workflows:
• first-time master password setup
• login verification
• file import
• file export
• deletion
• audit recording
This service is the central boundary between the UI and the lower-level subsystems.
5) Security subsystem
com.ciphervault.security holds the core confidentiality logic:
• PasswordService and PasswordHash handle master password hashing/verification using PBKDF2.
• CryptoService and EncryptedPayload handle AES-GCM encryption/decryption for vault files.
The important architectural point is that file content is encrypted before persisting to disk and decrypted only in memory on export.
6) Persistence subsystem: SQLite metadata store
com.ciphervault.db contains a small repository-based persistence layer:
• DatabaseManager manages the SQLite connection and setup
• UserRepository stores the master-password record
• VaultFileRepository stores metadata for vaulted files
• AuditLogRepository stores activity records
The database is the system of record for identity, vault metadata, and audit history, not for raw file contents.
7) File storage subsystem
Encrypted file blobs live separately from the database under the user’s home directory, specifically ~/.ciphervault/vault/. The database keeps references and metadata; the actual file payloads are stored as encrypted blobs on disk.
8) Configuration and local paths
com.ciphervault.config.AppPaths centralizes filesystem locations under ~/.ciphervault/, including:
• the SQLite database file
• the vault directory for ciphertext blobs
This is the main environment-specific boundary in the app.
9) Data flow: setup and login
On first launch, the app creates a master password record. On subsequent launches, the entered password is verified against the stored hash. That password also derives the encryption key used by CryptoService. Successful authentication gates access to all vault operations.
10) Data flow: import/export/delete
For import, file bytes are read, encrypted in memory, and written as ciphertext to the vault directory; metadata and an audit entry are then stored in SQLite. For export, the encrypted blob is read from disk, decrypted in memory, and written to a user-selected destination. Delete removes the stored blob and corresponding metadata, with the action logged.
11) Audit trail
AuditEntry and AuditLogRepository indicate a built-in activity log for security-sensitive events. The audit trail covers login attempts and vault actions, giving the system traceability without involving any external service.
12) Test coverage
Tests live under src/test/java/com/ciphervault/security, with unit coverage for:
• CryptoService
• PasswordService
• AppService
That suggests the most critical behavior is concentrated in security and orchestration logic rather than UI rendering.
13) Architectural summary for a diagram
A good diagram would show: JavaFX UI → AppService → {PasswordService/CryptoService, Repositories, AppPaths} → SQLite database + local encrypted vault files. The key design constraint is that everything is local, and the sensitive file payloads are always encrypted at rest.
Main entry points: AppService.java AppService · CipherVaultApp.java App Shell · CryptoService.java CryptoService · AppPaths.java App Paths
Components 18
Presentation
JavaFX desktop shell and styling
Orchestration
Application workflows and coordination
- AppService · Coordinates login, vault operations, and audit flow
src/main/java/com/ciphervault/service/AppService.java
Security
Password and file cryptography
- PasswordService · Master password hashing and verification
src/main/java/com/ciphervault/security/PasswordService.java - CryptoService · Encrypts and decrypts vault file content
src/main/java/com/ciphervault/security/CryptoService.java - PasswordHash · PBKDF2 password hash representation
src/main/java/com/ciphervault/security/PasswordHash.java - Payload · Encrypted file payload container
src/main/java/com/ciphervault/security/EncryptedPayload.java
Persistence
SQLite-backed metadata and audit storage
- DB Manager · Creates and manages the SQLite connection
src/main/java/com/ciphervault/db/DatabaseManager.java - User Repo · Stores the master-password record
src/main/java/com/ciphervault/db/UserRepository.java - Vault Repo · Stores vaulted file metadata
src/main/java/com/ciphervault/db/VaultFileRepository.java - Audit Repo · Persists security and activity audit events
src/main/java/com/ciphervault/db/AuditLogRepository.java
Local Storage
Encrypted blobs and database files on disk
- SQLite DB · Local metadata and audit store
- Vault Files · Encrypted file blobs stored under the user profile
Configuration
Filesystem location management
- App Paths · Centralizes local filesystem locations
src/main/java/com/ciphervault/config/AppPaths.java
Domain Models
Shared records used across layers
- User Record · Stored master-password metadata
src/main/java/com/ciphervault/model/UserRecord.java - Vault Record · Metadata for an encrypted vault file
src/main/java/com/ciphervault/model/VaultFileRecord.java - Audit Entry · Log entry for authentication and vault actions
src/main/java/com/ciphervault/model/AuditEntry.java
Connections 21
- Launcher → App Shell: starts · Launches the JavaFX application
- App Shell → UI Style: styles · Applies the desktop stylesheet
- App Shell → AppService: delegates · Hands user actions to the application service
- AppService → PasswordService: auth · Verifies and derives master-password state
- AppService → CryptoService: encrypts · Encrypts imported files and decrypts exports
- PasswordService → PasswordHash: produces · Creates and checks password hashes
- CryptoService → Payload: produces · Wraps encrypted file bytes and metadata
- AppService → DB Manager: uses · Opens and coordinates database access
- DB Manager → SQLite DB: connects · Manages the local SQLite database
- AppService → User Repo: stores · Reads and writes master-password records
- AppService → Vault Repo: stores · Persists vault file metadata
- AppService → Audit Repo: logs · Writes audit records for sensitive actions
- User Repo → User Record: maps · Persists user records
- Vault Repo → Vault Record: maps · Persists vault file records
- Audit Repo → Audit Entry: maps · Persists audit entries
- AppService → App Paths: resolves · Finds database and vault filesystem locations
- App Paths → Vault Files: points to · Locates the encrypted blob directory
- App Paths → SQLite DB: points to · Locates the SQLite file
- CryptoService → Vault Files: reads/writes · Stores encrypted file blobs on disk
- AppService → Vault Files: imports/exports · Coordinates file blob movement during vault actions
- AppService → Audit Entry: records · Creates audit events for login and vault operations