diff --git a/Cargo.toml b/Cargo.toml index e23e345..901b475 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/src/hyper_http_ext.rs b/src/hyper_http_ext.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/lib.rs b/src/lib.rs index 705b79d..f399309 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ mod crypto; +mod hyper_http_ext; mod message_component; mod signature_base; mod signature_params; diff --git a/src/signature_base.rs b/src/signature_base.rs index 4646f0c..f17efd4 100644 --- a/src/signature_base.rs +++ b/src/signature_base.rs @@ -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, signature_params: &HttpSignatureParams, @@ -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 { + let string = self.to_string(); + string.as_bytes().to_vec() + } } impl std::fmt::Display for SignatureBase {