Preserve AiDex pairing keys across reconnects - #159
Open
ctqvva wants to merge 1 commit into
Open
Conversation
ctqvva
marked this pull request as ready for review
August 4, 2026 12:50
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
DELETE_BONDacknowledgement.5e488fa5preference when present.Why
The earlier
5e488fa5implementation treated a failed saved-key F002 decrypt as proof that the stable PAIR key was invalid, deleted it, and retried the full F001 PAIR flow. It also coupled several transport/bond recovery paths to key deletion or Android bond removal. A transient reconnect failure could therefore turn into repeated sensor-side pairing traffic and strand an otherwise usable sensor.This version deliberately chooses degraded broadcast connectivity over a speculative/destructive pairing recovery.
Verification
:Common:processMobileLibre3SiDexGoogleDebugResourcestk.glucodata.drivers.aidex.native.*unit-test packagemobileLibre3SiDexGoogleDebuggit diff --checkAll checks passed locally.
Hardware validation boundary
This is source-, resource-, and unit-test verified, but not yet validated against a live AiDex sensor. Keeping this PR as draft until a saved-key reconnect, reset, explicit unpair, export, and restore cycle is exercised on hardware.
Backup-file note
The portable
.aidexkeyfile intentionally contains the sensor credential so it remains restorable on a different device; the UI warns the user to store it privately. Android Keystore encryption is not used for the portable copy because Keystore keys are device-bound and would make a migrated backup unreadable.