aboutsummaryrefslogtreecommitdiffstats
path: root/crates/atuin-client/src/auth.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-11 00:54:30 +0200
commit5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8 (patch)
treec64baa8d5866c8e339eaf660dd3f94f30a3f7d8a /crates/atuin-client/src/auth.rs
parentchore: Somewhat simplify sync code (diff)
downloadatuin-5c39e7cf284a1f6e9a1657f2deb44e359fc47eb8.zip
chore: Move everything into one big crate
That helps remove duplicated code and rustc/cargo will now also show dead code correctly.
Diffstat (limited to '')
-rw-r--r--crates/turtle/src/atuin_client/auth.rs (renamed from crates/atuin-client/src/auth.rs)29
1 files changed, 11 insertions, 18 deletions
diff --git a/crates/atuin-client/src/auth.rs b/crates/turtle/src/atuin_client/auth.rs
index 1031c11f..b770c488 100644
--- a/crates/atuin-client/src/auth.rs
+++ b/crates/turtle/src/atuin_client/auth.rs
@@ -2,12 +2,15 @@ use async_trait::async_trait;
use eyre::{Context, Result, bail};
use reqwest::{Url, header::USER_AGENT};
-use atuin_common::{
- api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ChangePasswordRequest, LoginRequest},
- tls::ensure_crypto_provider,
+use crate::{
+ atuin_client::api_client,
+ atuin_common::{
+ api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ChangePasswordRequest, LoginRequest},
+ tls::ensure_crypto_provider,
+ },
};
-use crate::settings::Settings;
+use crate::atuin_client::settings::Settings;
static APP_USER_AGENT: &str = concat!("atuin/", env!("CARGO_PKG_VERSION"));
@@ -42,12 +45,7 @@ pub enum MutateResponse {
#[async_trait]
pub trait AuthClient: Send + Sync {
/// Log in with username + password, optionally providing a TOTP code.
- async fn login(
- &self,
- username: &str,
- password: &str,
- totp_code: Option<&str>,
- ) -> Result<AuthResponse>;
+ async fn login(&self, username: &str, password: &str) -> Result<AuthResponse>;
/// Register a new account.
async fn register(&self, username: &str, email: &str, password: &str) -> Result<AuthResponse>;
@@ -129,14 +127,9 @@ impl LegacyAuthClient {
#[async_trait]
impl AuthClient for LegacyAuthClient {
- async fn login(
- &self,
- username: &str,
- password: &str,
- _totp_code: Option<&str>,
- ) -> Result<AuthResponse> {
+ async fn login(&self, username: &str, password: &str) -> Result<AuthResponse> {
// The legacy server has no 2FA support; totp_code is ignored.
- let resp = crate::api_client::login(
+ let resp = api_client::login(
&self.address,
LoginRequest {
username: username.to_string(),
@@ -152,7 +145,7 @@ impl AuthClient for LegacyAuthClient {
}
async fn register(&self, username: &str, email: &str, password: &str) -> Result<AuthResponse> {
- let resp = crate::api_client::register(&self.address, username, email, password).await?;
+ let resp = api_client::register(&self.address, username, email, password).await?;
Ok(AuthResponse::Success {
session: resp.session,
auth_type: resp.auth.or(Some("cli".into())),