nightscout / AndroidAPS

Opensource automated insulin delivery system (closed loop)
https://wiki.aaps.app
GNU Affero General Public License v3.0
706 stars 1.73k forks source link

PR3463 Unattended settings export. #3461

Open vanelsberg opened 3 days ago

vanelsberg commented 3 days ago

Enabling unattended settings export.

Current AAPS functionality enables exporting AAPS settings to file which includes exporting sensitive information like pump connection specs. For this the user is required to enter the AAPS master password (which is not known to AAPS) for encryption.

The AAPS master password protects the (encrypted) settings file from unintended access. This PR is intended to enable automatic settings exports. Think of scheduled settings exports through automaton or after activating pumps like Omnipod EROS/DASH and Metrum.

This PR adds functionality to AAPS to initiate unattended exports from code (that is without need for the user to enter the master password):

Requirements:

When enabled:

Functional short description: The master password should be entered as usual when manually exporting settings from the AAPS maintenance menu. When the "unattended exports" option is enabled in maintenance preferences, the entered password is encrypted and securely stored on the user's phone (not in AAPS). Subsequent exports will no longer require the user to enter the master password until it expires or is reset.

When active, the new "Export settings" automation will alert in AAPS overview on exporting and (when relevant) not being enabled or password expiry. The user can (grace period) or is required (expired) to reenter the password executing a manual export.

Ad1) Android DataStore: This system provides a robust and flexible way of storing key-value pairs on the phones storage.

Ad2) Android Keystore: This system allows you to store cryptographic keys in a secure container, making them difficult to extract from the device.

Additional note:

This above is currently under development. PR will follow soon. It's goal will be to get basic functionality for unattended exports stabalized and get the bugs out.

Suggestions on future functionality (requires additional PR(s)): a) Logging at the bottom part of Maintenance tab log's similar to Automations. b) Records in db - user actions (successful/ unsuccessful backup and destination of backup) c) Dedicated automation for scheduled backups (daily/weekly/monthly/objective completed/new pump paired/....) d) Export destinations: AAPS folder, Google, MS OneDrive, NS...

vanelsberg commented 3 days ago

See also: Feature request: https://github.com/nightscout/AndroidAPS/issues/3296 PR: https://github.com/nightscout/AndroidAPS/pull/3451