Skip to content

Latest commit

Β 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” SecureVault

Offline hardware password manager with 6-layer encryption β€” ESP32-S3 firmware + Electron desktop app + Chrome extension.

Your vault never leaves the device. No cloud. No accounts. No trust required.

Platform Framework Language Electron Extension License: MIT

🌐 Landing Page · ⚑ Web Flasher

SecureVault is a hardware password manager built on the ESP32-S3 (EdgeHax S3-PRO, N16R8). It stores your passwords in an encrypted vault on the device itself, behind a PIN lock with brute-force backoff. You can type passwords into any device over USB-C HID or Bluetooth LE HID β€” no software, no drivers, no browser extensions required on the host. For bulk management, AP Mode spins up an end-to-end encrypted WiFi hotspot + webapp, and the Electron desktop companion connects over USB-CDC serial with ECDH P-256 + AES-256-GCM.


πŸ”‘ What it does, in one picture

flowchart LR
    V["Your vault<br/>lives on the device"] --> P["Pick an entry,<br/>tap a field"]
    P --> Q{"Connected<br/>how?"}
    Q -->|USB-C HID| U["Types into your<br/>PC as a keyboard"]
    Q -->|Bluetooth LE| W["Types into your phone<br/>or laptop, wirelessly"]
    Q -->|AP Mode WiFi| A["Manage vault from<br/>phone browser (E2EE)"]
    Q -->|USB-CDC serial| D["Electron desktop<br/>dashboard (E2EE)"]
Loading

To the host computer it just looks like someone typing β€” no app, no browser extension, no account needed for basic use.


πŸ†š How it compares

SecureVault Cloud manager Browser autofill
Where secrets live πŸ”’ on the device ☁️ company server πŸ’» browser profile
Needs an account ❌ βœ… βœ…
Needs host software for basic typing ❌ βœ… βœ…
Works on any device, no install βœ… (USB/BLE) ❌ ❌
Usable fully offline βœ… ❌ ❌
End-to-end encrypted management βœ… (ECDH+AES-GCM) ❌ (server decrypts) ❌
Open hardware + firmware βœ… ❌ ❌

✨ Features

Feature What it does
⌨️ Dual-transport typing Types passwords as real keystrokes over USB-C HID and Bluetooth LE HID simultaneously.
πŸ” 6-Layer Security Stack ECDH P-256 handshake β†’ HKDF-SHA256 key derivation β†’ AES-256-GCM encryption β†’ per-message nonce β†’ method tunneling β†’ traffic obfuscation.
πŸ”’ PIN lock + brute-force backoff 4-digit unlock with escalating lockout (30s β†’ 60s β†’ 2m β†’ 5m) persisted across reboots.
πŸ“Ά AP Mode (WiFi hotspot) Spin up a captive-portal web app with end-to-end encryption. Join WiFi, enter a 6-digit code, manage vault from any phone browser.
πŸ–₯️ Dashboard Mode (USB-CDC) Electron desktop companion connects over serial with full ECDH+AES-GCM session. Push/pull entries, view dashboard.
🧩 Chrome Extension Browser extension syncs .svlt encrypted vault file with the Electron app for autofill, breach checking, and save prompts.
πŸ—‚οΈ Encrypted vault on SD + Flash AES-256-GCM encrypted vault.db on SD card with atomic writes + backup rotation. LittleFS partition for session data.
πŸ”Ž Search & favorites Live filtering with on-screen keyboard, plus favorites view.
πŸ›‘οΈ Duress mode Separate decoy vault unlocked by a secondary PIN β€” real vault stays hidden.
πŸ”’ Auto-lock, sleep, factory reset Idle auto-lock, hold-to-lock, PIN-gated factory wipe.
🎨 Custom TFT UI Hand-drawn UI on 320Γ—240 ILI9341 TFT β€” color avatars, glow effects, pill toggles.
πŸ“Š RTC + diagnostics DS3231 RTC for timestamps, MPU6050 IMU, AT24C32 EEPROM, full diagnostic logging.
πŸ” Secure key zeroing All ECDH private keys, session keys, and PIN buffers wiped with secureZero() on lock/timeout/mode-exit.

🧭 Getting around

flowchart LR
    L["Lock"] --> P["PIN"]
    P --> H["Home / Vault List"]
    H --> D["Detail<br/>tap a field β†’ it types"]
    H --> A["Add new entry"]
    H --> S["Settings"]
    S --> M["Mode Menu"]
    M --> BLE["BLE Mode"]
    M --> AP["AP Mode<br/>WiFi hotspot"]
    M --> DB["Dashboard Mode<br/>USB-CDC serial"]
Loading

πŸ›‘οΈ 6-Layer Security Stack

