Skip to content

Improve dynamic pairing - #155

Merged
arturpragacz merged 2 commits into
mainfrom
ap/improve-dynamic-pairing
Aug 18, 2026
Merged

arturpragacz merged 2 commits into
mainfrom
ap/improve-dynamic-pairing

Conversation

@arturpragacz

@arturpragacz arturpragacz commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Improve dynamic pairing:

  • Fix the dynamic pairing code at 6 digits.
  • Define pairing code presentation format.
  • Add QR-code emission format for the dynamic pairing code. Before the only QR-code format was defined for static Pairing PSK Flow, which is generally not the right tool to use for dynamic display purposes.
  • Wrap nonce_B properly.
  • Drop other from out_channels.
  • Require Pairing PSK Token input format.

Warning

All of the changes here are breaking.

Fix the dynamic pairing code at 6 digits
Define pairing code presentation format
Add QR-code emission format for dynamic pairing
Wrap nonce_B properly
Drop other from out_channels

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

Left a few questions. Also, can you add a section to this PRs description roughly describing the breaking changes? Or at least add a:

Warning

so its clearer that this contains breaking changes?

Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved
Comment thread pairing.md Resolved

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

Don't have any more questions/nits.
Thanks @arturpragacz !

@arturpragacz
arturpragacz merged commit 1ad1b67 into main Aug 18, 2026
1 check passed
@arturpragacz
arturpragacz deleted the ap/improve-dynamic-pairing branch August 18, 2026 19:03
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`
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.

2 participants