diff --git a/imkey-core/ikc-wallet/coin-cosmos/src/transaction.rs b/imkey-core/ikc-wallet/coin-cosmos/src/transaction.rs index 5e975e3f..7f49af0e 100644 --- a/imkey-core/ikc-wallet/coin-cosmos/src/transaction.rs +++ b/imkey-core/ikc-wallet/coin-cosmos/src/transaction.rs @@ -7,6 +7,7 @@ use ikc_common::utility::{hex_to_bytes, secp256k1_sign, sha256_hash}; use ikc_device::device_binding::KEY_MANAGER; use ikc_transport::message::{send_apdu, send_apdu_timeout}; use secp256k1::{self, ecdsa::Signature as SecpSignature}; +use ikc_common::path::check_path_validity; #[derive(Debug)] pub struct CosmosTransaction { @@ -19,6 +20,7 @@ pub struct CosmosTransaction { impl CosmosTransaction { pub fn sign(self) -> Result { + check_path_validity(&self.path).unwrap(); let sign_hash = sha256_hash(hex_to_bytes(&self.sign_data)?.as_slice()); let mut sign_pack = "0120".to_string(); sign_pack.push_str(&sign_hash.to_hex()); @@ -56,7 +58,7 @@ impl CosmosTransaction { ApduCheck::check_response(&response)?; } - let sign_apdu = CosmosApdu::sign_digest(constants::COSMOS_PATH); + let sign_apdu = CosmosApdu::sign_digest(&self.path); let sign_result = send_apdu(sign_apdu)?; ApduCheck::check_response(&sign_result)?;