Repository navigation
Follow the spec rules for pairing methods and pairing codes - #197
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 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
33 tasks done
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.

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/hellolists the methods keyed by their new names, and always offerspairing_psk, also without storage. The dynamic pairing code is always 6 digits, the server picks aformatinstead of a length, andnonce_Bis sent wrapped.Breaking API changes:
onPairingPin,pinOutChannels,staticPinandstaticPinLocationsare nowonPairingCode,pairingCodeOutChannels,staticPairingCodeandstaticPairingCodeLocationsminPinLengthis removedpairingPsk,pairingTokenandrotatePairingPsk()no longer returnnullwithout storageThe 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
bugfixnew-featureenhancementbreaking-changerefactordocumentationmaintenancecidependencies