reqsign-core
Core components for signing API requests.
This crate provides the foundational types and traits for the reqsign ecosystem. It defines the core abstractions that enable flexible and extensible request signing.
Quick Start
use ;
// Create a context with your implementations
let ctx = default;
// Create a signer with credential loader and request builder
let signer = new;
// Sign your requests
let mut parts = /* your request parts */;
signer.sign.await?;
Features
- Flexible Architecture: Define your own credential types and signing logic
- Async Support: Built with async/await for modern Rust applications
- Environment Integration: Access environment variables through the Context
- Type Safety: Strong typing ensures compile-time correctness
Core Concepts
Context
The Context struct serves as a container for runtime dependencies:
- File system access via
FileReadtrait - HTTP client via
HttpSendtrait - Environment variables via
Envtrait
Traits
ProvideCredential: Load credentials from various sourcesSignRequest: Build service-specific signing requestsSigningCredential: Validate credential validityFileRead: Async file reading operationsHttpSend: HTTP request executionEnv: Environment variable access
Signer
The Signer orchestrates the signing process by:
- Loading credentials using the provided loader
- Building signing requests with the builder
- Applying signatures to HTTP requests
Examples
Check out the custom_signer example to see how to implement your own signing logic.
Integration
This crate is typically used with service-specific implementations:
reqsign-aws-v4for AWS servicesreqsign-aliyun-ossfor Aliyun OSSreqsign-azure-storagefor Azure Storage- And more...
License
Licensed under Apache License, Version 2.0.