This commit is contained in:
jonesmarvin8 2026-04-26 22:50:16 -04:00
parent 24f6f1f8ca
commit 8386d3ab17
19 changed files with 165 additions and 111 deletions

View File

@ -134,7 +134,7 @@ async fn amm_public() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: 7,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -165,7 +165,7 @@ async fn amm_public() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: 7,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -555,7 +555,7 @@ async fn amm_new_pool_using_labels() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: 5,
from_pin: None,
pin: None,
from_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;
@ -581,7 +581,7 @@ async fn amm_new_pool_using_labels() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: 5,
from_pin: None,
pin: None,
from_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;

View File

@ -269,7 +269,7 @@ async fn transfer_and_burn_via_ata() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: fund_amount,
from_pin: None,
pin: None,
from_key_path: None,
}),
)
@ -503,7 +503,7 @@ async fn transfer_via_ata_private_owner() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: fund_amount,
from_pin: None,
pin: None,
from_key_path: None,
}),
)
@ -619,7 +619,7 @@ async fn burn_via_ata_private_owner() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: fund_amount,
from_pin: None,
pin: None,
from_key_path: None,
}),
)

View File

@ -32,7 +32,8 @@ async fn private_transfer_to_owned_account() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -75,7 +76,8 @@ async fn private_transfer_to_foreign_account() -> Result<()> {
to_vpk: Some(hex::encode(to_vpk.0)),
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
let result = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -127,7 +129,8 @@ async fn deshielded_transfer_to_public_account() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -194,7 +197,8 @@ async fn private_transfer_to_owned_account_using_claiming_path() -> Result<()> {
to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)),
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
let sub_ret = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -246,7 +250,8 @@ async fn shielded_transfer_to_owned_private_account() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -292,7 +297,8 @@ async fn shielded_transfer_to_foreign_account() -> Result<()> {
to_vpk: Some(hex::encode(to_vpk.0)),
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
let result = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -366,7 +372,8 @@ async fn private_transfer_to_owned_account_continuous_run_path() -> Result<()> {
to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)),
amount: 100,
pin: None,
key_path: None,
to_key_path: None,
from_key_path: None,
});
let sub_ret = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -473,7 +480,8 @@ async fn private_transfer_using_from_label() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;

View File

