style: fix code formatting issues

- Fix spacing and line formatting in signer modules
- Remove unnecessary blank lines
- Ensure consistent code style per project standards
This commit is contained in:
weisd
2025-06-30 21:36:26 +08:00
parent 7b76fc0efe
commit bfeb746c5f
3 changed files with 3 additions and 12 deletions

View File

@@ -12,8 +12,6 @@ const _SIGN_V4_ALGORITHM: &str = "AWS4-HMAC-SHA256";
const SIGN_V2_ALGORITHM: &str = "AWS";
fn encode_url2path(req: &request::Builder, _virtual_host: bool) -> String {
//path = serde_urlencoded::to_string(req.uri_ref().unwrap().path().unwrap()).unwrap();
let path = req.uri_ref().unwrap().path().to_string();
path
@@ -60,13 +58,11 @@ pub fn pre_sign_v2(
.parse()
.unwrap(),
);
req.uri(Uri::from_parts(parts).unwrap())
}
fn _post_pre_sign_signature_v2(policy_base64: &str, secret_access_key: &str) -> String {
hex(hmac_sha1(secret_access_key, policy_base64))
}

View File

@@ -34,7 +34,7 @@ pub fn get_signing_key(secret: &str, loc: &str, t: OffsetDateTime, service_type:
let date = hmac_sha256(s.into_bytes(), t.format(&format).unwrap().into_bytes());
let location = hmac_sha256(date, loc);
let service = hmac_sha256(location, service_type);
hmac_sha256(service, "aws4_request")
}
@@ -166,10 +166,7 @@ fn get_canonical_request(req: &request::Builder, ignored_headers: &HashMap<Strin
query_params.sort_by(|a, b| a.0.cmp(&b.0));
// Build canonical query string
let sorted_params: Vec<String> = query_params
.iter()
.map(|(k, v)| format!("{}={}", k, v) )
.collect();
let sorted_params: Vec<String> = query_params.iter().map(|(k, v)| format!("{}={}", k, v)).collect();
canonical_query_string = sorted_params.join("&");
canonical_query_string = canonical_query_string.replace("+", "%20");
@@ -256,14 +253,13 @@ pub fn pre_sign_v4(
.parse()
.unwrap(),
);
req.uri(Uri::from_parts(parts).unwrap())
}
fn _post_pre_sign_signature_v4(policy_base64: &str, t: OffsetDateTime, secret_access_key: &str, location: &str) -> String {
let signing_key = get_signing_key(secret_access_key, location, t, SERVICE_TYPE_S3);
get_signature(signing_key, policy_base64)
}

View File

@@ -692,7 +692,6 @@ pub struct ExpirationOptions {
pub expire: bool,
}
#[derive(Debug, Clone)]
pub struct TransitionOptions {
pub status: String,