aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-client/src/login.rs
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2026-02-04 13:26:06 -0800
committerGitHub <noreply@github.com>2026-02-04 13:26:06 -0800
commit57b542e8ed4335e5f66b5e008d9a8e90776ebffb (patch)
treeaf8512d588023c09301e0505ad81653a21fad70f /crates/atuin-client/src/login.rs
parentfeat: Add a parameter to the sync to specify the download/upload page (#2408) (diff)
downloadatuin-57b542e8ed4335e5f66b5e008d9a8e90776ebffb.zip
feat: replace several files with a sqlite db (#3128)
These files have been known to have corruption issues. SQLite will perform better across filesystems for reads/writes across threads, and will lock as expected. I've also put the session file in there, though I'm 50/50 on it - I'll be replacing it with keyring storage asap anyway. The key file is _not_ included. It should ~never be changed, and should be easy for the user to secure + manage themselves In the future, instead of creating more files, we can just use this as a kv store Resolves https://github.com/atuinsh/atuin/issues/2336, resolves https://github.com/atuinsh/atuin/issues/1650 ## Checks - [ ] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [ ] I have checked that there are no existing pull requests for the same thing
Diffstat (limited to 'crates/atuin-client/src/login.rs')
-rw-r--r--crates/atuin-client/src/login.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/atuin-client/src/login.rs b/crates/atuin-client/src/login.rs
index 78168c7e..ab265928 100644
--- a/crates/atuin-client/src/login.rs
+++ b/crates/atuin-client/src/login.rs
@@ -54,7 +54,7 @@ pub async fn login(
bail!("the specified key was invalid");
}
- let mut file = File::create(key_path).await?;
+ let mut file = File::create(&key_path).await?;
file.write_all(key.as_bytes()).await?;
} else {
// we now know that the user has logged in specifying a key, AND that the key path
@@ -75,7 +75,7 @@ pub async fn login(
store.re_encrypt(&current_key, &new_key).await?;
println!("Writing new key");
- let mut file = File::create(key_path).await?;
+ let mut file = File::create(&key_path).await?;
file.write_all(encoded.as_bytes()).await?;
}
}
@@ -86,9 +86,10 @@ pub async fn login(
)
.await?;
- let session_path = settings.session_path.as_str();
- let mut file = File::create(session_path).await?;
- file.write_all(session.session.as_bytes()).await?;
+ Settings::meta_store()
+ .await?
+ .save_session(&session.session)
+ .await?;
Ok(session.session)
}