Skip to content

Commit

Permalink
Bump to version 0.12 (#328)
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored May 19, 2023
1 parent d570168 commit 2a024b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
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

1 comment on commit 2a024b0

@github-actions
Copy link

@github-actions github-actions bot commented on 2a024b0 May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for reqsign ready!

✅ Preview
https://reqsign-1o6qufx2w-xuanwo.vercel.app

Built with commit 2a024b0.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.