@ -25,7 +25,8 @@ async fn successful_transfer_to_existing_account() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -85,7 +86,8 @@ pub async fn successful_transfer_to_new_account() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -125,7 +127,8 @@ async fn failed_transfer_with_insufficient_balance() -> Result<()> {
to_vpk: None,
amount: 1_000_000,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
let failed_send = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await;
@ -167,7 +170,8 @@ async fn two_consecutive_successful_transfers() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -203,7 +207,8 @@ async fn two_consecutive_successful_transfers() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -292,7 +297,8 @@ async fn successful_transfer_using_from_label() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -341,7 +347,8 @@ async fn successful_transfer_using_to_label() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;

View File

@ -114,7 +114,8 @@ async fn indexer_state_consistency() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -152,7 +153,8 @@ async fn indexer_state_consistency() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -240,7 +242,8 @@ async fn indexer_state_consistency_with_labels() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;

View File

@ -77,7 +77,8 @@ async fn sync_private_account_with_non_zero_chain_index() -> Result<()> {
to_vpk: Some(hex::encode(to_keys.viewing_public_key.0)),
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
let sub_ret = wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -155,7 +156,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 100,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -169,7 +171,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 101,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -211,7 +214,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 102,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -225,7 +229,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 103,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -292,7 +297,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 10,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;
@ -305,7 +311,8 @@ async fn restore_keys_from_seed() -> Result<()> {
to_vpk: None,
amount: 11,
pin: None,
key_path: None,
from_key_path: None,
to_key_path: None,
});
wallet::cli::execute_subcommand(ctx.wallet_mut(), command).await?;

View File

@ -135,7 +135,7 @@ async fn create_and_transfer_public_token() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -379,7 +379,7 @@ async fn create_and_transfer_token_with_private_supply() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -771,7 +771,7 @@ async fn create_token_with_private_definition_and_supply() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -904,7 +904,7 @@ async fn shielded_token_transfer() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -1032,7 +1032,7 @@ async fn deshielded_token_transfer() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
@ -1374,7 +1374,7 @@ async fn transfer_token_using_from_label() -> Result<()> {
to_npk: None,
to_vpk: None,
amount: transfer_amount,
from_pin: None,
pin: None,
from_key_path: None,
};
wallet::cli::execute_subcommand(ctx.wallet_mut(), Command::Token(subcommand)).await?;

42
keycard_wallet/Cargo.toml Normal file
View File

@ -0,0 +1,42 @@
[package]
name = "keycard_wallet"
version = "0.1.0"
edition = "2024"
license = { workspace = true }
[lints]
workspace = true
[dependencies]
nssa_core.workspace = true
nssa.workspace = true
common.workspace = true
key_protocol.workspace = true
sequencer_service_rpc = { workspace = true, features = ["client"] }
token_core.workspace = true
amm_core.workspace = true
testnet_initial_state.workspace = true
ata_core.workspace = true
bip39.workspace = true
pyo3 = { version = "0.21", features = ["auto-initialize"] }
anyhow.workspace = true
thiserror.workspace = true
serde_json.workspace = true
env_logger.workspace = true
log.workspace = true
serde.workspace = true
humantime-serde.workspace = true
humantime.workspace = true
tokio = { workspace = true, features = ["macros"] }
clap.workspace = true
base58.workspace = true
hex.workspace = true
rand.workspace = true
itertools.workspace = true
sha2.workspace = true
futures.workspace = true
async-stream.workspace = true
indicatif = { version = "0.18.3", features = ["improved_unicode"] }
optfield = "0.4.0"
url.workspace = true

View File

@ -1,16 +1,15 @@
use nssa::{AccountId, PublicKey, Signature};
use pyo3::{prelude::*, types::PyAny};
use crate::cli::python_path;
pub mod python_path;
/// Rust wrapper around the Python KeycardWallet class.
/// Holds a persistent Python object in memory.
/// Rust wrapper around the Python `KeycardWallet` class.
pub struct KeycardWallet {
instance: Py<PyAny>,
}
impl KeycardWallet {
/// Create a new Python KeycardWallet instance
/// Create a new Python `KeycardWallet` instance.
pub fn new(py: Python) -> PyResult<Self> {
let module = py.import_bound("keycard_wallet")?;
let class = module.getattr("KeycardWallet")?;
@ -22,7 +21,6 @@ impl KeycardWallet {
})
}
/// Calls Python: is_unpaired_keycard_available()
pub fn is_unpaired_keycard_available(&self, py: Python) -> PyResult<bool> {
self.instance
.bind(py)
@ -30,7 +28,7 @@ impl KeycardWallet {
.extract()
}
pub fn setup_communication(&self, py: Python, pin: &String) -> PyResult<bool> {
pub fn setup_communication(&self, py: Python, pin: &str) -> PyResult<bool> {
let py_pin = pyo3::types::PyString::new_bound(py, pin);
self.instance
@ -43,7 +41,7 @@ impl KeycardWallet {
self.instance.bind(py).call_method0("disconnect")?.extract()
}
pub fn get_public_key_for_path(&self, py: Python, path: &String) -> PyResult<PublicKey> {
pub fn get_public_key_for_path(&self, py: Python, path: &str) -> PyResult<PublicKey> {
let public_key: Vec<u8> = self
.instance
.bind(py)
@ -55,11 +53,12 @@ impl KeycardWallet {
Ok(PublicKey::try_new(public_key).expect("Expect a valid public key1"))
}
pub fn get_public_key_for_path_with_connect(pin: &String, path: &String) -> PublicKey {
#[must_use]
pub fn get_public_key_for_path_with_connect(pin: &str, path: &str) -> PublicKey {
let pub_key = Python::with_gil(|py| {
python_path::add_python_path(py).expect("keycard_wallet.py not found");
let wallet = KeycardWallet::new(py).expect("Expect keycard wallet");
let wallet = Self::new(py).expect("Expect keycard wallet");
let is_connected = wallet
.setup_communication(py, pin)
@ -82,7 +81,7 @@ impl KeycardWallet {
pub fn sign_message_for_path(
&self,
py: Python,
path: &String,
path: &str,
message: &[u8; 32],
) -> PyResult<Signature> {
let py_message = pyo3::types::PyBytes::new_bound(py, message);
@ -98,19 +97,20 @@ impl KeycardWallet {
"Expected signature of exactly 64 bytes",
)
})?;
println!("{:?}", signature);
println!("{signature:?}");
Ok(Signature { value: signature })
}
pub fn sign_message_for_path_with_connection(
pin: &String,
path: &String,
#[must_use]
pub fn sign_message_for_path_with_connect(
pin: &str,
path: &str,
message: &[u8; 32],
) -> PyResult<Signature> {
let signature = Python::with_gil(|py| {
Python::with_gil(|py| {
python_path::add_python_path(py).expect("keycard_wallet.py not found");
let wallet = KeycardWallet::new(py).expect("Expect keycard wallet");
let wallet = Self::new(py).expect("Expect keycard wallet");
let is_connected = wallet
.setup_communication(py, pin)
@ -127,9 +127,7 @@ impl KeycardWallet {
let _ = wallet.disconnect(py);
signature
});
signature
})
}
pub fn load_mnemonic(&self, py: Python, mnemonic: &str) -> PyResult<()> {
@ -139,9 +137,10 @@ impl KeycardWallet {
Ok(())
}
pub fn get_account_id_for_path_with_connect(pin: &String, key_path: &String) -> AccountId {
let public_key = KeycardWallet::get_public_key_for_path_with_connect(pin, key_path);
#[must_use]
pub fn get_account_id_for_path_with_connect(pin: &str, key_path: &str) -> String {
let public_key = Self::get_public_key_for_path_with_connect(pin, key_path);
AccountId::from(&public_key)
format!("Public/{}", AccountId::from(&public_key))
}
}

View File

@ -2,7 +2,7 @@ use std::{env, path::PathBuf};
use pyo3::{prelude::*, types::PyList};
/// Adds the project's `python/` directory and venv site-packages to Python's sys.path
/// Adds the project's `python/` directory and venv site-packages to Python's sys.path.
pub fn add_python_path(py: Python) -> PyResult<()> {
let current_dir = env::current_dir().expect("Failed to get current working directory");
@ -14,7 +14,7 @@ pub fn add_python_path(py: Python) -> PyResult<()> {
// Sanity check — warns early if a path doesn't exist
for path in &paths_to_add {
if !path.exists() {
eprintln!("Warning: Python path does not exist: {:?}", path);
eprintln!("Warning: Python path does not exist: {path:?}");
}
}

View File

@ -31,11 +31,7 @@ impl WitnessSet {
}
#[must_use]
pub fn from_list(
proof: Proof,
signatures: &[Signature],
public_keys: &[PublicKey],
) -> Self {
pub fn from_list(proof: Proof, signatures: &[Signature], public_keys: &[PublicKey]) -> Self {
assert_eq!(signatures.len(), public_keys.len());
let signatures_and_public_keys = signatures

View File

@ -90,14 +90,14 @@ mod tests {
assert_eq!(witness_set.signatures_and_public_keys.len(), 2);
let message_bytes = message.to_bytes();
let message_hash = message.hash_message();
for ((signature, public_key), expected_public_key) in witness_set
.signatures_and_public_keys
.into_iter()
.zip([pubkey1, pubkey2])
{
assert_eq!(public_key, expected_public_key);
assert!(signature.is_valid_for(&message_bytes, &expected_public_key));
assert!(signature.is_valid_for(&message_hash, &expected_public_key));
}
}
}

View File

@ -160,7 +160,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded(
let transfer = NativeTokenTransfer(&wallet);
match block_on(
transfer.send_shielded_transfer_to_outer_account(from_id, to_npk, to_vpk, amount),
transfer.send_shielded_transfer_to_outer_account(from_id, to_npk, to_vpk, amount, &None, &None),
) {
Ok((tx_hash, _shared_key)) => {
let tx_hash = CString::new(tx_hash.to_string())
@ -412,7 +412,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded_owned(
let transfer = NativeTokenTransfer(&wallet);
match block_on(transfer.send_shielded_transfer(from_id, to_id, amount)) {
match block_on(transfer.send_shielded_transfer(from_id, to_id, amount, &None, &None)) {
Ok((tx_hash, _shared_key)) => {
let tx_hash = CString::new(tx_hash.to_string())
.map_or(ptr::null_mut(), std::ffi::CString::into_raw);

View File

@ -52,7 +52,7 @@ impl WalletSubcommand for KeycardSubcommand {
let wallet = KeycardWallet::new(py).expect("Expect keycard wallet");
let is_connected = wallet
.setup_communication(py, &pin.expect("TODO"))
.setup_communication(py, &pin.expect("Expect a pin as a String."))
.expect("Expect a Boolean.");
if is_connected {
@ -61,7 +61,7 @@ impl WalletSubcommand for KeycardSubcommand {
println!("\u{274c} Keycard is not connected to wallet.");
}
let _ = wallet.load_mnemonic(py, &mnemonic.expect("TODO"));
let _ = wallet.load_mnemonic(py, &mnemonic.expect("Expect a mnemonic phrase as a string"));
let _ = wallet.disconnect(py);
});

View File

@ -167,7 +167,7 @@ impl WalletSubcommand for AuthTransferSubcommand {
)?),
(None, None, Some(to_key_path)) => {
Some(KeycardWallet::get_account_id_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&to_key_path,
))
}
@ -486,7 +486,7 @@ impl WalletSubcommand for NativeTokenTransferProgramSubcommandShielded {
let (tx_hash, secret) = NativeTokenTransfer(wallet_core)
.send_shielded_transfer(from, to, amount, &pin, &key_path)
.await?; //TODO: here (marvin)
.await?;
println!("Transaction hash is {tx_hash}");

View File

@ -69,7 +69,7 @@ pub fn resolve_id_or_label(
(None, Some(label), None) => resolve_account_label(&label, labels, user_data),
(None, None, Some(pin)) => Ok(KeycardWallet::get_account_id_for_path_with_connect(
pin,
key_path.as_ref().expect("TODO"),
key_path.as_ref().expect("Expect a key path String."),
)
.to_string()),
_ => anyhow::bail!("provide exactly one of account id, account label or keycard path"),

View File

@ -391,12 +391,12 @@ impl WalletCore {
) -> Result<(HashType, Vec<SharedSecretKey>), ExecutionFailureKind> {
let acc_manager = privacy_preserving_tx::AccountManager::new(self, accounts).await?;
let mut pre_states = acc_manager.pre_states();
let pre_states = acc_manager.pre_states();
let keycard_account = if let Some(pin) = pin.as_ref() {
let account_id = KeycardWallet::get_account_id_for_path_with_connect(
pin,
key_path.as_ref().expect("TODO"),
key_path.as_ref().expect("Expect a key path String."),
);
let (acc_id, _) =
@ -417,11 +417,11 @@ impl WalletCore {
None
};
let mut nonces: Vec<Nonce> = acc_manager.public_account_nonces().into_iter().collect();
let nonces: Vec<Nonce> = acc_manager.public_account_nonces().into_iter().collect();
let mut account_ids: Vec<AccountId> = acc_manager.public_account_ids();
let account_ids: Vec<AccountId> = acc_manager.public_account_ids();
let mut visibility_mask = acc_manager.visibility_mask().to_vec();
let visibility_mask = acc_manager.visibility_mask().to_vec();
if let Some(acc) = keycard_account.as_ref() {
nonces.push(acc.account.nonce);
@ -627,11 +627,11 @@ impl WalletCore {
message: &nssa::privacy_preserving_transaction::Message,
proof: &Proof,
acc_manager: &privacy_preserving_tx::AccountManager,
pin: &Option<String>,
key_path: &Option<String>,
_pin: &Option<String>,
_key_path: &Option<String>,
) -> Result<nssa::privacy_preserving_transaction::witness_set::WitnessSet, ExecutionFailureKind>
{
if pin.is_none() {
//if pin.is_none() {
Ok(
nssa::privacy_preserving_transaction::witness_set::WitnessSet::for_message(
message,
@ -639,14 +639,14 @@ impl WalletCore {
&acc_manager.public_account_auth(),
),
)
} else {
/*} else {
let public_key = KeycardWallet::get_public_key_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&key_path.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&key_path.as_ref().expect("Expect a key path String."),
);
let signature = KeycardWallet::sign_message_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&key_path.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&key_path.as_ref().expect("Expect a key path String."),
&message.hash_message(),
)
.expect("Expect a valid signature");
@ -661,7 +661,7 @@ impl WalletCore {
&public_keys,
),
)
}
}*/
}
pub fn sign_privacy_message_with_keycard(
@ -674,20 +674,12 @@ impl WalletCore {
let mut signatures = Vec::<Signature>::new();
let mut public_keys = Vec::<PublicKey>::new();
let message_bytes: [u8; 32] = {
let v = message.to_bytes();
let mut bytes = [0_u8; 32];
let len = v.len().min(32);
bytes[..len].copy_from_slice(&v[..len]);
bytes
};
for path in key_paths.iter() {
public_keys.push(KeycardWallet::get_public_key_for_path_with_connect(
&pin, &path,
));
signatures.push(
KeycardWallet::sign_message_for_path_with_connect(&pin, &path, &message_bytes)
KeycardWallet::sign_message_for_path_with_connect(&pin, &path, &message.hash_message())
.expect("Expect a valid signature"),
);
}

View File

@ -60,12 +60,12 @@ impl NativeTokenTransfer<'_> {
.expect("Expect a valid signature")
} else {
let pub_key = KeycardWallet::get_public_key_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&key_path.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&key_path.as_ref().expect("Expect a key path String."),
);
let signature = KeycardWallet::sign_message_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&key_path.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&key_path.as_ref().expect("Expect a key path String."),
&message.hash_message(),
)
.expect("Expect valid signature");
@ -112,13 +112,13 @@ impl NativeTokenTransfer<'_> {
WitnessSet::for_message(&message, &[signing_key])
} else {
let pub_key = KeycardWallet::get_public_key_for_path_with_connect(
pin.as_ref().expect("TODO"),
key_path.as_ref().expect("TODO"),
pin.as_ref().expect("Expect a pin as a String."),
key_path.as_ref().expect("Expect a key path String."),
);
let signature = KeycardWallet::sign_message_for_path_with_connect(
pin.as_ref().as_ref().expect("TODO"),
key_path.as_ref().expect("TODO"),
pin.as_ref().as_ref().expect("Expect a pin as a String."),
key_path.as_ref().expect("Expect a key path String."),
&message.hash_message(),
)
.expect("Expect a valid Signature.");

View File

@ -214,12 +214,12 @@ impl Token<'_> {
nssa::public_transaction::WitnessSet::for_message(&message, &private_keys)
} else {
let sender_public_key = KeycardWallet::get_public_key_for_path_with_connect(
&pin.as_ref().expect("TODO"),
&sender_key_path.as_ref().expect("TODO"),
&pin.as_ref().expect("Expect a pin as a String."),
&sender_key_path.as_ref().expect("Expect a key path String."),
);
let signature = KeycardWallet::sign_message_for_path_with_connect(
&pin.expect("TODO"),
&sender_key_path.expect("TODO"),
&pin.expect("Expect a pin as a String."),
&sender_key_path.expect("Expect a key path String."),
&message.hash_message(),
)
.expect("Expect a valid signature");