app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit 1d1fc46c78096b2a4b007c364a5cbb63b5197ffa
parent 3643f9fadb7737ee379be0f07b80c7900155c754
Author: triesap <tyson@radroots.org>
Date:   Sat, 28 Mar 2026 19:27:44 +0000

app: roll back remote signer activation drift

Diffstat:
Mcrates/android/src/remote_signer.rs | 22+++++++++++++++++-----
Mcrates/desktop/src/remote_signer.rs | 22+++++++++++++++++-----
Mcrates/ios/src/remote_signer.rs | 22+++++++++++++++++-----
3 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/crates/android/src/remote_signer.rs b/crates/android/src/remote_signer.rs @@ -228,11 +228,23 @@ fn activate_remote_session( ) .map_err(|source| source.to_string())?; let store_path = sessions_path()?; - let mut state = load_sessions(store_path.as_path())?; - state - .activate_session(client_account_id, user_identity.clone()) - .ok_or_else(|| "pending remote signer session disappeared before activation".to_owned())?; - save_sessions(store_path.as_path(), &state)?; + let activation_result = (|| -> Result<(), String> { + let mut state = load_sessions(store_path.as_path())?; + state + .activate_session(client_account_id, user_identity.clone()) + .ok_or_else(|| { + "pending remote signer session disappeared before activation".to_owned() + })?; + save_sessions(store_path.as_path(), &state) + })(); + if let Err(error) = activation_result { + if let Err(rollback_error) = manager.remove_account(&user_identity.id) { + return Err(format!( + "{error}. remote signer account rollback needs retry: {rollback_error}" + )); + } + return Err(error); + } Ok(IdentityGateState::Ready { account_id: user_identity.id.to_string(), }) diff --git a/crates/desktop/src/remote_signer.rs b/crates/desktop/src/remote_signer.rs @@ -227,11 +227,23 @@ fn activate_remote_session( ) .map_err(|source| source.to_string())?; let store_path = sessions_path()?; - let mut state = load_sessions(store_path.as_path())?; - state - .activate_session(client_account_id, user_identity.clone()) - .ok_or_else(|| "pending remote signer session disappeared before activation".to_owned())?; - save_sessions(store_path.as_path(), &state)?; + let activation_result = (|| -> Result<(), String> { + let mut state = load_sessions(store_path.as_path())?; + state + .activate_session(client_account_id, user_identity.clone()) + .ok_or_else(|| { + "pending remote signer session disappeared before activation".to_owned() + })?; + save_sessions(store_path.as_path(), &state) + })(); + if let Err(error) = activation_result { + if let Err(rollback_error) = manager.remove_account(&user_identity.id) { + return Err(format!( + "{error}. remote signer account rollback needs retry: {rollback_error}" + )); + } + return Err(error); + } Ok(IdentityGateState::Ready { account_id: user_identity.id.to_string(), }) diff --git a/crates/ios/src/remote_signer.rs b/crates/ios/src/remote_signer.rs @@ -228,11 +228,23 @@ fn activate_remote_session( ) .map_err(|source| source.to_string())?; let store_path = sessions_path()?; - let mut state = load_sessions(store_path.as_path())?; - state - .activate_session(client_account_id, user_identity.clone()) - .ok_or_else(|| "pending remote signer session disappeared before activation".to_owned())?; - save_sessions(store_path.as_path(), &state)?; + let activation_result = (|| -> Result<(), String> { + let mut state = load_sessions(store_path.as_path())?; + state + .activate_session(client_account_id, user_identity.clone()) + .ok_or_else(|| { + "pending remote signer session disappeared before activation".to_owned() + })?; + save_sessions(store_path.as_path(), &state) + })(); + if let Err(error) = activation_result { + if let Err(rollback_error) = manager.remove_account(&user_identity.id) { + return Err(format!( + "{error}. remote signer account rollback needs retry: {rollback_error}" + )); + } + return Err(error); + } Ok(IdentityGateState::Ready { account_id: user_identity.id.to_string(), })