Skip to content

fix(meshcore): handle disabled export private key#268

Merged
Avi0n merged 1 commit into
Avi0n:devfrom
robekl:fix/export-private-key-disabled
Mar 27, 2026
Merged

fix(meshcore): handle disabled export private key#268
Avi0n merged 1 commit into
Avi0n:devfrom
robekl:fix/export-private-key-disabled

Conversation

@robekl
Copy link
Copy Markdown
Contributor

@robekl robekl commented Mar 25, 2026

Bug

exportPrivateKey() mishandles the firmware's disabled response. The protocol parser emits .disabled, but the current request matcher treated that as nil, which means "ignore this event and keep waiting". When key export is disabled on-device, the call times out instead of surfacing the actual disabled state.

Strategy

Keep the existing async throws -> Data API and make disabled an explicit error outcome, matching the existing style used for other feature-gated commands. That avoids widening the API to Data?, keeps the change narrow, and makes the failure mode consistent with the rest of the session layer.

Implementation

  • route exportPrivateKey() through the error-aware request path
  • map .disabled to MeshCoreError.featureDisabled instead of ignoring it
  • align the doc comment with the actual throwing behavior
  • add regression tests for a real disabled response and for unrelated disabled events not satisfying other requests

Verification

  • swift test --skip-build --filter MeshCoreSessionCommandCorrelationTests
  • swift test in MeshCore

@Avi0n
Copy link
Copy Markdown
Owner

Avi0n commented Mar 27, 2026

Thanks!

@Avi0n Avi0n merged commit b8f1ba7 into Avi0n:dev Mar 27, 2026
2 checks passed
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.

2 participants