Skip to content

Commit

Permalink
Fix remaining aliases (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
giarc3 authored May 10, 2024
1 parent a2c7edf commit 8676c97
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 254 deletions.
91 changes: 49 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
profile = "default"
channel = "1.77.2"
channel = "1.78.0"
components = ["rust-src", "rust-analyzer", "llvm-tools"]
7 changes: 2 additions & 5 deletions src/deterministic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ pub struct PlaintextField {
pub struct PlaintextFields(pub HashMap<FieldId, PlaintextField>);
custom_newtype!(PlaintextFields, HashMap<FieldId, PlaintextField>);

// TODO: These newtype can't include FieldId because of a bug with generated Python
// not using forward references. If this is addressed, we can change it.
// See https://github.com/mozilla/uniffi-rs/issues/2067
pub struct EncryptedFields(pub HashMap<String, EncryptedField>);
custom_newtype!(EncryptedFields, HashMap<String, EncryptedField>);
pub struct EncryptedFields(pub HashMap<FieldId, EncryptedField>);
custom_newtype!(EncryptedFields, HashMap<FieldId, EncryptedField>);
pub struct GenerateFieldQueryResult(pub HashMap<FieldId, Vec<EncryptedField>>);
custom_newtype!(GenerateFieldQueryResult, HashMap<FieldId, Vec<EncryptedField>>);
create_batch_result_struct!(DeterministicRotateResult, EncryptedField, FieldId);
Expand Down
20 changes: 2 additions & 18 deletions src/saas_shield/deterministic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ use crate::deterministic::{
use crate::errors::AlloyError;
use crate::tenant_security_client::{DerivationType, SecretType, TenantSecurityClient};
use crate::util::{check_rotation_no_op, perform_batch_action};
use crate::FieldId;
use crate::{alloy_client_trait::AlloyClient, AlloyMetadata, DerivationPath, SecretPath, TenantId};
use ironcore_documents::v5::key_id_header::{EdekType, PayloadType};
use itertools::Itertools;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use std::collections::HashMap;
use std::sync::Arc;

Expand Down Expand Up @@ -197,14 +195,7 @@ impl DeterministicFieldOps for SaasShieldDeterministicClient {
encrypted_field.derivation_path.clone(),
)
};
Ok(perform_batch_action(
encrypted_fields
.0
.into_par_iter()
.map(|(k, v)| (FieldId(k), v)),
decrypt_field,
)
.into())
Ok(perform_batch_action(encrypted_fields.0, decrypt_field).into())
}

/// Encrypt each plaintext field with any Current and InRotation keys for the provided secret path.
Expand Down Expand Up @@ -321,14 +312,7 @@ impl DeterministicFieldOps for SaasShieldDeterministicClient {
)
}
};
Ok(perform_batch_action(
encrypted_fields
.0
.into_par_iter()
.map(|(k, v)| (FieldId(k), v)),
reencrypt_field,
)
.into())
Ok(perform_batch_action(encrypted_fields.0, reencrypt_field).into())
}

/// Generate a prefix that could used to search a data store for fields encrypted using an identifier (KMS
Expand Down
Loading

0 comments on commit 8676c97

Please sign in to comment.