upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/git_remote_nostr/push.rs11
-rw-r--r--src/bin/ngit/sub_commands/init.rs15
-rw-r--r--src/lib/client.rs46
-rw-r--r--src/lib/git_events.rs13
-rw-r--r--src/lib/login/mod.rs47
-rw-r--r--src/lib/repo_ref.rs3
6 files changed, 71 insertions, 64 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs
index db86c04..c57e21f 100644
--- a/src/bin/git_remote_nostr/push.rs
+++ b/src/bin/git_remote_nostr/push.rs
@@ -29,9 +29,8 @@ use ngit::{
29}; 29};
30use nostr::nips::nip10::Marker; 30use nostr::nips::nip10::Marker;
31use nostr_sdk::{ 31use nostr_sdk::{
32 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, Kind, PublicKey, Tag, 32 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, Kind, NostrSigner, PublicKey, Tag,
33}; 33};
34use nostr_signer::NostrSigner;
35use repo_ref::RepoRef; 34use repo_ref::RepoRef;
36use repo_state::RepoState; 35use repo_state::RepoState;
37 36
@@ -868,7 +867,7 @@ async fn get_merged_status_events(
868 repo_ref: &RepoRef, 867 repo_ref: &RepoRef,
869 git_repo: &Repo, 868 git_repo: &Repo,
870 remote_nostr_url: &str, 869 remote_nostr_url: &str,
871 signer: &NostrSigner, 870 signer: &Arc<dyn NostrSigner>,
872 refspecs_to_git_server: &Vec<String>, 871 refspecs_to_git_server: &Vec<String>,
873) -> Result<Vec<Event>> { 872) -> Result<Vec<Event>> {
874 let mut events = vec![]; 873 let mut events = vec![];
@@ -944,7 +943,7 @@ async fn get_merged_status_events(
944} 943}
945 944
946async fn create_merge_status( 945async fn create_merge_status(
947 signer: &NostrSigner, 946 signer: &Arc<dyn NostrSigner>,
948 repo_ref: &RepoRef, 947 repo_ref: &RepoRef,
949 proposal: &Event, 948 proposal: &Event,
950 revision: &Option<Event>, 949 revision: &Option<Event>,
@@ -1186,14 +1185,14 @@ trait BuildRepoState {
1186 async fn build( 1185 async fn build(
1187 identifier: String, 1186 identifier: String,
1188 state: HashMap<String, String>, 1187 state: HashMap<String, String>,
1189 signer: &NostrSigner, 1188 signer: &Arc<dyn NostrSigner>,
1190 ) -> Result<RepoState>; 1189 ) -> Result<RepoState>;
1191} 1190}
1192impl BuildRepoState for RepoState { 1191impl BuildRepoState for RepoState {
1193 async fn build( 1192 async fn build(
1194 identifier: String, 1193 identifier: String,
1195 state: HashMap<String, String>, 1194 state: HashMap<String, String>,
1196 signer: &NostrSigner, 1195 signer: &Arc<dyn NostrSigner>,
1197 ) -> Result<RepoState> { 1196 ) -> Result<RepoState> {
1198 let mut tags = vec![Tag::identifier(identifier.clone())]; 1197 let mut tags = vec![Tag::identifier(identifier.clone())];
1199 for (name, value) in &state { 1198 for (name, value) in &state {
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs
index 8f9ff0d..50b8b3c 100644
--- a/src/bin/ngit/sub_commands/init.rs
+++ b/src/bin/ngit/sub_commands/init.rs
@@ -212,7 +212,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
212 let mut maintainers_string = if !args.other_maintainers.is_empty() { 212 let mut maintainers_string = if !args.other_maintainers.is_empty() {
213 [args.other_maintainers.clone()].concat().join(" ") 213 [args.other_maintainers.clone()].concat().join(" ")
214 } else if repo_ref.is_none() && repo_config_result.is_err() { 214 } else if repo_ref.is_none() && repo_config_result.is_err() {
215 signer.public_key().await?.to_bech32()? 215 signer.get_public_key().await?.to_bech32()?
216 } else { 216 } else {
217 let maintainers = if let Ok(config) = &repo_config_result { 217 let maintainers = if let Ok(config) = &repo_config_result {
218 config.maintainers.clone() 218 config.maintainers.clone()
@@ -225,7 +225,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
225 .collect() 225 .collect()
226 } else { 226 } else {
227 //unreachable 227 //unreachable
228 vec![signer.public_key().await?.to_bech32()?] 228 vec![signer.get_public_key().await?.to_bech32()?]
229 }; 229 };
230 // add current user if not present 230 // add current user if not present
231 if maintainers.iter().any(|m| { 231 if maintainers.iter().any(|m| {
@@ -237,9 +237,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
237 }) { 237 }) {
238 maintainers.join(" ") 238 maintainers.join(" ")
239 } else { 239 } else {
240 [maintainers, vec![signer.public_key().await?.to_bech32()?]] 240 [
241 .concat() 241 maintainers,
242 .join(" ") 242 vec![signer.get_public_key().await?.to_bech32()?],
243 ]
244 .concat()
245 .join(" ")
243 } 246 }
244 }; 247 };
245 'outer: loop { 248 'outer: loop {
@@ -263,7 +266,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
263 } 266 }
264 // add current user incase removed 267 // add current user incase removed
265 if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) { 268 if !maintainers.iter().any(|m| user_ref.public_key.eq(m)) {
266 maintainers.push(signer.public_key().await?); 269 maintainers.push(signer.get_public_key().await?);
267 } 270 }
268 break maintainers; 271 break maintainers;
269 } 272 }
diff --git a/src/lib/client.rs b/src/lib/client.rs
index 44ac0cb..d8c5f6d 100644
--- a/src/lib/client.rs
+++ b/src/lib/client.rs
@@ -15,6 +15,7 @@ use std::{
15 fmt::{Display, Write}, 15 fmt::{Display, Write},
16 fs::create_dir_all, 16 fs::create_dir_all,
17 path::Path, 17 path::Path,
18 sync::Arc,
18 time::Duration, 19 time::Duration,
19}; 20};
20 21
@@ -61,7 +62,7 @@ pub struct Client {
61pub trait Connect { 62pub trait Connect {
62 fn default() -> Self; 63 fn default() -> Self;
63 fn new(opts: Params) -> Self; 64 fn new(opts: Params) -> Self;
64 async fn set_signer(&mut self, signer: NostrSigner); 65 async fn set_signer(&mut self, signer: Arc<dyn NostrSigner>);
65 async fn connect(&self, relay_url: &Url) -> Result<()>; 66 async fn connect(&self, relay_url: &Url) -> Result<()>;
66 async fn disconnect(&self) -> Result<()>; 67 async fn disconnect(&self) -> Result<()>;
67 fn get_fallback_relays(&self) -> &Vec<String>; 68 fn get_fallback_relays(&self) -> &Vec<String>;
@@ -167,8 +168,8 @@ impl Connect for Client {
167 } 168 }
168 } 169 }
169 170
170 async fn set_signer(&mut self, signer: NostrSigner) { 171 async fn set_signer(&mut self, signer: Arc<dyn NostrSigner>) {
171 self.client.set_signer(Some(signer)).await; 172 self.client.set_signer(signer).await;
172 } 173 }
173 174
174 async fn connect(&self, relay_url: &Url) -> Result<()> { 175 async fn connect(&self, relay_url: &Url) -> Result<()> {
@@ -660,29 +661,32 @@ fn get_dedup_events(relay_results: Vec<Result<Vec<nostr::Event>>>) -> Vec<Event>
660 dedup_events 661 dedup_events
661} 662}
662 663
663pub async fn sign_event(event_builder: EventBuilder, signer: &NostrSigner) -> Result<nostr::Event> { 664pub async fn sign_event(
664 if signer.r#type().eq(&nostr_signer::NostrSignerType::NIP46) { 665 event_builder: EventBuilder,
665 let term = console::Term::stderr(); 666 signer: &Arc<dyn NostrSigner>,
666 term.write_line("signing event with remote signer...")?; 667) -> Result<nostr::Event> {
667 let event = signer 668 // if signer.type_id().().eq(&nostr_signer::NostrSignerType::NIP46) {
668 .sign_event_builder(event_builder) 669 let term = console::Term::stderr();
669 .await 670 term.write_line("signing event with remote signer...")?;
670 .context("failed to sign event")?; 671 let event = signer
671 term.clear_last_lines(1)?; 672 .sign_event(event_builder.build(signer.get_public_key().await?))
672 Ok(event) 673 .await
673 } else { 674 .context("failed to sign event")?;
674 signer 675 term.clear_last_lines(1)?;
675 .sign_event_builder(event_builder) 676 Ok(event)
676 .await 677 // } else {
677 .context("failed to sign event") 678 // signer
678 } 679 // .sign_event(event_builder.build(signer.get_public_key().await?))
680 // .await
681 // .context("failed to sign event")
682 // }
679} 683}
680 684
681pub async fn fetch_public_key(signer: &NostrSigner) -> Result<nostr::PublicKey> { 685pub async fn fetch_public_key(signer: &Arc<dyn NostrSigner>) -> Result<nostr::PublicKey> {
682 let term = console::Term::stderr(); 686 let term = console::Term::stderr();
683 term.write_line("fetching npub from remote signer...")?; 687 term.write_line("fetching npub from remote signer...")?;
684 let public_key = signer 688 let public_key = signer
685 .public_key() 689 .get_public_key()
686 .await 690 .await
687 .context("failed to get npub from remote signer")?; 691 .context("failed to get npub from remote signer")?;
688 term.clear_last_lines(1)?; 692 term.clear_last_lines(1)?;
diff --git a/src/lib/git_events.rs b/src/lib/git_events.rs
index 2adc205..29c4cf2 100644
--- a/src/lib/git_events.rs
+++ b/src/lib/git_events.rs
@@ -1,12 +1,11 @@
1use std::str::FromStr; 1use std::{str::FromStr, sync::Arc};
2 2
3use anyhow::{bail, Context, Result}; 3use anyhow::{bail, Context, Result};
4use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19}; 4use nostr::nips::{nip01::Coordinate, nip10::Marker, nip19::Nip19};
5use nostr_sdk::{ 5use nostr_sdk::{
6 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, FromBech32, Kind, PublicKey, Tag, 6 hashes::sha1::Hash as Sha1Hash, Event, EventBuilder, EventId, FromBech32, Kind, NostrSigner,
7 TagKind, TagStandard, UncheckedUrl, 7 PublicKey, Tag, TagKind, TagStandard, UncheckedUrl,
8}; 8};
9use nostr_signer::NostrSigner;
10 9
11use crate::{ 10use crate::{
12 cli_interactor::{Interactor, InteractorPrompt, PromptInputParms}, 11 cli_interactor::{Interactor, InteractorPrompt, PromptInputParms},
@@ -86,7 +85,7 @@ pub async fn generate_patch_event(
86 root_commit: &Sha1Hash, 85 root_commit: &Sha1Hash,
87 commit: &Sha1Hash, 86 commit: &Sha1Hash,
88 thread_event_id: Option<nostr::EventId>, 87 thread_event_id: Option<nostr::EventId>,
89 signer: &nostr_sdk::NostrSigner, 88 signer: &Arc<dyn NostrSigner>,
90 repo_ref: &RepoRef, 89 repo_ref: &RepoRef,
91 parent_patch_event_id: Option<nostr::EventId>, 90 parent_patch_event_id: Option<nostr::EventId>,
92 series_count: Option<(u64, u64)>, 91 series_count: Option<(u64, u64)>,
@@ -309,7 +308,7 @@ pub async fn generate_cover_letter_and_patch_events(
309 cover_letter_title_description: Option<(String, String)>, 308 cover_letter_title_description: Option<(String, String)>,
310 git_repo: &Repo, 309 git_repo: &Repo,
311 commits: &[Sha1Hash], 310 commits: &[Sha1Hash],
312 signer: &NostrSigner, 311 signer: &Arc<dyn NostrSigner>,
313 repo_ref: &RepoRef, 312 repo_ref: &RepoRef,
314 root_proposal_id: &Option<String>, 313 root_proposal_id: &Option<String>,
315 mentions: &[nostr::Tag], 314 mentions: &[nostr::Tag],
@@ -624,7 +623,7 @@ mod tests {
624 Tag::hashtag("root"), 623 Tag::hashtag("root"),
625 ], 624 ],
626 ) 625 )
627 .to_event(&nostr::Keys::generate())?) 626 .sign_with_keys(&nostr::Keys::generate())?)
628 } 627 }
629 628
630 #[test] 629 #[test]
diff --git a/src/lib/login/mod.rs b/src/lib/login/mod.rs
index d774426..148b9d7 100644
--- a/src/lib/login/mod.rs
+++ b/src/lib/login/mod.rs
@@ -7,11 +7,11 @@ use nostr::{
7 nips::{nip05, nip46::NostrConnectURI}, 7 nips::{nip05, nip46::NostrConnectURI},
8 PublicKey, 8 PublicKey,
9}; 9};
10use nostr_connect::client::NostrConnect;
10use nostr_sdk::{ 11use nostr_sdk::{
11 Alphabet, FromBech32, JsonUtil, Keys, Kind, NostrSigner, SingleLetterTag, Timestamp, ToBech32, 12 Alphabet, FromBech32, JsonUtil, Keys, Kind, NostrSigner, SingleLetterTag, Timestamp, ToBech32,
12 Url, 13 Url,
13}; 14};
14use nostr_signer::Nip46Signer;
15use qrcode::QrCode; 15use qrcode::QrCode;
16use tokio::sync::{oneshot, Mutex}; 16use tokio::sync::{oneshot, Mutex};
17 17
@@ -45,7 +45,7 @@ pub async fn launch(
45 #[cfg(not(test))] client: Option<&Client>, 45 #[cfg(not(test))] client: Option<&Client>,
46 change_user: bool, 46 change_user: bool,
47 silent: bool, 47 silent: bool,
48) -> Result<(NostrSigner, UserRef)> { 48) -> Result<(Arc<dyn NostrSigner>, UserRef)> {
49 if let Ok(signer) = match get_signer_without_prompts( 49 if let Ok(signer) = match get_signer_without_prompts(
50 git_repo, 50 git_repo,
51 bunker_uri, 51 bunker_uri,
@@ -86,7 +86,7 @@ pub async fn launch(
86 .password(PromptPasswordParms::default().with_prompt("password")) 86 .password(PromptPasswordParms::default().with_prompt("password"))
87 .context("failed to get password input from interactor.password")?; 87 .context("failed to get password input from interactor.password")?;
88 if let Ok(keys) = get_keys_with_password(git_repo, &password) { 88 if let Ok(keys) = get_keys_with_password(git_repo, &password) {
89 break Ok(NostrSigner::Keys(keys)); 89 break Ok(Arc::new(keys) as Arc<dyn NostrSigner>);
90 } 90 }
91 eprintln!("incorrect password"); 91 eprintln!("incorrect password");
92 } 92 }
@@ -101,7 +101,7 @@ pub async fn launch(
101 // get user ref 101 // get user ref
102 let user_ref = get_user_details( 102 let user_ref = get_user_details(
103 &signer 103 &signer
104 .public_key() 104 .get_public_key()
105 .await 105 .await
106 .context("cannot get public key from signer")?, 106 .context("cannot get public key from signer")?,
107 client, 107 client,
@@ -139,15 +139,13 @@ async fn get_signer_without_prompts(
139 nsec: &Option<String>, 139 nsec: &Option<String>,
140 password: &Option<String>, 140 password: &Option<String>,
141 save_local: bool, 141 save_local: bool,
142) -> Result<NostrSigner> { 142) -> Result<Arc<dyn NostrSigner>> {
143 if let Some(nsec) = nsec { 143 if let Some(nsec) = nsec {
144 Ok(NostrSigner::Keys(get_keys_from_nsec( 144 Ok(Arc::new(get_keys_from_nsec(
145 git_repo, nsec, password, save_local, 145 git_repo, nsec, password, save_local,
146 )?)) 146 )?))
147 } else if let Some(password) = password { 147 } else if let Some(password) = password {
148 Ok(NostrSigner::Keys(get_keys_with_password( 148 Ok(Arc::new(get_keys_with_password(git_repo, password)?))
149 git_repo, password,
150 )?))
151 } else if let Some(bunker_uri) = bunker_uri { 149 } else if let Some(bunker_uri) = bunker_uri {
152 if let Some(bunker_app_key) = bunker_app_key { 150 if let Some(bunker_app_key) = bunker_app_key {
153 let signer = get_nip46_signer_from_uri_and_key(bunker_uri, bunker_app_key) 151 let signer = get_nip46_signer_from_uri_and_key(bunker_uri, bunker_app_key)
@@ -156,7 +154,7 @@ async fn get_signer_without_prompts(
156 if save_local { 154 if save_local {
157 save_to_git_config( 155 save_to_git_config(
158 git_repo, 156 git_repo,
159 &signer.public_key().await?.to_bech32()?, 157 &signer.get_public_key().await?.to_bech32()?,
160 &None, 158 &None,
161 &Some((bunker_uri.to_string(),bunker_app_key.to_string())), 159 &Some((bunker_uri.to_string(),bunker_app_key.to_string())),
162 false, 160 false,
@@ -286,11 +284,14 @@ fn get_keys_with_password(git_repo: &Repo, password: &str) -> Result<nostr::Keys
286 .context("failed to decrypt stored nsec key with provided password") 284 .context("failed to decrypt stored nsec key with provided password")
287} 285}
288 286
289async fn get_nip46_signer_from_uri_and_key(uri: &str, app_key: &str) -> Result<NostrSigner> { 287async fn get_nip46_signer_from_uri_and_key(
288 uri: &str,
289 app_key: &str,
290) -> Result<Arc<dyn NostrSigner>> {
290 let term = console::Term::stderr(); 291 let term = console::Term::stderr();
291 term.write_line("connecting to remote signer...")?; 292 term.write_line("connecting to remote signer...")?;
292 let uri = NostrConnectURI::parse(uri)?; 293 let uri = NostrConnectURI::parse(uri)?;
293 let signer = NostrSigner::nip46(Nip46Signer::new( 294 let signer = Arc::new(NostrConnect::new(
294 uri, 295 uri,
295 nostr::Keys::from_str(app_key).context("invalid app key")?, 296 nostr::Keys::from_str(app_key).context("invalid app key")?,
296 Duration::from_secs(10 * 60), 297 Duration::from_secs(10 * 60),
@@ -302,7 +303,7 @@ async fn get_nip46_signer_from_uri_and_key(uri: &str, app_key: &str) -> Result<N
302 303
303async fn get_signer_with_git_config_nsec_or_bunker_without_prompts( 304async fn get_signer_with_git_config_nsec_or_bunker_without_prompts(
304 git_repo: &Repo, 305 git_repo: &Repo,
305) -> Result<NostrSigner> { 306) -> Result<Arc<dyn NostrSigner>> {
306 if let Ok(local_nsec) = &git_repo 307 if let Ok(local_nsec) = &git_repo
307 .get_git_config_item("nostr.nsec", Some(false)) 308 .get_git_config_item("nostr.nsec", Some(false))
308 .context("failed get local git config")? 309 .context("failed get local git config")?
@@ -311,7 +312,7 @@ async fn get_signer_with_git_config_nsec_or_bunker_without_prompts(
311 if local_nsec.contains("ncryptsec") { 312 if local_nsec.contains("ncryptsec") {
312 bail!("git global config item nostr.nsec is an ncryptsec") 313 bail!("git global config item nostr.nsec is an ncryptsec")
313 } 314 }
314 Ok(NostrSigner::Keys( 315 Ok(Arc::new(
315 nostr::Keys::from_str(local_nsec).context("invalid nsec parameter")?, 316 nostr::Keys::from_str(local_nsec).context("invalid nsec parameter")?,
316 )) 317 ))
317 } else if let Ok((uri, app_key)) = get_git_config_bunker_uri_and_app_key(git_repo, Some(false)) 318 } else if let Ok((uri, app_key)) = get_git_config_bunker_uri_and_app_key(git_repo, Some(false))
@@ -325,7 +326,7 @@ async fn get_signer_with_git_config_nsec_or_bunker_without_prompts(
325 if global_nsec.contains("ncryptsec") { 326 if global_nsec.contains("ncryptsec") {
326 bail!("git global config item nostr.nsec is an ncryptsec") 327 bail!("git global config item nostr.nsec is an ncryptsec")
327 } 328 }
328 Ok(NostrSigner::Keys( 329 Ok(Arc::new(
329 nostr::Keys::from_str(global_nsec).context("invalid nsec parameter")?, 330 nostr::Keys::from_str(global_nsec).context("invalid nsec parameter")?,
330 )) 331 ))
331 } else if let Ok((uri, app_key)) = get_git_config_bunker_uri_and_app_key(git_repo, Some(true)) { 332 } else if let Ok((uri, app_key)) = get_git_config_bunker_uri_and_app_key(git_repo, Some(true)) {
@@ -358,7 +359,7 @@ async fn fresh_login(
358 #[cfg(test)] client: Option<&MockConnect>, 359 #[cfg(test)] client: Option<&MockConnect>,
359 #[cfg(not(test))] client: Option<&Client>, 360 #[cfg(not(test))] client: Option<&Client>,
360 always_save: bool, 361 always_save: bool,
361) -> Result<(NostrSigner, UserRef)> { 362) -> Result<(Arc<dyn NostrSigner>, UserRef)> {
362 let app_key = Keys::generate(); 363 let app_key = Keys::generate();
363 let app_key_secret = app_key.secret_key().to_secret_hex(); 364 let app_key_secret = app_key.secret_key().to_secret_hex();
364 let relays = if let Some(client) = client { 365 let relays = if let Some(client) = client {
@@ -403,13 +404,13 @@ async fn fresh_login(
403 if offline { 404 if offline {
404 return; 405 return;
405 } 406 }
406 if let Ok(nip46_signer) = Nip46Signer::new( 407 if let Ok(nostr_connect) = NostrConnect::new(
407 nostr_connect_url.clone(), 408 nostr_connect_url.clone(),
408 app_key.clone(), 409 app_key.clone(),
409 Duration::from_secs(10 * 60), 410 Duration::from_secs(10 * 60),
410 None, 411 None,
411 ) { 412 ) {
412 let signer = NostrSigner::nip46(nip46_signer); 413 let signer: Arc<dyn NostrSigner> = Arc::new(nostr_connect);
413 if let Ok(pub_key) = fetch_public_key(&signer).await { 414 if let Ok(pub_key) = fetch_public_key(&signer).await {
414 let mut printer_locked = printer_clone.lock().await; 415 let mut printer_locked = printer_clone.lock().await;
415 printer_locked.clear_all(); 416 printer_locked.clear_all();
@@ -437,7 +438,7 @@ async fn fresh_login(
437 let (signer, public_key) = { 438 let (signer, public_key) = {
438 if let Ok(Some((signer, public_key))) = rx.await { 439 if let Ok(Some((signer, public_key))) = rx.await {
439 let bunker_url = NostrConnectURI::Bunker { 440 let bunker_url = NostrConnectURI::Bunker {
440 signer_public_key: public_key, 441 remote_signer_public_key: public_key,
441 relays: relays.clone(), 442 relays: relays.clone(),
442 secret: None, 443 secret: None,
443 }; 444 };
@@ -455,7 +456,7 @@ async fn fresh_login(
455 let mut public_key: Option<PublicKey> = None; 456 let mut public_key: Option<PublicKey> = None;
456 // prompt for nsec 457 // prompt for nsec
457 let mut prompt = "login with nsec / bunker url / nostr address"; 458 let mut prompt = "login with nsec / bunker url / nostr address";
458 let signer = loop { 459 let signer: Arc<dyn NostrSigner> = loop {
459 let input = Interactor::default() 460 let input = Interactor::default()
460 .input(PromptInputParms::default().with_prompt(prompt)) 461 .input(PromptInputParms::default().with_prompt(prompt))
461 .context("failed to get nsec input from interactor")?; 462 .context("failed to get nsec input from interactor")?;
@@ -463,7 +464,7 @@ async fn fresh_login(
463 if let Err(error) = save_keys(git_repo, &keys, always_save) { 464 if let Err(error) = save_keys(git_repo, &keys, always_save) {
464 eprintln!("{error}"); 465 eprintln!("{error}");
465 } 466 }
466 break NostrSigner::Keys(keys); 467 break Arc::new(keys);
467 } 468 }
468 let uri = if let Ok(uri) = NostrConnectURI::parse(&input) { 469 let uri = if let Ok(uri) = NostrConnectURI::parse(&input) {
469 uri 470 uri
@@ -501,7 +502,7 @@ async fn fresh_login(
501 let public_key = if let Some(public_key) = public_key { 502 let public_key = if let Some(public_key) = public_key {
502 public_key 503 public_key
503 } else { 504 } else {
504 signer.public_key().await? 505 signer.get_public_key().await?
505 }; 506 };
506 (signer, public_key) 507 (signer, public_key)
507 } 508 }
@@ -561,7 +562,7 @@ pub async fn fetch_nip46_uri_from_nip05(nip05: &str) -> Result<NostrConnectURI>
561 bail!("nip05 provider isn't configured for remote login") 562 bail!("nip05 provider isn't configured for remote login")
562 } 563 }
563 Ok(NostrConnectURI::Bunker { 564 Ok(NostrConnectURI::Bunker {
564 signer_public_key: profile.public_key, 565 remote_signer_public_key: profile.public_key,
565 relays: profile.nip46, 566 relays: profile.nip46,
566 secret: None, 567 secret: None,
567 }) 568 })
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs
index 9bee641..8b48824 100644
--- a/src/lib/repo_ref.rs
+++ b/src/lib/repo_ref.rs
@@ -3,6 +3,7 @@ use std::{
3 fs::File, 3 fs::File,
4 io::BufReader, 4 io::BufReader,
5 str::FromStr, 5 str::FromStr,
6 sync::Arc,
6}; 7};
7 8
8use anyhow::{bail, Context, Result}; 9use anyhow::{bail, Context, Result};
@@ -116,7 +117,7 @@ impl TryFrom<nostr::Event> for RepoRef {
116} 117}
117 118
118impl RepoRef { 119impl RepoRef {
119 pub async fn to_event(&self, signer: &NostrSigner) -> Result<nostr::Event> { 120 pub async fn to_event(&self, signer: &Arc<dyn NostrSigner>) -> Result<nostr::Event> {
120 sign_event( 121 sign_event(
121 nostr_sdk::EventBuilder::new( 122 nostr_sdk::EventBuilder::new(
122 nostr::event::Kind::GitRepoAnnouncement, 123 nostr::event::Kind::GitRepoAnnouncement,