Skip to content

Follow the spec rules for pairing methods and pairing codes - #197

Merged
maximmaxim345 merged 6 commits into
mainfrom
fix/pairing-methods
Oct 26, 2026
Merged

maximmaxim345 merged 6 commits into
mainfrom
fix/pairing-methods

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

The client listed its pairing methods in the old shape and under the old names, and derived and bound the pairing codes differently from the current spec. So pairing with a pairing code couldn't succeed against a server following the spec.

Now client/hello lists the methods keyed by their new names, and always offers pairing_psk, also without storage. The dynamic pairing code is always 6 digits, the server picks a format instead of a length, and nonce_B is sent wrapped.

Breaking API changes:

  • onPairingPin, pinOutChannels, staticPin and staticPinLocations are now onPairingCode, pairingCodeOutChannels, staticPairingCode and staticPairingCodeLocations
  • minPinLength is removed
  • pairingPsk, pairingToken and rotatePairingPsk() no longer return null without storage

The docs and the sample player now also advise keeping the pairing token secret, and offering only one pairing code method as the implementation guide recommends:

Related issue or spec PR (if applicable):

Types of changes

  • 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

@github-actions github-actions Bot added the breaking-change Changes the public API or the protocol in a way that is not backwards compatible label Oct 26, 2026
@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 26, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cryptographic pairing changes require human security review and interoperability confirmation, alongside resolution of the invalid dual-method advertisement.

1 open issue
What changed in this PR

Updates the SDK’s pairing APIs and wire messages to match the current Sendspin specification, addressing pairing-code interoperability.

Changes:

  • Renames pairing options and advertises methods in a keyed object.
  • Updates six-digit code derivation, cryptographic session binding, and nonce wrapping.
  • Enables pairing without persistent storage and updates tests, documentation, and sample controls.
File Description
tests/​unit/​protocol-handler.test.ts Checks keyed pairing-method advertisements.
tests/​unit/​player-pairing-config.test.ts Verifies renamed configuration forwarding.
tests/​unit/​pake/​cpace.test.ts Updates code-derivation vectors and padding checks.
tests/​unit/​pairing.test.ts Tests revised pairing flows and wrapped nonces.
tests/​unit/​noise/​identity.test.ts Removes the identity warning expectation.
tests/​unit/​core-encryption.test.ts Checks pairing availability without storage.
tests/​helpers/​known-violations.ts Removes addressed protocol gaps.
tests/​e2e/​sendspin-security.e2e.test.ts Updates pairing options and advertisement checks.
src/​types.ts Revises public options and protocol message types.
src/​index.ts Exposes renamed options and non-null credentials.
src/​core/​protocol-handler.ts Uses keyed pairing-method types.
src/​core/​pake/​pin.ts Implements fixed six-digit code derivation.
src/​core/​pairing.ts Updates negotiation, session binding, and wrapping.
src/​core/​noise/​identity.ts Removes the obsolete storage warning.
src/​core/​core.ts Enables in-memory pairing and forwards renamed options.
README.md Updates pairing examples and persistence guidance.
public/​app.js Adopts renamed APIs and adds a dual-method warning.
index.html Updates pairing labels and explanatory text.
CLAUDE.md Updates the pairing configuration reference.

Review effort: Balanced

Comment thread src/core/pairing.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Authentication and credential-lifecycle changes need human review backed by verified end-to-end interoperability results.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread index.html Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Authentication-sensitive changes to session binding and key wrapping warrant human security review and confirmed interoperability results.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@maximmaxim345
maximmaxim345 merged commit 751bd89 into main Oct 26, 2026
4 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/pairing-methods branch October 26, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes the public API or the protocol in a way that is not backwards compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants