aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-common/src/api.rs
diff options
context:
space:
mode:
authorMichelle Tilley <michelle@michelletilley.net>2026-03-23 09:33:04 -0700
committerGitHub <noreply@github.com>2026-03-23 09:33:04 -0700
commit7f06ba0ee93eebf4482a7eb5d5d25e9d8a072f9d (patch)
tree20f214ce5d0ac08dc6eee0beb2c3c70128050a8e /crates/atuin-common/src/api.rs
parentfeat: hex init nu (#3330) (diff)
downloadatuin-7f06ba0ee93eebf4482a7eb5d5d25e9d8a072f9d.zip
chore: Refactor CLI auth flows and token storage (#3317)
This PR eplaces the binary `is_hub_sync()` auth routing with an explicit `SyncAuth` enum that classifies the client's authentication state at runtime. This fixes a class of bugs where CLI session tokens were silently mis-stored or used with the wrong auth scheme during Hub migration.
Diffstat (limited to 'crates/atuin-common/src/api.rs')
-rw-r--r--crates/atuin-common/src/api.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/atuin-common/src/api.rs b/crates/atuin-common/src/api.rs
index efc17163..1a9f348c 100644
--- a/crates/atuin-common/src/api.rs
+++ b/crates/atuin-common/src/api.rs
@@ -26,6 +26,10 @@ pub struct RegisterRequest {
#[derive(Debug, Serialize, Deserialize)]
pub struct RegisterResponse {
pub session: String,
+ /// Auth type: "hub" for Hub API tokens, "cli" for legacy CLI session tokens.
+ /// Old servers that don't return this field will deserialize as None.
+ #[serde(default)]
+ pub auth: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -49,6 +53,10 @@ pub struct LoginRequest {
#[derive(Debug, Serialize, Deserialize)]
pub struct LoginResponse {
pub session: String,
+ /// Auth type: "hub" for Hub API tokens, "cli" for legacy CLI session tokens.
+ /// Old servers that don't return this field will deserialize as None.
+ #[serde(default)]
+ pub auth: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]