fix: persist Mouse Without Borders security key edits #51377

Open
mvanhorn opened 7:33am on October 17, 2026 wants to merge 96 Ξ” into microsoft/powertoys main from
fix/27945-mwb-security-key-persistence

Pull Request Overview

  • Opened on October 17, 2026
  • Status Open
  • Commit count 1 with first commit October 17, 2026

Total Delta

96 Total Diff Delta

Open Days

Open 17 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
17.9 days Revising work with 0 commits in response to 0 reviews that left 1 comment

Total time for pull request still awaiting merge (longer than repo's target): 17.9 business days

Author avatar

fix: persist Mouse Without Borders security key edits

Summary of the Pull Request

Typing a new Mouse Without Borders security key does not keep the machines connected. They continue to report that the keys do not match, and the previously saved key is still the one in use after settings load again. Connecting requires changing that saved key outside the UI, or removing the local settings and setting the machines up again. The matrix form validated the typed key and stored it only on the live session value, Encryption.MyKey. The value that is written and later reloaded is Settings.MyKey, and that property stayed at the previous key, so the next reload put the old key back into the session.

UpdateKey now applies the typed key through TryApplySecurityKey. An invalid key is rejected with the existing error message, and both the stored key and the live session key stay as they were. A valid key that differs from the current session key is assigned to settings.MyKey and Encryption.MyKey together, and Encryption.GeneratedKey is cleared, so a later reload keeps the edited key. New tests check that a valid edit remains after ApplyLoadedSettings and that an invalid edit leaves the original stored and runtime key unchanged.

Closes #27945

PR Checklist


  • [x] Closes: #27945

  • [x] Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected

  • [ ] Tests: Added/updated and all pass

  • [ ] Localization: All end-user-facing strings can be localized

  • [ ] Dev docs: Added/updated

  • [ ] New binaries: Added on the required places



  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #27945

Detailed Description of the Pull Request / Additional comments

Covered in the summary above.

Validation Steps Performed

./tools/build/build.ps1 could not run in this environment for the PowerToys change (./tools/build/build.ps1 is not executable).
Tests for the PowerToys change live in src/modules/MouseWithoutBorders/MouseWithoutBorders.UnitTests/SettingsReloadTests.cs.

AI was used for assistance.

Comments Threads Pending Resolution

Resolved Comment Threads

No resolved comments have been left on this PR.