Skip to content

refactor: rename pairing PIN terminology to Pairing Code - #137

Merged
maximmaxim345 merged 1 commit into
mainfrom
refactor/pairing-code-terminology
Aug 18, 2026
Merged

maximmaxim345 merged 1 commit into
mainfrom
refactor/pairing-code-terminology

Conversation

@chrisuthe

@chrisuthe chrisuthe commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Renames the pairing "PIN" concept to Pairing Code throughout the spec: prose, section headings and their anchors, and the wire protocol.

Scope

76 occurrences across 4 source files, plus the regenerated README.md.

File Lines changed
pairing.md 122
management.md 22
messaging.md 6
template.md 2
README.md (generated) 152

reset-pinhole in the Pairing Window section is deliberately untouched — that's a physical pin.

⚠️ Breaking: wire identifiers

Before After
dynamic_pin dynamic_pairing_code
static_pin static_pairing_code
pin_length pairing_code_length
min_pin_length min_pairing_code_length
pin_mismatch pairing_code_mismatch
pin_length_unacceptable pairing_code_length_unacceptable
static_pin.pin static_pairing_code.code

⚠️⚠️ Breaking, and it fails silently: the derivation label

The CPace pairing-code derivation label changes:

"sendspin-pin-derive-v1"  ->  "sendspin-pairing-code-derive-v1"

The version suffix stays at v1 while the derived value changes. A peer updated on only one side derives a different code and fails key confirmation, surfacing as pairing_code_mismatch — indistinguishable from an operator typo.

This was a deliberate choice to keep the label consistent with the new terminology rather than leave a pin reference in the crypto. Calling it out prominently because a v1 label that produces v1-incompatible output is the worst case for anyone debugging a pairing failure. Reviewers who would rather bump to v2 (or leave the label untouched entirely) should say so — it is a one-line change either way.

The commit and PSK-wrap labels (sendspin-pair-commit-v1, sendspin-pair-psk-wrap-v1) are unchanged; they never contained "pin".

⚠️ Breaking: anchors

Before After
#dynamic-pin-pairing-flow #dynamic-pairing-code-flow
#static-pin-pairing-flow #static-pairing-code-flow

External deep links to those two sections will break. All 14 in-repo references were updated.

Prose conventions applied

  • Method names are title-cased as proper nouns — "Dynamic Pairing Code", "Static Pairing Code" — matching the existing treatment of "Pairing PSK".
  • Flow references use the full title-cased name including "Flow" ("the Dynamic Pairing Code Flow"), following the established Pairing PSK Flow precedent in running prose. Lowercase "flow" is kept only for pronouns ("this flow").
  • "code-based" is used where the old text used "PIN" as a category label for the two PAKE methods as against Pairing PSK — matching the wording in the Definitions entry.
  • Derivation pseudocode variables are lowercased to code_int / code / derived_code / code_typed, matching the surrounding snake_case field names.

Verification

  • python3 tools/build-readme.py --check passes. This is the meaningful check: the build fails on any link pointing at an anchor with no matching heading, so it proves every cross-reference to the two renamed headings resolves.
  • Case-sensitive sweep for PIN|\bpin\b|pin_|_pin\b|-pin-|\bPin\b across all .md and .py files returns zero matches.

Renames the pairing "PIN" concept to "Pairing Code" throughout the spec:
prose, section headings and their anchors, and the wire protocol.

BREAKING CHANGE: wire identifiers change.

  dynamic_pin              -> dynamic_pairing_code
  static_pin               -> static_pairing_code
  pin_length               -> pairing_code_length
  min_pin_length           -> min_pairing_code_length
  pin_mismatch             -> pairing_code_mismatch
  pin_length_unacceptable  -> pairing_code_length_unacceptable
  static_pin.pin           -> static_pairing_code.code

The CPace derivation label also changes, which changes derived output:

  "sendspin-pin-derive-v1" -> "sendspin-pairing-code-derive-v1"

The version suffix stays at v1 while the derived value changes, so a
peer updated on only one side fails key confirmation rather than
erroring cleanly. See the PR notes.

Section anchors #dynamic-pin-pairing-flow and #static-pin-pairing-flow
become #dynamic-pairing-code-flow and #static-pairing-code-flow.

@maximmaxim345 maximmaxim345 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @chrisuthe !

