From cc43704e7412ef82f6d41ba211b50e26307a3ddf Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 30 Oct 2025 09:21:24 +0800 Subject: Return key ID along with challenge verification result - Update challenge method to return (bool, String) tuple - Include key ID in both success and failure cases - Update tests to verify key ID matches expected value - Maintain same verification logic but provide additional context --- .../tcp_connection/tcp_connection_test/src/test_challenge.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/utils/tcp_connection/tcp_connection_test/src') diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs b/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs index 2fc1a87..9327b3e 100644 --- a/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs +++ b/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs @@ -69,8 +69,9 @@ impl ServerHandle for ExampleChallengeServerHandle async fn process(mut instance: ConnectionInstance) { // Challenge with correct key let key_dir = current_dir().unwrap().join("res").join("key"); - let result = instance.challenge(key_dir).await.unwrap(); + let (result, key_id) = instance.challenge(key_dir).await.unwrap(); assert!(result); + assert_eq!(key_id, "test_key"); // Send response instance @@ -80,8 +81,9 @@ impl ServerHandle for ExampleChallengeServerHandle // Challenge again let key_dir = current_dir().unwrap().join("res").join("key"); - let result = instance.challenge(key_dir).await.unwrap(); + let (result, key_id) = instance.challenge(key_dir).await.unwrap(); assert!(!result); + assert_eq!(key_id, "test_key"); // Send response instance @@ -91,8 +93,9 @@ impl ServerHandle for ExampleChallengeServerHandle // Challenge again let key_dir = current_dir().unwrap().join("res").join("key"); - let result = instance.challenge(key_dir).await.unwrap(); + let (result, key_id) = instance.challenge(key_dir).await.unwrap(); assert!(!result); + assert_eq!(key_id, "test_key__"); // Send response instance -- cgit