Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body:
- iOS app
- core:tts (Read Aloud)
- core:vaultcrypto / vaultstore (Encrypted Vaults)
- core:licensing / billing
- Donations / billing
- EPUB reader
- PDF reader
- Markdown viewer
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ body:
- iOS app
- core:tts (Read Aloud)
- core:vaultcrypto / vaultstore (Encrypted Vaults)
- core:licensing / billing
- Donations / billing
- EPUB reader
- PDF reader
- Markdown viewer
Expand Down
4 changes: 2 additions & 2 deletions .github/agent-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ sensitive_paths:
- "core/vaultcrypto/**"
- "core/vaultstore/**"

# Licensing / billing / payments
- "core/licensing/**"
# Billing / payments (no core/licensing module anymore — no Pro tier
# for now, donation-only; these globs are for the still-live donation flow)
- "**/BtcPayClient*"
- "**/*Billing*"

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ios-app-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ jobs:
./gradlew :core:domain:assembleDebug \
:core:tts:assembleDebug \
:core:logger:assembleDebug \
:core:storage:assembleDebug \
:core:licensing:assembleDebug -q
:core:storage:assembleDebug -q

- name: Run Unit Tests
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/jvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ jobs:
#
# `testDebugUnitTest` is a task NAME, not a path — Gradle runs it in every
# subproject that has a task by that exact name and *silently* skips any
# subproject that doesn't, with no error and no log line. core:licensing,
# feature:settings, and app all have `flavorDimensions` (fdroid/play), so
# they only have `test{Fdroid,Play}{Debug,Release}UnitTest` tasks — no plain
# subproject that doesn't, with no error and no log line. feature:settings
# and app both have `flavorDimensions` (fdroid/play), so they only have
# `test{Fdroid,Play}{Debug,Release}UnitTest` tasks — no plain
# `testDebugUnitTest` — and were never actually exercised by this step
# despite having real, passing-when-run-directly tests. Call out their
# flavor-specific debug tasks explicitly so this can't recur silently.
# (core:licensing used to be listed here too — deleted, no Pro tier for
# now, see the Encrypted Vaults Phase 6 cleanup.)
- name: Run JVM tests
run: |
./gradlew testDebugUnitTest \
:core:licensing:testFdroidDebugUnitTest \
:core:licensing:testPlayDebugUnitTest \
:feature:settings:testFdroidDebugUnitTest \
:feature:settings:testPlayDebugUnitTest \
:app:testFdroidDebugUnitTest \
Expand Down
7 changes: 5 additions & 2 deletions KNOWN_LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ contributors don't mistake them for gaps, and so users don't ask

- The Play flavor's donation flow uses BTCPay (self-hosted). It's
not a one-tap "Buy Pro" — it's a manual crypto transfer.
- There is no Pro tier beyond the simple unlock. No subscription, no
monthly tier, no per-book purchase.
- There is no Pro tier at all right now, on any flavor. No unlock, no
subscription, no monthly tier, no per-book purchase — every feature,
including Encrypted Vaults, is free and donation-funded. A subscription
is a possible future direction once there's a real install base to
justify it, not before.

