Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Oct 3, 2024
1 parent d279626 commit d5f1ede
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/bitwarden-crypto/src/service/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::RwLockReadGuard;

use rsa::Oaep;

use super::RustCryptoServiceKeys;
use super::Keys;
use crate::{
service::{key_store::KeyStore, AsymmetricKeyRef, SymmetricKeyRef},
AsymmetricCryptoKey, AsymmetricEncString, CryptoError, EncString, SymmetricCryptoKey,
Expand All @@ -11,7 +11,7 @@ use crate::{
pub struct CryptoServiceContext<'a, SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef> {
// We hold a RwLock read guard to avoid having any nested
//calls locking it again and potentially causing a deadlock
pub(super) global_keys: RwLockReadGuard<'a, RustCryptoServiceKeys<SymmKeyRef, AsymmKeyRef>>,
pub(super) global_keys: RwLockReadGuard<'a, Keys<SymmKeyRef, AsymmKeyRef>>,

pub(super) local_symmetric_keys: Box<dyn KeyStore<SymmKeyRef>>,
pub(super) local_asymmetric_keys: Box<dyn KeyStore<AsymmKeyRef>>,
Expand Down
6 changes: 3 additions & 3 deletions crates/bitwarden-crypto/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use key_store::KeyStore;
pub struct CryptoService<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef> {
// We use an Arc<> to make it easier to pass this service around, as we can
// clone it instead of passing references
key_stores: Arc<RwLock<RustCryptoServiceKeys<SymmKeyRef, AsymmKeyRef>>>,
key_stores: Arc<RwLock<Keys<SymmKeyRef, AsymmKeyRef>>>,
}

impl<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef> std::fmt::Debug
Expand All @@ -29,7 +29,7 @@ impl<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef> std::fmt::Debug
}

// This is just a wrapper around the keys so we only deal with one RwLock
pub(crate) struct RustCryptoServiceKeys<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef>
pub(crate) struct Keys<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef>
{
symmetric_keys: Box<dyn KeyStore<SymmKeyRef>>,
asymmetric_keys: Box<dyn KeyStore<AsymmKeyRef>>,
Expand All @@ -41,7 +41,7 @@ impl<SymmKeyRef: SymmetricKeyRef, AsymmKeyRef: AsymmetricKeyRef>
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
Self {
key_stores: Arc::new(RwLock::new(RustCryptoServiceKeys {
key_stores: Arc::new(RwLock::new(Keys {
symmetric_keys: create_key_store(),
asymmetric_keys: create_key_store(),
})),
Expand Down

0 comments on commit d5f1ede

Please sign in to comment.