62 releases

new 0.15.0 Mar 26, 2024
0.14.7 Jan 31, 2024
0.14.6 Dec 21, 2023
0.14.4 Nov 22, 2023
0.0.3 Mar 28, 2022

#1 in #services

Download history 23165/week @ 2023-12-04 21485/week @ 2023-12-11 31279/week @ 2023-12-18 36408/week @ 2023-12-25 36666/week @ 2024-01-01 32333/week @ 2024-01-08 46472/week @ 2024-01-15 38132/week @ 2024-01-22 44764/week @ 2024-01-29 23794/week @ 2024-02-05 17558/week @ 2024-02-12 26084/week @ 2024-02-19 32747/week @ 2024-02-26 24466/week @ 2024-03-04 29806/week @ 2024-03-11 24975/week @ 2024-03-18

113,086 downloads per month
Used in 8 crates (2 directly)

Apache-2.0

260KB
5.5K SLoC

reqsign   Build Status Latest Version Crate Downloads

Signing API requests without effort.


Most API is simple. But they could be complicated when they are hidden from complex abstraction. reqsign bring the simple API back: build, sign, send.

Quick Start

use anyhow::Result;
use reqsign::AwsConfig;
use reqsign::AwsLoader;
use reqsign::AwsV4Signer;
use reqwest::Client;
use reqwest::Request;
use reqwest::Url;

#[tokio::main]
async fn main() -> Result<()> {
    // Signer can load region and credentials from environment by default.
    let client = Client::new();
    let config = AwsConfig::default().from_profile().from_env();
    let loader = AwsLoader::new(client.clone(), config);
    let signer = AwsV4Signer::new("s3", "us-east-1");
    // Construct request
    let url = Url::parse("https://s3.amazonaws.com/testbucket")?;
    let mut req = reqwest::Request::new(http::Method::GET, url);
    // Signing request with Signer
    let credential = loader.load().await?.unwrap();
    signer.sign(&mut req, &credential)?;
    // Sending already signed request.
    let resp = client.execute(req).await?;
    println!("resp got status: {}", resp.status());
    Ok(())
}

Features

  • Pure rust with minimal dependencies.
  • Test again official SDK and services.
  • Supported services
    • Aliyun OSS: reqsign::AliyunOssSigner
    • AWS services (SigV4): reqsign::AwsV4Signer
    • Azure Storage services: reqsign::AzureStorageSigner
    • Google services: reqsign::GoogleSigner
    • Huawei Cloud OBS: reqsign::HuaweicloudObsSigner

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

Acknowledge

Inspired a lot from:

License

Licensed under Apache License, Version 2.0.

Dependencies

~3–20MB
~282K SLoC