part of the diaswarm project
Ayni is a viewer for one person's continuous glucose — a partner, a parent, a child, someone in your care. It is nothing else: no loop, no pump, no insulin.
Readings are sealed on the sender's phone before they leave it, travel directly between phones — on the same network, with no internet in the middle at all — and only someone handed a key can open them. No account, no server holding your data, nobody who can read it.
It runs on a swarm, not a server: every phone and desktop running it quietly seeds a slice of everyone else's sealed data. The more people take part, the more resilient everyone's readings become — and no device can read a byte it holds for anyone else.
every reading carries its age — so a stale one can't pose as current.
Ayni does one job well and is honest about the rest. It shows glucose — it never touches a dose.
nz.diaswarm.ayni) that installs alongside AndroidAPS, never over it.The whole design removes the server and puts access in one place: who holds a key.
Records are sealed on the sender's phone before they are sent. Every holder in between stores ciphertext and can read none of it.
Withdrawing access doesn't ask a server to stop serving. The departing reader is simply not wrapped for the next segment.
There is nobody to sign up with and no cloud holding your data. Readings travel phone to phone.
Readings normally arrive about 2–3 minutes old — plenty for a CGM — and each is shown with its age, so a stale one can't pose as current.
Android power-saving can delay a backgrounded phone; excuse it from battery optimisation for the freshest data.
Every Ayni phone and desktop peer holds a share of other people's sealed records, so your data stays reachable while your phone sleeps. More participants, more resilient — and none can read it.
Two phones on the same wifi find each other and sync with no internet and no server at all — the offline-first property of the p2panda stack it's built on. Off that network, an iroh relay just introduces the two phones, and still cannot read a byte.
There is no server behind Ayni. The swarm is simply everyone taking part, each holding a small, unreadable slice of everyone else's records, so no single phone has to be awake for the data to be there.
Every follower seeds a share of the pool for people it has never met — the app is named for that reciprocity. Following someone and carrying for the swarm are the same app.
A diaswarm-peer on a machine that never sleeps turns "probably reachable" into "reliably reachable". One in a friend group lifts everyone in it.
The phone sharing its own loop — the diaswarm fork of AndroidAPS — publishes its sealed records into the same swarm, and hands no one a readable copy.
The more people share and seed, the more copies of everything exist and the more resilient everyone's data becomes. Every byte any device holds for anyone else is unreadable ciphertext.
Install Ayni from F-Droid. On its own it does nothing until someone shares with you — that's not a bug. Pairing is a single scan, and it works in both directions at once.
Ayni shows a QR invite. Showing it opens a short window in which the sender's phone will accept being paired back — outside that moment, an uninvited offer is refused.
The person sharing scans your code. Their phone grants you access and hands back its own address in the same movement. The trend line appears.
One scan, not two.
The invite's subject field is exactly the key someone would grant, so a single code works in both directions. An invite is not a secret and not a grant — anyone holding it can download your ciphertext and open none of it. A camera isn't always in the room, so an invite can also be pasted as text.
an invite is not a secret, and not a grant.
The padlock is on for the whole of the middle. The pool holds the ciphertext and serves it to anyone; only a granted reader's private key — which never leaves their device — can open it.
Your phone records a glucose reading. Your loop keeps running exactly as it does now — sharing is added on the side.
The reading goes into an envelope that's locked on your phone. From here on, the padlock never comes off in the middle.
Your phone gives Mum's phone the key to these envelopes, sealed so that only her phone can take it out. You choose who gets one, and nobody else can hand them out.
Copies go to other phones in the pool. They hold your envelopes the way you hold theirs, and none of them can read a thing.
Your phone goes offline. Mum's phone simply fetches the envelope from someone else in the pool — there's no server to go down.
Her phone unlocks it with her key and shows the reading — always with its age, so an old number can't pass for a fresh one.
Next day, you've stopped sharing. Your phone switches to a new key and doesn't give it to her: she can still fetch the new envelope, but can't open it. What she already had, she keeps — and nobody in the middle had to be asked.
Every other holder is a phone, and the promise that your data stays reachable while your phone is asleep rests on someone having the bytes. One mains-powered desktop peer makes that structural rather than a matter of luck. It can read none of what it carries.
The desktop peer and the Ayni app speak one wire protocol, and a mismatched build simply won't carry for a newer phone. Download the peer release that matches your Ayni version from the releases page. There's a native build for each platform, so running one is downloading a file, not installing a toolchain.
| platform | binary goes | service file (keeps it running) |
|---|---|---|
| Linux | ~/.local/bin/diaswarm-peer | systemd/diaswarm-peer.service → ~/.config/systemd/user/ |
| macOS | /usr/local/bin/diaswarm-peer | launchd/nz.diaswarm.peer.plist → ~/Library/LaunchAgents/ |
| Windows | %LOCALAPPDATA%\Programs\diaswarm\ | run windows/install-task.ps1 |
Run it with no arguments and it carries a share of the pool. It can also follow a subject you've been granted and turn that into something a clinic can use:
summary is the clinician's view: an HL7 CGM FHIR document — time in range, mean glucose, GMI, variability, days of wear — that validates against HL7's own validator with zero errors. Nothing here ever dials a server; these are files you choose to hand over.
Run loginctl enable-linger "$USER" after enabling the service, or systemd stops it when you log out — so an "always-on" carrier runs only while you're logged in, which on a server is rarely.
Someone may make a decision at 3 a.m. based on what this shows, so the trade-offs are stated plainly rather than buried.
The hard parts aren't home-made. Transport, membership and gossip are p2panda-net over iroh, and the group encryption that manages keys is p2panda-encryption — mainline, open-source libraries, not cryptography invented here.
diaswarm adds a thin custody layer on top of them with standard, well-known primitives (X25519, ChaCha20-Poly1305). That layer hasn't yet had a formal third-party audit, so treat the whole as capable, actively developed software rather than something battle-hardened.
A relay sees metadata — never your readings, but which devices talk and when. The default is third-party; you can run your own.
Nothing can be un-published. Revocation stops future readings; it can't recall what was already shared.
Being in the swarm is visible, even though everything you hold for others is unreadable ciphertext.
Early days: no iOS yet, and storage grows over time — there's no pruning.
The full technical assessment lives in the repository's feasibility notes and decision log.