mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 17:14:21 +01:00
prelim fns for edit profiles
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -330,6 +330,14 @@ impl Accounts {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn contains_full_kp(&self, pubkey: &enostr::Pubkey) -> bool {
|
||||||
|
if let Some(contains) = self.contains_account(pubkey.bytes()) {
|
||||||
|
contains.has_nsec
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[must_use = "UnknownIdAction's must be handled. Use .process_unknown_id_action()"]
|
#[must_use = "UnknownIdAction's must be handled. Use .process_unknown_id_action()"]
|
||||||
pub fn add_account(&mut self, account: Keypair) -> AddAccountAction {
|
pub fn add_account(&mut self, account: Keypair) -> AddAccountAction {
|
||||||
let pubkey = account.pubkey;
|
let pubkey = account.pubkey;
|
||||||
@@ -562,6 +570,18 @@ impl Accounts {
|
|||||||
self.needs_relay_config = false;
|
self.needs_relay_config = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_full<'a>(&'a self, pubkey: &[u8; 32]) -> Option<FilledKeypair<'a>> {
|
||||||
|
if let Some(contains) = self.contains_account(pubkey) {
|
||||||
|
if contains.has_nsec {
|
||||||
|
if let Some(kp) = self.get_account(contains.index) {
|
||||||
|
return kp.to_full();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_selected_index(accounts: &[UserAccount], keystore: &KeyStorageType) -> Option<usize> {
|
fn get_selected_index(accounts: &[UserAccount], keystore: &KeyStorageType) -> Option<usize> {
|
||||||
|
|||||||
Reference in New Issue
Block a user