From 86c6d91786b65e513b346350af4b05b205fa157f Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 11 Nov 2024 17:20:37 +0000 Subject: fix(login): only get signer npub when unknown on get the user public key from the remote signer when it is unknown so that read operations aren't blocked by being unable to reach remote signer --- src/lib/login/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/login/mod.rs b/src/lib/login/mod.rs index 148b9d7..de82c01 100644 --- a/src/lib/login/mod.rs +++ b/src/lib/login/mod.rs @@ -65,8 +65,7 @@ pub async fn launch( eprintln!( "login as {}", if let Ok(public_key) = PublicKey::from_bech32( - get_config_item(git_repo, "nostr.npub") - .unwrap_or("unknown ncryptsec".to_string()), + get_config_item(git_repo, "nostr.npub").unwrap_or("unknown".to_string()), ) { if let Ok(user_ref) = get_user_details(&public_key, client, git_repo.get_path()?, silent) @@ -99,16 +98,17 @@ pub async fn launch( } } { // get user ref - let user_ref = get_user_details( - &signer + let public_key = if let Ok(public_key) = PublicKey::from_bech32( + get_config_item(git_repo, "nostr.npub").unwrap_or("unknown".to_string()), + ) { + public_key + } else { + signer .get_public_key() .await - .context("cannot get public key from signer")?, - client, - git_repo.get_path()?, - silent, - ) - .await?; + .context("cannot get public key from signer")? + }; + let user_ref = get_user_details(&public_key, client, git_repo.get_path()?, silent).await?; if !silent { print_logged_in_as(&user_ref, client.is_none())?; } -- cgit v1.2.3