Secura is an Electron-based secure vault application for managing passwords and sensitive data. It combines Electron, React, TypeScript, Zustand, and Tailwind/Radix UI to provide a secure, responsive, and user-friendly interface.
- Features
- Architecture
- Security Model (Important)
- Getting Started
- Project Structure
- Vault Backend
- UI Components
- Screens
- Utilities & Stores
- Types
- License
- Secure vault with AES-256-GCM encryption
- Master password unlock with secure in-memory session (main process)
- CRUD operations for secrets: add, edit, delete
- Categorized secrets with search and filter
- Custom frameless window with title bar controls
- Radix + Tailwind UI primitives (buttons, inputs, switches, modals)
- Auto-lock, clipboard timeout
- React Router-based navigation
flowchart LR
MainProcess["Main Process - Electron"] -->|IPC Channels| VaultModules["Vault Backend"]
MainProcess -->|Preload Load| Preload["Preload Script"]
Preload -->|Exposed APIs| Renderer["Renderer Process (React)"]
Renderer -->|window.vault.*| VaultModules
Renderer -->|window.electronAPI| MainProcess
Secura is designed so that all encryption/decryption and session key handling happen inside the Electron Main Process, not inside the renderer.
- The renderer never receives the raw session key
- The renderer only calls high-level vault APIs exposed through the preload layer (
window.vault.*) - The main process holds the derived key in memory and performs:
- vault unlock
- encryption/decryption
- read/write operations
- The renderer only receives already-decrypted secret data needed for UI rendering
This reduces the attack surface in case the renderer is compromised (XSS, dependency injection, devtools, etc.).
- User enters master password in the renderer
- Renderer calls
vault.unlock(...)via preload API - Main process invokes
unlockVault(...) - Main process derives and stores the session key in-memory
- Renderer requests secrets through vault APIs
- Main process decrypts secrets and returns safe data to the renderer → displayed in UI
- Node.js >= 18
- npm or yarn
- Electron-compatible OS
git clone https://github.com/yourusername/secura.git
cd secura
npm install# Start Electron app
npm run devnpm run build
npm run packagesrc/main/index.ts– Entry point, creates frameless window, sets up IPC channels for vault operations and window controls, manages app lifecycle.
src/preload/index.ts– Bridges main and renderer safely usingcontextBridge.src/preload/index.d.ts– TypeScript types forwindow.electronAPIandwindow.vault.
src/renderer/src/main.tsx– Entrypoint rendering<App>withHashRouter.src/renderer/index.html– HTML scaffold for root div.
crypto.ts– Key derivation via Argon2id (310k iterations)vaultUnlock.ts– Initial vault setup & unlock logicvaultStore.ts– CRUD operations: read, write, encrypt, decrypt secrets
- Button – styled with variants (size, intent, disabled, ghost)
- Input / Textarea / Label / Select / Switch – Tailwind + Radix
- Icons – Maps secret type to Lucide icons
- Modals & Dialogs
- AddEditSecretModal – add/edit secret with validation & password strength
- DeleteConfirmDialog – confirm deletion
- CustomTitleBar – frameless window controls
- EmptyDetails / SecretDetails – secret detail views
- SecretsList – sidebar with filtering, search, add button
- Sidebar – category navigation + settings + lock vault
- VaultLogo – branding component
- UnlockVault.tsx – Master password entry, unlock logic
- VaultScreen.tsx – Main vault UI: sidebar, secret list, secret details
- SettingsScreen.tsx – Preferences: auto-lock, clipboard timeout, biometric toggle
utils.ts– helper functions (e.g.,cnfor classNames)masterPasswordStore.ts– Zustand store: vault unlocked state (no raw session key in renderer)secretTypes.ts– Maps secret types to human-readable labels
global.d.ts– Extends global Window with electron & vaultvault.ts– Core vault types:
| Type | Description |
|---|---|
| SecretType | union of secret categories |
| Secret | secret object with id, name, value, metadata |
| VaultSettings | user preferences |
| ViewMode | 'list' or 'details' |
| Category | secret filter categories |