Skip to content

Commit 6e7245c

Browse files
committed
fix(kms-connector): fix keygen test
1 parent 4cf3ba8 commit 6e7245c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

kms-connector/crates/kms-worker/tests/response_publisher.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ async fn test_publish_keygen_response() -> anyhow::Result<()> {
135135
let rand_prep_keygen_id = rand_u256();
136136
let rand_signature = rand_signature();
137137
let mut rand_key_digests = HashMap::new();
138-
rand_key_digests.insert(String::from("server"), rand_digest().to_vec());
139-
rand_key_digests.insert(String::from("public"), rand_digest().to_vec());
138+
rand_key_digests.insert(String::from("ServerKey"), rand_digest().to_vec());
139+
rand_key_digests.insert(String::from("PublicKey"), rand_digest().to_vec());
140140

141141
let grpc_response = KmsGrpcResponse::Keygen(KeyGenResult {
142142
request_id: Some(RequestId {
@@ -164,8 +164,8 @@ async fn test_publish_keygen_response() -> anyhow::Result<()> {
164164
assert_eq!(key_id, rand_key_id);
165165
for kd in key_digests {
166166
let key_type_str = match kd.key_type {
167-
KeyType::Public => "public",
168-
KeyType::Server => "server",
167+
KeyType::Public => "PublicKey",
168+
KeyType::Server => "ServerKey",
169169
};
170170
assert_eq!(Some(&kd.digest), rand_key_digests.get(key_type_str));
171171
}

kms-connector/crates/utils/src/types/db.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ impl TryFrom<u8> for ParamsTypeDb {
6363
} else if value == Self::Test as u8 {
6464
Ok(Self::Test)
6565
} else {
66-
Err(anyhow!("Invalid ParamsType value"))
66+
Err(anyhow!("Invalid ParamsType value: {value}"))
6767
}
6868
}
6969
}
7070

7171
#[derive(sqlx::Type, Copy, Clone, Debug, Default, PartialEq)]
7272
#[sqlx(type_name = "key_type")]
73-
/// Struct representing the `ParamsType` enum in the database.
73+
/// Struct representing the `KeyType` enum in the database.
7474
pub enum KeyType {
7575
Server,
7676
#[default]
@@ -86,7 +86,7 @@ impl TryFrom<u8> for KeyType {
8686
} else if value == Self::Public as u8 {
8787
Ok(Self::Public)
8888
} else {
89-
Err(anyhow!("Invalid KeyType value"))
89+
Err(anyhow!("Invalid KeyType value: {value}"))
9090
}
9191
}
9292
}

0 commit comments

Comments
 (0)