In development
A search that understands Polish inflection without seeing the text - encrypted data in a personal app
Every entry is encrypted with the key of the user’s space, and search still works like in an ordinary app, including Polish word forms. The database holds only unreadable hashes.
- Client profile
- A private app for personal and family matters: notes, health, mood, home, car, finances
- My role
- Security architecture, data encryption and search
- Status
- In development
This description is anonymous: no client name, data or screenshots.
Context
In this app people record things they would show nobody: test results, their mood over the past weeks, family spending. Under the GDPR this is special category data. Every entry is encrypted with a separate key for the user’s space, so a leaked database or backup does not reveal the content.
Encryption has a price, though. An ordinary search engine cannot search encrypted text. And Polish is heavily inflected: someone searching for “psa” (a dog, in one case) also wants the note that says “psie” or “psach”.
Solution
I built a so-called blind index with Polish morphology. When an entry is saved, each word is reduced to its base form with a Polish dictionary (4.6 million word forms, built into the app) and then turned into an HMAC hash with a key that belongs only to that user’s space. Only the hashes go into the database. A query goes through the same steps, so “mam” finds both an entry about “mama” and one with the verb “mieć”. Prefix search works too. The query text never goes into the URL, so it does not end up in server logs.
To be clear about what this mechanism does not hide: someone with a copy of the database can see that two entries contain the same word, but not which word.
The second part is the end of the data’s life. Deleting an account destroys its encryption keys. Older backups still exist, but without the keys they are random bytes.
Result
Users search their notes the way they are used to, in Polish and with inflection. Someone who walks away with the database holds ciphertext and hashes. Word search also works when the user has not agreed to AI processing or the AI provider is down.
Want a similar system in your company?
Let’s talk