1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

feat(rust/trezor-client): add get_ecdh_session_key method

This commit is contained in:
Roman Zeyde 2023-11-25 17:50:46 +02:00 committed by matejcik
parent 4374485805
commit 6d371be724

View File

@ -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<u8>,
curve: String,
) -> Result<TrezorResponse<'_, protos::ECDHSessionKey, protos::ECDHSessionKey>> {
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)))
}
}