chore(pairing): 5-min pairing window + inbound-event wiretap logging

This commit is contained in:
Avi 2026-09-12 21:26:07 -05:00
commit 5aa122d92d

View file

@ -40,7 +40,7 @@ const REQUEST_TIMEOUT: Duration = Duration::from_secs(30);
const HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(120);
/// How long a pairing QR (client-initiated `nostrconnect://`) stays live
/// while a human opens their signer and scans it.
const PAIRING_TIMEOUT: Duration = Duration::from_secs(120);
const PAIRING_TIMEOUT: Duration = Duration::from_secs(300);
/// App name advertised to signers during client-initiated pairing.
const APP_NAME: &str = "Keynectr";
@ -581,6 +581,11 @@ impl Nip46ClientSigner {
}
};
let event = *incoming;
eprintln!(
"[nip46 pairing] inbound 24133 from {} (content len {})",
&event.pubkey.to_hex()[..16],
event.content.len()
);
// Never answer ourselves.
if event.pubkey == our_pk {
continue;
@ -588,9 +593,11 @@ impl Nip46ClientSigner {
// Not addressed to us unless it decrypts with a conversation
// keyed to this author.
let Ok(conv) = ConversationKey::derive(keys.secret_key(), &event.pubkey) else {
eprintln!("[nip46 pairing] could not derive a conversation with this author");
continue;
};
let Ok(plain) = nip44_decrypt(&conv, &event.content) else {
eprintln!("[nip46 pairing] payload did not decrypt (wrong conversation key)");
continue;
};
let Ok(request) = serde_json::from_str::<RawRequest>(&plain) else {