@@ -22,6 +22,7 @@ use tokio::sync::Mutex;
2222
2323/// Configuration for the authentication client
2424#[ derive( Debug , Clone ) ]
25+ #[ allow( dead_code) ]
2526pub struct AuthConfig {
2627 /// Base URL of the verifier (e.g., "https://verifier.example.com")
2728 pub verifier_base_url : String ,
@@ -52,20 +53,23 @@ impl Default for AuthConfig {
5253
5354/// Session token with expiration information
5455#[ derive( Debug , Clone ) ]
56+ #[ allow( dead_code) ]
5557struct SessionToken {
5658 token : String ,
5759 expires_at : DateTime < Utc > ,
5860 session_id : u64 ,
5961}
6062
6163impl SessionToken {
64+ #[ allow( dead_code) ]
6265 fn is_valid ( & self , buffer_minutes : i64 ) -> bool {
6366 let buffer = Duration :: minutes ( buffer_minutes) ;
6467 Utc :: now ( ) + buffer < self . expires_at
6568 }
6669}
6770
6871/// Mock TPM operations for testing
72+ #[ allow( dead_code) ]
6973pub trait TpmOperations : Send + Sync {
7074 fn generate_proof ( & self , challenge : & str ) -> Result < ProofOfPossession > ;
7175}
@@ -92,6 +96,7 @@ impl TpmOperations for MockTpmOperations {
9296}
9397
9498/// Standalone authentication client implementing the challenge-response protocol
99+ #[ allow( dead_code) ]
95100pub struct AuthenticationClient {
96101 config : AuthConfig ,
97102 http_client : Client ,
@@ -101,6 +106,7 @@ pub struct AuthenticationClient {
101106
102107impl AuthenticationClient {
103108 /// Create a new authentication client with the given configuration
109+ #[ allow( dead_code) ]
104110 pub fn new ( config : AuthConfig ) -> Result < Self > {
105111 let timeout = std:: time:: Duration :: from_millis ( config. timeout_ms ) ;
106112 let http_client = Client :: builder ( )
@@ -117,6 +123,7 @@ impl AuthenticationClient {
117123 }
118124
119125 /// Create a new authentication client with custom TPM operations
126+ #[ allow( dead_code) ]
120127 pub fn with_tpm_ops (
121128 config : AuthConfig ,
122129 tpm_ops : Box < dyn TpmOperations > ,
@@ -136,6 +143,7 @@ impl AuthenticationClient {
136143 }
137144
138145 /// Get a valid authentication token, performing authentication if necessary
146+ #[ allow( dead_code) ]
139147 pub async fn get_auth_token ( & self ) -> Result < String > {
140148 let token_guard = self . session_token . lock ( ) . await ;
141149
@@ -160,6 +168,7 @@ impl AuthenticationClient {
160168 }
161169
162170 /// Check if we currently have a valid token
171+ #[ allow( dead_code) ]
163172 pub async fn has_valid_token ( & self ) -> bool {
164173 let token_guard = self . session_token . lock ( ) . await ;
165174 if let Some ( ref token) = * token_guard {
@@ -170,13 +179,15 @@ impl AuthenticationClient {
170179 }
171180
172181 /// Clear the current token (e.g., after receiving 401)
182+ #[ allow( dead_code) ]
173183 pub async fn clear_token ( & self ) {
174184 let mut token_guard = self . session_token . lock ( ) . await ;
175185 * token_guard = None ;
176186 debug ! ( "Authentication token cleared" ) ;
177187 }
178188
179189 /// Perform the complete authentication flow
190+ #[ allow( dead_code) ]
180191 async fn authenticate ( & self ) -> Result < String > {
181192 info ! (
182193 "Starting authentication flow for agent: {}" ,
@@ -218,6 +229,7 @@ impl AuthenticationClient {
218229 }
219230
220231 /// Internal authentication implementation
232+ #[ allow( dead_code) ]
221233 async fn do_authenticate ( & self ) -> Result < String > {
222234 // Step 1: Request challenge
223235 debug ! ( "Step 1: Requesting challenge from verifier" ) ;
@@ -240,6 +252,7 @@ impl AuthenticationClient {
240252 }
241253
242254 /// Step 1: Request challenge from verifier
255+ #[ allow( dead_code) ]
243256 async fn request_challenge ( & self ) -> Result < SessionResponse > {
244257 let session_request = SessionRequest {
245258 data : SessionRequestData {
@@ -287,6 +300,7 @@ impl AuthenticationClient {
287300 }
288301
289302 /// Step 2: Generate TPM proof of possession
303+ #[ allow( dead_code) ]
290304 fn generate_tpm_proof (
291305 & self ,
292306 challenge_response : & SessionResponse ,
@@ -311,6 +325,7 @@ impl AuthenticationClient {
311325 }
312326
313327 /// Step 3: Submit proof and get authentication result
328+ #[ allow( dead_code) ]
314329 async fn submit_proof (
315330 & self ,
316331 session_id : u64 ,
@@ -372,6 +387,7 @@ impl AuthenticationClient {
372387 }
373388
374389 /// Step 4: Process authentication result and store token
390+ #[ allow( dead_code) ]
375391 async fn process_auth_result (
376392 & self ,
377393 auth_response : SessionIdResponse ,
@@ -412,6 +428,7 @@ impl AuthenticationClient {
412428 }
413429
414430 /// Make an authenticated HTTP request (convenience method for testing)
431+ #[ allow( dead_code) ]
415432 pub async fn make_authenticated_request (
416433 & self ,
417434 method : Method ,
@@ -460,7 +477,7 @@ mod tests {
460477 max_auth_retries : 2 ,
461478 } ;
462479
463- AuthenticationClient :: new ( config) . unwrap ( )
480+ AuthenticationClient :: new ( config) . unwrap ( ) //#[allow_ci]
464481 }
465482
466483 #[ tokio:: test]
@@ -532,14 +549,14 @@ mod tests {
532549 let client = create_test_client ( & mock_server. uri ( ) ) . await ;
533550
534551 // Test authentication
535- let token = client. get_auth_token ( ) . await . unwrap ( ) ;
552+ let token = client. get_auth_token ( ) . await . unwrap ( ) ; //#[allow_ci]
536553 assert_eq ! ( token, "test-token-456" ) ;
537554
538555 // Test that token is cached
539556 assert ! ( client. has_valid_token( ) . await ) ;
540557
541558 // Test that subsequent calls use cached token
542- let token2 = client. get_auth_token ( ) . await . unwrap ( ) ;
559+ let token2 = client. get_auth_token ( ) . await . unwrap ( ) ; //#[allow_ci]
543560 assert_eq ! ( token2, "test-token-456" ) ;
544561 }
545562
@@ -610,7 +627,7 @@ mod tests {
610627 let result = client. get_auth_token ( ) . await ;
611628 assert ! ( result. is_err( ) ) ;
612629 assert ! ( result
613- . unwrap_err( )
630+ . unwrap_err( ) //#[allow_ci]
614631 . to_string( )
615632 . contains( "Authentication failed" ) ) ;
616633 }
@@ -691,11 +708,11 @@ mod tests {
691708 max_auth_retries : 2 ,
692709 } ;
693710
694- let client = AuthenticationClient :: new ( config) . unwrap ( ) ;
711+ let client = AuthenticationClient :: new ( config) . unwrap ( ) ; //#[allow_ci]
695712
696713 // Since token expires in 1 minute but we have 5 minute buffer,
697714 // it should be considered invalid and trigger re-authentication
698- let token = client. get_auth_token ( ) . await . unwrap ( ) ;
715+ let token = client. get_auth_token ( ) . await . unwrap ( ) ; //#[allow_ci]
699716 assert_eq ! ( token, "short-lived-token" ) ;
700717
701718 // Check that token is considered invalid due to buffer
0 commit comments