Repository navigation
fix: drop a sign key the server never accepted, so the station can be added again - #48
Merged
Merged
Conversation
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.
Problem
When a station is added again, submit creates a new sign key and
add_devicesaves it to flash right away, before the server has accepted it. If the server never accepts it, the station is stuck. That happens when an old backend refuses the key, when someone rejects or ignores the approval in the panel, or when the station restarts before approval:Seen on the competition router: a station pressed submit while the backend refused its new key, and stayed on "Server Not Trusted!" until it was reset.
Change
add_devicealso saves a pending flag (SIGN_PENDINGin NVS) when it creates a new key.If the station reconnects before the approval, it drops the key and asks again with a new one. The backend keeps only the latest request per station, so approving it stores the key the station actually holds.
Verification
cargo fmt --check; clippy-D warningsfor v3, v4 and the default build; release builds for v3 and v4.[trust] the server never accepted the sign key, dropping it to be added againand showed "Device not added". No "Server Not Trusted!".[trust] server trusted.