Skip to content

Commit 70a2310

Browse files
chore(sdk): upgrade kms (#1949)
* chore(sdk): upgrade kms * ci(sdk): run tests on bindings update
1 parent 480c043 commit 70a2310

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

.github/workflows/sdk-rust-sdk-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- 'sdk/rust-sdk/src/**'
4141
- 'sdk/rust-sdk/examples/**'
4242
- 'sdk/rust-sdk/Cargo.toml'
43+
- gateway-contracts/rust-bindings/**
4344
4445
start-runner:
4546
name: sdk-rust-sdk-tests/start-runner

sdk/rust-sdk/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gateway-sdk"
3-
version = "0.10.0"
3+
version = "0.12.0"
44
edition = "2024"
55

66
# Library configuration
@@ -9,11 +9,11 @@ name = "gateway_sdk"
99
path = "src/lib.rs"
1010

1111
[dependencies]
12-
fhevm_gateway_bindings = { git = "https://git@github.com/zama-ai/fhevm.git", tag = "v0.10.0-3", default-features = false }
13-
kms = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.12.4", default-features = false }
14-
kms-grpc = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.12.4", default-features = false }
15-
bc2wrap = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.12.4", default-features = false }
16-
tfhe = { version = "1.4.0-alpha.3", features = ["boolean", "integer", "zk-pok"] }
12+
fhevm_gateway_bindings = { path = "../../gateway-contracts/rust_bindings", default-features = false }
13+
kms = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.13.0-rc.3", default-features = false }
14+
kms-grpc = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.13.0-rc.3", default-features = false }
15+
bc2wrap = { git = "https://git@github.com/zama-ai/kms.git", tag = "v0.13.0-rc.3", default-features = false }
16+
tfhe = { version = "1.5.1", features = ["boolean", "integer", "zk-pok"] }
1717

1818
alloy = { version = "1.0", default-features = false, features = [
1919
"essentials",

sdk/rust-sdk/src/decryption/user/deserializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn decode_hex_field(hex_str: &str, field_name: &str) -> Result<Vec<u8>> {
100100
fn deserialize_payload(buf: &[u8]) -> Result<UserDecryptionResponsePayload> {
101101
debug!("Deserializing payload of {} bytes", buf.len());
102102

103-
bc2wrap::deserialize(buf)
103+
bc2wrap::deserialize_safe(buf)
104104
.map_err(|e| FhevmError::DecryptionError(format!("Bincode deserialize error: {e}")))
105105
}
106106

sdk/rust-sdk/src/decryption/user/response.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ use kms_grpc::rpc_types::protobuf_to_alloy_domain;
1010
use kms_lib::client::js_api::{new_client, new_server_id_addr};
1111
use kms_lib::client::user_decryption_wasm::{CiphertextHandle, ParsedUserDecryptionRequest};
1212
use kms_lib::consts::SAFE_SER_SIZE_LIMIT;
13-
use kms_lib::cryptography::internal_crypto_types::{
14-
PrivateEncKey, UnifiedPrivateEncKey, UnifiedPublicEncKey,
15-
};
13+
use kms_lib::cryptography::encryption::{PrivateEncKey, UnifiedPrivateEncKey, UnifiedPublicEncKey};
1614
use tracing::{debug, info};
1715

1816
/// Builder for processing user decryption responses
@@ -228,7 +226,7 @@ impl ResponseProcessor {
228226
.map_err(|e| FhevmError::DecryptionError(format!("Invalid public key: {e:?}")))?;
229227

230228
let ml_kem_priv_key =
231-
bc2wrap::deserialize::<PrivateEncKey<ml_kem::MlKem512>>(&private_key_bytes)
229+
bc2wrap::deserialize_safe::<PrivateEncKey<ml_kem::MlKem512>>(&private_key_bytes)
232230
.map(UnifiedPrivateEncKey::MlKem512)
233231
.map_err(|e| FhevmError::DecryptionError(format!("Invalid private key: {e:?}")))?;
234232

@@ -246,11 +244,7 @@ impl ResponseProcessor {
246244
.map_err(|e| FhevmError::DecryptionError(format!("KMS decryption failed: {e:?}")))?
247245
} else {
248246
client
249-
.insecure_process_user_decryption_resp(
250-
&responses,
251-
&ml_kem_pub_key,
252-
&ml_kem_priv_key,
253-
)
247+
.insecure_process_user_decryption_resp(&responses, &ml_kem_priv_key)
254248
.map_err(|e| FhevmError::DecryptionError(format!("KMS decryption failed: {e:?}")))?
255249
};
256250

0 commit comments

Comments
 (0)