From b62546ff852ebf5e6f36d68f754c9b14594d7071 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 12 Nov 2024 08:28:24 +0000 Subject: test: prevent signer commentary identification of signer has been removed from rust-nostr. until it is added back in we must always prompt the user about signing as if its a local signer the message will be removed before the user sees it. unfortunately this is picked up by the tests so we must only prompt the user when not running tests. --- src/lib/client.rs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/lib') diff --git a/src/lib/client.rs b/src/lib/client.rs index d8c5f6d..70616fc 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -665,21 +665,24 @@ pub async fn sign_event( event_builder: EventBuilder, signer: &Arc, ) -> Result { - // if signer.type_id().().eq(&nostr_signer::NostrSignerType::NIP46) { - let term = console::Term::stderr(); - term.write_line("signing event with remote signer...")?; - let event = signer - .sign_event(event_builder.build(signer.get_public_key().await?)) - .await - .context("failed to sign event")?; - term.clear_last_lines(1)?; - Ok(event) - // } else { - // signer - // .sign_event(event_builder.build(signer.get_public_key().await?)) - // .await - // .context("failed to sign event") - // } + // TODO: Yuki suggested he would add a backend option to NostrSigner so we can + // identify nip46 signers again and replace the below if statement with: + // if signer.backend() == nip46 { + if std::env::var("NGITTEST").is_err() { + let term = console::Term::stderr(); + term.write_line("signing event with remote signer...")?; + let event = signer + .sign_event(event_builder.build(signer.get_public_key().await?)) + .await + .context("failed to sign event")?; + term.clear_last_lines(1)?; + Ok(event) + } else { + signer + .sign_event(event_builder.build(signer.get_public_key().await?)) + .await + .context("failed to sign event") + } } pub async fn fetch_public_key(signer: &Arc) -> Result { -- cgit v1.2.3