fix(pairing-cli): send the JSON envelope the apps decode, and stop panicking on wss:// - #10
Open
lodar wants to merge 1 commit into
Open
fix(pairing-cli): send the JSON envelope the apps decode, and stop panicking on wss://#10lodar wants to merge 1 commit into
lodar wants to merge 1 commit into
Conversation
…nicking on wss://
Two defects that together made it impossible to pair a handset with the Buzz
mobile app against an HTTPS relay. Both measured against a live relay.
1. THE ENVELOPE
`resolve_payload` returned a bare bech32 nsec as `PayloadType::Nsec` in both
arms. Mobile `_processPayload` begins with
`jsonDecode(payload) as Map<String, dynamic>` and nothing in `mobile/lib`
branches on `payload_type`, so a bare nsec dies on the leading `n` with
`FormatException: Unexpected character (at character 1)`. That is verbatim what
a real store build produced on a real handset.
`--envelope-relay <https url>` now emits the same shape the desktop client
sends (`desktop/src-tauri/src/commands/pairing.rs:145-148`,
`PayloadType::Custom` at :215): `{"relayUrl","pubkey","nsec"}`. `pubkey` is
DERIVED from the transferred nsec so the two cannot drift. Without the flag the
payload is unchanged, so CLI-to-CLI interop testing keeps working exactly as
before.
2. wss:// PANICKED BEFORE ANY PAIRING COULD START
thread 'main' panicked at rustls-0.23.42/src/crypto/mod.rs:249:14
Could not automatically determine the process-level CryptoProvider
Both `ring` and `aws-lc-rs` are reachable in the workspace, so rustls refuses to
choose. Plain `ws://` never reaches that code path — which is why interop
testing done entirely against a plaintext relay was structurally blind to it:
the defect exists only past the TLS an HTTPS deployment adds. Pin the `ring`
provider and install it at the top of `main()`.
`Cargo.lock` records the new direct `rustls` dependency; without that hunk the
tree does not build under `--locked`.
Signed-off-by: lodar <markounik@gmail.com>
lodar
force-pushed
the
upstream-pr/pairing-envelope-tls
branch
from
August 26, 2026 03:05
b6202e3 to
ff555b1
Compare
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.
Two defects that together make it impossible to pair a handset with the Buzz mobile app against an
HTTPS relay. Both measured against a live relay, not by inspection.
1. The payload shape the apps cannot decode
resolve_payloadreturned a bare bech32 nsec asPayloadType::Nsecin both arms. Mobile_processPayloadbegins withjsonDecode(payload) as Map<String, dynamic>, and nothing inmobile/libbranches onpayload_type, so a bare nsec dies on the leadingnwith:That is verbatim what a real store build produced on a real handset.
--envelope-relay <https url>now emits the same shape the desktop client already sends(
desktop/src-tauri/src/commands/pairing.rs:145-148,PayloadType::Customat :215):{"relayUrl","pubkey","nsec"}.pubkeyis derived from the transferred nsec, so the two cannotdrift.
Without the flag the payload is unchanged, so existing CLI-to-CLI interop testing keeps working
exactly as before.
2.
wss://panicked before any pairing could startBoth
ringandaws-lc-rsare reachable in the workspace, so rustls refuses to choose. Plainws://never reaches that code path — which is why interop testing done entirely against aplaintext relay was structurally blind to it: the defect exists only past the TLS an HTTPS
deployment adds. The fix pins the
ringprovider and installs it at the top ofmain().Cargo.lockrecords the new directrustlsdependency; without that hunk the tree does not buildunder
--locked.Testing
Verified end to end against a live HTTPS relay:
wss://connects instead of panicking, and a realmobile build decodes the envelope and completes pairing.
--envelope-relay-less runs arebyte-identical to before.