Crate ids_daps_client
source ·Expand description
§ids-daps
The ids-daps crate provides a rust client for the Dynamic Attribute Token Service (DAPS) of
the Reference Architecture Model 4 (RAM 4) of the International Data Spaces Association (IDSA).
§Usage
use ids_daps_client::{DapsConfigBuilder, DapsClient, ReqwestDapsClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a DAPS client configuration
let config = DapsConfigBuilder::default()
.certs_url(certs_url)
.token_url(token_url)
.private_key(std::path::Path::new("./testdata/connector-certificate.p12"))
.private_key_password(Some(std::borrow::Cow::from("Password1")))
.scope(std::borrow::Cow::from("idsc:IDS_CONNECTORS_ALL"))
.certs_cache_ttl(1)
.build()
.expect("Failed to build DAPS-Config");
// Create DAPS client
let client: ReqwestDapsClient<'_> = DapsClient::new(&config);
// Request a DAT token
let dat = client.request_dat().await?;
println!("DAT Token: {:?}", dat);
// Validate the DAT token
if client.validate_dat(&dat).await.is_ok() {
println!("Validation successful");
}
Ok(())
}Modules§
- This module provides functions to work with DAPS certificates.
Structs§
- The main struct of this crate. It provides the functionality to request and validate DAT tokens from a DAPS.
- Configuration for the DAPS client.
- Builder for
DapsConfig. - Claims within the DAT token.
- Token response from the DAPS.
Enums§
- Error type for DapsConfigBuilder
Type Aliases§
- An alias for the DAPS client using the Reqwest HTTP client.