Skip to content

refactor: use one canonical name per PSK category - #159

Merged
arturpragacz merged 5 commits into
mainfrom
refactor/canonical-psk-names
Aug 24, 2026
Merged

arturpragacz merged 5 commits into
mainfrom
refactor/canonical-psk-names

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #141.

Collapses the PSK naming variants to one canonical name per category, matching the wire identifiers (long_term_psk, pairing_psk, sendspin-sentinel-psk-v1). No wire change; no anchors move.

Before Count After
Sendspin PSK (bare) 12 long-term PSK
long-term Sendspin PSK 3 long-term PSK
per-server PSK 2 long-term PSK
per-pair Sendspin PSK 1 long-term PSK
Sendspin Pairing PSK 6 pairing PSK
Pairing PSK (key references) 11 pairing PSK
Sentinel PSK 13 unchanged

Counts are against current main, which has moved since the issue was filed (#137, #155), hence the small drift from the issue's table.

Method and flow names keep title case

The issue's table maps all "Pairing PSK" to lowercase "pairing PSK". Twelve occurrences, however, use the phrase as the method name or the Pairing PSK Flow section name rather than as a reference to the key — e.g. "clients must implement Pairing PSK", "the Pairing PSK Flow additionally omits...", and the ### Pairing PSK Flow heading itself. These keep title case, consistent with how the other method names (Dynamic Pairing Code, Static Pairing Code) are treated since #137. Key references are lowercase throughout. Settled in review: the method and flow names stay title case, so all twelve are left as they are.

Correction included

The long-term PSK definition claimed the secret is "shared between a (client, server) pair"; with a shared-PSK record one long-term PSK can authenticate more than one server. The erroneous clause is deleted (nothing new is asserted):

long-term PSK - a 32-byte pre-shared symmetric secret established during pairing and mixed into the Noise handshake state for every subsequent connection.

"Distinct from the per-pair Sendspin PSK that pairing produces" in the pairing PSK entry likewise becomes "Distinct from the long-term PSK that pairing produces", and the two per-server PSK references in management.md become long-term PSK (the stored-pubkey record's binding to a server_id already conveys the per-server relationship).

The same framing appeared a second time, in the client/pair-finalize description ("Delivers the long-term PSK for this (client, server) pair"), and is corrected the same way: "Delivers the long-term PSK established by this pairing." No occurrence of the per-pair claim is left.

Small cleanups in passing

  • pairing.md: "in the Pairing PSK flow" → "in the Pairing PSK Flow" (the one lowercase-"flow" holdout against the title-case convention).
  • Definitions entry "used as the PSK in the Pairing PSK pairing method" → "…in the Pairing PSK method".
  • connection.md: the category list "(long-term, Pairing, Sentinel)" becomes "(long-term, pairing, Sentinel)". The issue cites this parenthetical as the place the category names already exist, so it should spell them the way the prose now does.
  • pairing.md: the five prose references to "the new PSK" become "the new long-term PSK" (the reveal rule, the three sequence-diagram notes, and the wrapping summary). All three PSKs are in play in a pairing flow, so the one that pairing produces is now named.

Verification

  • python3 tools/build-readme.py --check passes (README regenerated; all links resolve).
  • Zero remaining occurrences of Sendspin PSK, Sendspin Pairing PSK, per-pair, or per-server PSK in the source files.
  • Zero remaining occurrences of the "(client, server) pair" framing or of a bare "new PSK".

Collapses the PSK naming variants to one canonical name per category,
matching the wire identifiers (long_term_psk, pairing_psk,
sendspin-sentinel-psk-v1):

  Sendspin PSK / long-term Sendspin PSK /
  per-server PSK / per-pair Sendspin PSK  -> long-term PSK
  Sendspin Pairing PSK / Pairing PSK      -> pairing PSK
  Sentinel PSK                            -> unchanged

Title case is kept where "Pairing PSK" names the pairing method or the
Pairing PSK Flow section, consistent with the other method names.

Also corrects the long-term PSK definition: it claimed the secret is
"shared between a (client, server) pair", but with a shared-PSK record
one long-term PSK can authenticate more than one server.

No wire change.

Fixes #141
maximmaxim345 added a commit that referenced this pull request Aug 20, 2026
Fixes #148.

Drops the "Sendspin" prefix term by term per the issue's table:
**Server**, **Client**, **Group**, **Stream**, **Identity**, **Pairing
Code**, and **Trust Level** in the Definitions block, plus the prefixed
body references ("Sendspin group" ×3, "Every Sendspin client and
server", "the Sendspin client implements", "a different Sendspin
server", and the discovery-chapter opener "Sendspin Servers must support
both methods").

## Kept, per the issue's exceptions

- `connection.md:13` and the connection note (`:62`) — "Sendspin client"
where the Sendspin client is the WebSocket listener / always the data
consumer, so the prefix disambiguates against the WebSocket role.
- `connection.md:48` — server discovery text.
- The adjective forms: "Sendspin playback" ×3 and "non-Sendspin
activity" ×2 in External Source Handling, and the system-name use in
`roles/source/v1.md`.

## Coordination with #159

The issue's two PSK rows (Sendspin PSK → long-term PSK, Sendspin Pairing
PSK → pairing PSK) are **not** in this PR — they are implemented by #159
(issue #141), as this issue anticipates ("Complete one issue, then
remove this row from the other issue"). The two PRs touch adjacent lines
of the Definitions block and both regenerate `README.md`, so whichever
merges second may need a trivial rebase + `python3
tools/build-readme.py`.

## Verification

- Remaining `Sendspin <term>` occurrences in source files are exactly
the exception list above — audited by grep.
- No wire identifiers, message types, or the `_sendspin._tcp` /
`_sendspin-server._tcp` service types touched.
- `python3 tools/build-readme.py --check` passes; definition links all
target the unchanged `#definitions` anchor.

---------

Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
chrisuthe and others added 4 commits August 21, 2026 17:41
Resolves the Definitions-block and pairing.md conflicts with #162:
main's de-prefixed terms (Group, Stream, Identity, Pairing Code, Trust
Level) are kept, and this branch's long-term PSK / pairing PSK
renames are applied on top. README.md regenerated.
@arturpragacz
arturpragacz merged commit 59670df into main Aug 24, 2026
1 check passed
@arturpragacz
arturpragacz deleted the refactor/canonical-psk-names branch August 24, 2026 09:45
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 5, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

The spec removed trust level and made `psk_category` the only name for
it, so `TrustLevel` and `ConnectionSecurity.trust_level` are removed.
Use `ConnectionSecurity.psk_category` instead: `PskCategory.LONG_TERM`
was trust level `user`, and anything else was `none`.

Nothing changes on the wire. The server still accepts a `trust_level`
key in `client/hello` from older clients.

**Related issue or spec PR (if applicable):**

- Sendspin/spec#158
- Sendspin/spec#159

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [ ] Bugfix (non-breaking change which fixes an issue): `bugfix`
- [ ] New feature (non-breaking change which adds functionality):
`new-feature`
- [ ] Enhancement to an existing feature: `enhancement`
- [x] Breaking change (changes the public API or the protocol in a way
that is not backwards compatible): `breaking-change`
- [ ] Refactor (no behavior change): `refactor`
- [ ] Documentation only: `documentation`
- [ ] Maintenance / chore: `maintenance`
- [ ] CI / workflow change: `ci`
- [ ] Dependencies bump: `dependencies`
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.

Use one canonical name per PSK category (long-term PSK / pairing PSK / sentinel PSK)

3 participants