diff --git a/crates/nostr-sdk/src/client/blocking.rs b/crates/nostr-sdk/src/client/blocking.rs index c6520fab8..d501e2422 100644 --- a/crates/nostr-sdk/src/client/blocking.rs +++ b/crates/nostr-sdk/src/client/blocking.rs @@ -74,6 +74,11 @@ impl Client { RUNTIME.block_on(async { self.client.keys().await }) } + /// Change [`Keys`] + pub fn set_keys(&self, keys: &Keys) { + RUNTIME.block_on(async { self.client.set_keys(keys).await }) + } + /// Start a previously stopped client pub fn start(&self) { RUNTIME.block_on(async { self.client.start().await }) diff --git a/crates/nostr-sdk/src/client/mod.rs b/crates/nostr-sdk/src/client/mod.rs index 517ec5c19..7ef973a19 100644 --- a/crates/nostr-sdk/src/client/mod.rs +++ b/crates/nostr-sdk/src/client/mod.rs @@ -208,6 +208,12 @@ impl Client { keys.clone() } + /// Change [`Keys`] + pub async fn set_keys(&self, keys: &Keys) { + let mut current_keys = self.keys.write().await; + *current_keys = keys.clone(); + } + /// Get [`RelayPool`] pub fn pool(&self) -> RelayPool { self.pool.clone()