wip: startup flow

This commit is contained in:
2024-11-21 08:43:42 +07:00
parent fb71f02ef3
commit c60a37a245
15 changed files with 910 additions and 82 deletions

16
crates/ui/src/utils.rs Normal file
View File

@@ -0,0 +1,16 @@
use keyring_search::{Limit, List, Search};
use nostr_sdk::prelude::*;
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 list = List::list_credentials(&results, Limit::All);
let accounts: HashSet<PublicKey> = list
.split_whitespace()
.filter(|v| v.starts_with("npub1") && !v.ends_with("coop"))
.filter_map(|i| PublicKey::from_bech32(i).ok())
.collect();
accounts
}