From 9eb2ffb2e9b52cdec70acb268e7a12131811db10 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 10 Jun 2026 23:12:17 +0200 Subject: chore: Somewhat simplify sync code --- crates/atuin-client/src/api_client.rs | 24 ------------------------ crates/atuin-client/src/login.rs | 21 +-------------------- crates/atuin-client/src/settings.rs | 9 --------- 3 files changed, 1 insertion(+), 53 deletions(-) (limited to 'crates/atuin-client/src') diff --git a/crates/atuin-client/src/api_client.rs b/crates/atuin-client/src/api_client.rs index 066fecb5..ca2fc661 100644 --- a/crates/atuin-client/src/api_client.rs +++ b/crates/atuin-client/src/api_client.rs @@ -40,8 +40,6 @@ static APP_USER_AGENT: &str = concat!("atuin/", env!("CARGO_PKG_VERSION"),); /// authentication across CLI and Hub features. #[derive(Debug, Clone)] pub enum AuthToken { - /// Hub API token, used with "Bearer {token}" header - Bearer(String), /// Legacy CLI session token, used with "Token {token}" header Token(String), } @@ -50,7 +48,6 @@ impl AuthToken { /// Format the token as an Authorization header value fn to_header_value(&self) -> String { match self { - AuthToken::Bearer(token) => format!("Bearer {token}"), AuthToken::Token(token) => format!("Token {token}"), } } @@ -139,27 +136,6 @@ pub async fn login(address: &str, req: LoginRequest) -> Result { Ok(session) } -#[cfg(feature = "check-update")] -pub async fn latest_version() -> Result { - use atuin_common::api::IndexResponse; - - ensure_crypto_provider(); - let url = "https://api.atuin.sh"; - let client = reqwest::Client::new(); - - let resp = client - .get(url) - .header(USER_AGENT, APP_USER_AGENT) - .send() - .await?; - let resp = handle_resp_error(resp).await?; - - let index = resp.json::().await?; - let version = Version::parse(index.version.as_str())?; - - Ok(version) -} - pub fn ensure_version(response: &Response) -> Result { let version = response.headers().get(ATUIN_HEADER_VERSION); diff --git a/crates/atuin-client/src/login.rs b/crates/atuin-client/src/login.rs index d72d1c09..2545e890 100644 --- a/crates/atuin-client/src/login.rs +++ b/crates/atuin-client/src/login.rs @@ -7,7 +7,7 @@ use tokio::io::AsyncWriteExt; use crate::{ api_client, - encryption::{Key, decode_key, encode_key, load_key}, + encryption::{decode_key, load_key}, record::{sqlite_store::SqliteStore, store::Store}, settings::Settings, }; @@ -19,25 +19,6 @@ pub async fn login( password: String, key: String, ) -> Result { - // try parse the key as a mnemonic... - let key = match bip39::Mnemonic::from_phrase(&key, bip39::Language::English) { - Ok(mnemonic) => encode_key(Key::from_slice(mnemonic.entropy()))?, - Err(err) => { - match err { - // assume they copied in the base64 key - bip39::ErrorKind::InvalidWord(_) => key, - bip39::ErrorKind::InvalidChecksum => { - bail!("key mnemonic was not valid") - } - bip39::ErrorKind::InvalidKeysize(_) - | bip39::ErrorKind::InvalidWordLength(_) - | bip39::ErrorKind::InvalidEntropyLength(_, _) => { - bail!("key was not the correct length") - } - } - } - }; - let key_path = settings.key_path.as_str(); let key_path = PathBuf::from(key_path); diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index ce84c053..5fb65c17 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -336,11 +336,6 @@ impl Default for Stats { } } -#[derive(Clone, Debug, Deserialize, Default, Serialize)] -pub struct Sync { - pub records: bool, -} - /// Sync protocol type for authentication. /// /// This setting is primarily for development/testing. When not explicitly set, @@ -1102,9 +1097,6 @@ pub struct Settings { #[serde(default)] pub stats: Stats, - #[serde(default)] - pub sync: Sync, - #[serde(default)] pub keys: Keys, @@ -1330,7 +1322,6 @@ impl Settings { // muscle memory. // New users will get the new default, that is more similar to what they are used to. .set_default("enter_accept", false)? - .set_default("sync.records", true)? .set_default("keys.scroll_exits", true)? .set_default("keys.accept_past_line_end", true)? .set_default("keys.exit_past_line_start", true)? -- cgit v1.3.1