7 releases (4 breaking)

0.5.0 Apr 25, 2024
0.4.0 Dec 21, 2023
0.3.1 Oct 13, 2023
0.3.0 Jul 26, 2023
0.1.0 Jan 31, 2023

#131 in Authentication

Download history 1252/week @ 2024-01-25 1191/week @ 2024-02-01 1366/week @ 2024-02-08 1084/week @ 2024-02-15 1314/week @ 2024-02-22 1280/week @ 2024-02-29 1358/week @ 2024-03-07 1648/week @ 2024-03-14 1578/week @ 2024-03-21 1049/week @ 2024-03-28 1415/week @ 2024-04-04 1470/week @ 2024-04-11 1970/week @ 2024-04-18 1386/week @ 2024-04-25 1431/week @ 2024-05-02 1704/week @ 2024-05-09

6,791 downloads per month
Used in bws

Custom license

2.5MB
51K SLoC

Bitwarden Secrets Manager SDK

A Rust client SDK to interact with the Bitwarden Secrets Manager. This is a beta release and might be missing some functionality.

Usage

[dependencies]
bitwarden = { "*", features = ["secrets"] }

Minimum Supported Rust Version

Rust 1.71 or higher.

Example

use bitwarden::{
    auth::login::AccessTokenLoginRequest,
    client::client_settings::{ClientSettings, DeviceType},
    error::Result,
    secrets_manager::secrets::SecretIdentifiersRequest,
    Client,
};
use uuid::Uuid;

async fn test() -> Result<()> {
    // Use the default values
    let mut client = Client::new(None);

    // Or set your own values
    let settings = ClientSettings {
        identity_url: "https://identity.bitwarden.com".to_string(),
        api_url: "https://api.bitwarden.com".to_string(),
        user_agent: "Bitwarden Rust-SDK".to_string(),
        device_type: DeviceType::SDK,
    };
    let mut client = Client::new(Some(settings));

    // Before we operate, we need to authenticate with a token
    let token = AccessTokenLoginRequest { access_token: String::from(""), state_file: None };
    client.auth().login_access_token(&token).await.unwrap();

    let org_id = SecretIdentifiersRequest { organization_id: Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap() };
    println!("Stored secrets: {:#?}", client.secrets().list(&org_id).await.unwrap());
    Ok(())
}

Dependencies

~16–35MB
~544K SLoC