Ayni icon ayni / diaswarm

part of the diaswarm project

See the glucose of someone who shares it with you.

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.

Get it on F-Droid desktop peer → view on github →
mum · shared with you 23s ago
5.9 +0.1
3h · in range 3.9–10.0mmol/L

every reading carries its age — so a stale one can't pose as current.

01read this first

What Ayni is, and what it is not

Ayni does one job well and is honest about the rest. It shows glucose — it never touches a dose.

is

✓A viewer for one person's glucose, with every reading shown with its age.
✓End-to-end sealed: records are encrypted on the sender's phone, openable only with a key.
✓Revocable by key, not by a server's goodwill — stop wrapping the next key and sharing ends.
✓Serverless and accountless — readings travel directly between phones.
✓A standalone app (nz.diaswarm.ayni) that installs alongside AndroidAPS, never over it.

is not

✕An artificial pancreas. It contains no closed-loop code and does not talk to a pump.
✕Able to deliver insulin or change a dose. There is nothing in it to dose with.
✕A Nightscout server, or a thing that needs one.
✕A medical device. It's capable but early software — see the honest trade-offs.
✕A way to find or search for a person — there is no directory, deliberately.
02features

Sharing that you hold the key to

The whole design removes the server and puts access in one place: who holds a key.

a

Sealed in the middle

Records are sealed on the sender's phone before they are sent. Every holder in between stores ciphertext and can read none of it.

b

Revoke by key

Withdrawing access doesn't ask a server to stop serving. The departing reader is simply not wrapped for the next segment.

c

No account, no server

There is nobody to sign up with and no cloud holding your data. Readings travel phone to phone.

d · ~2–3 min

Fresh, and labelled with it

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.

e

Carried by the community

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.

f · no internet needed

On the same network, phones connect directly

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.

03the swarm

A community holds the data up — not a company

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.

stranger's phone · bucket 0x3146 segments · 219 wraps

6d 4b ef 8e ba e0 0f 46 8f 82 6b 31 e8 0e 5d 58 aa ec 83 2a 67 48 5d 6c 55 88 9d 3b e8 75 dc a2 a2 84 81 b0 f0 65 b5 40 96 59 54 64 cb e0 1c d1 13 68 27 13 ff 38 a1 24 75 97 23 eb e2 e3 e2 e8 c2 46 02 3f 13 00 9d 3b bd 7d b0 3c e1 3c 5f e4 1e 7d 00 e9 a3 ec 05 e6 30 f7 90 ad 44 39 35 90 0d c4 b3 b6 7f 08 1c eb 21 b0 e4 09 e2 dc fe f4 c3 6b 3f ba e1 65 3c 67 e3 8f 59 9f bc 55 b9 6c 32 4f fc fe a1 df eb 33 a5 22 7f 8e c5 f2 7b 2f 72 2a a9 85 8f 81 c1 5c c0 06 4c 8a 33 b9 4a 3c a8 6d 13 c5 d2 ea e8 ae f5 06 c3 99 b9 e5 09 22 14 1b 15 02 9a f2 31 22 33 ac 3e 74 fe 6c ac c6 65 6a 0f 3a ce f9 27 ec 82 1f 35 9a 2b 13 45 a5 8e 7b fe 13 69 50 01 01 69 17 3b ec c7 c3 6f da f6 cd a9 92 59 68 7f 7e 91 b8 aa a2 ba e2 d8 fc 70 7c f5 f9 5b 14 57 e1 b5 bc f4 c9 35 3c cc 1a ea cc a2 b6 89 71 df 90 df 45 af 6f 65 30 96 3b e6 d2 56 ae e0 1d 4e eb 00 21 65 05 b1 e5 2c 36 f2 b3 2c 1d a0 04 cf 97 c0 20 54 b6 f4 8c 96 c7 b3 bb 98 19 0b 9c 39 94 40 39 9e a1 d0 3d e7 0d b0 68 ca a8 cd 1a eb 80 d2 6c dd ca ba e8 db 30 b8 27 20 f2 f4 0e 13 43 f0 de f4 46 32 07 78 8f 24 52 7b 3a 0e 0b 17 a1 77 ce ba 82 b3 63 9d f7 c5 f6 b6 9a cd 2b 10 ba a5 6e 8b 63 7e 1f 10 14 5a 58 33 a3 20 0d 00 d5 de 0b c4 51 66 e8 cb 02 fe 34 a4 6d 08 2c c1 c0 3f db d0 51 75 4c 40 e1 de ad 7f dd d1 d0 c2 f8 b0 49 b6 53 dd 29 d8 a8 d0 77 cb d4 0a 3b 32 05 93 cf a0 da dd d0 35 8f 75 62 89 c0 84 62 7f 3e b4 c5 4c 41 9d 8d f0 91 50 99 92 a2 92 29 35 1e 55 a2 df a4 63 58 65 20 27 0d 79 60 17 a2 67 75 19 d7 46 4d 1f 33 6f 33 9b 93 c1 c8 7e dd af 1e 9f bc e4 94 f7 4a fe 09 1a 4e db e6 b9 8b 3d 88

