GithubHelp home page GithubHelp logo

wcy-fdu / reqsign Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuanwo/reqsign

0.0 0.0 0.0 705 KB

Signing HTTP requests without heavy SDKs.

Home Page: https://docs.rs/reqsign/

License: Apache License 2.0

Rust 100.00%

reqsign's Introduction

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.

reqsign's People

Contributors

xuanwo avatar dependabot[bot] avatar everpcpc avatar godruoyi avatar wcy-fdu avatar messense avatar xxchan avatar flaneur2020 avatar teckick avatar wolfv avatar tennyzhuang avatar clslaid avatar agocke avatar snowdrop4 avatar arlyon avatar d2lark avatar leizhiyuan avatar saiintbrisson avatar utkarshgupta137 avatar zwpaper avatar zachno avatar nicktp avatar oowl avatar pengye91 avatar yufan022 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.