Every management session (AP Mode, Dashboard Mode) is protected by six independent layers:

flowchart TB
    L1["Layer 1: ECDH P-256 Key Exchange<br/>Device + client agree on a shared secret"] --> L2
    L2["Layer 2: HKDF-SHA256 Key Derivation<br/>Session key = HKDF(ecdh_secret + SHA-256(code))"] --> L3
    L3["Layer 3: AES-256-GCM Encryption<br/>Every message encrypted + authenticated"] --> L4
    L4["Layer 4: Per-Message Nonces<br/>Sequential counter prevents replay"] --> L5
    L5["Layer 5: Method Tunneling<br/>Request types wrapped in obfuscated envelopes"] --> L6
    L6["Layer 6: Traffic Obfuscation<br/>Padding + chaff traffic hides real patterns"]
Loading

Key lifecycle: all private keys and session keys are zeroed with secureZero() (volatile memset, not optimized away) on lock, timeout, mode-exit, or power-off.


🧰 Hardware

Part Detail
Board EdgeHax ESP32-S3 S3-PRO (N16R8)
MCU ESP32-S3, dual-core, 8 MB octal PSRAM, 16 MB flash
Display ILI9341, 320 Γ— 240, SPI TFT + XPT2046 touch
RTC DS3231 (IΒ²C) β€” timestamps on vault entries
IMU MPU6050 (IΒ²C) β€” motion-based auto-lock detection
EEPROM AT24C32 (IΒ²C) β€” persistent lockout counters
SD Card microSD on dedicated HSPI bus β€” encrypted vault storage
LED RGB status LED
USB USB-C, native ESP32-S3 (USB-OTG / TinyUSB)

πŸš€ Quick start

1. Build the firmware (PlatformIO)

Tool Version Where
PlatformIO latest platformio.org
ESP32-S3 core Espressif v5.x Via PlatformIO
# Install PlatformIO
pip install platformio

# From the firmware directory:
cd firmware
pio run -t upload

# Monitor serial output (115200 baud):
pio device monitor

First-time flash (if the partition table changed):

pio run -t erase && pio run -t upload

2. Build the Electron desktop app

cd electron
npm install
npm start

The Electron app connects over USB-CDC serial. Make sure Dashboard Mode is active on the ESP32 (TFT shows a 6-digit code), then enter the code in the app.

3. Load the Chrome extension

  1. Open chrome://extensions/
  2. Enable Developer mode
  3. Click Load unpacked β†’ select the extension/ folder
  4. The SecureVault icon appears in your toolbar

4. Flash via web installer (no IDE needed)

Visit the self-flasher page β€” connect your ESP32-S3 via USB, click the button, and the firmware installs directly from the browser using ESP Web Tools. See flasher/ for the hosted page.


πŸ“ Project structure

