Skip to content

[PM-5693] Migrate SDK to KeyStore #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions bitwarden_license/bitwarden-sm/src/projects/create.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitwarden_api_api::models::ProjectCreateRequestModel;
use bitwarden_core::Client;
use bitwarden_crypto::KeyEncryptable;
use bitwarden_core::{key_management::SymmetricKeyId, Client};
use bitwarden_crypto::Encryptable;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand All @@ -26,11 +26,16 @@
) -> Result<ProjectResponse, SecretsManagerError> {
input.validate()?;

let enc = client.internal.get_encryption_settings()?;
let key = enc.get_key(&Some(input.organization_id))?;
let key_store = client.internal.get_key_store();
let key = SymmetricKeyId::Organization(input.organization_id);

Check warning on line 30 in bitwarden_license/bitwarden-sm/src/projects/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/create.rs#L29-L30

Added lines #L29 - L30 were not covered by tests

let project = Some(ProjectCreateRequestModel {
name: input.name.clone().trim().encrypt_with_key(key)?.to_string(),
name: input
.name
.clone()
.trim()
.encrypt(&mut key_store.context(), key)?
.to_string(),

Check warning on line 38 in bitwarden_license/bitwarden-sm/src/projects/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/create.rs#L33-L38

Added lines #L33 - L38 were not covered by tests
});

let config = client.internal.get_api_configurations().await;
Expand All @@ -41,7 +46,7 @@
)
.await?;

ProjectResponse::process_response(res, &enc)
ProjectResponse::process_response(res, &mut key_store.context())

Check warning on line 49 in bitwarden_license/bitwarden-sm/src/projects/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/create.rs#L49

Added line #L49 was not covered by tests
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions bitwarden_license/bitwarden-sm/src/projects/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

let res = bitwarden_api_api::apis::projects_api::projects_id_get(&config.api, input.id).await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 23 in bitwarden_license/bitwarden-sm/src/projects/get.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/get.rs#L23

Added line #L23 was not covered by tests

ProjectResponse::process_response(res, &enc)
ProjectResponse::process_response(res, &mut key_store.context())

Check warning on line 25 in bitwarden_license/bitwarden-sm/src/projects/get.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/get.rs#L25

Added line #L25 was not covered by tests
}
11 changes: 6 additions & 5 deletions bitwarden_license/bitwarden-sm/src/projects/list.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use bitwarden_api_api::models::ProjectResponseModelListResponseModel;
use bitwarden_core::client::{encryption_settings::EncryptionSettings, Client};
use bitwarden_core::{client::Client, key_management::KeyIds};
use bitwarden_crypto::KeyStoreContext;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand All @@ -24,9 +25,9 @@
)
.await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 28 in bitwarden_license/bitwarden-sm/src/projects/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/list.rs#L28

Added line #L28 was not covered by tests

ProjectsResponse::process_response(res, &enc)
ProjectsResponse::process_response(res, &mut key_store.context())

Check warning on line 30 in bitwarden_license/bitwarden-sm/src/projects/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/list.rs#L30

Added line #L30 was not covered by tests
}

