Repository navigation
Replace trust_level with boolean paired - #138
Closed
maximmaxim345 wants to merge 3 commits into
Closed
maximmaxim345 wants to merge 3 commits into
maximmaxim345 wants to merge 3 commits into
Conversation
maximmaxim345
marked this pull request as draft
August 18, 2026 15:06
Member
Author
|
Marked this PR as draft for now since #140 looks like an even better solution. |
Member
Author
|
Superseded by #158 |
maximmaxim345
force-pushed
the
refactor/trust-level-paired
branch
from
August 27, 2026 13:05
39f98ec to
dcdd044
Compare
maximmaxim345
marked this pull request as ready for review
August 27, 2026 13:05
arturpragacz
added a commit
that referenced
this pull request
Aug 28, 2026
The server already knows which PSK matched during the Noise handshake, so it can derive whether the session is paired instead of taking the client's word for it. Nothing consumed the field: every enforcement rule already keys on the matched PSK. One gap made the field load-bearing until now: a management server could remove a record and then set its PSK as the client's pairing PSK, and the original server's next handshake would complete with the two sides disagreeing about the matched category - `trust_level` was the only signal exposing that. This PR therefore adds `psk_category: 'lt' | 'pr' | 'sn'` to the Noise message 1 payload: the server declares which category it is using the referenced PSK as, and the client matches `psk_id` only among candidates of that category. A recategorized credential is now an ordinary lookup miss that lands in the Sentinel fallback, which already tells the server to re-pair, so paired state is fully derivable on both sides and the field can go. A miss during a re-handshake instead fails the handshake as before; the server's reconnect then takes the initial-handshake fallback path. Design notes: a category mismatch is deliberately a miss rather than a hard failure - the fallback turns it into an authenticated credential-mismatch signal with the re-pair path attached, where a hard failure would just produce a mute reconnect loop. The three codes share one length, keeping the encrypted payload's length independent of the category. The `psk_id` derivation, the published Sentinel constant, and the `already_exists` guards are all unchanged; the cross-category uniqueness rule stays, its rationale restated as what it actually protects (the pairing token distributes the pairing PSK in cleartext, so the same bytes must not also back a record). This PR also rewords the "trust level" term in the spec. This was a left over from when we had 3 (the additional owner level, whose management rights were merged into the user level - now called just paired). `unpaired_access.enabled` remains because it is genuine client policy the server cannot derive. ## Breaking change Existing pairing records and `psk_id`s are untouched, so deployed pairings keep working. Breaking only when a client is updated before its server: an updated client requires `psk_category` in Noise message 1 and no longer sends `trust_level`, both of which an old server trips on. The reverse order is safe: receivers ignore unrecognized payload fields, so an updated server interoperates with old clients, which then simply don't enforce the category check. --- Closes #140 Alternative to #138, which keeps the field as a boolean `paired` instead. --------- Co-authored-by: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com>
Member
Author
|
Closing since #158 was merged. |
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.
In a previous draft we had 3 trust levels:
none,user, andowner. With only 2 left, a booleanpairedsays the same thing, and it keeps "trust level" jargon out of server and client UIs.Keeping the field means the client can still correct a server whose own view of the pairing state has gone stale, which the matched PSK alone does not always reveal.
Warning
This is a breaking change for servers and clients.
Alternative to #158, which deletes the field entirely on top of per-category
psk_idderivation labels.Closes #140