feat: save user key to keyring
This commit is contained in:
@@ -4,7 +4,7 @@ use std::collections::HashSet;
|
||||
|
||||
pub fn get_all_accounts_from_keyring() -> HashSet<PublicKey> {
|
||||
let search = Search::new().expect("Keyring not working.");
|
||||
let results = search.by_service("coop");
|
||||
let results = search.by_service("Coop Safe Storage");
|
||||
let list = List::list_credentials(&results, Limit::All);
|
||||
let accounts: HashSet<PublicKey> = list
|
||||
.split_whitespace()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use ::client::NostrClient;
|
||||
use components::{
|
||||
input::{InputEvent, TextInput},
|
||||
label::Label,
|
||||
@@ -23,9 +24,13 @@ impl SetupView {
|
||||
if let InputEvent::PressEnter = input_event {
|
||||
let content = text_input.read(cx).text().to_string();
|
||||
|
||||
if let Ok(public_key) = PublicKey::parse(content) {
|
||||
cx.global_mut::<AppState>().accounts.insert(public_key);
|
||||
cx.notify();
|
||||
if let Ok(keys) = Keys::parse(content) {
|
||||
let public_key = keys.public_key();
|
||||
|
||||
if cx.global::<NostrClient>().add_account(keys).is_ok() {
|
||||
cx.global_mut::<AppState>().accounts.insert(public_key);
|
||||
cx.notify();
|
||||
}
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user