You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Push body weight + composition to a self-hosted Endurain server via POST /api/v1/health/weight (upsert-by-date).
Auth: OAuth2 username/password login -> JWT access + rotating refresh token, stored in EncryptedSharedPreferences (no password kept), with proactive refresh in connect() and reactive refresh-on-401. MFA supported; SSO/PKCE deferred. Implemented clean-room from Endurain's REST API (not derived from Gadgetbridge's AGPL client).
Field mapping reads openScale's generic, unit-aware values: masses (muscle_mass/bone_mass) sent in kg, fat/water in %, plus visceral_fat. bmi is left for the server to auto-calc; source is omitted (server enum rejects non-garmin). Export only.
Thanks for the Endurain backend — the mapping logic and the token-refresh handling look solid, and the test coverage on buildWeightRequest is appreciated. 👍
One thing I'd like changed before merging: the androidx.security:security-crypto dependency for token storage.
Why:
It's deprecated. Jetpack Security Crypto (EncryptedSharedPreferences / MasterKey) was deprecated as of 1.1.0-alpha07 and never reached a stable release — the 1.1.0-alpha06 pin here is the same never-stabilized library, one version before the deprecation annotation landed. It's also known for keyset corruption crashes on some OEM devices, and there's no official AndroidX drop-in successor (Google's guidance is to roll your own Keystore + Cipher).
It's inconsistent with the rest of the app. Every other backend stores its secrets as plaintext putString in the shared openScaleSyncSettings prefs — MQTT password (MQTTViewModel), Wger token (WgerViewModel), InfluxDB token + password (InfluxDbViewModel), Webhook auth header (WebhookViewModel). There's no encryption anywhere else in the codebase. Since minSdk is 31, app-private storage is already sandboxed and file-based-encrypted at rest, so encrypting only the Endurain tokens adds a dead dependency and a one-off pattern for marginal real-world benefit.
So could you please drop the EncryptedSharedPreferences and store the tokens like everything else?
I have updated the PR per your suggestions. Feel free to squash commits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Push body weight + composition to a self-hosted Endurain server via
POST /api/v1/health/weight(upsert-by-date).Auth: OAuth2 username/password login -> JWT access + rotating refresh token, stored in EncryptedSharedPreferences (no password kept), with proactive refresh in
connect()and reactive refresh-on-401. MFA supported; SSO/PKCE deferred. Implemented clean-room from Endurain's REST API (not derived from Gadgetbridge's AGPL client).Field mapping reads openScale's generic, unit-aware values: masses (
muscle_mass/bone_mass) sent in kg, fat/water in %, plusvisceral_fat.bmiis left for the server to auto-calc;sourceis omitted (server enum rejects non-garmin). Export only.