Skip to content

Commit b0dcebf

Browse files
committed
chore(rust): release 1.2.1
1 parent e0d2b77 commit b0dcebf

File tree

12 files changed

+123
-70
lines changed

12 files changed

+123
-70
lines changed

DynamoDbEncryption/runtimes/rust/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "aws-db-esdk"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
5-
rust-version = "1.86.0"
5+
rust-version = "1.88.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
77
license = "ISC AND (Apache-2.0 OR ISC)"
88
description = "aws-db-esdk is a library for implementing client side encryption with DynamoDB."
@@ -16,21 +16,21 @@ readme = "README.md"
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
aws-config = "1.8.5"
20-
aws-lc-rs = {version = "1.13.3"}
21-
aws-lc-sys = { version = "0.30", optional = true }
19+
aws-config = "1.8.10"
20+
aws-lc-rs = {version = "1.15.0"}
21+
aws-lc-sys = { version = "0.33", optional = true }
2222
aws-lc-fips-sys = { version = "0.13", optional = true }
23-
aws-sdk-dynamodb = "1.90.0"
24-
aws-sdk-kms = "1.84.0"
25-
aws-smithy-runtime-api = {version = "1.9.0", features = ["client"] }
26-
aws-smithy-types = "1.3.2"
27-
chrono = "0.4.41"
23+
aws-sdk-dynamodb = "1.99.0"
24+
aws-sdk-kms = "1.94.0"
25+
aws-smithy-runtime-api = {version = "1.9.2", features = ["client"] }
26+
aws-smithy-types = "1.3.4"
27+
chrono = "0.4.42"
2828
cpu-time = "1.0.0"
2929
dafny_runtime = { path = "../../../submodules/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust", features = ["sync","small-int"] }
3030
dashmap = "6.1.0"
31-
pem = "3.0.5"
32-
tokio = {version = "1.47.1", features = ["full"] }
33-
uuid = { version = "1.18.0", features = ["v4"] }
31+
pem = "3.0.6"
32+
tokio = {version = "1.48.0", features = ["full"] }
33+
uuid = { version = "1.18.1", features = ["v4"] }
3434

3535
[[example]]
3636
name = "main"

DynamoDbEncryption/runtimes/rust/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ pub(crate) use crate::implementation_from_dafny::ECDH;
129129
pub(crate) use crate::implementation_from_dafny::HMAC;
130130
pub(crate) use crate::implementation_from_dafny::UTF8;
131131
pub(crate) use crate::implementation_from_dafny::UUID;
132+
pub(crate) use crate::deps::com_amazonaws_kms::client::Client as KmsClient;
132133

133134
pub(crate) mod conversions;
134135
pub(crate) mod deps;

TestVectors/runtimes/rust/Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
name = "aws-db-esdk-test-vectors"
33
version = "0.1.0"
44
edition = "2021"
5-
rust-version = "1.86.0"
5+
rust-version = "1.88.0"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
aws-config = "1.8.5"
11-
aws-lc-rs = {version = "1.13.3"}
12-
aws-lc-sys = { version = "0.30", optional = true }
10+
aws-config = "1.8.10"
11+
aws-lc-rs = {version = "1.15.0"}
12+
aws-lc-sys = { version = "0.33", optional = true }
1313
aws-lc-fips-sys = { version = "0.13", optional = true }
14-
aws-sdk-dynamodb = "1.90.0"
15-
aws-sdk-kms = "1.84.0"
16-
aws-smithy-runtime-api = {version = "1.9.0", features = ["client"] }
17-
aws-smithy-types = "1.3.2"
18-
chrono = "0.4.41"
14+
aws-sdk-dynamodb = "1.99.0"
15+
aws-sdk-kms = "1.94.0"
16+
aws-smithy-runtime-api = {version = "1.9.2", features = ["client"] }
17+
aws-smithy-types = "1.3.4"
18+
chrono = "0.4.42"
1919
cpu-time = "1.0.0"
2020
dafny_runtime = { path = "../../../submodules/smithy-dafny/TestModels/dafny-dependencies/dafny_runtime_rust", features = ["sync","small-int"] }
2121
dashmap = "6.1.0"
22-
pem = "3.0.5"
23-
tokio = {version = "1.47.1", features = ["full"] }
24-
uuid = { version = "1.18.0", features = ["v4"] }
22+
pem = "3.0.6"
23+
tokio = {version = "1.48.0", features = ["full"] }
24+
uuid = { version = "1.18.1", features = ["v4"] }
2525

