fix(pairing): widen pairing relay set so signer-chosen relays are covered

Amber picks whichever relay it likes from the nostrconnect:// URI and
some relays drop ephemeral kind-24133 traffic, so pairing could appear
successful on the signer while nothing reached us. The pairing set is
now the user's relays UNION a curated fallback of well-known relays;
loopback-only sets (e2e harness) skip widening to keep tests isolated.
This commit is contained in:
Avi 2026-09-12 21:07:27 -05:00
commit f59c2b1b45
3 changed files with 45 additions and 7 deletions

View file

@ -138,6 +138,11 @@ async fn start_relay() -> String {
])
.to_string();
if let Some(sess) = s.sessions.get(session_idx) {
eprintln!(
"[relay] replay {} to new sub {}",
&ev.id.to_hex()[..16],
sub_id
);
let _ = sess.tx.send(out);
}
break;
@ -526,8 +531,13 @@ async fn run_fake_scanner(
continue;
}
let Some(plain) = nip44_dec(&conversation, &ev.content) else {
eprintln!(
"[scanner] event from {} not decryptable",
&ev.pubkey.to_hex()[..16]
);
continue;
};
eprintln!("[scanner] decrypted: {}", &plain[..plain.len().min(120)]);
let Ok(req) = serde_json::from_str::<Value>(&plain) else {
continue;
};
@ -641,6 +651,8 @@ async fn nip46_qr_pairing_handshake_and_sign() {
else {
panic!("pairing URI must be the client variant");
};
// The e2e relay set is loopback-only, and loopback sets skip the curated
// pairing-relay widening, so the token carries exactly our relay.
assert_eq!(relays.len(), 1);
assert!(!secret.is_empty());