AndroidAPS
AndroidAPS copied to clipboard
WIP: Remora Companion App for Remote Control
This pull request introduces an experimental companion app for secure, app-based remote control of AndroidAPS, intended as a more user-friendly and secure alternative to the current SMS Communicator (primarily used by caregivers of children with diabetes).
Motivation
- Replace SMS commands and mobile-network dependencies with a dedicated app UI and IP-based transport (Firebase Cloud Messaging (FCM) and Firestore).
- Replace the SMS OTP mechanism with end-to-end encrypted (E2EE) authenticated messages.
- Enable more ergonomic workflows for caregivers. Help caregivers focus on what's really important instead of typing SMS commands.
Cryptography (current WIP design)
- Key exchange: out-of-band Elliptic-Curve Diffie–Hellman (ECDH, prime256v1).
- Final keys and a small key verification string are derived using HKDF.
- Message protection: AES-128 in AEAD mode (AES-GCM) for confidentiality and integrity.
Architecture
Remora consists of three components:
- The Remora companion app, which must be installed on follower phones.
- The Remora AndroidAPS plugin, which must be bundled with the used installation of AndroidAPS on the main phone.
- The Remora library, which handles communcation between devices and acts as a backend to both the companion app and the AndroidAPS plugin.
Both the companion app and the library can be found in this repository: https://github.com/TebbeUbben/Remora
Remora utilizes a modern Android development stack based on Jetpack Compose, Kotlin, Coroutines, Room, Dagger etc. To keep message payloads small, the communication relies almost entirely on Protocol Buffers. The UI intends to follow Material You design principles (including dynamic theming). I hope to reuse some of the components later to integrate them in AndroidAPS, too.
How to build
- Clone my fork of AndroidAPS: https://github.com/TebbeUbben/AndroidAPS.git
- Clone the Remora repository: https://github.com/TebbeUbben/Remora.git
- Append these lines to the root
settings.gradleand change the path to your local copy of the Remora repository:
includeBuild("C:\\Path\\To\\Remora") {
dependencySubstitution {
substitute(module("de.tebbeubben.remora:lib"))
.using(project(":lib"))
}
}
This makes sure that the AndroidAPS build system can access the required source files of the Remora library. Later this will be replaced by providing a build artificat, by using git submodules or by fully merging the source code into the AndroidAPS repository.
- Build the app module of both repositories and install on your phone.
Firebase setup
For legal and technical reasons, Remora requires every user to create an individual Firebase project, which takes just a few clicks:
- Go to https://console.firebase.google.com.
- Click "Create new Firebase project".
- Choose a name, e.g. "Remora". Turn off Google Analytics (doesn't hurt, but we don't need it).
- Click "Create project" and wait for the setup to complete.
- In the menu on the left, choose "Build" -> "Firestore Database" and click "Create database"
- Choose "Standard version", optionally change the database location and create the database in "production mode".
- Click the "Rules" tab, paste the following into the text editor and click "Publish":
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /remora/status {
allow read, write: if true;
}
}
}
- Click the settings icon in the upper left corner and choose "Project settings".
- In the section "My apps", click the Android icon to add a new Android app.
- Type the package name "info.nightscout.androidaps" (but any arbitrary package name should work) and click "Register app".
- Download the google-services.json and keep clicking "Next" until you're back at the Firebase console.
- Now switch to the tab "Service accounts".
- Click the button "Generate new private key", confirm the dialog and wait for the configuration file to download.
- Transfer both downloaded configuration files to the AndroidAPS phone and complete setup. Remora settings can be launched by clicking the button in the Remora fragment.
Working
- Device pairing
- Basic communication between paired devices
- Transmission of 24-hour status data to peer devices, with display support
- Boluses
- Carbs
- eCarbs
- Temp Targets (when issues boluses or carb)
Not yet implemented
- Profile switches
- Temp targets alone
- Extended boluses
- Pump disconnect
- Temporary basals
- Change loop/running mode
- Bolus calculator
Important notes
- This project is work in progress and remains highly experimental.
- It must not be used in production environments.
- The are still many bugs, crashes and things that need to be done.
- The work is part of my bachelor thesis at the Hasso-Plattner-Institut, where I am pursuing a degree in IT-Systems Engineering.
Screenshots
Still very much in progress, but here's an early look: