From 2723d5a319d4e94b9327a2721ba981711cfb0fa8 Mon Sep 17 00:00:00 2001 From: Bryan Brooks Date: Sun, 14 Dec 2025 10:25:42 -0600 Subject: [PATCH] Fix remaining CI issues: Rust formatting and TypeScript lint - Fix Rust formatting in examples, error.rs, validation.rs, sqlite.rs - Fix TypeScript unused variable lint errors in react.ts --- examples/with_session_store.rs | 6 +++++- src/error.rs | 4 +++- src/session/sqlite.rs | 7 ++++--- src/validation.rs | 11 +++++++++-- ts/src/react.ts | 6 +++--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/examples/with_session_store.rs b/examples/with_session_store.rs index 96a0028..4f398af 100644 --- a/examples/with_session_store.rs +++ b/examples/with_session_store.rs @@ -67,7 +67,11 @@ fn main() -> Result<(), Box> { println!("3. Get All User Sessions"); let user_sessions = sessions.get_user_sessions(&test_payload.did)?; - println!(" Found {} session(s) for {}", user_sessions.len(), test_payload.did); + println!( + " Found {} session(s) for {}", + user_sessions.len(), + test_payload.did + ); println!(); println!("4. Create Another Session (same user, different device)"); diff --git a/src/error.rs b/src/error.rs index 6396bbd..9518bc7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -59,7 +59,9 @@ impl AuthError { pub fn is_invalid_token(&self) -> bool { matches!( self, - AuthError::InvalidFormat(_) | AuthError::InvalidSignature | AuthError::InvalidPayload(_) + AuthError::InvalidFormat(_) + | AuthError::InvalidSignature + | AuthError::InvalidPayload(_) ) } diff --git a/src/session/sqlite.rs b/src/session/sqlite.rs index a5d4cd1..5126066 100644 --- a/src/session/sqlite.rs +++ b/src/session/sqlite.rs @@ -77,7 +77,9 @@ impl SqliteSessionStore { /// Get a connection from the pool. fn conn(&self) -> AuthResult> { - self.pool.get().map_err(|e| AuthError::Database(e.to_string())) + self.pool + .get() + .map_err(|e| AuthError::Database(e.to_string())) } } @@ -121,8 +123,7 @@ impl SessionStore for SqliteSessionStore { let result = stmt.query_row(params![token], |row| { let metadata_str: Option = row.get(6)?; - let metadata = metadata_str - .and_then(|s| serde_json::from_str(&s).ok()); + let metadata = metadata_str.and_then(|s| serde_json::from_str(&s).ok()); Ok(Session { token: row.get(0)?, diff --git a/src/validation.rs b/src/validation.rs index da5a0a2..f24861f 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -57,7 +57,9 @@ pub fn validate_did(did: &str) -> AuthResult<()> { // Validate method (second part) let method = parts[1]; if method.is_empty() { - return Err(AuthError::InvalidDid("DID method cannot be empty".to_string())); + return Err(AuthError::InvalidDid( + "DID method cannot be empty".to_string(), + )); } // Method should only contain lowercase letters @@ -164,7 +166,12 @@ pub fn validate_handle(handle: &str) -> AuthResult<()> { } // First part (username) should start with letter or number - if i == 0 && !part.chars().next().map_or(false, |c| c.is_ascii_alphanumeric()) { + if i == 0 + && !part + .chars() + .next() + .map_or(false, |c| c.is_ascii_alphanumeric()) + { return Err(AuthError::InvalidHandle( "Handle must start with letter or number".to_string(), )); diff --git a/ts/src/react.ts b/ts/src/react.ts index e145b67..002c03d 100644 --- a/ts/src/react.ts +++ b/ts/src/react.ts @@ -41,7 +41,7 @@ export function createAuthStore(config: AtAuthConfig) { return create()( persist( - (set, get) => ({ + (set, _get) => ({ // Initial state isAuthenticated: false, isLoading: true, @@ -185,8 +185,8 @@ export function useAuthStore(): AuthStore & { state.clearAuth(); // Optionally redirect to gateway logout if (defaultConfig?.gatewayUrl) { - const logoutUrl = buildLogoutUrl(defaultConfig, window.location.origin); - // Don't auto-redirect, let the app decide + // Build logout URL - app can redirect if needed + void buildLogoutUrl(defaultConfig, window.location.origin); } }, }; -- knotmirror 0.0.1