ids-daps-client

A client to connect with the IDS DAPS

3 unstable releases

0.2.1 Sep 30, 2024
0.2.0 Sep 30, 2024
0.1.0 Aug 20, 2024
Download history 126/week @ 2024-08-18 6/week @ 2024-08-25 14/week @ 2024-09-15 9/week @ 2024-09-22 297/week @ 2024-09-29 19/week @ 2024-10-06

339 downloads per month

Apache-2.0

28KB
497 lines

ids-daps-client

This is a Rust client library to interact with the Dynamic Attribute Provisioning Service (DAPS) in the latest IDS Reference Architecture Model (RAM 4).

For further information and usage see the crate documentation.

References


lib.rs:

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::{config::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_u64)
        .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(())
}

Dependencies

~8–20MB
~319K SLoC