← Back to selected work Independent project · Mobile cryptography, native modules & on-device AI · iOS & Android

SecureVault .

A private vault for your papers.

A private document vault for your phone: scan a passport, a lease, or a receipt once, and find it in seconds — encrypted on the device, on iPhone and Android.

SecureVault was rebuilt across nine verified engineering phases from a 2025 prototype into a production-architected React Native 0.88 and Expo SDK 58 application on the New Architecture. It pairs three custom Swift and Kotlin Expo Modules with a SQLCipher full-text index and shared cross-platform cryptographic test vectors. Every document shown is a fictional sample.

1,174 Automated tests

144 Jest suites (1,128 tests) against real SQLite FTS5 + 21 Swift XCTest & 25 Kotlin JUnit vector cases

3 Native Swift & Kotlin modules

expo-vault (Secure Enclave/Keystore + AES-GCM), expo-document-scanner, and expo-document-ai

AES-256 Hardware-bound keys

1 MiB chunked AES-256-GCM streams under iOS Secure Enclave & Android Keystore + SQLCipher FTS5

0.88 / 58 RN & Expo New Arch

React Native 0.88, React 19.3, React Compiler, Expo SDK 58, Unistyles 3, and TypeScript 6

01 / Product walkthrough

See it in motion.

84-second captioned walkthrough with sound: PIN & Face ID setup, document import with on-device Apple Vision OCR and AI field extraction, SQLCipher FTS5 full-text search inside pages, pinch-zoom dark-stage viewer, Secure Enclave lock protection, and dark mode.

02 / Product & interface tour

Every flow, end to end.

Key user flows, states, and interface details across the application.

01

Hardware-sealed encryption & chunked streaming

Every document is encrypted in 1 MiB AES-256-GCM chunks (SVC1 format) under a device key sealed to the iOS Secure Enclave or non-exportable Android Keystore. Thumbnails and pages are encrypted separately so library scrolling stays instant.

02

Encrypted SQLCipher index with FTS5 full-text search

Metadata, tags, and extracted OCR text live in a SQLCipher 4.17 database indexed with SQLite FTS5, allowing instant full-text search inside multi-page documents while the index key itself stays encrypted under the hardware device key.

03

On-device OCR & hallucination-checked AI extraction

Apple Vision (iOS, zero Google dependencies) and ML Kit (Android) extract page text on-device. Where available, Apple Foundation Models or Gemini Nano propose titles, collections, dates, and document numbers — and every proposed date or number must appear verbatim in the OCR text before it is shown.

04

Cross-platform portable backups verified by shared vectors

Passphrase-protected .svbackup (SVB1) archives move a vault between iOS and Android. An independent Node generator produces damaged, reordered, and truncated binary test vectors verified by both Swift XCTest and Kotlin Robolectric suites before restore ever touches the vault.

First intro screen: one place for the papers that matter, with local PIN and Face ID setup
01 / Zero-account setup

Set up locally in under a minute with a 6-digit PBKDF2 PIN and Face ID — no cloud account or server required.

New document form with a suggested title, collection, and the expiry and issue dates found in the text
02 / On-device OCR & AI suggestions

Apple Vision and on-device language models suggest titles, collections, dates, and numbers verified verbatim against scanned text.

Library screen with documents expiring soon, category collections, and recent encrypted documents
03 / Encrypted library & expiry alerts

Separately encrypted thumbnails and a SQLCipher index surface collections and expiring documents without decrypting full files.

Search for the word landlord finding a lease by the OCR text inside the document
04 / SQLCipher + FTS5 full-text search

Finds words inside the OCR text of multi-page leases and policies — not just document titles or tags.

Dark-stage page viewer with the details sheet showing the extracted expiry date and tags of a lease
05 / Native dark-stage viewer & details

Pinch-zoom multi-page viewer with native PDF rasterization inside the vault module and one-tap extracted metadata.

SecureVault library rendered in the dark theme with synchronized status and tab bars
06 / Hardware lock & dark theme

Auto-locks with a privacy cover on backgrounding and switches seamlessly between light and dark Unistyles 3 themes.

03 / Under the hood

Engineered like production.

Architectural choices, state boundaries, and verification strategy for technical reviewers.

01 / Hardware-bound device keys (Secure Enclave & Android Keystore)

On iOS, the random vault key is ECIES-sealed to a non-exportable Secure Enclave private key gated by biometric or device passcode authentication. On Android, keys live in the hardware-backed Android Keystore. The vault module is the only layer permitted to touch cryptographic keys.

Read ADR 0009 on GitHub