## Accessibility

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,20 @@ libravault/
├── core/
│ ├── database/ # Room entities, DAOs, repositories (KMP commonMain)
│ ├── domain/ # Models, interfaces, use cases (KMP commonMain)
│ ├── licensing/ # Play Billing + F-Droid Ed25519 license key (KMP)
│ ├── logger/ # Local opt-in crash logger (KMP commonMain)
│ ├── storage/ # SAF vault manager, file scanner, metadata extractor
│ ├── tts/ # Text-to-speech reader support (KMP commonMain)
│ └── ui/ # Material3 theme, colours, typography
│ ├── ui/ # Material3 theme, colours, typography
│ ├── vaultcrypto/ # Encrypted Vaults: chunked AES-256-GCM format, key hierarchy
│ ├── vaultstore/ # Encrypted Vaults: lifecycle, Keystore wrap, manifest
│ └── vaultcontent/ # Encrypted Vaults: Readium/Media3/PDF content adapters
└── feature/
├── onboarding/ # First-launch vault setup
├── library/ # Home screen, search, scan trigger
├── reader/ # EPUB + PDF reader
├── player/ # Audio player, sleep timer, chapters
└── settings/ # App preferences, logging, cache management
├── settings/ # App preferences, logging, cache management
└── vault/ # Encrypted Vaults UI: create/unlock/list, import, read/play
```

---
Expand Down
27 changes: 13 additions & 14 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ The attack surface is limited to:
- SAF URI permission handling
- Local data storage (Room database, SharedPreferences, cover art cache)
- BTCPay API responses (Play flavor only, opt-in)
- Encrypted Vaults: the chunked AES-256-GCM file format, the PIN/Argon2id/
recovery-key wrapping hierarchy, and the Android Keystore integration

Out of scope: social engineering, physical device access, OS-level vulnerabilities.

There is currently no paid/Pro tier on any flavor — all features, including
Encrypted Vaults, are free and donation-funded. (A previous Ed25519-license-key
/ Play Billing system was removed; a subscription may return once there's a
real install base to justify it, but not before.)

## Threat model

The asset table below is the canonical list of things worth protecting.
Expand All @@ -45,7 +52,8 @@ this table first — if your change adds a new asset, add a row.
| Asset | Where it lives | Sensitivity |
|---|---|---|
| User's EPUB / PDF / audiobook files | SAF-granted folders; never copied into the app sandbox | High (user's library) |
| License keys (Pro tier) | `libravault_pro.xml` EncryptedSharedPreferences | High (proves purchase) |
| Encrypted Vault content and manifest (files a user chose to encrypt) | App-private dir, chunked AES-256-GCM ciphertext; manifest (titles/authors/highlights/cover art) encrypted as one file | Highest — this is the one asset class the app makes an explicit confidentiality promise about |
| Vault Master Key | In memory only while unlocked; wrapped by a hardware-backed (StrongBox/TEE) Android Keystore key (PIN path) and independently by a 256-bit recovery key shown once at creation | High |
| Reading progress, bookmarks, highlights | Room `libravault.db` | Medium (no PII; user-identifying on restore) |
| Pending BTCPay invoice IDs | `libravault_prefs.xml` | Low (transient, scoped to one donation) |
| Donation crypto addresses | `feature/settings/src/fdroid/.../FdroidStaticDonationAddresses.kt` only — never in the Play APK | Low (public donation addresses) |
Expand All @@ -57,9 +65,11 @@ this table first — if your change adds a new asset, add a row.
|---|---|---|
| **Malicious EPUB / PDF** | Crafts a file that exploits a parser bug to crash, RCE, or extract data | Jsoup-based HTML strip (WS3.6); `MediaMetadataRetriever` bounded by `withTimeout(10s)`; EPUB entry size hard-capped at 5 MB (WS3.5); `BitmapFactory.Options.inSampleSize` capped at 16 (WS3.1); `XmlPullParser.FEATURE_PROCESS_DOCDECL = false` blocks XXE (WS3.4); fuzz harness in CI for the parsers (WS7). |
| **Compromised BTCPay** or **MITM** | Returns malicious `checkoutLink` (e.g. `javascript:`, `intent:`) | DonateScreen validates `checkoutLink.startsWith("https://")` and shows the host inline before launching the browser (WS5.2). Proxy requires Bearer auth with `PROXY_SHARED_SECRET` and 4 KB body cap (WS2). |
| **Rooted device** | Reads `libravault_pro.xml` from the EncryptedSharedPreferences sandbox | Documented as out-of-scope; master key is AES-256-GCM, key scheme is per-install. If a device is rooted the attacker has effectively won already. |
| **Sibling app with SAF grant to same folder** | Reads the user's library directly via SAF; nothing the app can do | Sandbox isolation; SAF grants are user-approved at folder level. |
| **Rooted device / offline image of `/data`** | Extracts app-private storage with the device off or locked, no live UI | Encrypted Vault content is never derivable from disk alone: the PIN-wrapped Vault Master Key additionally requires the non-exportable Keystore key (no offline brute-force path), and the recovery-key path requires a 256-bit key that was never persisted anywhere. |
| **Live device, repeated vault PIN guessing** | Attacker holds an unlocked-screen device, tries PINs in the vault UI | Exponential backoff after 3 free attempts (capped at 5 min); deliberately no auto-wipe on repeated failure. |
| **Sibling app with SAF grant to same folder** | Reads the user's library directly via SAF; nothing the app can do | Sandbox isolation; SAF grants are user-approved at folder level. Encrypted Vault content is never SAF-exposed at all — it lives in app-private storage. |
| **Over-the-shoulder clipboard sniff** | Views the BTC address the user is about to paste | `copyToClipboard` sets `EXTRA_IS_SENSITIVE` on Android 13+, suppressing the system clipboard preview (WS5.4). |
| **Screenshot / screen recording / casting while a vault is open** | Malware or a shoulder-surfer captures the screen | `FLAG_SECURE` — unconditional while a vault's recovery key is shown/entered, user-togglable (default on) for vault content otherwise. |
| **BTCPay API abuse / request flood** | Burn the proxy's CPU / memory | `express-rate-limit` (60 req/min/IP globally, 10 req/min/IP per endpoint); 4 KB body cap (WS2). |
| **Side-channel via MediaMetadataRetriever** | Hangs the IO thread on malformed frames | `withTimeout(10_000)` covers the entire extract (WS3.3). |
| **EPUB with 500 MB cover image** | OOM during `BitmapFactory.decodeByteArray` | Cover entry size-capped at 5 MB in EPUB extract (WS3.5); `inSampleSize` capped at 16 (WS3.1); header that reports 0×0 is rejected before decode (WS3.1). |
Expand All @@ -71,17 +81,6 @@ this table first — if your change adds a new asset, add a row.
| `fdroid` | **Stripped** from manifest | None |
| `play` | Declared | `https://<your-btcpay-host>/donate/*` only, with Bearer auth, body-capped, rate-limited, scheme-validated (WS2 + WS5.2). |

