Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to version 0.12 #328

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/tencent/cos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
16 changes: 8 additions & 8 deletions src/tencent/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// expires in for credential.
Expand Down Expand Up @@ -92,8 +92,8 @@ impl CredentialLoader {
fn load_via_config(&self) -> Result<Option<Credential>> {
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.
Expand Down Expand Up @@ -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)?),
};
Expand Down