02 / SQLCipher + FTS5 index & two-store key hierarchy

Replacing the 2025 prototype's whole-file JSON index, SecureVault separates encrypted binary streams in expo-vault from searchable metadata rows in a SQLCipher database with FTS5 virtual tables. Legacy JSON indexes migrate automatically on first unlock.

Read ADR 0002 on GitHub

03 / Native Apple Vision OCR & grounded on-device language models

iOS uses Apple's native Vision framework for OCR so no third-party ML SDK ships in the iOS binary. On-device language models (Apple Foundation Models / Gemini Nano) extract structured fields, guarded by a strict grounding check that rejects any date or ID not present in the recognized text.

Read ADR 0008 & ADR 0011

04 / Passphrase-protected SVB1 backups & tri-platform binary vectors

The custom SVB1 backup format verifies every header, check entry, and chunk authentication tag in a preflight pass before touching existing vault data. Swift and Kotlin implementations are tested in CI against byte vectors generated by an independent Node specification script.

Read ADR 0007 & Native Test Notes
Technical stack

Core layers & tooling

Runtime & UI
Expo SDK 58, React Native 0.88, React 19.3, New Architecture, React Compiler, TypeScript 6 (strict)
Navigation & Styling
Expo Router typed routes with Stack.Protected session guards; Unistyles 3 light and dark themes
Native Modules (Swift & Kotlin)
Three local Expo Modules: expo-vault, expo-document-scanner (VisionKit / ML Kit), and expo-document-ai
Encrypted Storage & Search
expo-sqlite with SQLCipher 4.17 and FTS5; expo-secure-store for PIN record and lockout state
Cryptography & Containers
AES-256-GCM in 1 MiB chunks (SVC1), PBKDF2-HMAC-SHA256 for PIN and cross-platform SVB1 backups
On-Device Intelligence
Apple Vision (iOS) & ML Kit (Android) OCR; Apple Foundation Models / Gemini Nano with heuristic fallback
Quality & Native CI
Jest + RNTL with real SQLite FTS5 (144 suites, 1,128 tests), Swift XCTest (21) & Kotlin JUnit/Robolectric (25)
Data & state pipeline

From screen to data & services

  1. 01
    Expo Router Screens & Stack.Protected Guards

    Document routes mount only while SessionProvider status is unlocked; backgrounding triggers an instant privacy cover

  2. 02
    Feature Hooks & Document / Backup / OCR Services

    Coordinates multi-page capture, temp file cleanup, encrypted storage, and index updates

  3. 03
    SQLCipher + FTS5 Document Repository

    Encrypted relational store for collections, expiry dates, tags, and full-text search queries

  4. 04
    expo-vault Native Module (Swift & Kotlin)

    Secure Enclave / Keystore key sealing, 1 MiB AES-256-GCM file streams, native PDF rasterization, and SVB1 backups

  5. 05
    expo-document-scanner & expo-document-ai

    VisionKit / ML Kit camera capture, Apple Vision OCR, and grounded Foundation Models / Gemini Nano field extraction

Repository structure

Feature-owned codebase layout

app/
Expo Router routes: lock, setup, tabs, documents, and settings
src/screens/
One folder per screen with co-located components, hooks, and helpers
src/features/
Session, auth, documents, scan, backup, and dark-stage viewer
src/data/
SQLCipher index: schema, migrations, and FTS5 repository
modules/expo-vault/
Swift & Kotlin vault: hardware keys, SVC1 streams, PDF pages, SVB1 backups, native tests
modules/expo-document-scanner/
Swift & Kotlin wrapper over Apple VisionKit and Google ML Kit document scanners
modules/expo-document-ai/
Apple Vision OCR, Apple Foundation Models, and Android Gemini Nano AICore bridge
docs/
Security model, 11 ADRs, 9-phase modernization plan, and Pixel 9 verification records
Run it locally

Zero-credential local setup

Nothing to sign up for — the app has no backend and runs 100% locally on device or simulator. Includes 144 Jest suites against real SQLite FTS5 plus standalone Swift and Kotlin cryptographic vector suites.

npm install
npm run validate
npm run test:native:ios
npx expo prebuild --clean && npm run ios
Project lineage

SecureVault began in 2025 as an Expo SDK 53 prototype (preserved under the legacy-v1 tag) with a single-blob JSON index. It was rebuilt across nine verified phases into a New Architecture Expo SDK 58 app with chunked AES-256-GCM streaming, SQLCipher FTS5 search, three native Swift/Kotlin modules, and cross-platform encrypted backups.