### Key rotation

Ed25519 key for Pro license verification is rotated by:
1. Generating a new keypair with `tools/gen_keypair.py`.
2. Shipping an app release with the new public key in `LicenseVerifier.PUBLIC_KEY_B64`.
3. Re-signing all outstanding Pro license tokens with the new private key.

The `pro:v1:` payload prefix is unchanged across rotations — no
client-side version bump is required. Old keys remain valid for any
client that hasn't upgraded.

### When the proxy is compromised

If `PROXY_SHARED_SECRET` leaks (compromised CI, decompilation of a
Expand Down
12 changes: 6 additions & 6 deletions SHERPA_ONNX_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ they already do for engine binaries); `core/tts/build.gradle.kts`'s
checks after copying from assets into app storage.

This specific voice was a deliberate choice, not the first thing tried.
LibraVault doesn't have a live paid tier today (per `KNOWN_LIMITATIONS.md`:
"no Pro tier beyond the simple unlock"), but it does ship Play Billing /
license-verification infrastructure (`core/licensing`) toward one that isn't
launched yet — so the model's license needed checking before shipping it
regardless, to avoid a licensing cleanup once that goes live. Two more
"obvious" options were looked at and ruled out:
LibraVault has no paid tier today — the Ed25519-license-key/Play Billing
infrastructure this note originally referenced (`core/licensing`) was
removed; all features are free, donation-funded, and a subscription tier
is a possible future direction, not a near-term one. The model's license
still needed checking before shipping it regardless. Two more "obvious"
options were looked at and ruled out:

- **sherpa-onnx's own "Pocket TTS" model family** (`sherpa-onnx-pocket-tts-*`)
— same name as this feature, and `PocketVoiceCatalog`'s original design
Expand Down
1 change: 0 additions & 1 deletion WORKTREE-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Full details: `docs/v3-ios-ci-setup.md`
- `core/database` — SQLite schema, DAOs, migrations (Room KMP)
- `core/storage` — File scanning, metadata extraction (interfaces + platform `actual`s)
- `core/tts` — Text-to-speech interface (iOS implementation deferred to v3.1)
- `core/licensing` — Licensing interfaces (iOS implementation in v3.1)
- `core/logger` — Local-only logging interface

### iOS-Only Modules
Expand Down
37 changes: 0 additions & 37 deletions core/licensing/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading