Skip to content

Commit

Permalink
fix: fix ikc cosmos signature error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguang1010 committed Apr 19, 2024
1 parent 7799ba6 commit 3d7a434
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imkey-core/ikc-wallet/coin-cosmos/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -19,6 +20,7 @@ pub struct CosmosTransaction {

impl CosmosTransaction {
pub fn sign(self) -> Result<CosmosTxOutput> {
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());
Expand Down Expand Up @@ -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)?;
Expand Down

0 comments on commit 3d7a434

Please sign in to comment.