notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit d06744795b69591a7ec49a4e79d6be063c988854
parent 98d0dbd01382930c67f291ba90beb59cb070c380
Author: kernelkind <kernelkind@gmail.com>
Date:   Thu, 20 Nov 2025 16:36:56 -0700

fix: don't exit early in account retrieval

fixes:
> i opened up notedeck with the keyring branch and it seemed to
> nuke my acocunt

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/notedeck/src/storage/account_storage.rs | 24+++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/crates/notedeck/src/storage/account_storage.rs b/crates/notedeck/src/storage/account_storage.rs @@ -48,12 +48,13 @@ impl AccountStorage { fn persist_account(&self, account: &UserAccountSerializable) -> Result<()> { if let Some(secret) = account.key.secret_key.as_ref() { self.keyring.store_secret(&account.key.pubkey, secret)?; + self.write_account_without_secret(account)?; } else { // if the account is npub only, make sure the db doesn't somehow have the nsec self.keyring.remove_secret(&account.key.pubkey)?; } - self.write_account_without_secret(account) + Ok(()) } fn write_account_without_secret(&self, account: &UserAccountSerializable) -> Result<()> { @@ -136,11 +137,24 @@ impl AccountStorageReader { // sanitize our storage of secrets & inject the secret from `keyring` into `UserAccountSerializable` .map(|mut account| -> Result<UserAccountSerializable> { if let Some(secret) = &account.key.secret_key { - self.storage + match self + .storage .keyring - .store_secret(&account.key.pubkey, secret)?; - self.storage.write_account_without_secret(&account)?; - } else if let Some(secret) = self.storage.keyring.get_secret(&account.key.pubkey)? { + .store_secret(&account.key.pubkey, secret) + { + Ok(_) => { + if let Err(e) = self.storage.write_account_without_secret(&account) { + tracing::error!( + "failed to write account {:?} without secret: {e}", + account.key.pubkey + ); + } + } + Err(e) => tracing::error!("failed to store secret in OS secure store: {e}"), + } + } else if let Ok(Some(secret)) = + self.storage.keyring.get_secret(&account.key.pubkey) + { account.key.secret_key = Some(secret); } Ok(account)