2626
[features]
2727
wrapped-client = []

TestVectors/runtimes/rust/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub(crate) use crate::implementation_from_dafny::ECDH;
5050
pub(crate) use crate::implementation_from_dafny::HMAC;
5151
pub(crate) use crate::implementation_from_dafny::UTF8;
5252
pub(crate) use crate::implementation_from_dafny::UUID;
53+
pub(crate) use crate::deps::com_amazonaws_kms::client::Client as KmsClient;
5354

5455
pub mod aes_gcm;
5556
pub mod aes_kdf_ctr;

releases/rust/db_esdk/Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "aws-db-esdk"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
edition = "2021"
5-
rust-version = "1.86.0"
5+
rust-version = "1.88.0"
66
keywords = ["cryptography", "security", "dynamodb", "encryption", "client-side"]
77
license = "ISC AND (Apache-2.0 OR ISC)"
88
description = "aws-db-esdk is a library for implementing client side encryption with DynamoDB."
@@ -16,20 +16,20 @@ readme = "README.md"
1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1717

1818
[dependencies]
19-
aws-config = "1.8.5"
20-
aws-lc-rs = {version = "1.13.3"}
21-
aws-lc-sys = { version = "0.30", optional = true }
19+
aws-config = "1.8.10"
20+
aws-lc-rs = {version = "1.15.0"}
21+
aws-lc-sys = { version = "0.33", optional = true }
2222
aws-lc-fips-sys = { version = "0.13", optional = true }
23-
aws-sdk-dynamodb = "1.90.0"
24-
aws-sdk-kms = "1.84.0"
25-
aws-smithy-runtime-api = {version = "1.9.0", features = ["client"] }
26-
aws-smithy-types = "1.3.2"
27-
chrono = "0.4.41"
23+
aws-sdk-dynamodb = "1.99.0"
24+
aws-sdk-kms = "1.94.0"
25+
aws-smithy-runtime-api = {version = "1.9.2", features = ["client"] }
26+
aws-smithy-types = "1.3.4"
27+
chrono = "0.4.42"
2828
cpu-time = "1.0.0"
2929
dashmap = "6.1.0"
30-
pem = "3.0.5"
31-
tokio = {version = "1.47.1", features = ["full"] }
32-
uuid = { version = "1.18.0", features = ["v4"] }
30+
pem = "3.0.6"
31+
tokio = {version = "1.48.0", features = ["full"] }
32+
uuid = { version = "1.18.1", features = ["v4"] }
3333
dafny-runtime = { version = "0.3.1", features = ["sync", "small-int"] }
3434

3535
[[example]]

releases/rust/db_esdk/examples/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub mod create_keystore_key;
1111
pub mod get_encrypted_data_key_description;
1212
pub mod itemencryptor;
1313
pub mod keyring;
14+
pub mod migration;
1415
pub mod multi_get_put_example;
1516
pub mod searchableencryption;
1617
pub mod test_utils;

releases/rust/db_esdk/examples/test_utils.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,32 @@ pub const TEST_BRANCH_KEY_WRAPPING_KMS_KEY_ARN: &str =
4444
// Our tests require access to DDB Table with this name configured as a branch keystore
4545
pub const TEST_BRANCH_KEYSTORE_DDB_TABLE_NAME: &str = "KeyStoreDdbTable";
4646
pub const TEST_COMPLEX_DDB_TABLE_NAME: &str = "ComplexBeaconTestTable";
47+
48+
// Helper method to clean up test items
49+
pub async fn cleanup_items(
50+
table_name: &str,
51+
partition_key_value: &str,
52+
sort_key_value: &str,
53+
) -> Result<(), Box<dyn std::error::Error>> {
54+
let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
55+
let ddb = aws_sdk_dynamodb::Client::new(&sdk_config);
56+
57+
let key = std::collections::HashMap::from([
58+
(
59+
"partition_key".to_string(),
60+
aws_sdk_dynamodb::types::AttributeValue::S(partition_key_value.to_string()),
61+
),
62+
(
63+
"sort_key".to_string(),
64+
aws_sdk_dynamodb::types::AttributeValue::N(sort_key_value.to_string()),
65+
),
66+
]);
67+
68+
ddb.delete_item()
69+
.table_name(table_name)
70+
.set_key(Some(key))
71+
.send()
72+
.await?;
73+
74+
Ok(())
75+
}

