Skip to content

Commit

Permalink
chore: optimization imKey public key conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoguang1010 committed Aug 16, 2024
1 parent 883382a commit d987f43
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions imkey-core/ikc-common/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub const VERSION: &str = "2.16.0";
// pub const URL: &str = "https://imkey.online:1000/imkey";
pub const URL: &str = "https://imkeyserver.com:10444/imkey";
pub const URL: &str = "https://imkey.online:1000/imkey";
// pub const URL: &str = "https://imkeyserver.com:10444/imkey";

pub const TSM_ACTION_SE_SECURE_CHECK: &str = "/seSecureCheck";
pub const TSM_ACTION_APP_DOWNLOAD: &str = "/appDownload";
Expand Down
4 changes: 3 additions & 1 deletion imkey-core/ikc-wallet/coin-bitcoin/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use ikc_transport::message::{send_apdu, send_apdu_timeout};
use secp256k1::ecdsa::Signature;
use std::borrow::Borrow;
use std::str::FromStr;
use secp256k1::PublicKey;

#[derive(Clone)]
pub struct Utxo {
Expand Down Expand Up @@ -342,7 +343,8 @@ impl BtcTransaction {
data.extend(path_data.iter());

let mut tweaked_pub_key_data: Vec<u8> = vec![];
let untweaked_public_key = UntweakedPublicKey::from_str(&pub_key[2..66])?;
let public_key = PublicKey::from_str(pub_key)?;
let untweaked_public_key = UntweakedPublicKey::from(public_key);
let tweaked_pub_key = TapTweakHash::from_key_and_tweak(untweaked_public_key, None).to_vec();
tweaked_pub_key_data.push(tweaked_pub_key.len() as u8);
tweaked_pub_key_data.extend_from_slice(&tweaked_pub_key);
Expand Down
1 change: 1 addition & 0 deletions imkey-core/ikc-wallet/coin-ckb/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ mod tests {
receiver: "ckt1qyqtr684u76tu7r8efkd24hw8922xfvhnazskzdzy6".to_string(),
sender: "ckt1qyqtr684u76tu7r8efkd24hw8922xfvhnazskzdzy6".to_string(),
fee: "0.0001191 ckb".to_string(),
seg_wit: "".to_string(),
};

let tx_output = CkbSigner::sign_transaction(&tx_input, &sign_param).expect("sign error");
Expand Down
1 change: 1 addition & 0 deletions imkey-core/ikc-wallet/coin-filecoin/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ mod tests {
receiver: "f1d2xrzcslx7xlbbylc5c3d5lvandqw4iwl6epxba".to_string(),
sender: "f1o2ph66tg7o7obyrqa7eiwiinrltauzxitkuk4ay".to_string(),
fee: "0.1 FILECOIN".to_string(),
seg_wit: "".to_string(),
};

let tx_result = Transaction::sign_tx(tx_input, &sign_param).unwrap();
Expand Down
1 change: 1 addition & 0 deletions token-core/tcx-btc-kin/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ mod tests {
curve: CurveType::SECP256k1,
network: "MAINNET".to_string(),
seg_wit: "NONE".to_string(),
hrp: "".to_string(),
})
.unwrap();
assert_eq!(account.address, "DQ4tVEqdPWHc1aVBm4Sfwft8XyNRPMEchR");
Expand Down

0 comments on commit d987f43

Please sign in to comment.