diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-10-28 07:35:07 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-10-28 07:35:07 +0000 |
| commit | 96781f127a09dc8db93cf288c2792f134e74d339 (patch) | |
| tree | 89a3967bda49ca56c90d42fc95613f73d28b1c3b /src/lib/login | |
| parent | 3affc4389f4f5daa4b8300ccde715a297cc01550 (diff) | |
fix: nip46 signer bunker pubkey
the user pubkey was being used in bunker-url rather than the bunker pubkey.
fixes
nostr:nevent1qvzqqqqx25pzpv3tq6c9rl2jx2tx4y6y5c6dj4krmse60a0vmjkea5gam3qjpfljqqsx5ztpy48muheny4p49hh634l5zs3jqw9x5980dm9xsjsk98jrk8ch2sdsw
Diffstat (limited to 'src/lib/login')
| -rw-r--r-- | src/lib/login/fresh.rs | 22 |
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") |