Crates.io | messagesign |
lib.rs | messagesign |
version | |
source | src |
created_at | 2024-12-07 01:08:11.353462 |
updated_at | 2024-12-09 23:32:26.095961 |
description | Library for signing requests to mehal services |
homepage | https://github.com/mehal-tech/messagesign |
repository | https://github.com/mehal-tech/messagesign |
max_upload_size | |
id | 1474903 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A rust library to sign requests to mehal services based on the AWS S3V4 approach.
The implementation is based on the s3v4 library.
This crate provides a signature
function that can be used to sign a request to an mehal services.
Both functions return an Error
generated by the error_chain
crate which can be
converted to a String
or accessed through the description
method or display_chain
and backtrace
methods in case a full backtrace is needed.
let signature: s3v4::Signature = s3v4::signature(
url,
method,
&access,
&secret,
®ion,
&"brog",
machineid
"UNSIGNED-PAYLOAD", //payload hash, or "UNSIGNED-PAYLOAD"
).map_err(|err| format!("Signature error: {}", err.display_chain()))?;
let req = Request::builder()
.method(Method::GET)
.header("x-mhl-content-sha256", "UNSIGNED-PAYLOAD")
.header("x-mhl-date", &signature.date_time)
.header("x-mhl-mid", &machineid)
.header("authorization", &signature.auth_header)
let agent = AgentBuilder::new().build();
let response = agent
.put(&uri)
.set("x-mhl-content-sha256", "UNSIGNED-PAYLOAD")
.set("x-mhl-date", &signature.date_time)
.set("x-mhl-mid", &machineid)
.set("authorization", &signature.auth_header)