SecureVault/
β”œβ”€β”€ firmware/                    ESP32-S3 firmware (PlatformIO + ESP-IDF)
β”‚   β”œβ”€β”€ src/                     C++ source files
β”‚   β”‚   β”œβ”€β”€ main.cpp             Main: setup/loop, UI controller, HID dispatch
β”‚   β”‚   β”œβ”€β”€ ui_screens.cpp       All screen drawing + touch handlers (~150KB)
β”‚   β”‚   β”œβ”€β”€ vault_manager.cpp   Encrypted vault CRUD on SD + flash
β”‚   β”‚   β”œβ”€β”€ web_vault_server.cpp AP Mode HTTPS server + E2EE webapp
β”‚   β”‚   β”œβ”€β”€ ap_mode_manager.cpp  WiFi AP lifecycle (start/stop/teardown)
β”‚   β”‚   β”œβ”€β”€ secure_session.cpp   ECDH P-256 + HKDF + AES-256-GCM session
β”‚   β”‚   β”œβ”€β”€ serial_protocol.cpp  Dashboard Mode USB-CDC serial protocol
β”‚   β”‚   β”œβ”€β”€ ble_keyboard_manager.cpp  BLE HID keyboard + pairing gate
β”‚   β”‚   └── ...                  Crypto, display, RTC, diagnostics, etc.
β”‚   β”œβ”€β”€ include/                 Headers
β”‚   β”‚   β”œβ”€β”€ ui_screens.h         UiController + Screen enum
β”‚   β”‚   β”œβ”€β”€ portal_html.h        Captive-portal SPA (embedded HTML)
β”‚   β”‚   β”œβ”€β”€ vault_types.h        VaultEntry, SessionData structs
β”‚   β”‚   └── ...                  All module headers
β”‚   β”œβ”€β”€ components/              ESP-IDF components (esp_littlefs, esp_tinyusb, tinyusb)
β”‚   β”œβ”€β”€ docs/                    AP_MODE.md, GPIO_MAP.md
β”‚   β”œβ”€β”€ platformio.ini           Build configuration
β”‚   β”œβ”€β”€ sdkconfig.defaults       ESP-IDF sdkconfig overrides
β”‚   β”œβ”€β”€ partitions.csv           Flash partition table
β”‚   └── CMakeLists.txt           ESP-IDF CMake
β”‚
β”œβ”€β”€ electron/                    Desktop companion app (Electron)
β”‚   β”œβ”€β”€ main.js                  Main process: serial channel, vault ops, IPC
β”‚   β”œβ”€β”€ preload.js               Context bridge to renderer
β”‚   β”œβ”€β”€ secureChannel.js         ECDH + AES-256-GCM over USB-CDC serial
β”‚   β”œβ”€β”€ vaultCrypto.js           Vault encryption/decryption (PBKDF2 + AES-GCM)
β”‚   β”œβ”€β”€ vaultFileCrypto.js       .svlt v2 file format for extension sync
β”‚   β”œβ”€β”€ breachCheck.js           HaveIBeenPwned API integration
β”‚   β”œβ”€β”€ wordlist.js              Diceware wordlist for passphrase generation
β”‚   β”œβ”€β”€ renderer/                UI (index.html + renderer.js + style.css)
β”‚   └── package.json             Electron + serialport dependencies
β”‚
β”œβ”€β”€ extension/                   Chrome extension (Manifest V3)
β”‚   β”œβ”€β”€ manifest.json            MV3 manifest with permissions
β”‚   β”œβ”€β”€ background.js            Service worker: vault sync, autofill engine
β”‚   β”œβ”€β”€ content.js               Content script: form detection
β”‚   β”œβ”€β”€ window.js                Vault UI (popup window)
β”‚   β”œβ”€β”€ window.html              Vault HTML
β”‚   β”œβ”€β”€ window.css               Vault styles
β”‚   β”œβ”€β”€ inline-overlay.js        In-page overlay for credential capture
β”‚   β”œβ”€β”€ save-prompt.js           New-credential save prompt
β”‚   β”œβ”€β”€ urlMatcher.js            URL matching for autofill
β”‚   β”œβ”€β”€ vaultFileCrypto.js       .svlt file read/write (shared with Electron)
β”‚   β”œβ”€β”€ breachCheck.js           Breach checking (shared with Electron)
β”‚   β”œβ”€β”€ icons/                   Unlocked icons (16/48/128px)
β”‚   └── icons_locked/            Locked icons (16/48/128px)
β”‚
β”œβ”€β”€ docs/                        Project documentation
β”‚   β”œβ”€β”€ AP_MODE.md               AP Mode architecture, threat model, troubleshooting
β”‚   β”œβ”€β”€ GPIO_MAP.md              ESP32-S3 GPIO pin assignments
β”‚   └── ARCHITECTURE.md          Full architecture deep dive
β”‚
β”œβ”€β”€ scripts/                     Utility scripts
β”‚   └── disable_component_manager.py  ESP-IDF component manager disable
β”‚
β”œβ”€β”€ flasher/                     Web-based firmware installer
β”‚   β”œβ”€β”€ index.html               ESP Web Tools installer page
β”‚   β”œβ”€β”€ manifest.json            Firmware manifest for ESP Web Tools
β”‚   └── firmware/                Pre-built binary files for web flasher
β”‚
β”œβ”€β”€ .github/workflows/           CI
β”‚   └── build.yml                PlatformIO build on push/PR
β”‚
β”œβ”€β”€ .gitignore                   Ignore patterns
β”œβ”€β”€ LICENSE                      MIT license
β”œβ”€β”€ CONTRIBUTING.md              Contribution guidelines
β”œβ”€β”€ SETUP.md                     New-machine setup guide
└── README.md                    This file

πŸ–₯️ Using Dashboard Mode

  1. Power on β†’ enter PIN β†’ vault list.
  2. Tap the mode badge (top-right) β†’ DASHBOARD.
  3. TFT shows a 6-digit code (e.g. 482917).
  4. Launch the Electron app β†’ click Connect to ESP32 Device.
  5. Enter the 6-digit code β†’ ECDH handshake completes (~100ms).
  6. All reads/writes are AES-256-GCM encrypted frames over USB-CDC serial.
  7. Exit: tap mode badge β†’ BLE MODE, or click Lock in the Electron app.