@maximmaxim345
maximmaxim345 merged commit 9a526a4 into main Aug 18, 2026
1 check passed
@maximmaxim345
maximmaxim345 deleted the refactor/pairing-code-terminology branch August 18, 2026 09:09
maximmaxim345 pushed a commit that referenced this pull request Aug 20, 2026
…xt (#161)

Fixes #147. Refs #100.

Relocates all 14 `**Note:**` blocks carrying BCP 14 keywords into body
text, per the issue's list (located by content — line numbers had
drifted with #137/#155). Keywords stay uppercase; wording is untouched
except for the two integrations below. The issue's mechanical test now
passes: **no `**Note:**` block contains an uppercase BCP 14 keyword**
(16 comment-only notes remain).

## Straight promotions (11)

The `**Note:** ` marker is dropped and the paragraph stands as body text
in place — each already sat adjacent to the content it governs:

- `connection.md` ×2 — TXT `name` / hello-name agreement (client and
server sections)
- `messaging.md` ×4 — minimal activity set; MAY-omit-role;
`server/state` asymmetry (clients MAY resend unchanged fields);
disconnect-without-goodbye handling incl. the reconnect-backoff SHOULD
NOT
- `roles/player/v1.md` ×2 — volume/mute independence (MUST NOT clear
mute); initial format selection (SHOULD/MAY)
- `roles/source/v1.md` ×3 — servers MUST support all codecs; SHOULD
accept the announced source format; source-timestamp handling
(SHOULD/SHOULD NOT)

## Integrations (3 notes → 2 places)

Per the issue's "write the new text again — do not only move it":

- **`shutdown` note** folds into the `shutdown` reason bullet in
`client/goodbye`, matching the style of the other reason bullets (which
already carry normative sentences). "clients SHOULD send `shutdown`"
becomes "clients SHOULD send this reason" now that it sits inside the
bullet defining it.
- **The two adjacent volume notes** in `roles/player/v1.md`
(perceived-loudness curve + click ramp) join into one body paragraph;
both sentences govern the same behavior.

## Left alone, deliberately

Notes stating requirements with lowercase keywords (`roles/player/v1.md`
"Servers must support…", `roles/artwork/v1.md`, and the keyword-free
server requirement in the role-removal note) are outside this issue's
mechanical test and belong to the general keyword pass in #100, as the
issue states.

## Verification

- Sweep of every note block **including attached lists** (the backoff
SHOULD NOT hides in a list continuation, not the note's first line): 14
found before, 0 after.
- `python3 tools/build-readme.py --check` passes.
arturpragacz pushed a commit that referenced this pull request Aug 24, 2026
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".

---------

Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 1, 2026
# What does this implement/fix?

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

aiosendspin client 9.1.1 and sendspin-js 5.0.0 offer `dynamic_pin` and
`static_pin`, the PIN methods from before the pairing code rename. The
server ignored them and sent a pairing code activation instead:
aiosendspin 9.1.1 can't parse it, so the attempt times out after 60 s,
and sendspin-js 5.0.0 aborts with `method_not_supported`.

The server now reads the old method names from `client/hello` and pairs
these clients over the old PIN wire. The Python API doesn't change,
since `DYNAMIC_PAIRING_CODE` and `STATIC_PAIRING_CODE` attempts pick the
old wire on their own. Dynamic PINs are 6 digits only, so a client
asking for a longer one shows up in `unusable_methods`.

Tested with the released aiosendspin 9.1.1 and sendspin-js 5.0.0
clients, dynamic and static, including a wrong code.

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

- Sendspin/spec#137
- Sendspin/spec#155

## 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.
-->

- [x] 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`
- [ ] 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`
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 8, 2026
# What does this implement/fix?

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

`set_pairing_config` sent the renamed `static_pairing_code` and
`dynamic_pairing_code` keys to every client. Clients from before the
rename, like the aiosendspin 9.x client, ignore those keys, apply
nothing, and still reply `ok`.

Clients that send `supported_pair_methods` as a list now get the old
`static_pin` and `dynamic_pin` keys instead.

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

- Sendspin/spec#137

## 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.
-->

- [x] 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`
- [ ] 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`
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Oct 8, 2026
# What does this implement/fix?

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

Clients from before the rename, like the aiosendspin 9.1.1 client,
answer `management/get-pairing-config` with `static_pin` and
`dynamic_pin`. The server dropped those keys, so `get_pairing_config`
reported neither pairing code method for these clients.

The old keys are now read as `static_pairing_code` and
`dynamic_pairing_code`. This is the read side of #515.

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

- Sendspin/spec#137

## 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.
-->

- [x] 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`
- [ ] 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.

3 participants