upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/login/fresh.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/login/fresh.rs b/src/lib/login/fresh.rs
index a9cf845..44ee66a 100644
--- a/src/lib/login/fresh.rs
+++ b/src/lib/login/fresh.rs
@@ -413,13 +413,13 @@ pub async fn listen_for_remote_signer(
413 let app_key = app_key.clone(); 413 let app_key = app_key.clone();
414 let nostr_connect_url_clone = nostr_connect_url.clone(); 414 let nostr_connect_url_clone = nostr_connect_url.clone();
415 415
416 let nostr_connect = NostrConnect::new( 416 let nostr_connect = Arc::new(NostrConnect::new(
417 nostr_connect_url_clone, 417 nostr_connect_url_clone,
418 app_key, 418 app_key,
419 Duration::from_secs(10 * 60), 419 Duration::from_secs(10 * 60),
420 None, 420 None,
421 )?; 421 )?);
422 let signer: Arc<dyn NostrSigner> = Arc::new(nostr_connect); 422 let signer: Arc<dyn NostrSigner> = nostr_connect.clone();
423 let pubkey_future = signer.get_public_key(); 423 let pubkey_future = signer.get_public_key();
424 424
425 // wait for signer response or ctrl + c 425 // wait for signer response or ctrl + c
@@ -437,12 +437,16 @@ pub async fn listen_for_remote_signer(
437 printer.clear_all(); 437 printer.clear_all();
438 438
439 if let Some(Ok(public_key)) = res { 439 if let Some(Ok(public_key)) = res {
440 let bunker_url = NostrConnectURI::Bunker { 440 // Get the proper bunker URI from the NostrConnect client
441 // TODO the remote signer pubkey may not be the user pubkey 441 // This will contain the correct remote-signer-pubkey that was discovered
442 remote_signer_public_key: public_key, 442 // during the connection handshake, regardless of whether the original URL
443 relays: nostr_connect_url.relays().to_vec(), 443 // was bunker:// (already had it) or nostrconnect:// (extracted from response
444 secret: nostr_connect_url.secret().map(String::from), 444 // event author)
445 }; 445 let bunker_url = nostr_connect
446 .bunker_uri()
447 .await
448 .context("failed to get bunker URI from NostrConnect client")?;
449
446 Ok((signer, public_key, bunker_url)) 450 Ok((signer, public_key, bunker_url))
447 } else { 451 } else {
448 bail!("failed to get signer") 452 bail!("failed to get signer")