Crates.io | edgerc |
lib.rs | edgerc |
version | 0.1.2 |
source | src |
created_at | 2023-09-12 03:58:05.564524 |
updated_at | 2023-09-13 16:20:20.126475 |
description | A standard Akamai edgerc signer |
homepage | |
repository | https://bitbucket.org/millohcs/edgerc__lib |
max_upload_size | |
id | 970424 |
size | 27,303 |
EdgeRc is a Rust library designed to sign Akamai HTTP requests.
Add the following dependency in your project Cargo.toml
:
[dependencies]
edgerc = "0.1.0"
Prepare configuration:
let section = "default";
let edgerc_string: String = std::fs::read_to_string("~/.edgerc")?;
let edge_signer = Credentials::build_signer(edgerc_string)
.get_by_section(section.to_string()).unwrap();
Create a signature
Important: Make sure your http client is not modifying either the body or headers. Otherwise will incur into a bad signed request.
let edge_request = EdgeRCRequest {
method: EdgeRCHttpMethods::POST,
path: format!("/ccu/v3/invalidate/url/{network}/"),
query_strings: None,
canonical_headers: None,
body_hash: EdgeRCSigner::encode_body(body.to_string(), None),
};
let signed_authorization_header = signer.get_authorization_header_value(&edge_request);
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this [EdgeRC lib] by you, shall be licensed as MIT, without any additional terms or conditions.