3 unstable releases

0.2.1 Sep 30, 2024
0.2.0 Sep 30, 2024
0.1.0 Aug 20, 2024

#276 in Authentication

Download history 86/week @ 2024-08-14 46/week @ 2024-08-21 9/week @ 2024-09-11 10/week @ 2024-09-18 241/week @ 2024-09-25 69/week @ 2024-10-02 14/week @ 2024-10-09 4/week @ 2024-10-16

98 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–21MB
~322K SLoC