Skip to content

Pair with plain-key app credentials - #16

Merged
ps2 merged 2 commits into
mainfrom
app-identity-pairing
Oct 5, 2026
Merged

ps2 merged 2 commits into
mainfrom
app-identity-pairing

Conversation

@ps2

@ps2 ps2 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Pairs Libre 3 / 3+ sensors with a plain-key app credential (certificate plus P-256 key).

Pairing

  • kAuth is SHA-256(00000001 ‖ Ze ‖ Zs)[0..<16] from plain ECDH; Phase 5/6 use standard AES-CCM.
  • The credentials file is downloaded from Arweave and verified against a pinned digest.
  • A v4 Keychain record carries the credential label.

Field diagnostics

  • Every rejection is logged. A disconnect right after SendCertificateLoadDone is reported as a certificate rejection.
  • Device-log lines from a first-time pair (before Loop adopts the manager) were dropped; they're now held and flushed when the delegate is set. Lines mentioning a rejection are logged as errors.
  • Issue Report adds pairedWith and appIdentitiesInstalled.

Tested

On a US-region Libre 3 Plus (security version 1, region 2): paired through Phase 6, readings decrypt and forward normally with 0 decrypt failures, and cached reconnect with the saved kAuth succeeded repeatedly across app restarts.

ps2 added 2 commits October 5, 2026 15:33
On a fresh pair, select an RoundWhiteDiscKit AppIdentity from the NFC
patch info and run the first-pair handshake with it: its certificate, a
random ephemeral, kAuth from plain ECDH, and standard AES for Phase 5/6.
If the sensor refuses it, try the remaining identities, then fall back to
the whitebox, all within the same NFC scan. The identities blob is
downloaded from Arweave like the runtime tables; if it can't be fetched,
pairing logs why and uses the whitebox.

The Keychain record gains a v4 form carrying the identity label, so a
cached reconnect uses the cipher that matches how its kAuth was made.

For field reports:
- Selection is logged with the raw patch info, and every rejection is
  logged. A certificate the sensor won't accept shows up as a disconnect
  right after SendCertificateLoadDone and is reported as such. Pairing on
  an identity other than the one selected is logged as GUESS WRONG.
- Device-log lines from a first-time pair, made before Loop adopts the
  manager, are held and flushed when the delegate arrives instead of being
  dropped. Lines mentioning a rejection are logged as errors.
- The Issue Report shows pairedWith, appIdentitiesInstalled and
  appIdentityPairingEnabled.

The tables downloader becomes a shared ArweaveBlob used for both blobs. A
debug toggle on the Glucose Streams screen turns the identity path off.

Region 2 maps to ROW: a US-region Libre 3 Plus disconnected on the US
certificate and paired with ROW.
The standalone LibreLoop project resolves RoundWhiteDiscKit by exact
revision; dccf013 predates the app-identity API this branch uses.
@ps2
ps2 marked this pull request as ready for review October 5, 2026 20:58
@ps2
ps2 merged commit 252b079 into main Oct 5, 2026
carolvchn pushed a commit to carolvachon-org/LoopWorkspace that referenced this pull request Oct 5, 2026
- RoundWhiteDiscKit 0e076b2: pair with plain-key app identities, without
  the runtime tables (airedev326/RoundWhiteDiscKit#3).
- LibreLoop 252b079: use them before the whitebox, with field diagnostics
  for identity selection and rejection (LoopKit/LibreLoop#16).
- OmnipodKit 65a6ec4: acknowledge the expired-pod alert, and retry the
  acknowledgement once (LoopKit/OmnipodKit#182).
@ps2 ps2 changed the title Pair with plain-key app identities before the whitebox Pair with plain-key app credentials Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant