CodeShare
Started October 2026 · Private household app (iOS and Android)
A local-first, end-to-end encrypted app for sharing Albert Heijn bottle-deposit vouchers within a household. The Go backend only stores encrypted blobs.
- End-to-end encryption
- Local-first storage
- Hardware device keys
- Role
- Mobile apps, Go backend, cryptographic protocol, deployment
- Stack
- SwiftUI
- GRDB / SQLite
- CryptoKit
- Secure Enclave
- Android
- Go
- Echo v5
- PostgreSQL 18
- sqlc
- OpenAPI
- Ansible
- Caddy
- FreeBSD

What?
CodeShare is a private household app for scanning, storing, and sharing Albert Heijn bottle-deposit vouchers (emballagebonnen) and a shared Bonuskaart. It started as an iOS app and later got an Android client after I switched to a Pixel. Every phone keeps a full local copy, and a Go backend syncs updates between household members without ever being able to read them.
You scan a paper slip once with the camera, which reads both the barcode and the printed receipt text to pull out the branch number, address, euro amount, and timestamp (all editable before saving). Vouchers are grouped by branch with subtotals and sorted by distance, so when you walk into an Albert Heijn, the vouchers redeemable there show up first. Tapping a voucher renders a regenerated EAN-13 barcode at maximum screen brightness, and the interface is localized in English, Dutch, and Traditional Chinese.
Why?
In the Netherlands, returning cans and plastic bottles (statiegeld) at Albert Heijn gives you a paper voucher that can only be redeemed at that specific branch, with no expiration date. In a multi-person household, slips pile up quickly, and whoever happens to be at that store usually doesn’t have the right piece of paper on them.
Because Albert Heijn self-checkout tills accept barcodes scanned off a phone screen, the fix was simple: scan each voucher once, replicate it to everyone’s phone, group by store, and show the barcode at checkout. Since the vouchers are effectively cash, I didn’t want the server to be able to read them.
How?
Architecture
CodeShare is local-first. Each phone stores the full dataset in SQLite (via GRDB on iOS) so it still works inside supermarkets with poor reception, and treats the server as an untrusted relay and backup.
The backend is a single static Go binary running behind Caddy on FreeBSD, provisioned with Ansible. Routes are generated as a strict Echo v5 server from an OpenAPI 3 spec, with PostgreSQL 18 queries compiled by sqlc. Sync cursors use PostgreSQL transaction IDs (xid8) instead of timestamps so clock skew between devices and hosts can’t skip updates.
At first I distributed the iOS app by sideloading under a free Apple developer account, which leaves out push notifications, Sign in with Apple, and TestFlight, and expires builds every seven days. Because of that, login uses passkeys on a server-hosted web page and sync is always triggered by the client. Eventually the friction of iOS distribution pushed me to switch to a Pixel and add an Android client too. The implementation itself was built using Claude Opus 5.5 under my architecture, threat model, and review.
Cryptography
Voucher contents (barcode payload, amount, and label) are encrypted on the phone with ChaCha20-Poly1305 under a shared household key that never reaches the server. Metadata needed for ordering and deduplication is stored in plaintext next to a sealed copy, and clients only trust the sealed copy so the server can’t tamper with it.
Each phone generates a non-exportable NIST P-256 key pair in hardware (Secure Enclave on iOS), and the household key is wrapped to each device using ECDH and HKDF, authenticated with HMAC. Duplicate vouchers are detected using an HMAC-SHA256 blind index over the barcode payload. The protocol also supports key rotation by wrapping a fresh household key to current members and resealing existing records.
Things that came up in testing
Checking a real Albert Heijn voucher before designing the parser saved a lot of guesswork. It showed the exact line order, Dutch month abbreviations, time zone conventions, and the fact that the EAN-13 barcode doesn’t actually contain the euro amount.
A few bugs only showed up on real hardware. The iOS Simulator doesn’t have screen-brightness control, so I didn’t catch a bug that reset brightness to 0% after closing a voucher until I ran it on an actual phone. And even with sideloaded iOS builds expiring every week, backend changes still had to stay compatible with whichever older build was still installed on another phone in the household.