Building a Private Cycle-Tracking App: What Encryption Costs
Pavlo Rubanovskyi
Updated · 5 min read

A private cycle-tracking app encrypts entries on the phone with AES-256 and keeps the key in the iOS Keychain or Android Keystore. The encryption is the easy part. The cost is elsewhere: no analytics on entries, a restorable backup that means holding a key on the server, sync built from encrypted data, and every third-party SDK becoming a privacy promise.
Why start a cycle tracker from privacy, not from sign-up?
Because in this category a leak is not an inconvenience but a personal safety issue. Most health apps ask you to create an account first and explain the privacy later. When we built Kvit, our period and pregnancy tracker, we inverted that: the app had to be useful before it knows anything about you, and it had to stay useful if our servers disappeared tomorrow.
That is not a marketing position. It is an architectural constraint, and it decides almost everything downstream.
What does keeping the data on the phone cost?
Saying "your data stays on your phone" is easy. Living with it is not. Here is what the decision took away:
- No analytics on entries. We don't run analytics on entries: cloud copies are stored as AES-256-GCM ciphertext. Product decisions come from aggregate usage signals, not from entries.
- The encrypted backup is a choice, with a price. Kvit works without an account; entries then live only on the phone, and losing the phone loses them. Signing in with Google or Apple turns on the encrypted backup, so entries survive a lost phone — and to restore it, Kvit keeps the key to that copy on its side. We tell users which of the two they are choosing.
- No cheap cross-device sync. Sync has to be built on top of the encrypted backup — encrypted rows exchanged — not as a plain database read.
We accepted all three. For this category, that trade-off is the product.
How is the data encrypted, exactly?
With a named mechanism, not a slogan. "Bank-grade security" tells a user nothing and tells an auditor less. The mechanism, exactly:
1. On first launch the app generates a 256-bit key from a cryptographically secure random source. 2. The key goes into the platform's secure store — the Keychain on iOS (Apple: Keychain services), the Keystore on Android (Android Keystore system). It is not in our code or in a config file. If the user signs in, the key is also stored wrapped on our side so the entries can be restored on a new phone; the encrypted backup itself travels and rests as AES-256-GCM ciphertext. 3. The on-device database is encrypted with AES-256 using that key. Entries are encrypted before anything approaches the network.
In simplified form:
`dart final key = await secureStorage.read(key: 'db_key') ?? await _generateAndPersistKey(secureStorage);
final db = await openEncryptedDatabase( path: await _databasePath(), encryptionKey: base64Decode(key), ); `
What matters is where the key is read from. Encryption with a key stored next to the data protects nobody; the protection rests on where the key lives.
Which third-party SDKs run inside the app, and why does it matter?
Every SDK in the app is someone else's code with network access running inside it, and you answer for what it collects. Apple asks you to disclose the data collected by third-party partners whose code you integrate, and Google Play requires the same in the Data safety form.
Kvit ships no ad SDK; it does use Firebase Analytics and Crashlytics, which is exactly why the third question below matters. An ad SDK is usually framed as a UX decision; in a health app it is a data-flow decision, and leaving it out removes a whole party you would otherwise have to vouch for.
What should you ask before commissioning a private app?
If you are building in health, finance, or anything a user would not want read aloud, ask your engineering partner three questions early:
| Question | A good answer | A warning sign |
|---|---|---|
| Where does the encryption key live? | The platform's secure store — Keychain or Keystore | In a config file, or no clear answer: the encryption is decorative |
| What works with the network off? | The core features; the data model was built for it | "We'll add offline later" — it changes the data model |
| Which third-party SDKs run in the app? | A named list, each with a reason | "Just the usual ones" — each is a privacy promise made on someone else's behalf |
It is the standard we would build your app to.
Building a private app with DriveCode
DriveCode builds iOS & Android apps, Flutter-first. If your app handles health, money or anything else users would not want read aloud, our review of your spec covers where the key lives, what works offline and which SDKs ship — before the price. You get a fixed price per module, the code in your repository from day one, and regular TestFlight and Google Play test builds on your own phone. Projects start from $10K. How it works: building your iOS and Android app in Flutter. How scope sets the schedule: how long it takes to build an app.
Questions people ask
Is AES-256 on the phone enough to keep cycle data private? It protects the data on the phone, as long as the key sits in the platform's secure store. Backups, analytics and third-party SDKs are separate decisions, and each needs its own answer.
Does an encrypted backup mean only the user holds the key? Not in Kvit's case. To restore the encrypted backup on a new phone, Kvit keeps the key to that copy on its side. A design where only the user holds the key needs a recovery code or passphrase, and losing it loses the data.
Does a private app have to work without an account? No, but it helps. Kvit works without one; signing in adds the encrypted backup and sync across devices.
Can a Flutter app use the Keychain and Keystore? Yes, through plugins such as flutter_secure_storage, which stores values in the Keychain on iOS and encrypts them with Keystore-protected keys on Android.