From 94b2fd238ef3ce2b1b65a8a12c3ad72ef88dab40 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 12 Feb 2026 11:58:54 -0800 Subject: feat: add Hub authentication for future sync + extra features (#3010) --- crates/atuin-client/src/meta.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates/atuin-client/src/meta.rs') diff --git a/crates/atuin-client/src/meta.rs b/crates/atuin-client/src/meta.rs index 870f36d0..94ddcaf3 100644 --- a/crates/atuin-client/src/meta.rs +++ b/crates/atuin-client/src/meta.rs @@ -21,6 +21,7 @@ const KEY_LAST_SYNC: &str = "last_sync_time"; const KEY_LAST_VERSION_CHECK: &str = "last_version_check_time"; const KEY_LATEST_VERSION: &str = "latest_version"; const KEY_SESSION: &str = "session"; +const KEY_HUB_SESSION: &str = "hub_session"; const KEY_FILES_MIGRATED: &str = "files_migrated"; pub struct MetaStore { @@ -189,6 +190,24 @@ impl MetaStore { Ok(self.session_token().await?.is_some()) } + // Hub session methods (separate from sync session, used for Hub-specific features like AI) + + pub async fn hub_session_token(&self) -> Result> { + self.get(KEY_HUB_SESSION).await + } + + pub async fn save_hub_session(&self, token: &str) -> Result<()> { + self.set(KEY_HUB_SESSION, token).await + } + + pub async fn delete_hub_session(&self) -> Result<()> { + self.delete(KEY_HUB_SESSION).await + } + + pub async fn hub_logged_in(&self) -> Result { + Ok(self.hub_session_token().await?.is_some()) + } + // File migration: on first open, migrate old plain-text files into the database. // Old files are left in place for safe downgrades. -- cgit v1.3.1