#[derive(Serialize, Deserialize, Debug, JsonSchema)]
Expand All @@ -38,14 +39,14 @@
impl ProjectsResponse {
pub(crate) fn process_response(
response: ProjectResponseModelListResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 42 in bitwarden_license/bitwarden-sm/src/projects/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/list.rs#L42

Added line #L42 was not covered by tests
) -> Result<Self, SecretsManagerError> {
let data = response.data.unwrap_or_default();

Ok(ProjectsResponse {
data: data
.into_iter()
.map(|r| ProjectResponse::process_response(r, enc))
.map(|r| ProjectResponse::process_response(r, ctx))

Check warning on line 49 in bitwarden_license/bitwarden-sm/src/projects/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/list.rs#L49

Added line #L49 was not covered by tests
.collect::<Result<_, _>>()?,
})
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use bitwarden_api_api::models::ProjectResponseModel;
use bitwarden_core::{client::encryption_settings::EncryptionSettings, require};
use bitwarden_crypto::{EncString, KeyDecryptable};
use bitwarden_core::{
key_management::{KeyIds, SymmetricKeyId},
require,
};
use bitwarden_crypto::{Decryptable, EncString, KeyStoreContext};
use chrono::{DateTime, Utc};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand All @@ -21,14 +24,14 @@
impl ProjectResponse {
pub(crate) fn process_response(
response: ProjectResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 27 in bitwarden_license/bitwarden-sm/src/projects/project_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/project_response.rs#L27

Added line #L27 was not covered by tests
) -> Result<Self, SecretsManagerError> {
let organization_id = require!(response.organization_id);
let enc_key = enc.get_key(&Some(organization_id))?;
let key = SymmetricKeyId::Organization(organization_id);

Check warning on line 30 in bitwarden_license/bitwarden-sm/src/projects/project_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/project_response.rs#L30

Added line #L30 was not covered by tests

let name = require!(response.name)
.parse::<EncString>()?
.decrypt_with_key(enc_key)?;
.decrypt(ctx, key)?;

Check warning on line 34 in bitwarden_license/bitwarden-sm/src/projects/project_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/project_response.rs#L34

Added line #L34 was not covered by tests

Ok(ProjectResponse {
id: require!(response.id),
Expand Down
17 changes: 11 additions & 6 deletions bitwarden_license/bitwarden-sm/src/projects/update.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitwarden_api_api::models::ProjectUpdateRequestModel;
use bitwarden_core::Client;
use bitwarden_crypto::KeyEncryptable;
use bitwarden_core::{key_management::SymmetricKeyId, Client};
use bitwarden_crypto::Encryptable;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand Down Expand Up @@ -28,19 +28,24 @@
) -> Result<ProjectResponse, SecretsManagerError> {
input.validate()?;

let enc = client.internal.get_encryption_settings()?;
let key = enc.get_key(&Some(input.organization_id))?;
let key_store = client.internal.get_key_store();
let key = SymmetricKeyId::Organization(input.organization_id);

Check warning on line 32 in bitwarden_license/bitwarden-sm/src/projects/update.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/update.rs#L31-L32

Added lines #L31 - L32 were not covered by tests

let project = Some(ProjectUpdateRequestModel {
name: input.name.clone().trim().encrypt_with_key(key)?.to_string(),
name: input
.name
.clone()
.trim()
.encrypt(&mut key_store.context(), key)?
.to_string(),

Check warning on line 40 in bitwarden_license/bitwarden-sm/src/projects/update.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/update.rs#L35-L40

Added lines #L35 - L40 were not covered by tests
});

let config = client.internal.get_api_configurations().await;
let res =
bitwarden_api_api::apis::projects_api::projects_id_put(&config.api, input.id, project)
.await?;

ProjectResponse::process_response(res, &enc)
ProjectResponse::process_response(res, &mut key_store.context())

Check warning on line 48 in bitwarden_license/bitwarden-sm/src/projects/update.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/projects/update.rs#L48

Added line #L48 was not covered by tests
}

#[cfg(test)]
Expand Down
23 changes: 15 additions & 8 deletions bitwarden_license/bitwarden-sm/src/secrets/create.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitwarden_api_api::models::SecretCreateRequestModel;
use bitwarden_core::Client;
use bitwarden_crypto::KeyEncryptable;
use bitwarden_core::{key_management::SymmetricKeyId, Client};
use bitwarden_crypto::Encryptable;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand Down Expand Up @@ -34,16 +34,23 @@
) -> Result<SecretResponse, SecretsManagerError> {
input.validate()?;

let enc = client.internal.get_encryption_settings()?;
let key = enc.get_key(&Some(input.organization_id))?;
let key_store = client.internal.get_key_store();
let key = SymmetricKeyId::Organization(input.organization_id);
let mut ctx = key_store.context();

Check warning on line 39 in bitwarden_license/bitwarden-sm/src/secrets/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/create.rs#L37-L39

Added lines #L37 - L39 were not covered by tests

let secret = Some(SecretCreateRequestModel {
key: input.key.clone().trim().encrypt_with_key(key)?.to_string(),
value: input.value.clone().encrypt_with_key(key)?.to_string(),
note: input.note.clone().trim().encrypt_with_key(key)?.to_string(),
key: input.key.clone().trim().encrypt(&mut ctx, key)?.to_string(),
value: input.value.clone().encrypt(&mut ctx, key)?.to_string(),
note: input
.note
.clone()
.trim()
.encrypt(&mut ctx, key)?
.to_string(),

Check warning on line 49 in bitwarden_license/bitwarden-sm/src/secrets/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/create.rs#L42-L49

Added lines #L42 - L49 were not covered by tests
project_ids: input.project_ids.clone(),
access_policies_requests: None,
});
drop(ctx);

Check warning on line 53 in bitwarden_license/bitwarden-sm/src/secrets/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/create.rs#L53

Added line #L53 was not covered by tests

let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::organizations_organization_id_secrets_post(
Expand All @@ -53,7 +60,7 @@
)
.await?;

SecretResponse::process_response(res, &enc)
SecretResponse::process_response(res, &mut key_store.context())

Check warning on line 63 in bitwarden_license/bitwarden-sm/src/secrets/create.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/create.rs#L63

Added line #L63 was not covered by tests
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions bitwarden_license/bitwarden-sm/src/secrets/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let config = client.internal.get_api_configurations().await;
let res = bitwarden_api_api::apis::secrets_api::secrets_id_get(&config.api, input.id).await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 22 in bitwarden_license/bitwarden-sm/src/secrets/get.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/get.rs#L22

Added line #L22 was not covered by tests

SecretResponse::process_response(res, &enc)
SecretResponse::process_response(res, &mut key_store.context())

Check warning on line 24 in bitwarden_license/bitwarden-sm/src/secrets/get.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/get.rs#L24

Added line #L24 was not covered by tests
}
4 changes: 2 additions & 2 deletions bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
let res =
bitwarden_api_api::apis::secrets_api::secrets_get_by_ids_post(&config.api, request).await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 27 in bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs#L27

Added line #L27 was not covered by tests

SecretsResponse::process_response(res, &enc)
SecretsResponse::process_response(res, &mut key_store.context())

Check warning on line 29 in bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/get_by_ids.rs#L29

Added line #L29 was not covered by tests
}
23 changes: 12 additions & 11 deletions bitwarden_license/bitwarden-sm/src/secrets/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
SecretWithProjectsListResponseModel, SecretsWithProjectsInnerSecret,
};
use bitwarden_core::{
client::{encryption_settings::EncryptionSettings, Client},
client::Client,
key_management::{KeyIds, SymmetricKeyId},
require,
};
use bitwarden_crypto::{EncString, KeyDecryptable};
use bitwarden_crypto::{Decryptable, EncString, KeyStoreContext};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
Expand All @@ -30,9 +31,9 @@
)
.await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 34 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L34

Added line #L34 was not covered by tests

SecretIdentifiersResponse::process_response(res, &enc)
SecretIdentifiersResponse::process_response(res, &mut key_store.context())

Check warning on line 36 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L36

Added line #L36 was not covered by tests
}

