From d5c5095607e9c02c0344e27db0df556bbddfab0d Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Mon, 21 Jul 2025 20:32:35 +0100 Subject: [PATCH 1/8] feat(hwi): add hwi device list wallet subcommand - enable offline signer for creating tx whenever hwi feature is enabled - make handle_offline_wallet_subcommand fn async to handle hwi operations - add connecting to hwi fn in utils --- Cargo.lock | 816 +++++++++++++++++++++++++++++++++++++++++++++--- Cargo.toml | 3 + src/commands.rs | 21 +- src/handlers.rs | 29 +- src/utils.rs | 12 + 5 files changed, 837 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 562d768..cb10224 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,6 +48,41 @@ dependencies = [ "subtle", ] +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "ahash" version = "0.8.12" @@ -69,6 +104,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.21" @@ -119,12 +169,49 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-hwi" +version = "0.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6975ce4b96b18ed351aac747cf3d9ec38dd71a281c89c9f374662c298ff98c3a" +dependencies = [ + "async-trait", + "bitbox-api", + "bitcoin", + "coldcard", + "futures", + "hidapi", + "ledger-apdu", + "ledger-transport-hidapi", + "ledger_bitcoin_client", + "regex", + "reqwest 0.11.27", + "serde", + "serde_bytes", + "serde_cbor", + "serialport", + "tokio", + "tokio-serial", +] + [[package]] name = "async-trait" version = "0.1.89" @@ -133,7 +220,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -192,10 +279,17 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + [[package]] name = "bdk-cli" version = "2.0.0" dependencies = [ + "async-hwi", "bdk_bitcoind_rpc", "bdk_electrum", "bdk_esplora", @@ -366,6 +460,33 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "bitbox-api" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8349407999d3653dbbd3f75182742a6c8ad73f424ef83fcf5b87ead0c8ce2528" +dependencies = [ + "async-trait", + "base32", + "bitcoin", + "byteorder", + "chrono", + "getrandom 0.2.16", + "hex", + "hidapi", + "noise-protocol", + "noise-rust-crypto", + "num-bigint", + "prost 0.13.5", + "prost-build", + "semver", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "zeroize", +] + [[package]] name = "bitcoin" version = "0.32.8" @@ -555,6 +676,24 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "bumpalo" version = "3.19.1" @@ -620,6 +759,23 @@ dependencies = [ "cpufeatures 0.2.17", ] +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "chacha20-poly1305" version = "0.1.2" @@ -727,10 +883,10 @@ version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -771,12 +927,33 @@ dependencies = [ "cc", ] +[[package]] +name = "coldcard" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aaaf3f7409edc40001c30a4c1337f21558a8ceba2a4afe807da841a38ce83d6" +dependencies = [ + "aes", + "base58", + "bitcoin_hashes 0.13.0", + "ctr", + "hidapi", + "k256", + "rand", +] + [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation" version = "0.9.4" @@ -787,6 +964,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -856,7 +1043,77 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" dependencies = [ - "memchr", + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", ] [[package]] @@ -917,9 +1174,15 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "dunce" version = "1.0.5" @@ -943,6 +1206,34 @@ dependencies = [ "winapi", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_filter" version = "0.1.4" @@ -992,7 +1283,7 @@ dependencies = [ "hex-conservative 0.2.2", "log", "minreq", - "reqwest", + "reqwest 0.12.18", "serde", "tokio", ] @@ -1107,7 +1398,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -1198,6 +1489,42 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1223,6 +1550,12 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -1307,6 +1640,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.1" @@ -1314,7 +1658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http", + "http 1.3.1", ] [[package]] @@ -1325,8 +1669,8 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http", - "http-body", + "http 1.3.1", + "http-body 1.0.1", "pin-project-lite", ] @@ -1336,6 +1680,36 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.8.1" @@ -1382,7 +1756,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper", + "hyper 1.6.0", "hyper-util", "native-tls", "tokio", @@ -1401,9 +1775,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "http", - "http-body", - "hyper", + "http 1.3.1", + "http-body 1.0.1", + "hyper 1.6.0", "ipnet", "libc", "percent-encoding", @@ -1414,6 +1788,30 @@ dependencies = [ "tracing", ] +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.1.1" @@ -1584,7 +1982,7 @@ checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -1637,7 +2035,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags", + "bitflags 2.9.1", "libc", ] @@ -1652,6 +2050,26 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libudev" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b324152da65df7bb95acfcaab55e3097ceaab02fb19b228a9eb74d55f135e0" +dependencies = [ + "libc", + "libudev-sys", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -1685,6 +2103,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + [[package]] name = "memchr" version = "2.7.6" @@ -1727,6 +2154,25 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "mio-serial" +version = "5.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029e1f407e261176a983a6599c084efd322d9301028055c87174beac71397ba3" +dependencies = [ + "log", + "mio", + "nix 0.29.0", + "serialport", + "winapi", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "native-tls" version = "0.2.14" @@ -1771,13 +2217,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openssl" version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags", + "bitflags 2.9.1", "cfg-if", "foreign-types", "libc", @@ -1794,7 +2246,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -1875,6 +2327,16 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1887,6 +2349,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.32" @@ -2113,7 +2585,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags", + "bitflags 2.9.1", ] [[package]] @@ -2165,8 +2637,8 @@ dependencies = [ "base64 0.22.1", "bytes", "futures-core", - "http", - "http-body", + "http 1.3.1", + "http-body 1.0.1", "http-body-util", "hyper", "hyper-rustls", @@ -2183,7 +2655,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tokio-native-tls", "tokio-rustls", @@ -2197,6 +2669,16 @@ dependencies = [ "webpki-roots 1.0.5", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.14" @@ -2217,7 +2699,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags", + "bitflags 2.9.1", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2231,13 +2713,22 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys", @@ -2272,6 +2763,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pki-types" version = "1.13.3" @@ -2341,6 +2841,20 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "secp256k1" version = "0.29.1" @@ -2368,8 +2882,8 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags", - "core-foundation", + "bitflags 2.9.1", + "core-foundation 0.9.4", "core-foundation-sys", "libc", "security-framework-sys", @@ -2385,6 +2899,12 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + [[package]] name = "serde" version = "1.0.228" @@ -2404,6 +2924,25 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.228" @@ -2412,7 +2951,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2498,6 +3037,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "slab" version = "0.4.11" @@ -2510,6 +3059,28 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "snafu" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "socket2" version = "0.6.1" @@ -2520,6 +3091,16 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -2549,6 +3130,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.2" @@ -2566,7 +3153,28 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -2628,7 +3236,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2690,7 +3298,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -2772,7 +3380,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper", + "sync_wrapper 1.0.2", "tokio", "tower-layer", "tower-service", @@ -2784,11 +3392,11 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags", + "bitflags 2.9.1", "bytes", "futures-util", - "http", - "http-body", + "http 1.3.1", + "http-body 1.0.1", "iri-string", "pin-project-lite", "tower", @@ -2827,7 +3435,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3116,12 +3724,74 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -3149,6 +3819,21 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3182,6 +3867,12 @@ dependencies = [ "windows_x86_64_msvc 0.53.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3194,6 +3885,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -3206,6 +3903,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3230,6 +3933,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -3242,6 +3951,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -3254,6 +3969,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -3266,6 +3987,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -3299,6 +4026,17 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core", + "zeroize", +] + [[package]] name = "yoke" version = "0.8.1" @@ -3318,7 +4056,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", "synstructure", ] @@ -3339,7 +4077,7 @@ checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] @@ -3359,7 +4097,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", "synstructure", ] @@ -3413,7 +4151,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.101", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b7d610a..0855c74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,6 +59,9 @@ _payjoin-dependencies = ["payjoin", "reqwest", "url"] # Use this to consensus verify transactions at sync time verify = [] +# Use HWI to sign transaction with your hardware wallet +hwi = ["async-hwi"] + # Extra utility tools # Compile policies compiler = [] diff --git a/src/commands.rs b/src/commands.rs index 14ad9ea..c77398c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -23,6 +23,11 @@ use clap::{Args, Parser, Subcommand, ValueEnum, value_parser}; use crate::utils::parse_proxy_auth; use crate::utils::{parse_address, parse_outpoint, parse_recipient}; +#[cfg(feature = "hwi")] +const ENABLE_OFFLINE_SIGNER: bool = true; +#[cfg(not(feature = "hwi"))] +const ENABLE_OFFLINE_SIGNER: bool = false; + /// The BDK Command Line Wallet App /// /// bdk-cli is a lightweight command line bitcoin wallet, powered by BDK. @@ -305,7 +310,7 @@ pub enum OfflineWalletSubCommand { #[arg(long = "enable_rbf", short = 'r', default_value_t = true)] enable_rbf: bool, /// Make a PSBT that can be signed by offline signers and hardware wallets. Forces the addition of `non_witness_utxo` and more details to let the signer identify the change output. - #[arg(long = "offline_signer")] + #[arg(long = "offline_signer", default_value_t=ENABLE_OFFLINE_SIGNER)] offline_signer: bool, /// Selects which utxos *must* be spent. #[arg(env = "MUST_SPEND_TXID:VOUT", long = "utxos", value_parser = parse_outpoint)] @@ -405,6 +410,12 @@ pub enum OfflineWalletSubCommand { #[arg(env = "BASE64_PSBT", required = true)] psbt: Vec, }, + #[cfg(feature = "hwi")] + /// Hardware wallet interface operations. + Hwi { + #[clap(subcommand)] + subcommand: HwiSubCommand, + }, } /// Wallet subcommands that needs a blockchain backend. @@ -518,6 +529,14 @@ pub enum KeySubCommand { }, } +/// Subcommands for HWI operations. +#[cfg(feature = "hwi")] +#[derive(Debug, Subcommand, Clone, PartialEq, Eq)] +pub enum HwiSubCommand { + /// Lists all connected hardware wallet devices. + Devices, +} + /// Subcommands available in REPL mode. #[cfg(any(feature = "repl", target_arch = "wasm32"))] #[derive(Debug, Parser)] diff --git a/src/handlers.rs b/src/handlers.rs index 2138e4c..5defa08 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -97,7 +97,7 @@ const NUMS_UNSPENDABLE_KEY_HEX: &str = /// Execute an offline wallet sub-command /// /// Offline wallet sub-commands are described in [`OfflineWalletSubCommand`]. -pub fn handle_offline_wallet_subcommand( +pub async fn handle_offline_wallet_subcommand( wallet: &mut Wallet, wallet_opts: &WalletOpts, cli_opts: &CliOpts, @@ -591,6 +591,27 @@ pub fn handle_offline_wallet_subcommand( &json!({ "psbt": BASE64_STANDARD.encode(final_psbt.serialize()) }), )?) } + #[cfg(feature = "hwi")] + Hwi { subcommand } => match subcommand { + HwiSubCommand::Devices => { + let device = crate::utils::connect_to_hardware_wallet( + wallet.network(), + wallet_opts, + Some(wallet), + ) + .await?; + let device = if let Some(device) = device { + json!({ + "type": device.device_kind().to_string(), + "fingerprint": device.get_master_fingerprint().await?.to_string(), + "model": device.device_kind().to_string(), + }) + } else { + json!(null) + }; + Ok(json!({ "devices": device })) + } + }, } } @@ -1461,9 +1482,9 @@ async fn respond( ReplSubCommand::Wallet { subcommand: WalletSubCommand::OfflineWalletSubCommand(offline_subcommand), } => { - let value = - handle_offline_wallet_subcommand(wallet, wallet_opts, cli_opts, offline_subcommand) - .map_err(|e| e.to_string())?; + let value = handle_offline_wallet_subcommand(wallet, wallet_opts, offline_subcommand) + .await + .map_err(|e| e.to_string())?; Some(value) } ReplSubCommand::Wallet { diff --git a/src/utils.rs b/src/utils.rs index 76e56a0..fd4227d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -35,6 +35,18 @@ use bdk_wallet::{ template::DescriptorTemplate, }; use cli_table::{Cell, CellStruct, Style, Table}; +use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf}; +#[cfg(feature = "hwi")] +use { + async_hwi::jade::{self, Jade}, + async_hwi::ledger::{HidApi, LedgerSimulator}, + async_hwi::specter::{Specter, SpecterSimulator}, + async_hwi::{ + async_hwi::bitbox::{BitBox02, PairingBitbox02WithLocalCache}, + bitbox::api::runtime, + }, + async_hwi::{coldcard, HWI}, +}; #[cfg(any( feature = "electrum", From b925e6a609173e68da63bbe4564ae26580ad7af3 Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Tue, 22 Jul 2025 00:17:13 +0100 Subject: [PATCH 2/8] feat(hwi): add register wallet hwi subcommand - add `register` wallet hwi subcommand --- Cargo.lock | 99 +++++++++++++++++++++++++++++++++++++------------ src/commands.rs | 4 +- src/handlers.rs | 31 +++++++++++++++- src/utils.rs | 2 +- 4 files changed, 108 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb10224..60c4989 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,7 +220,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -832,7 +832,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", - "half", + "half 2.6.0", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", ] [[package]] @@ -886,7 +897,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -915,7 +926,7 @@ checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.104", ] [[package]] @@ -1059,6 +1070,27 @@ dependencies = [ "typenum", ] +[[package]] +name = "csv" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" +dependencies = [ + "memchr", +] + [[package]] name = "ctr" version = "0.9.2" @@ -1091,7 +1123,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1174,7 +1206,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1283,7 +1315,7 @@ dependencies = [ "hex-conservative 0.2.2", "log", "minreq", - "reqwest 0.12.18", + "reqwest 0.12.22", "serde", "tokio", ] @@ -1398,7 +1430,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1525,6 +1557,16 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" +[[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -1703,7 +1745,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -1782,7 +1824,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.0", "tokio", "tower-service", "tracing", @@ -1955,6 +1997,15 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.17" @@ -1982,7 +2033,7 @@ checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2246,7 +2297,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2939,7 +2990,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ - "half", + "half 1.8.3", "serde", ] @@ -2951,7 +3002,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3153,7 +3204,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3236,7 +3287,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3298,7 +3349,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3435,7 +3486,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3745,7 +3796,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3756,7 +3807,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4056,7 +4107,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "synstructure", ] @@ -4077,7 +4128,7 @@ checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4097,7 +4148,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "synstructure", ] @@ -4151,7 +4202,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] diff --git a/src/commands.rs b/src/commands.rs index c77398c..6c90458 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -533,8 +533,10 @@ pub enum KeySubCommand { #[cfg(feature = "hwi")] #[derive(Debug, Subcommand, Clone, PartialEq, Eq)] pub enum HwiSubCommand { - /// Lists all connected hardware wallet devices. + /// List connected hardware wallet device. Devices, + /// Register hardware wallet + Register, } /// Subcommands available in REPL mode. diff --git a/src/handlers.rs b/src/handlers.rs index 5defa08..89897fd 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -31,6 +31,8 @@ use bdk_wallet::bitcoin::{ secp256k1::Secp256k1, }; use bdk_wallet::chain::ChainPosition; +#[cfg(feature = "hwi")] +use bdk_wallet::bitcoin::hex::DisplayHex; use bdk_wallet::descriptor::Segwitv0; use bdk_wallet::keys::{ DerivableKey, DescriptorKey, DescriptorKey::Secret, ExtendedKey, GeneratableKey, GeneratedKey, @@ -591,7 +593,7 @@ pub async fn handle_offline_wallet_subcommand( &json!({ "psbt": BASE64_STANDARD.encode(final_psbt.serialize()) }), )?) } - #[cfg(feature = "hwi")] + #[cfg(feature = "hwi")] Hwi { subcommand } => match subcommand { HwiSubCommand::Devices => { let device = crate::utils::connect_to_hardware_wallet( @@ -611,6 +613,31 @@ pub async fn handle_offline_wallet_subcommand( }; Ok(json!({ "devices": device })) } + HwiSubCommand::Register => { + let policy = wallet_opts.ext_descriptor.clone().ok_or_else(|| { + Error::Generic( + "External descriptor required for wallet registration".to_string(), + ) + })?; + let wallet_name = wallet_opts.wallet.clone().ok_or_else(|| { + Error::Generic("Wallet name is required for wallet registration".to_string()) + })?; + + let device = crate::utils::connect_to_hardware_wallet( + wallet.network(), + wallet_opts, + Some(wallet), + ) + .await?; + let hmac = if let Some(device) = device { + let hmac = device.register_wallet(&wallet_name, &policy).await?; + hmac.map(|h| h.to_lower_hex_string()) + } else { + None + }; + //TODO: return status of wallet registration + Ok(json!({ "hmac": hmac })) + } }, } } @@ -1482,7 +1509,7 @@ async fn respond( ReplSubCommand::Wallet { subcommand: WalletSubCommand::OfflineWalletSubCommand(offline_subcommand), } => { - let value = handle_offline_wallet_subcommand(wallet, wallet_opts, offline_subcommand) + let value = handle_offline_wallet_subcommand(wallet, wallet_opts, cli_opts, offline_subcommand) .await .map_err(|e| e.to_string())?; Some(value) diff --git a/src/utils.rs b/src/utils.rs index fd4227d..91a6231 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -42,8 +42,8 @@ use { async_hwi::ledger::{HidApi, LedgerSimulator}, async_hwi::specter::{Specter, SpecterSimulator}, async_hwi::{ - async_hwi::bitbox::{BitBox02, PairingBitbox02WithLocalCache}, bitbox::api::runtime, + bitbox::{BitBox02, PairingBitbox02WithLocalCache}, }, async_hwi::{coldcard, HWI}, }; From f197fab6d8c4b02a87d87eaca357183631dc9e0a Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Tue, 22 Jul 2025 12:59:45 +0100 Subject: [PATCH 3/8] feat(hwi): add address subcommand for hwi fix clippy issues --- src/commands.rs | 2 ++ src/handlers.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/commands.rs b/src/commands.rs index 6c90458..9b7a5f2 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -537,6 +537,8 @@ pub enum HwiSubCommand { Devices, /// Register hardware wallet Register, + /// Generate address + Address, } /// Subcommands available in REPL mode. diff --git a/src/handlers.rs b/src/handlers.rs index 89897fd..7bde320 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -638,6 +638,10 @@ pub async fn handle_offline_wallet_subcommand( //TODO: return status of wallet registration Ok(json!({ "hmac": hmac })) } + HwiSubCommand::Address => { + let address = wallet.next_unused_address(KeychainKind::External); + Ok(json!({ "address": address.address })) + } }, } } @@ -1540,6 +1544,7 @@ async fn respond( ReplSubCommand::Exit => None, }; if let Some(value) = response { + let value = serde_json::to_string_pretty(&value).map_err(|e| e.to_string())?; writeln!(std::io::stdout(), "{value}").map_err(|e| e.to_string())?; std::io::stdout().flush().map_err(|e| e.to_string())?; Ok(false) From f9b55745599cd6b7c06f098c58b68acd667e6d0e Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Wed, 23 Jul 2025 05:32:07 +0100 Subject: [PATCH 4/8] feat(hwi): add hwi sign subcommand - add signing psbt with hardware wallet --- Cargo.lock | 14 +++++++++++ src/commands.rs | 11 ++++----- src/handlers.rs | 64 ++++++------------------------------------------- src/utils.rs | 4 ++-- 4 files changed, 28 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60c4989..ae4201e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2068,6 +2068,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "lazy_static" version = "1.5.0" diff --git a/src/commands.rs b/src/commands.rs index 9b7a5f2..0768927 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -410,12 +410,6 @@ pub enum OfflineWalletSubCommand { #[arg(env = "BASE64_PSBT", required = true)] psbt: Vec, }, - #[cfg(feature = "hwi")] - /// Hardware wallet interface operations. - Hwi { - #[clap(subcommand)] - subcommand: HwiSubCommand, - }, } /// Wallet subcommands that needs a blockchain backend. @@ -539,6 +533,11 @@ pub enum HwiSubCommand { Register, /// Generate address Address, + /// Sign PSBT with hardware wallet + Sign { + /// The base64-encoded PSBT to sign + psbt: String, + }, } /// Subcommands available in REPL mode. diff --git a/src/handlers.rs b/src/handlers.rs index 7bde320..e6d0587 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -23,6 +23,8 @@ use bdk_redb::Store as RedbStore; use bdk_wallet::bip39::{Language, Mnemonic}; use bdk_wallet::bitcoin::base64::Engine; use bdk_wallet::bitcoin::base64::prelude::BASE64_STANDARD; +#[cfg(feature = "hwi")] +use bdk_wallet::bitcoin::hex::DisplayHex; use bdk_wallet::bitcoin::{ Address, Amount, FeeRate, Network, Psbt, Sequence, Txid, bip32::{DerivationPath, KeySource}, @@ -31,8 +33,6 @@ use bdk_wallet::bitcoin::{ secp256k1::Secp256k1, }; use bdk_wallet::chain::ChainPosition; -#[cfg(feature = "hwi")] -use bdk_wallet::bitcoin::hex::DisplayHex; use bdk_wallet::descriptor::Segwitv0; use bdk_wallet::keys::{ DerivableKey, DescriptorKey, DescriptorKey::Secret, ExtendedKey, GeneratableKey, GeneratedKey, @@ -99,7 +99,7 @@ const NUMS_UNSPENDABLE_KEY_HEX: &str = /// Execute an offline wallet sub-command /// /// Offline wallet sub-commands are described in [`OfflineWalletSubCommand`]. -pub async fn handle_offline_wallet_subcommand( +pub fn handle_offline_wallet_subcommand( wallet: &mut Wallet, wallet_opts: &WalletOpts, cli_opts: &CliOpts, @@ -593,56 +593,6 @@ pub async fn handle_offline_wallet_subcommand( &json!({ "psbt": BASE64_STANDARD.encode(final_psbt.serialize()) }), )?) } - #[cfg(feature = "hwi")] - Hwi { subcommand } => match subcommand { - HwiSubCommand::Devices => { - let device = crate::utils::connect_to_hardware_wallet( - wallet.network(), - wallet_opts, - Some(wallet), - ) - .await?; - let device = if let Some(device) = device { - json!({ - "type": device.device_kind().to_string(), - "fingerprint": device.get_master_fingerprint().await?.to_string(), - "model": device.device_kind().to_string(), - }) - } else { - json!(null) - }; - Ok(json!({ "devices": device })) - } - HwiSubCommand::Register => { - let policy = wallet_opts.ext_descriptor.clone().ok_or_else(|| { - Error::Generic( - "External descriptor required for wallet registration".to_string(), - ) - })?; - let wallet_name = wallet_opts.wallet.clone().ok_or_else(|| { - Error::Generic("Wallet name is required for wallet registration".to_string()) - })?; - - let device = crate::utils::connect_to_hardware_wallet( - wallet.network(), - wallet_opts, - Some(wallet), - ) - .await?; - let hmac = if let Some(device) = device { - let hmac = device.register_wallet(&wallet_name, &policy).await?; - hmac.map(|h| h.to_lower_hex_string()) - } else { - None - }; - //TODO: return status of wallet registration - Ok(json!({ "hmac": hmac })) - } - HwiSubCommand::Address => { - let address = wallet.next_unused_address(KeychainKind::External); - Ok(json!({ "address": address.address })) - } - }, } } @@ -1367,7 +1317,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { offline_subcommand.clone(), )? }; - Ok(result) + Ok(result?) } CliSubCommand::Wallet { wallet, @@ -1513,9 +1463,9 @@ async fn respond( ReplSubCommand::Wallet { subcommand: WalletSubCommand::OfflineWalletSubCommand(offline_subcommand), } => { - let value = handle_offline_wallet_subcommand(wallet, wallet_opts, cli_opts, offline_subcommand) - .await - .map_err(|e| e.to_string())?; + let value = + handle_offline_wallet_subcommand(wallet, wallet_opts, cli_opts, offline_subcommand) + .map_err(|e| e.to_string())?; Some(value) } ReplSubCommand::Wallet { diff --git a/src/utils.rs b/src/utils.rs index 91a6231..45e9b36 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -24,6 +24,7 @@ use bdk_kyoto::{ BuilderExt, Info, LightClient, Receiver, ScanType::Sync, UnboundedReceiver, Warning, builder::Builder, }; +use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf}; use bdk_wallet::{ KeychainKind, bitcoin::bip32::{DerivationPath, Xpub}, @@ -35,17 +36,16 @@ use bdk_wallet::{ template::DescriptorTemplate, }; use cli_table::{Cell, CellStruct, Style, Table}; -use bdk_wallet::bitcoin::{Address, Network, OutPoint, ScriptBuf}; #[cfg(feature = "hwi")] use { async_hwi::jade::{self, Jade}, async_hwi::ledger::{HidApi, LedgerSimulator}, async_hwi::specter::{Specter, SpecterSimulator}, + async_hwi::{HWI, coldcard}, async_hwi::{ bitbox::api::runtime, bitbox::{BitBox02, PairingBitbox02WithLocalCache}, }, - async_hwi::{coldcard, HWI}, }; #[cfg(any( From 39bd58278fddb53b6d7608f0653cec21030b1591 Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Mon, 11 Aug 2025 09:26:41 +0100 Subject: [PATCH 5/8] feat(hwi): set hwi as top level command - add ledger and coldcard integration - update hwi as top level command - update CHANGELOG rebase and fix clippy issues --- CHANGELOG.md | 3 +++ Cargo.lock | 70 ++++++++++++++++++++++++------------------------- src/commands.rs | 17 ++++++++++++ src/handlers.rs | 11 +++++++- src/utils.rs | 3 ++- 5 files changed, 67 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a95b7..cadc9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details. - Add wallet subcommand `config` to save wallet configs - Add `wallets` command to list all wallets saved configs +- Add `hwi` top level command with subcommands: `devices`, `register`, `address` and `sign` transaction + ## [2.0.0] - Removed MSRV and bumped Rust Edition to 2024 @@ -20,6 +22,7 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details. - Renamed `BuilderError` to `KyotoBuilderError` and added `KyotoUpdateError` - Updated `bdk_electrum` to 0.23.0 - Added `just` example for starting, connecting and funding a wallet in regtest +- Add `--pretty` top level flag for formatting commands output in a tabular format ## [1.0.0] diff --git a/Cargo.lock b/Cargo.lock index ae4201e..2aed718 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" [[package]] name = "arrayref" @@ -189,9 +189,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-hwi" -version = "0.0.28" +version = "0.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6975ce4b96b18ed351aac747cf3d9ec38dd71a281c89c9f374662c298ff98c3a" +checksum = "724d232316bc0d9ce24eb3b3a6c600f487bd877513bd0e73ec02f8c890af3275" dependencies = [ "async-trait", "bitbox-api", @@ -220,7 +220,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -462,9 +462,9 @@ dependencies = [ [[package]] name = "bitbox-api" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8349407999d3653dbbd3f75182742a6c8ad73f424ef83fcf5b87ead0c8ce2528" +checksum = "04d5d5ce87126e79759ea758e3ed4c1113a84fd4188a61c23d425f05c9e3c791" dependencies = [ "async-trait", "base32", @@ -897,7 +897,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -926,7 +926,7 @@ checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1123,7 +1123,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1206,7 +1206,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1315,7 +1315,7 @@ dependencies = [ "hex-conservative 0.2.2", "log", "minreq", - "reqwest 0.12.22", + "reqwest 0.12.23", "serde", "tokio", ] @@ -1430,7 +1430,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -1798,7 +1798,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.6.0", + "hyper 1.7.0", "hyper-util", "native-tls", "tokio", @@ -1819,7 +1819,7 @@ dependencies = [ "futures-util", "http 1.3.1", "http-body 1.0.1", - "hyper 1.6.0", + "hyper 1.7.0", "ipnet", "libc", "percent-encoding", @@ -2033,7 +2033,7 @@ checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -2100,7 +2100,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "libc", ] @@ -2294,7 +2294,7 @@ version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "cfg-if", "foreign-types", "libc", @@ -2311,7 +2311,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -2650,7 +2650,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", ] [[package]] @@ -2764,7 +2764,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2793,7 +2793,7 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "errno", "libc", "linux-raw-sys", @@ -2947,7 +2947,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -3016,7 +3016,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3218,7 +3218,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3301,7 +3301,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3363,7 +3363,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3457,7 +3457,7 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.3", "bytes", "futures-util", "http 1.3.1", @@ -3500,7 +3500,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3810,7 +3810,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -3821,7 +3821,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -4121,7 +4121,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -4142,7 +4142,7 @@ checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] @@ -4162,7 +4162,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", "synstructure", ] @@ -4216,7 +4216,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.106", ] [[package]] diff --git a/src/commands.rs b/src/commands.rs index 0768927..aa46801 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -247,6 +247,23 @@ pub struct WalletOpts { pub compactfilter_opts: CompactFilterOpts, } +/// HWI specific options +#[cfg(feature = "hwi")] +#[derive(Clone, Debug, PartialEq, Eq, Args)] +pub struct HwiOpts { + /// Wallet name + #[arg(env = "WALLET", short = 'w', long = "wallet")] + pub wallet: Option, + + /// External descriptor + #[arg(env = "EXT_DESCRIPTOR", short = 'e', long = "ext_descriptor")] + pub ext_descriptor: Option, + + /// Database type + #[arg(short = 'd', long = "database_type")] + pub database_type: Option, +} + /// Options to configure a SOCKS5 proxy for a blockchain client connection. #[cfg(any(feature = "electrum", feature = "esplora"))] #[derive(Debug, Args, Clone, PartialEq, Eq)] diff --git a/src/handlers.rs b/src/handlers.rs index e6d0587..12cd777 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -1315,7 +1315,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { &wallet_opts, &cli_opts, offline_subcommand.clone(), - )? + ) }; Ok(result?) } @@ -1425,6 +1425,15 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { let descriptor = handle_descriptor_command(cli_opts.network, desc_type, key, pretty)?; Ok(descriptor) } + + #[cfg(feature = "hwi")] + CliSubCommand::Hwi { + hwi_opts, + subcommand, + } => { + let result = handle_hwi_subcommand(network, &hwi_opts, subcommand).await?; + Ok(serde_json::to_string_pretty(&result).map_err(|e| Error::SerdeJson(e))?) + } }; result } diff --git a/src/utils.rs b/src/utils.rs index 45e9b36..2772f37 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -38,8 +38,9 @@ use bdk_wallet::{ use cli_table::{Cell, CellStruct, Style, Table}; #[cfg(feature = "hwi")] use { + crate::commands::HwiOpts, async_hwi::jade::{self, Jade}, - async_hwi::ledger::{HidApi, LedgerSimulator}, + async_hwi::ledger::{HidApi, Ledger, LedgerSimulator, TransportHID}, async_hwi::specter::{Specter, SpecterSimulator}, async_hwi::{HWI, coldcard}, async_hwi::{ From 01df5b0d6f3840be88387312bcbe9ff476e6769a Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Sun, 12 Oct 2025 22:04:57 +0100 Subject: [PATCH 6/8] feat(hwi): add libudev-sys dep to workflows - async-hwi requires libudev-sys for linux systems - remove skip_blocks param as it is no longer needed for cbf --- .github/workflows/code_coverage.yml | 6 +- Cargo.lock | 1439 ++++++++++++++++++++------- Cargo.toml | 1 + src/commands.rs | 8 + src/error.rs | 3 + src/handlers.rs | 148 ++- src/utils.rs | 112 ++- 7 files changed, 1328 insertions(+), 389 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index df3d3e9..9c947b1 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -16,8 +16,10 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - - name: Install lcov tools - run: sudo apt-get install lcov -y + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev lcov - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 2aed718..0fc647c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,6 +34,17 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher 0.4.4", + "cpufeatures 0.2.17", +] + [[package]] name = "aes-gcm" version = "0.9.2" @@ -41,45 +52,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc3be92e19a7ef47457b8e6f90707e12b6ac5d20c6f3866584fa3be0787d839f" dependencies = [ "aead 0.4.3", - "aes", + "aes 0.7.5", "cipher 0.3.0", - "ctr", - "ghash", + "ctr 0.7.0", + "ghash 0.4.4", "subtle", ] -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - [[package]] name = "aes-gcm" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", + "aead 0.5.2", + "aes 0.8.4", + "cipher 0.4.4", + "ctr 0.9.2", + "ghash 0.5.1", "subtle", ] @@ -104,12 +94,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -171,9 +155,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" [[package]] name = "arrayref" @@ -220,7 +204,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -229,11 +213,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + [[package]] name = "aws-lc-rs" -version = "1.15.3" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e84ce723ab67259cfeb9877c6a639ee9eb7a27b28123abd71db7f0d5d0cc9d86" +checksum = "d9a7b350e3bb1767102698302bc37256cbd48422809984b98d292c40e2579aa9" dependencies = [ "aws-lc-sys", "zeroize", @@ -241,9 +231,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.36.0" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a442ece363113bd4bd4c8b18977a7798dd4d3c3383f34fb61936960e8f4ad8" +checksum = "b092fe214090261288111db7a2b2c2118e5a7f30dc2569f1732c4069a6840549" dependencies = [ "cc", "cmake", @@ -251,6 +241,24 @@ dependencies = [ "fs_extra", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + [[package]] name = "base58ck" version = "0.1.0" @@ -281,9 +289,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "bdk-cli" @@ -302,11 +310,11 @@ dependencies = [ "env_logger", "log", "payjoin", - "reqwest", + "reqwest 0.12.28", "serde", "serde_json", "shlex", - "thiserror 2.0.17", + "thiserror 2.0.18", "tokio", "toml 0.8.23", "tracing", @@ -373,9 +381,9 @@ dependencies = [ [[package]] name = "bdk_kyoto" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da8010d2587aba368afd0be83ad87563f465744eb124cda431905cf06f8bd1c" +checksum = "6f35b9f8b3aa8c4647bec7a92b050c496742d955e0ac1edcb4e7c2deabf63c54" dependencies = [ "bdk_wallet", "bip157", @@ -391,7 +399,7 @@ dependencies = [ "bdk_wallet", "ciborium", "redb", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -455,7 +463,7 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" dependencies = [ - "bitcoin_hashes 0.14.1", + "bitcoin_hashes 0.13.0", "serde", "unicode-normalization", ] @@ -471,7 +479,7 @@ dependencies = [ "bitcoin", "byteorder", "chrono", - "getrandom 0.2.16", + "getrandom 0.2.17", "hex", "hidapi", "noise-protocol", @@ -534,6 +542,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + [[package]] name = "bitcoin-internals" version = "0.3.0" @@ -571,7 +585,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87a803a4b54e44635206b53329c78c0029d0c70926288ac2f07f4bb1267546cb" dependencies = [ "aead 0.4.3", - "aes-gcm", + "aes-gcm 0.9.2", "bitcoin-hpke", "byteorder", "chacha20poly1305 0.8.0", @@ -597,6 +611,16 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals 0.2.0", + "hex-conservative 0.1.2", +] + [[package]] name = "bitcoin_hashes" version = "0.14.1" @@ -615,7 +639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0982261c82a50d89d1a411602afee0498b3e0debe3d36693f0c661352809639" dependencies = [ "bitcoin-io 0.2.0", - "hex-conservative 0.3.1", + "hex-conservative 0.3.2", ] [[package]] @@ -654,35 +678,32 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.10.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "block-buffer" -version = "0.9.0" +name = "bitflags" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] -name = "block-buffer" -version = "0.10.4" +name = "blake2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "generic-array", + "digest 0.10.7", ] [[package]] -name = "blake2" -version = "0.10.6" +name = "block-buffer" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "digest", + "generic-array", ] [[package]] @@ -696,9 +717,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5c6f81257d10a0f602a294ae4182251151ff97dbb504ef9afcdda4a64b24d9b4" [[package]] name = "byteorder" @@ -714,9 +735,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.52" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "jobserver", @@ -759,23 +780,6 @@ dependencies = [ "cpufeatures 0.2.17", ] -[[package]] -name = "cfg_aliases" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" - -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - [[package]] name = "chacha20-poly1305" version = "0.1.2" @@ -808,6 +812,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -832,18 +847,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", - "half 2.6.0", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", - "zeroize", + "half 2.7.1", ] [[package]] @@ -868,9 +872,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.5.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "c5caf74d17c3aec5495110c34cc3f78644bfa89af6c8993ed4de2790e49b6499" dependencies = [ "clap_builder", "clap_derive", @@ -878,9 +882,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.5.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "370daa45065b80218950227371916a1633217ae42b2715b2287b606dcd618e24" dependencies = [ "anstream", "anstyle", @@ -890,21 +894,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "clap_lex" -version = "0.7.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] name = "cli-table" @@ -926,7 +930,7 @@ checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -944,13 +948,13 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aaaf3f7409edc40001c30a4c1337f21558a8ceba2a4afe807da841a38ce83d6" dependencies = [ - "aes", + "aes 0.8.4", "base58", "bitcoin_hashes 0.13.0", - "ctr", + "ctr 0.9.2", "hidapi", "k256", - "rand", + "rand 0.8.5", ] [[package]] @@ -1015,6 +1019,18 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -1054,41 +1070,16 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "704a3c26996a80471189265814dbc2c257598b96b8a7feae2d31ace646bb9782" dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "csv" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", + "memchr", ] [[package]] -name = "csv-core" -version = "0.1.12" +name = "ctr" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" +checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" dependencies = [ - "memchr", + "cipher 0.3.0", ] [[package]] @@ -1097,7 +1088,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] @@ -1107,7 +1098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "curve25519-dalek-derive", "fiat-crypto", "rustc_version", @@ -1123,7 +1114,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -1136,27 +1127,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "ctr" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" -dependencies = [ - "cipher 0.3.0", -] - [[package]] name = "digest" version = "0.9.0" @@ -1173,6 +1143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -1206,14 +1177,14 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "doc-comment" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" [[package]] name = "dunce" @@ -1221,6 +1192,26 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + [[package]] name = "electrum-client" version = "0.24.1" @@ -1246,12 +1237,12 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", "pkcs8", - "rand_core", + "rand_core 0.6.4", "sec1", "subtle", "zeroize", @@ -1268,9 +1259,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" dependencies = [ "log", "regex", @@ -1278,9 +1269,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" dependencies = [ "anstream", "anstyle", @@ -1307,16 +1298,17 @@ dependencies = [ [[package]] name = "esplora-client" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0af349d96a5d9ad77ba59f1437aa6f348b03c5865d4f7d6e7a662d60aedce39" +checksum = "4aac1895e7d91053ecc4c4955832b6f904f4321ec59d07b120736103bf06f7a5" dependencies = [ "bitcoin", "hex-conservative 0.2.2", "log", "minreq", - "reqwest 0.12.23", + "reqwest 0.12.28", "serde", + "serde_json", "tokio", ] @@ -1338,11 +1330,45 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "find-msvc-tools" -version = "0.1.7" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" @@ -1376,9 +1402,9 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -1391,9 +1417,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -1401,15 +1427,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -1418,38 +1444,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -1459,7 +1485,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -1471,6 +1496,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1500,6 +1526,19 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + [[package]] name = "ghash" version = "0.4.4" @@ -1507,18 +1546,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug", - "polyval", + "polyval 0.5.3", ] [[package]] -name = "half" -version = "2.7.1" +name = "ghash" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ - "cfg-if", - "crunchy", - "zerocopy", + "opaque-debug", + "polyval 0.6.2", ] [[package]] @@ -1528,7 +1566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -1559,12 +1597,13 @@ checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "half" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", + "zerocopy", ] [[package]] @@ -1577,6 +1616,15 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + [[package]] name = "hashbrown" version = "0.16.1" @@ -1610,6 +1658,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "hex-conservative" version = "0.2.2" @@ -1621,9 +1675,9 @@ dependencies = [ [[package]] name = "hex-conservative" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b9348ee0d8d4e3a894946c1ab104d08a2e44ca13656613afada8905ea609b6" +checksum = "830e599c2904b08f0834ee6337d8fe8f0ed4a63b5d9e7a7f49c0ffa06d08d360" dependencies = [ "arrayvec", ] @@ -1634,6 +1688,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "hidapi" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "565dd4c730b8f8b2c0fb36df6be12e5470ae10895ddcc4e9dcfbfb495de202b0" +dependencies = [ + "cc", + "cfg-if", + "libc", + "pkg-config", + "windows-sys 0.48.0", +] + [[package]] name = "hkdf" version = "0.11.0" @@ -1672,6 +1739,26 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.4.0" @@ -1700,7 +1787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.3.1", + "http 1.4.0", ] [[package]] @@ -1711,7 +1798,7 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "pin-project-lite", ] @@ -1762,8 +1849,8 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "http", - "http-body", + "http 1.4.0", + "http-body 1.0.1", "httparse", "itoa", "pin-project-lite", @@ -1773,21 +1860,35 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.12", + "hyper 0.14.32", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", +] + [[package]] name = "hyper-rustls" version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "http", - "hyper", + "http 1.4.0", + "hyper 1.8.1", "hyper-util", "rustls 0.23.36", "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.26.4", "tower-service", - "webpki-roots 1.0.5", + "webpki-roots 1.0.6", ] [[package]] @@ -1798,7 +1899,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.7.0", + "hyper 1.8.1", "hyper-util", "native-tls", "tokio", @@ -1808,23 +1909,22 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ "base64 0.22.1", "bytes", "futures-channel", - "futures-core", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", - "hyper 1.7.0", + "hyper 1.8.1", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.0", + "socket2 0.6.2", "tokio", "tower-service", "tracing", @@ -1832,9 +1932,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1935,6 +2035,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.1.0" @@ -1964,6 +2070,8 @@ checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -1975,6 +2083,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "io-kit-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" +dependencies = [ + "core-foundation-sys", + "mach2", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1997,6 +2115,15 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -2014,9 +2141,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +checksum = "c867c356cc096b33f4981825ab281ecba3db0acefe60329f044c1789d94c6543" dependencies = [ "jiff-static", "log", @@ -2027,13 +2154,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +checksum = "f7946b4325269738f270bb55b3c19ab5c5040525f83fd625259422a9d25d9be5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -2078,7 +2205,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2", + "sha2 0.10.9", "signature", ] @@ -2088,11 +2215,65 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "ledger-apdu" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe435806c197dfeaa5efcded5e623c4b8230fd28fdf1e91e7a86e40ef2acbf90" +dependencies = [ + "arrayref", + "no-std-compat", + "snafu", +] + +[[package]] +name = "ledger-transport" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1117f2143d92c157197785bf57711d7b02f2cfa101e162f8ca7900fb7f976321" +dependencies = [ + "async-trait", + "ledger-apdu", +] + +[[package]] +name = "ledger-transport-hidapi" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27139d540e4271fa55b67b8cb94c6f100931042dcc663db1c2395fa3ffb8599" +dependencies = [ + "byteorder", + "cfg-if", + "hex", + "hidapi", + "ledger-transport", + "libc", + "log", + "thiserror 1.0.69", +] + +[[package]] +name = "ledger_bitcoin_client" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bb192e14da7725505c49791fde863bafee2b28dede2f37e05559fe72c29416" +dependencies = [ + "async-trait", + "bitcoin", + "miniscript", +] + [[package]] name = "libc" -version = "0.2.180" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libredox" @@ -2100,7 +2281,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "libc", ] @@ -2135,6 +2316,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -2179,9 +2366,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniscript" @@ -2215,6 +2408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", + "log", "wasi", "windows-sys 0.61.2", ] @@ -2240,9 +2434,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "native-tls" -version = "0.2.14" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" dependencies = [ "libc", "log", @@ -2255,6 +2449,59 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.11.0", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + +[[package]] +name = "noise-protocol" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2473d39689a839f5a363aaef7d99f76d5611bf352286682b25a6644fec18b1d3" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "noise-rust-crypto" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c6159f60beb3bbbcdc266bc789bfc6c37fdad7d7ca7152d3e049ef5af633f0" +dependencies = [ + "aes-gcm 0.10.3", + "blake2", + "chacha20poly1305 0.10.1", + "noise-protocol", + "sha2 0.10.9", + "x25519-dalek", + "zeroize", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -2264,6 +2511,34 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -2282,19 +2557,13 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "openssl" version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "cfg-if", "foreign-types", "libc", @@ -2311,14 +2580,14 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "openssl-probe" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openssl-sys" @@ -2372,8 +2641,8 @@ dependencies = [ "bitcoin-hpke", "bitcoin-ohttp", "bitcoin_uri", - "http", - "reqwest", + "http 1.4.0", + "reqwest 0.12.28", "serde", "serde_json", "tracing", @@ -2464,46 +2733,155 @@ dependencies = [ "universal-hash 0.4.0", ] +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "opaque-debug", + "universal-hash 0.5.1", +] + [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.116", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive 0.13.5", +] + +[[package]] +name = "prost-build" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ - "portable-atomic", + "bytes", + "heck 0.4.1", + "itertools 0.10.5", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease 0.1.25", + "prost 0.11.9", + "prost-types", + "regex", + "syn 1.0.109", + "tempfile", + "which", ] [[package]] -name = "potential_utf" -version = "0.1.4" +name = "prost-derive" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ - "zerovec", + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] -name = "ppv-lite86" -version = "0.2.21" +name = "prost-derive" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ - "zerocopy", + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.116", ] [[package]] -name = "proc-macro2" -version = "1.0.105" +name = "prost-types" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "unicode-ident", + "prost 0.11.9", ] [[package]] @@ -2519,8 +2897,8 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls 0.23.36", - "socket2", - "thiserror 2.0.17", + "socket2 0.6.2", + "thiserror 2.0.18", "tokio", "tracing", "web-time", @@ -2541,7 +2919,7 @@ dependencies = [ "rustls 0.23.36", "rustls-pki-types", "slab", - "thiserror 2.0.17", + "thiserror 2.0.18", "tinyvec", "tracing", "web-time", @@ -2556,16 +2934,16 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.6.2", "tracing", "windows-sys 0.60.2", ] [[package]] name = "quote" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -2650,7 +3028,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", ] [[package]] @@ -2661,14 +3039,14 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.17", "libredox", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -2678,9 +3056,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -2689,9 +3067,50 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" + +[[package]] +name = "reqwest" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-rustls 0.24.2", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-rustls 0.24.1", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.4", + "winreg", +] [[package]] name = "reqwest" @@ -2702,11 +3121,11 @@ dependencies = [ "base64 0.22.1", "bytes", "futures-core", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper", - "hyper-rustls", + "hyper 1.8.1", + "hyper-rustls 0.27.7", "hyper-tls", "hyper-util", "js-sys", @@ -2723,7 +3142,7 @@ dependencies = [ "sync_wrapper 1.0.2", "tokio", "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.26.4", "tower", "tower-http", "tower-service", @@ -2731,7 +3150,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 1.0.5", + "webpki-roots 1.0.6", ] [[package]] @@ -2740,7 +3159,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hmac", + "hmac 0.12.1", "subtle", ] @@ -2764,7 +3183,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2787,16 +3206,29 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.11.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + [[package]] name = "rustix" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.11.0", "windows-sys 0.61.2", ] @@ -2823,7 +3255,7 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.8", + "rustls-webpki 0.103.9", "subtle", "zeroize", ] @@ -2839,9 +3271,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.3" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4910321ebe4151be888e35fe062169554e74aad01beafed60410131420ceffbc" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ "web-time", "zeroize", @@ -2859,9 +3291,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.8" +version = "0.103.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" dependencies = [ "aws-lc-rs", "ring", @@ -2877,9 +3309,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "schannel" @@ -2926,7 +3358,7 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ - "bitcoin_hashes 0.14.1", + "bitcoin_hashes 0.13.0", "rand 0.8.5", "secp256k1-sys", "serde", @@ -2943,12 +3375,12 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "d17b898a6d6948c3a8ee4372c17cb384f90d2e6e912ef00895b14fd7ab54ec38" dependencies = [ - "bitflags 2.9.3", - "core-foundation 0.9.4", + "bitflags 2.11.0", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -2956,9 +3388,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.15.0" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +checksum = "321c8673b092a9a42605034a9879d73cb79101ed5fd117bc9a597b89b4e9e61a" dependencies = [ "core-foundation-sys", "libc", @@ -2966,9 +3398,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] name = "serde" @@ -2980,22 +3412,14 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_core" -version = "1.0.228" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" -dependencies = [ - "serde_derive", -] - [[package]] name = "serde_bytes" -version = "0.11.17" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -3008,6 +3432,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + [[package]] name = "serde_derive" version = "1.0.228" @@ -3016,7 +3449,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3053,6 +3486,25 @@ dependencies = [ "serde", ] +[[package]] +name = "serialport" +version = "4.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acaf3f973e8616d7ceac415f53fc60e190b2a686fbcf8d27d0256c741c5007b" +dependencies = [ + "bitflags 2.11.0", + "cfg-if", + "core-foundation 0.10.1", + "core-foundation-sys", + "io-kit-sys", + "libudev", + "mach2", + "nix 0.26.4", + "scopeguard", + "unescaper", + "winapi", +] + [[package]] name = "sha2" version = "0.9.9" @@ -3108,15 +3560,15 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", - "rand_core", + "digest 0.10.7", + "rand_core 0.6.4", ] [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -3148,9 +3600,19 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.1" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" dependencies = [ "libc", "windows-sys 0.60.2", @@ -3186,9 +3648,20 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.114" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb" dependencies = [ "proc-macro2", "quote", @@ -3218,7 +3691,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3244,14 +3717,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.24.0" +version = "3.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.1", "once_cell", - "rustix", + "rustix 1.1.3", "windows-sys 0.61.2", ] @@ -3275,11 +3748,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -3290,18 +3763,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.116", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3350,7 +3823,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.6.2", "tokio-macros", "windows-sys 0.61.2", ] @@ -3363,7 +3836,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3376,6 +3849,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.4" @@ -3386,6 +3869,33 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-serial" +version = "5.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa1d5427f11ba7c5e6384521cfd76f2d64572ff29f3f4f7aa0f496282923fdc8" +dependencies = [ + "cfg-if", + "futures", + "log", + "mio-serial", + "serialport", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -3457,10 +3967,10 @@ version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.9.3", + "bitflags 2.11.0", "bytes", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "iri-string", "pin-project-lite", @@ -3500,7 +4010,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3550,11 +4060,20 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "unescaper" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4064ed685c487dbc25bd3f0e9548f2e34bab9d18cefc700f9ec2dba74ba1138e" +dependencies = [ + "thiserror 2.0.18", +] + [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-normalization" @@ -3571,6 +4090,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "universal-hash" version = "0.4.0" @@ -3664,6 +4189,15 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.108" @@ -3710,7 +4244,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.116", "wasm-bindgen-shared", ] @@ -3723,6 +4257,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" version = "0.3.85" @@ -3751,13 +4319,25 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" dependencies = [ "rustls-pki-types", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3791,9 +4371,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.61.2" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", @@ -3804,24 +4384,24 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -3832,18 +4412,18 @@ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] @@ -3866,6 +4446,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.60.2" @@ -4079,11 +4668,103 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wit-bindgen" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap", + "prettyplease 0.2.37", + "syn 2.0.116", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease 0.2.37", + "proc-macro2", + "quote", + "syn 2.0.116", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" @@ -4098,7 +4779,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ "curve25519-dalek", - "rand_core", + "rand_core 0.6.4", "zeroize", ] @@ -4121,28 +4802,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] @@ -4162,7 +4843,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", "synstructure", ] @@ -4183,7 +4864,7 @@ checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.116", ] [[package]] @@ -4216,11 +4897,11 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.106", + "syn 2.0.116", ] [[package]] name = "zmij" -version = "1.0.14" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd8f3f50b848df28f887acb68e41201b5aea6bc8a8dacc00fb40635ff9a72fea" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index 0855c74..cf2c653 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ shlex = { version = "1.3.0", optional = true } payjoin = { version = "1.0.0-rc.1", features = ["v1", "v2", "io", "_test-utils"], optional = true} reqwest = { version = "0.12.23", default-features = false, optional = true } url = { version = "2.5.4", optional = true } +async-hwi ={ version = "0.0.29", optional = true } [features] default = ["repl", "sqlite"] diff --git a/src/commands.rs b/src/commands.rs index aa46801..6a0fdc9 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -132,6 +132,14 @@ pub enum CliSubCommand { }, /// List all saved wallet configurations. Wallets, + #[cfg(feature = "hwi")] + /// Hardware wallet interface operations. + Hwi { + #[command(flatten)] + hwi_opts: HwiOpts, + #[clap(subcommand)] + subcommand: HwiSubCommand, + }, } /// Wallet operation subcommands. #[derive(Debug, Subcommand, Clone, PartialEq)] diff --git a/src/error.rs b/src/error.rs index 3690d4f..b82b1ba 100644 --- a/src/error.rs +++ b/src/error.rs @@ -140,6 +140,9 @@ pub enum BDKCliError { #[cfg(feature = "payjoin")] #[error("Payjoin create request error: {0}")] PayjoinCreateRequest(#[from] payjoin::send::v2::CreateRequestError), + #[cfg(feature = "hwi")] + #[error("HWI error: {0}")] + HwiError(#[from] async_hwi::Error), } impl From for BDKCliError { diff --git a/src/handlers.rs b/src/handlers.rs index 12cd777..b6d8621 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -1196,9 +1196,150 @@ pub fn handle_wallets_subcommand(datadir: &Path, pretty: bool) -> Result Result { + match subcommand { + HwiSubCommand::Devices => { + let devices = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; + let device = if let Some(device) = devices { + json!({ + "fingerprint": device.get_master_fingerprint().await?.to_string(), + "model": device.device_kind().to_string(), + }) + } else { + json!(null) + }; + Ok(json!({ "devices": device })) + } + HwiSubCommand::Register => { + let policy = hwi_opts.ext_descriptor.clone().ok_or_else(|| { + Error::Generic("External descriptor required for wallet registration".to_string()) + })?; + let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { + Error::Generic("Wallet name is required for wallet registration".to_string()) + })?; + + let device = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; + + match device { + None => Ok(json!({ + "success": false, + "error": "No hardware wallet detected" + })), + Some(device) => match device.register_wallet(&wallet_name, &policy).await { + Ok(hmac_opt) => { + let hmac_hex = hmac_opt.map(|h| { + let bytes: &[u8] = &h; + bytes.to_lower_hex_string() + }); + Ok(json!({ + "success": true, + "hmac": hmac_hex + })) + } + Err(e) => Err(Error::Generic(format!("Wallet registration failed: {e}"))), + }, + } + } + HwiSubCommand::Address => { + let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { + Error::Generic("External descriptor required for address generation".to_string()) + })?; + let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { + Error::Generic("Wallet name is required for address generation".to_string()) + })?; + + let database = hwi_opts.database_type.clone().ok_or_else(|| { + Error::Generic("Database type is required for address generation".to_string()) + })?; + + let home_dir = prepare_home_dir(None)?; + let database_path = prepare_wallet_db_dir(&home_dir, wallet_name.as_str())?; + + let wallet_opts = WalletOpts { + wallet: Some(wallet_name), + verbose: false, + ext_descriptor: ext_descriptor, + int_descriptor: None, + #[cfg(any( + feature = "electrum", + feature = "esplora", + feature = "rpc", + feature = "cbf" + ))] + client_type: { + if cfg!(feature = "electrum") { + ClientType::Electrum + } else if cfg!(feature = "esplora") { + ClientType::Esplora + } else if cfg!(feature = "rpc") { + ClientType::Rpc + } else { + ClientType::Cbf + } + }, + #[cfg(any(feature = "sqlite", feature = "redb"))] + database_type: database, + #[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))] + url: String::new(), + #[cfg(feature = "electrum")] + batch_size: 10, + #[cfg(feature = "esplora")] + parallel_requests: 5, + #[cfg(feature = "rpc")] + basic_auth: (String::new(), String::new()), + #[cfg(feature = "rpc")] + cookie: None, + #[cfg(feature = "cbf")] + compactfilter_opts: CompactFilterOpts { conn_count: 2 }, + }; + + #[cfg(feature = "sqlite")] + let mut wallet = if hwi_opts.database_type.is_some() { + let db_file = database_path.join("wallet.sqlite"); + let mut persister = Connection::open(db_file)?; + let mut wallet = new_persisted_wallet(network, &mut persister, &wallet_opts)?; + wallet.persist(&mut persister)?; + wallet + } else { + return Err(Error::Generic( + "Could not connect to sqlite database".to_string(), + )); + }; + + #[cfg(not(feature = "sqlite"))] + let mut wallet = new_wallet(network, &wallet_opts)?; + + let address = wallet.next_unused_address(KeychainKind::External); + Ok(json!({ "address": address.address })) + } + HwiSubCommand::Sign { psbt } => { + let mut psbt = Psbt::from_str(&psbt) + .map_err(|e| Error::Generic(format!("Failed to parse PSBT: {e}")))?; + let device = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; + let signed_psbt = if let Some(device) = device { + device + .sign_tx(&mut psbt) + .await + .map_err(|e| Error::Generic(format!("Failed to sign PSBT: {e}")))?; + Some(psbt.to_string()) + } else { + None + }; + Ok(json!({ "psbt": signed_psbt })) + } + } +} + /// The global top level handler. pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { let pretty = cli_opts.pretty; + let network = cli_opts.network; let subcommand = cli_opts.subcommand.clone(); let result: Result = match subcommand { @@ -1315,15 +1456,14 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { &wallet_opts, &cli_opts, offline_subcommand.clone(), - ) + )? }; - Ok(result?) + Ok(result) } CliSubCommand::Wallet { wallet, subcommand: WalletSubCommand::Config { force, wallet_opts }, } => { - let network = cli_opts.network; let home_dir = prepare_home_dir(cli_opts.datadir)?; let result = handle_config_subcommand(&home_dir, network, wallet, &wallet_opts, force)?; Ok(result) @@ -1336,7 +1476,6 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { CliSubCommand::Key { subcommand: key_subcommand, } => { - let network = cli_opts.network; let result = handle_key_subcommand(network, key_subcommand, pretty)?; Ok(result) } @@ -1345,7 +1484,6 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { policy, script_type, } => { - let network = cli_opts.network; let result = handle_compile_subcommand(network, policy, script_type, pretty)?; Ok(result) } diff --git a/src/utils.rs b/src/utils.rs index 2772f37..0832f94 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -62,9 +62,7 @@ use bdk_wallet::Wallet; use bdk_wallet::{PersistedWallet, WalletPersister}; use bdk_wallet::bip39::{Language, Mnemonic}; -use bdk_wallet::bitcoin::{ - Address, Network, OutPoint, ScriptBuf, bip32::Xpriv, secp256k1::Secp256k1, -}; +use bdk_wallet::bitcoin::{bip32::Xpriv, secp256k1::Secp256k1}; use bdk_wallet::descriptor::Segwitv0; use bdk_wallet::keys::{GeneratableKey, GeneratedKey, bip39::WordCount}; use serde_json::{Value, json}; @@ -676,3 +674,111 @@ pub fn load_wallet_config( Ok((wallet_opts, network)) } + +#[cfg(feature = "hwi")] +pub async fn connect_to_hardware_wallet( + network: Network, + hwi_opts: &HwiOpts, +) -> Result>, Error> { + if let Ok(device) = SpecterSimulator::try_connect().await { + return Ok(Some(device.into())); + } + + if let Ok(devices) = Specter::enumerate().await { + if let Some(device) = devices.into_iter().next() { + return Ok(Some(device.into())); + } + } + + match Jade::enumerate().await { + Err(e) => { + println!("Jade enumeration error: {e:?}"); + } + Ok(devices) => { + for device in devices { + let device = device.with_network(network); + if let Ok(info) = device.get_info().await { + if info.jade_state == jade::api::JadeState::Locked { + if let Err(e) = device.auth().await { + eprintln!("Jade auth error: {:?}", e); + continue; + } + } + return Ok(Some(device.into())); + } + } + } + } + + if let Ok(device) = LedgerSimulator::try_connect().await { + return Ok(Some(device.into())); + } + + let api = Box::new(HidApi::new().map_err(|e| Error::Generic(e.to_string()))?); + + for device_info in api.device_list() { + let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { + Error::Generic("External descriptor is required for connecting to bitbox and coldcard hardware devices".to_string()) + })?; + let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { + Error::Generic( + "Wallet name is required for connecting to bitbox and coldcard hardware devices" + .to_string(), + ) + })?; + if async_hwi::bitbox::is_bitbox02(device_info) { + if let Ok(device) = device_info + .open_device(&api) + .map_err(|e| Error::Generic(e.to_string())) + { + if let Ok(device) = + PairingBitbox02WithLocalCache::::connect(device, None) + .await + { + if let Ok((device, _)) = device.wait_confirm().await { + let mut bb02 = BitBox02::from(device).with_network(network); + bb02 = bb02 + .with_policy(&ext_descriptor.as_str()) + .map_err(Error::HwiError)?; + return Ok(Some(bb02.into())); + } + } + } + } + if device_info.vendor_id() == coldcard::api::COINKITE_VID + && device_info.product_id() == coldcard::api::CKCC_PID + { + if let Some(sn) = device_info.serial_number() { + if let Ok((cc, _)) = coldcard::api::Coldcard::open(&api, sn, None) + .map_err(|e| Error::Generic(e.to_string())) + { + let mut hw = coldcard::Coldcard::from(cc); + hw = hw.with_wallet_name(wallet_name.to_string()); + return Ok(Some(hw.into())); + } + } + } + } + + for detected in Ledger::::enumerate(&api) { + let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { + Error::Generic( + "External descriptor required for connecting to ledger hardware device".to_string(), + ) + })?; + let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { + Error::Generic( + "Wallet name is required for connecting to ledger hardware device".to_string(), + ) + })?; + + if let Ok(mut device) = Ledger::::connect(&api, detected) { + device = device + .with_wallet(wallet_name, &ext_descriptor, None) + .map_err(Error::HwiError)?; + return Ok(Some(device.into())); + } + } + + Ok(None) +} From 121336d34ca3c11aae9e55df647891a4013c1da1 Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Sat, 21 Feb 2026 20:45:05 +0100 Subject: [PATCH 7/8] feat(hwi): Update hwi lib to v0.0.30 --- Cargo.lock | 67 ++++++++++++++++++-- Cargo.toml | 2 +- src/commands.rs | 4 -- src/handlers.rs | 161 ++++++++++++++---------------------------------- src/utils.rs | 142 ++++++++++++++++++++---------------------- 5 files changed, 178 insertions(+), 198 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0fc647c..3da2c02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,15 +173,17 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-hwi" -version = "0.0.29" +version = "0.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "724d232316bc0d9ce24eb3b3a6c600f487bd877513bd0e73ec02f8c890af3275" +checksum = "2d91656c4b2edeabc189dd872e09d338b4df1e127f098c17b393292c07eab666" dependencies = [ "async-trait", "bitbox-api", "bitcoin", "coldcard", + "crossbeam", "futures", + "hex", "hidapi", "ledger-apdu", "ledger-transport-hidapi", @@ -194,6 +196,7 @@ dependencies = [ "serialport", "tokio", "tokio-serial", + "tracing", ] [[package]] @@ -463,7 +466,7 @@ version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes 0.14.1", "serde", "unicode-normalization", ] @@ -1013,6 +1016,62 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crunchy" version = "0.2.4" @@ -3358,7 +3417,7 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes 0.14.1", "rand 0.8.5", "secp256k1-sys", "serde", diff --git a/Cargo.toml b/Cargo.toml index cf2c653..01e29f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ shlex = { version = "1.3.0", optional = true } payjoin = { version = "1.0.0-rc.1", features = ["v1", "v2", "io", "_test-utils"], optional = true} reqwest = { version = "0.12.23", default-features = false, optional = true } url = { version = "2.5.4", optional = true } -async-hwi ={ version = "0.0.29", optional = true } +async-hwi ={ version = "0.0.30", features = ["service", "coldcard", "ledger", "jade", "bitbox"], optional = true } [features] default = ["repl", "sqlite"] diff --git a/src/commands.rs b/src/commands.rs index 6a0fdc9..ee0e110 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -266,10 +266,6 @@ pub struct HwiOpts { /// External descriptor #[arg(env = "EXT_DESCRIPTOR", short = 'e', long = "ext_descriptor")] pub ext_descriptor: Option, - - /// Database type - #[arg(short = 'd', long = "database_type")] - pub database_type: Option, } /// Options to configure a SOCKS5 proxy for a blockchain client connection. diff --git a/src/handlers.rs b/src/handlers.rs index b6d8621..8a11f6c 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -23,8 +23,6 @@ use bdk_redb::Store as RedbStore; use bdk_wallet::bip39::{Language, Mnemonic}; use bdk_wallet::bitcoin::base64::Engine; use bdk_wallet::bitcoin::base64::prelude::BASE64_STANDARD; -#[cfg(feature = "hwi")] -use bdk_wallet::bitcoin::hex::DisplayHex; use bdk_wallet::bitcoin::{ Address, Amount, FeeRate, Network, Psbt, Sequence, Txid, bip32::{DerivationPath, KeySource}, @@ -1203,135 +1201,68 @@ pub async fn handle_hwi_subcommand( hwi_opts: &HwiOpts, subcommand: HwiSubCommand, ) -> Result { + use async_hwi::AddressScript; + use bdk_wallet::bitcoin::hex::DisplayHex; + match subcommand { HwiSubCommand::Devices => { - let devices = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; - let device = if let Some(device) = devices { + let device_opt = crate::utils::connect_hwi_device(network, hwi_opts).await?; + let device = if let Some(device) = device_opt.as_ref() { json!({ - "fingerprint": device.get_master_fingerprint().await?.to_string(), + "fingerprint": device.get_master_fingerprint().await.map_err(Error::HwiError)?.to_string(), "model": device.device_kind().to_string(), }) } else { json!(null) }; - Ok(json!({ "devices": device })) + Ok(json!({ "device": device })) } HwiSubCommand::Register => { - let policy = hwi_opts.ext_descriptor.clone().ok_or_else(|| { - Error::Generic("External descriptor required for wallet registration".to_string()) - })?; - let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { - Error::Generic("Wallet name is required for wallet registration".to_string()) - })?; - - let device = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; - - match device { - None => Ok(json!({ - "success": false, - "error": "No hardware wallet detected" - })), - Some(device) => match device.register_wallet(&wallet_name, &policy).await { - Ok(hmac_opt) => { - let hmac_hex = hmac_opt.map(|h| { - let bytes: &[u8] = &h; - bytes.to_lower_hex_string() - }); - Ok(json!({ - "success": true, - "hmac": hmac_hex - })) - } - Err(e) => Err(Error::Generic(format!("Wallet registration failed: {e}"))), - }, - } + let policy = hwi_opts + .ext_descriptor + .clone() + .ok_or_else(|| Error::Generic("External descriptor required".to_string()))?; + let wallet_name = hwi_opts + .wallet + .clone() + .ok_or_else(|| Error::Generic("Wallet name required".to_string()))?; + let device_opt = crate::utils::connect_hwi_device(network, hwi_opts).await?; + let device = device_opt + .ok_or_else(|| Error::Generic("No hardware wallet detected".to_string()))?; + tracing::debug!( + "Registering wallet '{}' with policy '{}'", + wallet_name, + policy + ); + let hmac_opt = device + .register_wallet(&wallet_name, &policy) + .await + .map_err(Error::HwiError)?; + let hmac_hex = hmac_opt.map(|h| h.to_lower_hex_string()); + Ok(json!({ "success": true, "hmac": hmac_hex })) } HwiSubCommand::Address => { - let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { - Error::Generic("External descriptor required for address generation".to_string()) - })?; - let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { - Error::Generic("Wallet name is required for address generation".to_string()) - })?; - - let database = hwi_opts.database_type.clone().ok_or_else(|| { - Error::Generic("Database type is required for address generation".to_string()) - })?; - - let home_dir = prepare_home_dir(None)?; - let database_path = prepare_wallet_db_dir(&home_dir, wallet_name.as_str())?; - - let wallet_opts = WalletOpts { - wallet: Some(wallet_name), - verbose: false, - ext_descriptor: ext_descriptor, - int_descriptor: None, - #[cfg(any( - feature = "electrum", - feature = "esplora", - feature = "rpc", - feature = "cbf" - ))] - client_type: { - if cfg!(feature = "electrum") { - ClientType::Electrum - } else if cfg!(feature = "esplora") { - ClientType::Esplora - } else if cfg!(feature = "rpc") { - ClientType::Rpc - } else { - ClientType::Cbf - } - }, - #[cfg(any(feature = "sqlite", feature = "redb"))] - database_type: database, - #[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))] - url: String::new(), - #[cfg(feature = "electrum")] - batch_size: 10, - #[cfg(feature = "esplora")] - parallel_requests: 5, - #[cfg(feature = "rpc")] - basic_auth: (String::new(), String::new()), - #[cfg(feature = "rpc")] - cookie: None, - #[cfg(feature = "cbf")] - compactfilter_opts: CompactFilterOpts { conn_count: 2 }, + let device_opt = crate::utils::connect_hwi_device(network, hwi_opts).await?; + let device = device_opt + .ok_or_else(|| Error::Generic("No hardware wallet detected".to_string()))?; + let address_script = AddressScript::Miniscript { + index: 0, + change: false, }; - - #[cfg(feature = "sqlite")] - let mut wallet = if hwi_opts.database_type.is_some() { - let db_file = database_path.join("wallet.sqlite"); - let mut persister = Connection::open(db_file)?; - let mut wallet = new_persisted_wallet(network, &mut persister, &wallet_opts)?; - wallet.persist(&mut persister)?; - wallet - } else { - return Err(Error::Generic( - "Could not connect to sqlite database".to_string(), - )); - }; - - #[cfg(not(feature = "sqlite"))] - let mut wallet = new_wallet(network, &wallet_opts)?; - - let address = wallet.next_unused_address(KeychainKind::External); - Ok(json!({ "address": address.address })) + device + .display_address(&address_script) + .await + .map_err(Error::HwiError)?; + Ok(json!({ "success": true, "message": "Address displayed and verified on device" })) } HwiSubCommand::Sign { psbt } => { let mut psbt = Psbt::from_str(&psbt) .map_err(|e| Error::Generic(format!("Failed to parse PSBT: {e}")))?; - let device = crate::utils::connect_to_hardware_wallet(network, hwi_opts).await?; - let signed_psbt = if let Some(device) = device { - device - .sign_tx(&mut psbt) - .await - .map_err(|e| Error::Generic(format!("Failed to sign PSBT: {e}")))?; - Some(psbt.to_string()) - } else { - None - }; - Ok(json!({ "psbt": signed_psbt })) + let device_opt = crate::utils::connect_hwi_device(network, hwi_opts).await?; + let device = device_opt + .ok_or_else(|| Error::Generic("No hardware wallet detected".to_string()))?; + device.sign_tx(&mut psbt).await.map_err(Error::HwiError)?; + Ok(json!({ "psbt": psbt.to_string() })) } } } @@ -1570,7 +1501,7 @@ pub(crate) async fn handle_command(cli_opts: CliOpts) -> Result { subcommand, } => { let result = handle_hwi_subcommand(network, &hwi_opts, subcommand).await?; - Ok(serde_json::to_string_pretty(&result).map_err(|e| Error::SerdeJson(e))?) + Ok(serde_json::to_string_pretty(&result).map_err(Error::SerdeJson)?) } }; result diff --git a/src/utils.rs b/src/utils.rs index 0832f94..73aeefb 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -37,17 +37,7 @@ use bdk_wallet::{ }; use cli_table::{Cell, CellStruct, Style, Table}; #[cfg(feature = "hwi")] -use { - crate::commands::HwiOpts, - async_hwi::jade::{self, Jade}, - async_hwi::ledger::{HidApi, Ledger, LedgerSimulator, TransportHID}, - async_hwi::specter::{Specter, SpecterSimulator}, - async_hwi::{HWI, coldcard}, - async_hwi::{ - bitbox::api::runtime, - bitbox::{BitBox02, PairingBitbox02WithLocalCache}, - }, -}; +use std::marker::Sync as MarkerSync; #[cfg(any( feature = "electrum", @@ -676,109 +666,113 @@ pub fn load_wallet_config( } #[cfg(feature = "hwi")] -pub async fn connect_to_hardware_wallet( +pub async fn connect_hwi_device( network: Network, - hwi_opts: &HwiOpts, -) -> Result>, Error> { + hwi_opts: &crate::commands::HwiOpts, +) -> Result>, Error> { + use async_hwi::bitbox::{BitBox02, PairingBitbox02WithLocalCache, api::runtime}; + use async_hwi::coldcard::api::{CKCC_PID, COINKITE_VID, Coldcard}; + use async_hwi::jade::{self, Jade}; + use async_hwi::ledger::{HidApi, Ledger, LedgerSimulator, TransportHID}; + use async_hwi::specter::{Specter, SpecterSimulator}; + use async_hwi::{HWI, coldcard}; + use tracing::{debug, info, warn}; + + let api = Box::new(HidApi::new().map_err(|e| Error::Generic(e.to_string()))?); + + let mut devices: Vec> = Vec::new(); + if let Ok(device) = SpecterSimulator::try_connect().await { - return Ok(Some(device.into())); + devices.push(Arc::new(device)); } - if let Ok(devices) = Specter::enumerate().await { - if let Some(device) = devices.into_iter().next() { - return Ok(Some(device.into())); + // Specter + if let Ok(specters) = Specter::enumerate().await { + for device in specters { + devices.push(Arc::new(device)); } } + // Jade match Jade::enumerate().await { - Err(e) => { - println!("Jade enumeration error: {e:?}"); - } - Ok(devices) => { - for device in devices { - let device = device.with_network(network); + Ok(jades) => { + for mut device in jades { + device = device.with_network(network); if let Ok(info) = device.get_info().await { if info.jade_state == jade::api::JadeState::Locked { if let Err(e) = device.auth().await { - eprintln!("Jade auth error: {:?}", e); + warn!("Jade auth failed: {:?}", e); continue; } } - return Ok(Some(device.into())); + devices.push(Arc::new(device)); } } } + Err(e) => warn!("Jade enumeration failed: {:?}", e), } - + // LedgerSimulator if let Ok(device) = LedgerSimulator::try_connect().await { - return Ok(Some(device.into())); + devices.push(Arc::new(device)); } - let api = Box::new(HidApi::new().map_err(|e| Error::Generic(e.to_string()))?); - for device_info in api.device_list() { - let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { - Error::Generic("External descriptor is required for connecting to bitbox and coldcard hardware devices".to_string()) - })?; - let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { - Error::Generic( - "Wallet name is required for connecting to bitbox and coldcard hardware devices" - .to_string(), - ) - })?; if async_hwi::bitbox::is_bitbox02(device_info) { - if let Ok(device) = device_info - .open_device(&api) - .map_err(|e| Error::Generic(e.to_string())) - { - if let Ok(device) = - PairingBitbox02WithLocalCache::::connect(device, None) - .await + if let Ok(device_handle) = device_info.open_device(&api) { + if let Ok(device) = PairingBitbox02WithLocalCache::::connect( + device_handle, + None, + ) + .await { if let Ok((device, _)) = device.wait_confirm().await { let mut bb02 = BitBox02::from(device).with_network(network); - bb02 = bb02 - .with_policy(&ext_descriptor.as_str()) - .map_err(Error::HwiError)?; - return Ok(Some(bb02.into())); + if let Some(policy) = hwi_opts.ext_descriptor.as_ref() { + bb02 = bb02 + .with_policy(policy) + .map_err(|e| Error::Generic(e.to_string()))?; + } + devices.push(Arc::new(bb02)); } } } } - if device_info.vendor_id() == coldcard::api::COINKITE_VID - && device_info.product_id() == coldcard::api::CKCC_PID - { + + if device_info.vendor_id() == COINKITE_VID && device_info.product_id() == CKCC_PID { if let Some(sn) = device_info.serial_number() { - if let Ok((cc, _)) = coldcard::api::Coldcard::open(&api, sn, None) - .map_err(|e| Error::Generic(e.to_string())) - { + debug!("Coldcard detected with SN: {}", sn); + if let Ok((cc, _)) = Coldcard::open(&api, sn, None) { let mut hw = coldcard::Coldcard::from(cc); - hw = hw.with_wallet_name(wallet_name.to_string()); - return Ok(Some(hw.into())); + if let Some(wallet_name) = hwi_opts.wallet.as_ref() { + hw = hw.with_wallet_name(wallet_name.clone()); + } + info!("Coldcard connected successfully."); + devices.push(Arc::new(hw)); + } else { + warn!("Failed to open Coldcard with SN: {}", sn); } } } } for detected in Ledger::::enumerate(&api) { - let ext_descriptor = hwi_opts.ext_descriptor.clone().ok_or_else(|| { - Error::Generic( - "External descriptor required for connecting to ledger hardware device".to_string(), - ) - })?; - let wallet_name = hwi_opts.wallet.clone().ok_or_else(|| { - Error::Generic( - "Wallet name is required for connecting to ledger hardware device".to_string(), - ) - })?; - if let Ok(mut device) = Ledger::::connect(&api, detected) { - device = device - .with_wallet(wallet_name, &ext_descriptor, None) - .map_err(Error::HwiError)?; - return Ok(Some(device.into())); + if let Some(wallet_name) = hwi_opts.wallet.as_ref() { + if let Some(policy) = hwi_opts.ext_descriptor.as_ref() { + device = device + .with_wallet(wallet_name, policy, None) + .map_err(|e| Error::Generic(e.to_string()))?; + } + } + devices.push(Arc::new(device)); } } - Ok(None) + if devices.is_empty() { + warn!("No hardware devices detected. Ensure device is connected"); + Ok(None) + } else { + info!("Detected {} devices; returning first.", devices.len()); + Ok(Some(devices.into_iter().next().unwrap())) + } } From c61d84882d51de3113e3bcb08be93edf660e9a89 Mon Sep 17 00:00:00 2001 From: Vihiga Tyonum Date: Wed, 25 Feb 2026 13:44:37 +0100 Subject: [PATCH 8/8] CI: Update workflows and add hwi feat deps - update code_coverage workflow to use the latest actions - add hidapi dependencies to workflows to fix failing compilation --- .github/workflows/code_coverage.yml | 9 ++++----- .github/workflows/cont_integration.yml | 9 ++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 9c947b1..0918b4a 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -13,22 +13,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y libudev-dev libusb-1.0-0-dev lcov + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config lcov - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable override: true profile: minimal components: llvm-tools-preview - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.8 + cache: true - name: Install grcov run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi - name: Test diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 727f042..37e50e2 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -22,6 +22,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config - name: Setup Rust Toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -45,7 +49,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libudev-dev libusb-1.0-0-dev pkg-config - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: