diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/login/mod.rs | 20 |
1 files changed, 10 insertions, 10 deletions
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( | |||
| 65 | eprintln!( | 65 | eprintln!( |
| 66 | "login as {}", | 66 | "login as {}", |
| 67 | if let Ok(public_key) = PublicKey::from_bech32( | 67 | if let Ok(public_key) = PublicKey::from_bech32( |
| 68 | get_config_item(git_repo, "nostr.npub") | 68 | get_config_item(git_repo, "nostr.npub").unwrap_or("unknown".to_string()), |
| 69 | .unwrap_or("unknown ncryptsec".to_string()), | ||
| 70 | ) { | 69 | ) { |
| 71 | if let Ok(user_ref) = | 70 | if let Ok(user_ref) = |
| 72 | get_user_details(&public_key, client, git_repo.get_path()?, silent) | 71 | get_user_details(&public_key, client, git_repo.get_path()?, silent) |
| @@ -99,16 +98,17 @@ pub async fn launch( | |||
| 99 | } | 98 | } |
| 100 | } { | 99 | } { |
| 101 | // get user ref | 100 | // get user ref |
| 102 | let user_ref = get_user_details( | 101 | let public_key = if let Ok(public_key) = PublicKey::from_bech32( |
| 103 | &signer | 102 | get_config_item(git_repo, "nostr.npub").unwrap_or("unknown".to_string()), |
| 103 | ) { | ||
| 104 | public_key | ||
| 105 | } else { | ||
| 106 | signer | ||
| 104 | .get_public_key() | 107 | .get_public_key() |
| 105 | .await | 108 | .await |
| 106 | .context("cannot get public key from signer")?, | 109 | .context("cannot get public key from signer")? |
| 107 | client, | 110 | }; |
| 108 | git_repo.get_path()?, | 111 | let user_ref = get_user_details(&public_key, client, git_repo.get_path()?, silent).await?; |
| 109 | silent, | ||
| 110 | ) | ||
| 111 | .await?; | ||
| 112 | if !silent { | 112 | if !silent { |
| 113 | print_logged_in_as(&user_ref, client.is_none())?; | 113 | print_logged_in_as(&user_ref, client.is_none())?; |
| 114 | } | 114 | } |