refactor app state

This commit is contained in:
2024-11-24 15:17:35 +07:00
parent 17e7766401
commit db7e28a78a
12 changed files with 49 additions and 65 deletions

View File

@@ -1,5 +1,4 @@
use gpui::Global;
use keyring::Entry;
use nostr_sdk::prelude::*;
use state::get_client;
@@ -18,15 +17,4 @@ impl NostrClient {
Self { client }
}
pub fn add_account(&self, keys: Keys) -> Result<()> {
let public_key = keys.public_key().to_bech32()?;
let secret = keys.secret_key().to_secret_hex();
let entry = Entry::new("Coop Safe Storage", &public_key)?;
// Add secret to keyring
entry.set_password(&secret)?;
Ok(())
}
}