diff --git a/src/auth.rs b/src/auth.rs index b541432..8607b71 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -198,7 +198,7 @@ impl InnerAuth<'_> { let oss_header = self.to_oss_header(); let sign_string = SignString::from_auth(self, oss_header); - map.append_sign(sign_string.to_sign().map_err(AuthError::from)?)?; + map.append_sign(sign_string.into_sign().map_err(AuthError::from)?)?; Ok(map) } @@ -207,7 +207,7 @@ impl InnerAuth<'_> { headers.append_auth(&self)?; let oss_header = self.to_oss_header(); let sign_string = SignString::from_auth(self, oss_header); - headers.append_sign(sign_string.to_sign().map_err(AuthError::from)?)?; + headers.append_sign(sign_string.into_sign().map_err(AuthError::from)?)?; Ok(()) } @@ -383,7 +383,7 @@ impl<'a> SignString<'a> { } // 转化成签名 - fn to_sign(self) -> Result, hmac::digest::crypto_common::InvalidLength> { + fn into_sign(self) -> Result, hmac::digest::crypto_common::InvalidLength> { Ok(Sign { data: self.secret.encryption(self.data.as_bytes())?, key: self.key, diff --git a/src/auth/test.rs b/src/auth/test.rs index 83a9887..fe731fd 100644 --- a/src/auth/test.rs +++ b/src/auth/test.rs @@ -436,12 +436,12 @@ mod sign_string_struct { }; #[test] - fn test_to_sign() { + fn test_into_sign() { let key = KeyId::from("foo1"); let secret = KeySecret::from("foo2"); let sign_string = SignString::new("bar", key, secret); - let res = sign_string.to_sign(); + let res = sign_string.into_sign(); assert!(res.is_ok()); let sign = res.unwrap(); assert_eq!(sign.data(), "gTzwiN1fRQV90YcecTvo1pH+kI8=");