πŸ“Ά Using AP Mode

  1. Power on β†’ enter PIN β†’ vault list.
  2. Tap mode badge β†’ AP MODE.
  3. TFT shows SSID, WPA2 password, and 6-digit code.
  4. On your phone: join the WiFi β†’ open http://192.168.4.1/ (captive portal auto-opens).
  5. Enter the 6-digit code β†’ ECDH handshake β†’ vault loads in the browser.
  6. All traffic is end-to-end encrypted (same 6-layer stack).
  7. Exit: tap BACK, or idle timeout (5 min), or auto-lock.

Every AP session regenerates the WPA2 password + 6-digit code + ECDH keypair. Exiting AP mode tears down WiFi, DNS, mDNS, the web server, and zeros all session credentials with secureZero().


🧩 Using the Chrome Extension

  1. Load the extension (Developer mode β†’ Load unpacked β†’ extension/ folder).
  2. Set a master password β€” this encrypts the local .svlt vault file.
  3. The Electron app and extension share the .svlt file for two-way sync:
    • Extension β†’ Electron: new logins captured on the web get pushed to the ESP32.
    • Electron β†’ Extension: entries synced from the ESP32 appear in the browser autofill.
  4. Inline overlay detects login forms and offers to save credentials.
  5. Breach check queries HaveIBeenPwned (k-anonymity API) for password exposure.

πŸ” Security model

What it does today:

  • Vault is offline, PIN-gated, and encrypted at rest (AES-256-GCM on SD card).
  • Brute-force PIN backoff persists across reboots (stored in AT24C32 EEPROM).
  • AP Mode and Dashboard Mode require ECDH P-256 handshake before any vault data flows.
  • All session keys zeroed with secureZero() on lock/timeout/exit.
  • Duress mode: secondary PIN unlocks a decoy vault, real vault stays hidden.
  • Browser extension vault file uses PBKDF2-SHA512@600k iterations + AES-256-GCM + HMAC-SHA256.

What it does not do yet (PRs welcome):

  • ESP32 Flash Encryption + Secure Boot v2 (one-way fuses, release mode).
  • FIDO2 / WebAuthn passkey (ECC P-256).
  • TOTP / 2FA code generator (HMAC-SHA1) β€” code exists but is not yet wired into the UI.

Treat this as a strong DIY / learning project with real crypto, not a certified security product. See the roadmap.


πŸ—ΊοΈ Architecture

Firmware (ESP32-S3)

The firmware is a PlatformIO project using the arduino + espidf dual framework. The main loop runs at ~60Hz: poll touch, render screen, service background managers (BLE, WiFi AP, auto-lock, secure session). No RTOS scheduling in user code.

loop() @ ~60 Hz
 β”œβ”€β”€ pollTouch() β†’ tap/drag/swipe/long-press β†’ onTapScreen()
 β”œβ”€β”€ per-screen animation ticks
 β”œβ”€β”€ BLE keyboard manager (advertise, pairing gate)
 β”œβ”€β”€ WiFi captive-portal service (AP Mode)
 β”œβ”€β”€ USB-CDC serial secure session (Dashboard Mode)
 β”œβ”€β”€ auto-lock / LED / physical button
 └── secure key lifecycle (zero on exit)

Electron app

The Electron desktop app connects to the ESP32 over USB-CDC serial (no HTTP, no network stack). The secure channel (secureChannel.js) performs ECDH P-256 handshake, then all communication is AES-256-GCM encrypted frames. The app also reads/writes an encrypted .svlt file that the browser extension consumes, enabling two-way vault sync.

Chrome extension

Manifest V3 extension with a service worker background, content scripts for form detection, and a popup vault UI. Shares vaultFileCrypto.js and breachCheck.js with the Electron app for format compatibility.

For the full deep dive, see docs/ARCHITECTURE.md.


πŸ›£οΈ Roadmap

  • Touch UI, encrypted vault, USB + BLE HID, AP Mode, Dashboard Mode
  • 6-Layer Security Stack (ECDH + HKDF + AES-GCM + nonces + tunneling + obfuscation)
  • Chrome extension + Electron desktop companion + .svlt file sync
  • Duress mode (decoy vault)
  • ESP32 Flash Encryption + Secure Boot v2 (one-way fuses)
  • FIDO2 / WebAuthn passkey (ECC P-256)
  • TOTP / 2FA code generator (HMAC-SHA1)
  • Custom PCB + 3D-printed enclosure

🀝 Contributing

Contributions, bug reports, and hardware ports are welcome β€” see CONTRIBUTING.md.

πŸ“œ License

MIT Β© Purujith Kadekar.

πŸ™Œ Credits

If this project helped you, drop a ⭐ β€” it genuinely helps.

About

An offline, air-gapped hardware password manager built on the ESP32-S3 featuring a capacitive Touch UI, Dynamic AP configuration, and 5D joystick control. Landing Page : https://securevault-hardware.vercel.app/

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages