Skip to content

Commit afd39e0

Browse files
fix: build error
1 parent 02458cc commit afd39e0

6 files changed

Lines changed: 194 additions & 134 deletions

File tree

Cargo.lock

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kms/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ rand_core = { version = "0.6", features = ["getrandom"] }
5959
# NEAR integration
6060
near-api = "0.8"
6161
near-crypto = "0.26" # Still needed for InMemorySigner in onboard_service.rs
62+
near-account-id = "2.5" # For AccountId type compatibility
63+
byte-slice-cast = "1.2"
64+
url.workspace = true
65+
66+
# DCAP QVL for TDX quote verification
67+
dcap-qvl.workspace = true
6268

6369
[features]
6470
default = []

kms/src/ckd.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use hkdf::Hkdf;
2323
use rand_core::OsRng;
2424
use sha2::Sha256;
2525
use sha3::{Digest, Sha3_256};
26+
use serde::{Deserialize, Serialize};
2627

2728
// Constants matching NEAR MPC contract
2829
const BLS12381G1_PUBLIC_KEY_SIZE: usize = 48;
@@ -46,11 +47,14 @@ pub struct MpcConfig {
4647
pub near_rpc_url: String,
4748
}
4849

50+
#[derive(Deserialize)]
51+
struct Bls12381G1PublicKey(String);
52+
4953
/// MPC CKD response (big_y, big_c from MPC network)
50-
#[derive(Debug, Clone)]
51-
pub struct MpcResponse {
52-
pub big_y: String, // BLS12-381 G1 point in NEAR format
53-
pub big_c: String, // BLS12-381 G1 point in NEAR format
54+
#[derive(Debug, Clone, Deserialize)]
55+
pub struct CkdResponse {
56+
pub big_y: Bls12381G1PublicKey,
57+
pub big_c: Bls12381G1PublicKey,
5458
}
5559

5660
/// Derive app_id the same way MPC contract does
@@ -202,7 +206,7 @@ pub fn derive_final_key(
202206
/// 3. Derives the final 32-byte key using HKDF
203207
/// 4. Returns the key that can be used as K256 signing key
204208
pub fn derive_root_key_from_mpc(
205-
mpc_response: &MpcResponse,
209+
mpc_response: &CKDResponse,
206210
ephemeral_private_key: Scalar,
207211
mpc_config: &MpcConfig,
208212
kms_account_id: &str,

0 commit comments

Comments
 (0)