↑ your readings, as a stranger's phone stores them. It can't read a byte.
follower

Ayni phones

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.

always on

Desktop peers

A diaswarm-peer on a machine that never sleeps turns "probably reachable" into "reliably reachable". One in a friend group lifts everyone in it.

publisher

The sender

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.

04get connected

Install, then pair with one scan

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.

1

Install Ayni

From F-Droid. It installs alongside any other app and asks for nothing to open.

2

Show your code

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.

3

They scan it once

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.

05how it works

One reading, from the phone that recorded it to the phone that draws it

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.

the idea in seven steps the technical version →

    1. A reading is taken

      Your phone records a glucose reading. Your loop keeps running exactly as it does now — sharing is added on the side.

    2. It's sealed before it leaves

      The reading goes into an envelope that's locked on your phone. From here on, the padlock never comes off in the middle.

    3. A key, given to one person

      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.

    4. Strangers carry it, and can't open it

      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.

    5. Your phone can sleep

      Your phone goes offline. Mum's phone simply fetches the envelope from someone else in the pool — there's no server to go down.

    6. Only Mum can open it

      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.

    7. Stopping means changing the key

      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.

    A three-lane diagram: the sender's phone records a reading in plain form, seals it into a segment and wraps the key to one chosen reader; the sealed segment publishes to strangers' phones that hold it and cannot open it; the reader fetches the ciphertext and opens it with a private key that never left their device.
    Where one glucose reading goes. Tomorrow's reading is simply never wrapped for a withdrawn reader — nothing on the network is asked to stop. revocation is the absence of a file.
    Ayni trend screen. Ayni showing a reading with its age.
    06desktop apps

    A machine that doesn't sleep: diaswarm-peer

    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.

    match the version peer-v0.1.8 ↔ Ayni 0.1.7

    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:

    ~$
    diaswarm-peer# carry a share of the pool, read nothing diaswarm-peer identity# the string a subject grants diaswarm-peer read --subject <id> --days 1# print readings diaswarm-peer export --subject <id> --out day.csv# spreadsheet diaswarm-peer summary --subject <id> --days 90 --patient <id> --report agp.html# clinician report diaswarm-peer nightscout --subject <id> --out ./ns# nightscout-format files

    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.

    note on linux

    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.

    07sending your own data

    To share your own loop, you run the diaswarm fork of AndroidAPS

    Ayni only receives. To be a sender — to share the glucose your own insulin-pump loop is already writing — the diaswarm module has to run inside AndroidAPS, and that means building AndroidAPS yourself.

    Building AndroidAPS from source is normal — that part isn't new. The one thing that is specific to diaswarm: you must build from the diaswarm fork of AndroidAPS (the diaswarm-addon branch, which wires the module in), not upstream AndroidAPS. Upstream has no diaswarm module and cannot send.

    The module ships disabled in the fork and is structurally incapable of dosing: it holds no pump reference and has no path into the loop. It only drains your own sealed records outward, and only once you've chosen to share. Build instructions and the full safety rationale are in the project repository.

    Build instructions → The diaswarm repository
    deliberately

    No pre-built loop APK. Anywhere.

    Running a loop is running a medical device you assembled, from source you have read.

    08honest about the trade

    What to know before you rely on it

    Someone may make a decision at 3 a.m. based on what this shows, so the trade-offs are stated plainly rather than buried.

    Built on proven foundations

    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.

    The honest costs

    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.