diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-25 18:44:21 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-25 23:14:16 -0400 |
commit | 5eab3c4b33f2b0b594993a095eae86f88828827d (patch) | |
tree | a2ce6133546bd03a56ad2ae65f1ad0478ab8ee91 /src/bin/rbw-agent/actions.rs | |
parent | b659cc500476a7b4b94bc6659d46922be9465b99 (diff) | |
download | rbw-5eab3c4b33f2b0b594993a095eae86f88828827d.tar.gz rbw-5eab3c4b33f2b0b594993a095eae86f88828827d.zip |
sync the db every hour, like other bitwarden clients
Diffstat (limited to 'src/bin/rbw-agent/actions.rs')
-rw-r--r-- | src/bin/rbw-agent/actions.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/bin/rbw-agent/actions.rs b/src/bin/rbw-agent/actions.rs index e857a1e..7b5dc58 100644 --- a/src/bin/rbw-agent/actions.rs +++ b/src/bin/rbw-agent/actions.rs @@ -130,7 +130,6 @@ pub async fn login( protected_key, )) => { login_success( - sock, state, access_token, refresh_token, @@ -166,11 +165,10 @@ pub async fn login( tty, &email, password.clone(), - provider + provider, ) .await?; login_success( - sock, state, access_token, refresh_token, @@ -307,7 +305,6 @@ async fn two_factor( } async fn login_success( - sock: &mut crate::sock::Sock, state: std::sync::Arc<tokio::sync::RwLock<crate::agent::State>>, access_token: String, refresh_token: String, @@ -329,7 +326,7 @@ async fn login_success( db.protected_key = Some(protected_key.to_string()); save_db(&db).await?; - sync(sock, false).await?; + sync(None).await?; let db = load_db().await?; let Some(protected_private_key) = db.protected_private_key @@ -497,8 +494,7 @@ pub async fn check_lock( } pub async fn sync( - sock: &mut crate::sock::Sock, - ack: bool, + sock: Option<&mut crate::sock::Sock>, ) -> anyhow::Result<()> { let mut db = load_db().await?; @@ -527,7 +523,7 @@ pub async fn sync( db.entries = entries; save_db(&db).await?; - if ack { + if let Some(sock) = sock { respond_ack(sock).await?; } |