From 067854f745c131c6af4c9a6d547680be915f6a1f Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 19 May 2023 17:27:26 +0800 Subject: [PATCH] Bump to version 0.12 Signed-off-by: Xuanwo --- Cargo.toml | 2 +- src/tencent/cos.rs | 4 ++-- src/tencent/credential.rs | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4953e41b..05294f9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ documentation = "https://docs.rs/reqsign" edition = "2021" license = "Apache-2.0" name = "reqsign" -version = "0.11.0" +version = "0.12.0" [package.metadata.docs.rs] all-features = true diff --git a/src/tencent/cos.rs b/src/tencent/cos.rs index 7317052e..4bffa766 100644 --- a/src/tencent/cos.rs +++ b/src/tencent/cos.rs @@ -127,7 +127,7 @@ fn build_signature( (now + chrono::Duration::from_std(expires).unwrap()).timestamp() ); - let sign_key = hex_hmac_sha1(cred.secret_access_key.as_bytes(), key_time.as_bytes()); + let sign_key = hex_hmac_sha1(cred.secret_key.as_bytes(), key_time.as_bytes()); let mut params = ctx .query @@ -202,5 +202,5 @@ fn build_signature( let signature = hex_hmac_sha1(sign_key.as_bytes(), string_to_sign.as_bytes()); - format!("q-sign-algorithm=sha1&q-ak={}&q-sign-time={}&q-key-time={}&q-header-list={}&q-url-param-list={}&q-signature={}", cred.access_key_id, key_time, key_time, header_list, param_list, signature) + format!("q-sign-algorithm=sha1&q-ak={}&q-sign-time={}&q-key-time={}&q-header-list={}&q-url-param-list={}&q-signature={}", cred.secret_id, key_time, key_time, header_list, param_list, signature) } diff --git a/src/tencent/credential.rs b/src/tencent/credential.rs index 918dcf19..1a62e84f 100644 --- a/src/tencent/credential.rs +++ b/src/tencent/credential.rs @@ -22,10 +22,10 @@ use super::config::Config; #[derive(Clone)] #[cfg_attr(test, derive(Debug))] pub struct Credential { - /// Access key id - pub access_key_id: String, - /// Secret access key - pub secret_access_key: String, + /// Secret ID + pub secret_id: String, + /// Secret Key + pub secret_key: String, /// security_token pub security_token: Option, /// expires in for credential. @@ -92,8 +92,8 @@ impl CredentialLoader { fn load_via_config(&self) -> Result> { if let (Some(ak), Some(sk)) = (&self.config.secret_id, &self.config.secret_key) { let cred = Credential { - access_key_id: ak.clone(), - secret_access_key: sk.clone(), + secret_id: ak.clone(), + secret_key: sk.clone(), security_token: self.config.security_token.clone(), // Set expires_in to 10 minutes to enforce re-read // from file. @@ -159,8 +159,8 @@ impl CredentialLoader { let resp_cred = resp.response.credentials; let cred = Credential { - access_key_id: resp_cred.tmp_secret_id, - secret_access_key: resp_cred.tmp_secret_key, + secret_id: resp_cred.tmp_secret_id, + secret_key: resp_cred.tmp_secret_key, security_token: Some(resp_cred.token), expires_in: Some(parse_rfc3339(&resp_expiration)?), };