Skip to content

Commit ba9e2c3

Browse files
committed
Rename to primitiveencryptablewithcontenttype
1 parent 2a202c1 commit ba9e2c3

File tree

19 files changed

+29
-27
lines changed

19 files changed

+29
-27
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_api_api::models::ProjectCreateRequestModel;
22
use bitwarden_core::{key_management::SymmetricKeyId, Client};
3-
use bitwarden_crypto::TypedEncryptable;
3+
use bitwarden_crypto::PrimitiveEncryptableWithContentType;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
66
use uuid::Uuid;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_api_api::models::ProjectUpdateRequestModel;
22
use bitwarden_core::{key_management::SymmetricKeyId, Client};
3-
use bitwarden_crypto::TypedEncryptable;
3+
use bitwarden_crypto::PrimitiveEncryptableWithContentType;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
66
use uuid::Uuid;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_api_api::models::SecretCreateRequestModel;
22
use bitwarden_core::{key_management::SymmetricKeyId, Client};
3-
use bitwarden_crypto::TypedEncryptable;
3+
use bitwarden_crypto::PrimitiveEncryptableWithContentType;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
66
use uuid::Uuid;

bitwarden_license/bitwarden-sm/src/secrets/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use bitwarden_api_api::models::SecretUpdateRequestModel;
22
use bitwarden_core::{key_management::SymmetricKeyId, Client};
3-
use bitwarden_crypto::TypedEncryptable;
3+
use bitwarden_crypto::PrimitiveEncryptableWithContentType;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
66
use uuid::Uuid;

crates/bitwarden-crypto/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ mod traits;
3535
pub use cose::ContentFormat;
3636
mod xchacha20;
3737
pub use traits::{
38-
CompositeEncryptable, Decryptable, Encryptable, IdentifyKey, KeyId, KeyIds, TypedEncryptable,
38+
CompositeEncryptable, Decryptable, Encryptable, IdentifyKey, KeyId, KeyIds,
39+
PrimitiveEncryptableWithContentType,
3940
};
4041
pub use zeroizing_alloc::ZeroAlloc as ZeroizingAllocator;
4142

crates/bitwarden-crypto/src/store/context.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ use crate::{
1515
/// The context of a crypto operation using [super::KeyStore]
1616
///
1717
/// This will usually be accessed from an implementation of [crate::Decryptable] or
18-
/// [crate::Encryptable], [crate::TypedEncryptable], but can also be obtained through [super::KeyStore::context]
18+
/// [crate::Encryptable], [crate::TypedEncryptable], but can also be obtained through
19+
/// [super::KeyStore::context]
1920
///
2021
/// This context contains access to the user keys stored in the [super::KeyStore] (sometimes
2122
/// referred to as `global keys`) and it also contains it's own individual secure backend for key

crates/bitwarden-crypto/src/store/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ pub(crate) mod tests {
310310
use crate::{
311311
store::{KeyStore, KeyStoreContext},
312312
traits::tests::{TestIds, TestSymmKey},
313-
EncString, SymmetricCryptoKey, TypedEncryptable,
313+
EncString, PrimitiveEncryptableWithContentType, SymmetricCryptoKey,
314314
};
315315

316316
pub struct DataView(pub String, pub TestSymmKey);

crates/bitwarden-crypto/src/traits/encryptable.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ impl<Ids: KeyIds, Key: KeyId, T: CompositeEncryptable<Ids, Key, Output>, Output>
4343

4444
/// An encryption operation that takes the input value - a primitive such as `String` and encrypts
4545
/// it into the output value. The implementation decides the content format.
46-
pub trait TypedEncryptable<Ids: KeyIds, Key: KeyId, Output> {
46+
pub trait PrimitiveEncryptableWithContentType<Ids: KeyIds, Key: KeyId, Output> {
4747
fn encrypt(&self, ctx: &mut KeyStoreContext<Ids>, key: Key) -> Result<Output, CryptoError>;
4848
}
4949

50-
impl<Ids: KeyIds, Key: KeyId, T: TypedEncryptable<Ids, Key, Output>, Output>
51-
TypedEncryptable<Ids, Key, Option<Output>> for Option<T>
50+
impl<Ids: KeyIds, Key: KeyId, T: PrimitiveEncryptableWithContentType<Ids, Key, Output>, Output>
51+
PrimitiveEncryptableWithContentType<Ids, Key, Option<Output>> for Option<T>
5252
{
5353
fn encrypt(
5454
&self,
@@ -61,7 +61,7 @@ impl<Ids: KeyIds, Key: KeyId, T: TypedEncryptable<Ids, Key, Output>, Output>
6161
}
6262
}
6363

64-
impl<Ids: KeyIds> TypedEncryptable<Ids, Ids::Symmetric, EncString> for &str {
64+
impl<Ids: KeyIds> PrimitiveEncryptableWithContentType<Ids, Ids::Symmetric, EncString> for &str {
6565
fn encrypt(
6666
&self,
6767
ctx: &mut KeyStoreContext<Ids>,
@@ -71,7 +71,7 @@ impl<Ids: KeyIds> TypedEncryptable<Ids, Ids::Symmetric, EncString> for &str {
7171
}
7272
}
7373

74-
impl<Ids: KeyIds> TypedEncryptable<Ids, Ids::Symmetric, EncString> for String {
74+
impl<Ids: KeyIds> PrimitiveEncryptableWithContentType<Ids, Ids::Symmetric, EncString> for String {
7575
fn encrypt(
7676
&self,
7777
ctx: &mut KeyStoreContext<Ids>,
@@ -148,7 +148,7 @@ impl<Ids: KeyIds, Key: KeyId, T: Encryptable<Ids, Key, Output>, Output>
148148
mod tests {
149149
use crate::{
150150
cose::ContentFormat, traits::tests::*, AsymmetricCryptoKey, Decryptable, Encryptable,
151-
KeyStore, SymmetricCryptoKey, TypedEncryptable,
151+
KeyStore, PrimitiveEncryptableWithContentType, SymmetricCryptoKey,
152152
};
153153

154154
fn test_store() -> KeyStore<TestIds> {

crates/bitwarden-crypto/src/traits/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod encryptable;
2-
pub use encryptable::{CompositeEncryptable, Encryptable, TypedEncryptable};
2+
pub use encryptable::{CompositeEncryptable, Encryptable, PrimitiveEncryptableWithContentType};
33
mod decryptable;
44
pub use decryptable::Decryptable;
55

crates/bitwarden-send/src/send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use bitwarden_core::{
99
};
1010
use bitwarden_crypto::{
1111
generate_random_bytes, CompositeEncryptable, ContentFormat, CryptoError, Decryptable,
12-
EncString, Encryptable, IdentifyKey, KeyStoreContext, TypedEncryptable,
12+
EncString, Encryptable, IdentifyKey, KeyStoreContext, PrimitiveEncryptableWithContentType,
1313
};
1414
use chrono::{DateTime, Utc};
1515
use serde::{Deserialize, Serialize};

0 commit comments

Comments
 (0)