Skip to content

Commit

Permalink
wip: add stub
Browse files Browse the repository at this point in the history
  • Loading branch information
junkurihara committed Jan 25, 2024
1 parent 1b23161 commit 387b283
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ sha2 = { version = "0.10.8", default-features = false }
# encoding
base64 = { version = "0.21.6" }

# # for request and response headers
# http = "1.0.0"
# for request and response headers
http = { version = "1.0.0" }
Empty file added src/hyper_http_ext.rs
Empty file.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod crypto;
mod hyper_http_ext;
mod message_component;
mod signature_base;
mod signature_params;
Expand Down
10 changes: 10 additions & 0 deletions src/signature_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ struct SignatureBase {
}

impl SignatureBase {
/// Creates a new signature base from component lines and signature params
/// This should not be exposed to user and not used directly.
/// TODO: Use wrapper functions generating SignatureBase from base HTTP request and SignatureParamsBuilder itself instead when newly generating signature
/// TODO: When verifying signature, use wrapper functions generating SignatureBase from HTTP request containing signature params itself instead.
pub(crate) fn try_new(
component_lines: &Vec<HttpMessageComponent>,
signature_params: &HttpSignatureParams,
Expand All @@ -35,6 +39,12 @@ impl SignatureBase {
signature_params: signature_params.clone(),
})
}

/// Returns the signature base string as bytes to be signed
pub(crate) fn as_bytes(&self) -> Vec<u8> {
let string = self.to_string();
string.as_bytes().to_vec()
}
}

impl std::fmt::Display for SignatureBase {
Expand Down

0 comments on commit 387b283

Please sign in to comment.