From 6d371be72480f9aaa2a0194e0c63942b9c4a64ce Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 25 Nov 2023 17:50:46 +0200 Subject: [PATCH] feat(rust/trezor-client): add `get_ecdh_session_key` method --- rust/trezor-client/src/client/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rust/trezor-client/src/client/mod.rs b/rust/trezor-client/src/client/mod.rs index 4666e84595..f541883df8 100644 --- a/rust/trezor-client/src/client/mod.rs +++ b/rust/trezor-client/src/client/mod.rs @@ -238,4 +238,17 @@ impl Trezor { req.set_ecdsa_curve_name(curve); self.call(req, Box::new(|_, m| Ok(m.signature().to_owned()))) } + + pub fn get_ecdh_session_key( + &mut self, + identity: protos::IdentityType, + peer_public_key: Vec, + curve: String, + ) -> Result> { + let mut req = protos::GetECDHSessionKey::new(); + req.identity = MessageField::some(identity); + req.set_peer_public_key(peer_public_key); + req.set_ecdsa_curve_name(curve); + self.call(req, Box::new(|_, m| Ok(m))) + } }