releases/rust/db_esdk/src/concurrent_call.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
pub mod ConcurrentCall {
1111

1212
fn de_const(
13-
p: *const dafny_runtime::Object<(dyn Callee + 'static)>,
14-
) -> *mut dafny_runtime::Object<(dyn Callee + 'static)> {
13+
p: *const dafny_runtime::Object<dyn Callee + 'static>,
14+
) -> *mut dafny_runtime::Object<dyn Callee + 'static> {
1515
p as _
1616
}
1717

1818
pub struct FakeCallee {
19-
callee: *const dafny_runtime::Object<(dyn Callee + 'static)>,
19+
callee: *const dafny_runtime::Object<dyn Callee + 'static>,
2020
}
2121
impl FakeCallee {
22-
fn new(callee: &dafny_runtime::Object<(dyn Callee + 'static)>) -> Self {
22+
fn new(callee: &dafny_runtime::Object<dyn Callee + 'static>) -> Self {
2323
Self {
2424
callee: std::ptr::from_ref(callee),
2525
}
2626
}
2727
fn call(&self, x: u32, y: u32) {
2828
let mptr = de_const(self.callee);
29-
let value: &mut dafny_runtime::Object<(dyn Callee + 'static)> = unsafe { &mut *mptr };
29+
let value: &mut dafny_runtime::Object<dyn Callee + 'static> = unsafe { &mut *mptr };
3030
value.as_mut().call(x, y);
3131
}
3232
}
@@ -37,7 +37,7 @@ pub mod ConcurrentCall {
3737
use crate::ConcurrentCall::Callee;
3838
impl _default {
3939
pub fn ConcurrentCall(
40-
callee: &dafny_runtime::Object<(dyn Callee + 'static)>,
40+
callee: &dafny_runtime::Object<dyn Callee + 'static>,
4141
serial_iters: u32,
4242
concurrent_iters: u32,
4343
) {

releases/rust/db_esdk/src/ecdh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ pub mod ECDH {
442442
&public_key,
443443
);
444444
let shared: Vec<u8> =
445-
aws_lc_rs::agreement::agree(&private_key, &public_key, "foo", |x| Ok(x.to_vec()))
445+
aws_lc_rs::agreement::agree(&private_key, public_key, "foo", |x| Ok(x.to_vec()))
446446
.map_err(|_e| "Failure in aws_lc_rs::agreement::agree.".to_string())?;
447447
Ok(shared)
448448
}

releases/rust/db_esdk/src/kms.rs

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
#![deny(nonstandard_style)]
66
#![deny(clippy::all)]
77

8-
use aws_config::Region;
8+
use aws_config::{AppName, Region, SdkConfig};
99
use std::sync::LazyLock;
10-
1110
static DAFNY_TOKIO_RUNTIME: LazyLock<tokio::runtime::Runtime> = LazyLock::new(|| {
1211
tokio::runtime::Builder::new_multi_thread()
1312
.enable_all()
@@ -17,12 +16,7 @@ static DAFNY_TOKIO_RUNTIME: LazyLock<tokio::runtime::Runtime> = LazyLock::new(||
1716

1817
impl crate::r#software::amazon::cryptography::services::kms::internaldafny::_default {
1918
#[allow(non_snake_case)]
20-
pub fn KMSClientForRegion(region: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::dafny_runtime::Rc<crate::r#_Wrappers_Compile::Result<::dafny_runtime::Object<dyn crate::software::amazon::cryptography::services::kms::internaldafny::types::IKMSClient>, ::dafny_runtime::Rc<crate::software::amazon::cryptography::services::kms::internaldafny::types::Error>>>{
21-
let region =
22-
dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(
23-
region,
24-
);
25-
19+
fn CreateSdkConfig() -> SdkConfig {
2620
let shared_config = match tokio::runtime::Handle::try_current() {
2721
Ok(curr) => tokio::task::block_in_place(|| {
2822
curr.block_on(async {
@@ -34,12 +28,23 @@ impl crate::r#software::amazon::cryptography::services::kms::internaldafny::_def
3428
)),
3529
};
3630

31+
Self::AddUserAgentStringToConfig(&shared_config)
32+
}
33+
34+
#[allow(non_snake_case)]
35+
pub fn KMSClientForRegion(region: &::dafny_runtime::Sequence<::dafny_runtime::DafnyCharUTF16>) -> ::dafny_runtime::Rc<crate::r#_Wrappers_Compile::Result<::dafny_runtime::Object<dyn crate::software::amazon::cryptography::services::kms::internaldafny::types::IKMSClient>, ::dafny_runtime::Rc<crate::software::amazon::cryptography::services::kms::internaldafny::types::Error>>>{
36+
let region =
37+
dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(
38+
region,
39+
);
40+
41+
let shared_config = &Self::CreateSdkConfig();
3742
let shared_config = shared_config
3843
.to_builder()
3944
.region(Region::new(region))
4045
.build();
4146
let inner = aws_sdk_kms::Client::new(&shared_config);
42-
let client = crate::deps::com_amazonaws_kms::client::Client { inner };
47+
let client = crate::KmsClient { inner };
4348
let dafny_client = ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(client));
4449
dafny_runtime::Rc::new(crate::r#_Wrappers_Compile::Result::Success {
4550
value: dafny_client,
@@ -48,25 +53,41 @@ impl crate::r#software::amazon::cryptography::services::kms::internaldafny::_def
4853

4954
#[allow(non_snake_case)]
5055
pub fn KMSClient() -> ::dafny_runtime::Rc<crate::r#_Wrappers_Compile::Result<::dafny_runtime::Object<dyn crate::software::amazon::cryptography::services::kms::internaldafny::types::IKMSClient>, ::dafny_runtime::Rc<crate::software::amazon::cryptography::services::kms::internaldafny::types::Error>>>{
51-
let shared_config = match tokio::runtime::Handle::try_current() {
52-
Ok(curr) => tokio::task::block_in_place(|| {
53-
curr.block_on(async {
54-
aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await
55-
})
56-
}),
57-
Err(_) => DAFNY_TOKIO_RUNTIME.block_on(aws_config::load_defaults(
58-
aws_config::BehaviorVersion::latest(),
59-
)),
60-
};
61-
62-
let inner = aws_sdk_kms::Client::new(&shared_config);
63-
let client = crate::deps::com_amazonaws_kms::client::Client { inner };
56+
let shared_config = &Self::CreateSdkConfig();
57+
let inner = aws_sdk_kms::Client::new(shared_config);
58+
let client = crate::KmsClient { inner };
6459
let dafny_client = ::dafny_runtime::upcast_object()(::dafny_runtime::object::new(client));
6560
dafny_runtime::Rc::new(crate::r#_Wrappers_Compile::Result::Success {
6661
value: dafny_client,
6762
})
6863
}
6964

65+
#[allow(non_snake_case)]
66+
fn AddUserAgentStringToConfig(sdkConfig: &SdkConfig) -> SdkConfig {
67+
let runtime = "Rust".to_string();
68+
let runtime_msg =
69+
dafny_runtime::dafny_runtime_conversions::unicode_chars_false::string_to_dafny_string(
70+
&runtime,
71+
);
72+
// sadly rust doesn't allow for '/' in the app name which the dafny function adds
73+
// so we will replace '/' with '-' which is allowed
74+
let user_agent_string = dafny_runtime::dafny_runtime_conversions::unicode_chars_false::dafny_string_to_string(
75+
&crate::software::amazon::cryptography::services::kms::internaldafny::_default::DafnyUserAgentSuffix(&runtime_msg)
76+
);
77+
let replaced_user_agent_string = user_agent_string.replace("/", "-");
78+
// To update the user agent string we take the application name and update it.
79+
let current_app_name = sdkConfig
80+
.app_name()
81+
.map(|app_name| app_name.to_string())
82+
.unwrap_or_default();
83+
let new_app_name = if current_app_name.is_empty() {
84+
replaced_user_agent_string.to_string()
85+
} else {
86+
format!("{} {} ", current_app_name, replaced_user_agent_string)
87+
};
88+
let app_name = AppName::new(new_app_name).expect("Valid app name");
89+
sdkConfig.to_builder().app_name(app_name).build()
90+
}
7091
#[allow(non_snake_case)]
7192
pub fn RegionMatch(
7293
kmsClient: &::dafny_runtime::Object<dyn crate::software::amazon::cryptography::services::kms::internaldafny::types::IKMSClient>,
@@ -77,8 +98,7 @@ impl crate::r#software::amazon::cryptography::services::kms::internaldafny::_def
7798
region,
7899
);
79100
let any = dafny_runtime::cast_any_object!(kmsClient);
80-
let client =
81-
dafny_runtime::cast_object!(any, crate::deps::com_amazonaws_kms::client::Client);
101+
let client = dafny_runtime::cast_object!(any, crate::KmsClient);
82102
let flag = match client.as_ref().inner.config().region() {
83103
Some(r) => r.as_ref() == region,
84104
None => false,

0 commit comments

Comments
 (0)