bitwarden_sm/secrets/
get.rs

1use bitwarden_core::Client;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4use uuid::Uuid;
5
6use crate::{error::SecretsManagerError, secrets::SecretResponse};
7
8#[allow(missing_docs)]
9#[derive(Serialize, Deserialize, Debug, JsonSchema)]
10#[serde(rename_all = "camelCase", deny_unknown_fields)]
11pub struct SecretGetRequest {
12    /// ID of the secret to retrieve
13    pub id: Uuid,
14}
15
16pub(crate) async fn get_secret(
17    client: &Client,
18    input: &SecretGetRequest,
19) -> Result<SecretResponse, SecretsManagerError> {
20    let config = client.internal.get_api_configurations().await;
21    let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?;
22
23    let key_store = client.internal.get_key_store();
24
25    SecretResponse::process_response(res, &mut key_store.context())
26}