#[derive(Serialize, Deserialize, Debug, JsonSchema)]
Expand All @@ -53,9 +54,9 @@
)
.await?;

let enc = client.internal.get_encryption_settings()?;
let key_store = client.internal.get_key_store();

Check warning on line 57 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L57

Added line #L57 was not covered by tests

SecretIdentifiersResponse::process_response(res, &enc)
SecretIdentifiersResponse::process_response(res, &mut key_store.context())

Check warning on line 59 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L59

Added line #L59 was not covered by tests
}

#[derive(Serialize, Deserialize, Debug, JsonSchema)]
Expand All @@ -67,14 +68,14 @@
impl SecretIdentifiersResponse {
pub(crate) fn process_response(
response: SecretWithProjectsListResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 71 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L71

Added line #L71 was not covered by tests
) -> Result<SecretIdentifiersResponse, SecretsManagerError> {
Ok(SecretIdentifiersResponse {
data: response
.secrets
.unwrap_or_default()
.into_iter()
.map(|r| SecretIdentifierResponse::process_response(r, enc))
.map(|r| SecretIdentifierResponse::process_response(r, ctx))

Check warning on line 78 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L78

Added line #L78 was not covered by tests
.collect::<Result<_, _>>()?,
})
}
Expand All @@ -92,14 +93,14 @@
impl SecretIdentifierResponse {
pub(crate) fn process_response(
response: SecretsWithProjectsInnerSecret,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 96 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L96

Added line #L96 was not covered by tests
) -> Result<SecretIdentifierResponse, SecretsManagerError> {
let organization_id = require!(response.organization_id);
let enc_key = enc.get_key(&Some(organization_id))?;
let enc_key = SymmetricKeyId::Organization(organization_id);

Check warning on line 99 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L99

Added line #L99 was not covered by tests

let key = require!(response.key)
.parse::<EncString>()?
.decrypt_with_key(enc_key)?;
.decrypt(ctx, enc_key)?;

Check warning on line 103 in bitwarden_license/bitwarden-sm/src/secrets/list.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/list.rs#L103

Added line #L103 was not covered by tests

Ok(SecretIdentifierResponse {
id: require!(response.id),
Expand Down
31 changes: 18 additions & 13 deletions bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use bitwarden_api_api::models::{
BaseSecretResponseModel, BaseSecretResponseModelListResponseModel, SecretResponseModel,
};
use bitwarden_core::{client::encryption_settings::EncryptionSettings, require};
use bitwarden_crypto::{EncString, KeyDecryptable};
use bitwarden_core::{
key_management::{KeyIds, SymmetricKeyId},
require,
};
use bitwarden_crypto::{Decryptable, EncString, KeyStoreContext};
use chrono::{DateTime, Utc};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand All @@ -28,7 +31,7 @@
impl SecretResponse {
pub(crate) fn process_response(
response: SecretResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 34 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L34

Added line #L34 was not covered by tests
) -> Result<SecretResponse, SecretsManagerError> {
let base = BaseSecretResponseModel {
object: response.object,
Expand All @@ -41,24 +44,26 @@
revision_date: response.revision_date,
projects: response.projects,
};
Self::process_base_response(base, enc)
Self::process_base_response(base, ctx)

Check warning on line 47 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L47

Added line #L47 was not covered by tests
}
pub(crate) fn process_base_response(
response: BaseSecretResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 51 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L51

Added line #L51 was not covered by tests
) -> Result<SecretResponse, SecretsManagerError> {
let org_id = response.organization_id;
let enc_key = enc.get_key(&org_id)?;
let organization_id = require!(response.organization_id);
let enc_key = SymmetricKeyId::Organization(organization_id);

Check warning on line 54 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L53-L54

Added lines #L53 - L54 were not covered by tests

let key = require!(response.key)
.parse::<EncString>()?
.decrypt_with_key(enc_key)?;
.decrypt(ctx, enc_key)?;

Check warning on line 58 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L58

Added line #L58 was not covered by tests

let value = require!(response.value)
.parse::<EncString>()?
.decrypt_with_key(enc_key)?;
.decrypt(ctx, enc_key)?;

Check warning on line 62 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L62

Added line #L62 was not covered by tests

let note = require!(response.note)
.parse::<EncString>()?
.decrypt_with_key(enc_key)?;
.decrypt(ctx, enc_key)?;

Check warning on line 66 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L66

Added line #L66 was not covered by tests

let project = response
.projects
Expand All @@ -67,7 +72,7 @@

Ok(SecretResponse {
id: require!(response.id),
organization_id: require!(org_id),
organization_id,

Check warning on line 75 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L75

Added line #L75 was not covered by tests
project_id: project,
key,
value,
Expand All @@ -88,14 +93,14 @@
impl SecretsResponse {
pub(crate) fn process_response(
response: BaseSecretResponseModelListResponseModel,
enc: &EncryptionSettings,
ctx: &mut KeyStoreContext<KeyIds>,

Check warning on line 96 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L96

Added line #L96 was not covered by tests
) -> Result<SecretsResponse, SecretsManagerError> {
Ok(SecretsResponse {
data: response
.data
.unwrap_or_default()
.into_iter()
.map(|r| SecretResponse::process_base_response(r, enc))
.map(|r| SecretResponse::process_base_response(r, ctx))

Check warning on line 103 in bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs

View check run for this annotation

Codecov / codecov/patch

bitwarden_license/bitwarden-sm/src/secrets/secret_response.rs#L103

Added line #L103 was not covered by tests
.collect::<Result<_, _>>()?,
})
}
Expand Down
Loading