Skip to content

Commit

Permalink
sdk: add set_keys method to Client
Browse files Browse the repository at this point in the history
Closes #167
  • Loading branch information
yukibtc committed Sep 28, 2023
1 parent 1304b7c commit 67953bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/nostr-sdk/src/client/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
6 changes: 6 additions & 0 deletions crates/nostr-sdk/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 67953bf

Please sign in to comment.