mvanhorn's Description of Work
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
- [ ] JSON for signing for new binaries
- [ ] WXS for installer for new binaries and localization folder
- [x] YML for CI pipeline for new test projects
- [ ] YML for signed pipeline
- [ ] 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.