chore: Add the signer to the client if found

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-06-08 20:26:38 +00:00
parent b1027b3b04
commit 9069adbe22
2 changed files with 16 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ use futures::future;
use nostr::{
event::{Event, EventId, Kind, Tag, TagStandard, Tags, UnsignedEvent},
filter::Filter,
key::{Keys, PublicKey},
key::PublicKey,
nips::{nip01::Coordinate, nip22, nip34::GitRepositoryAnnouncement},
parser::NostrParser,
types::RelayUrl,
@@ -103,17 +103,13 @@ impl NostrClient {
/// Initializes a new [`NostrClient`] instance and connects to the specified
/// relays.
pub async fn init(options: &CliOptions, relays: &[RelayUrl]) -> Self {
let client = Self::new(
Client::builder()
.signer(Keys::new(
options
.secret_key
.as_ref()
.expect("This the only method for now")
.clone(),
))
.build(),
);
let mut client_builder = Client::builder();
if let Some(signer) = options.signer() {
client_builder = client_builder.signer(signer);
}
let client = Self::new(client_builder.build());
client.add_relays(relays).await;
client