From 919a9707e8dd78b17acb615b22466daa7804d6c9 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Wed, 12 Jun 2024 10:52:00 -0400 Subject: [PATCH 01/41] version updated to 0.18.0 --- Cargo.lock | 188 ++++++++++++++++++++++++++++++----------------- Cargo.toml | 10 +-- README.md | 2 +- python/README.md | 36 +++++---- 4 files changed, 148 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f985c9..0cfa7af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,6 +142,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "askama" version = "0.12.0" @@ -206,6 +212,16 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals 0.3.0", + "bitcoin_hashes 0.14.0", +] + [[package]] name = "base64" version = "0.13.1" @@ -275,9 +291,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bech32" -version = "0.10.0-beta" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bhttp" @@ -335,16 +351,19 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.31.2" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" +checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6" dependencies = [ - "bech32 0.10.0-beta", - "bitcoin-internals 0.2.0", - "bitcoin_hashes 0.13.0", - "hex-conservative", + "base58ck", + "bech32 0.11.0", + "bitcoin-internals 0.3.0", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes 0.14.0", + "hex-conservative 0.2.1", "hex_lit", - "secp256k1 0.28.2", + "secp256k1 0.29.0", "serde", ] @@ -359,16 +378,38 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" dependencies = [ "serde", ] +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + [[package]] name = "bitcoin-private" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals 0.3.0", + "serde", +] + [[package]] name = "bitcoin_hashes" version = "0.11.0" @@ -392,15 +433,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" dependencies = [ "bitcoin-internals 0.2.0", - "hex-conservative", + "hex-conservative 0.1.2", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative 0.2.1", "serde", ] [[package]] name = "bitcoincore-rpc" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb70725a621848c83b3809913d5314c0d20ca84877d99dd909504b564edab00" +checksum = "aedd23ae0fd321affb4bbbc36126c6f49a32818dc6b979395d24da8c9d4e80ee" dependencies = [ "bitcoincore-rpc-json", "jsonrpc", @@ -411,11 +462,11 @@ dependencies = [ [[package]] name = "bitcoincore-rpc-json" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856ffbee2e492c23bca715d72ea34aae80d58400f2bda26a82015d6bc2ec3662" +checksum = "d8909583c5fab98508e80ef73e5592a651c954993dc6b7739963257d19f0e71a" dependencies = [ - "bitcoin 0.31.2", + "bitcoin 0.32.2", "serde", "serde_json", ] @@ -608,7 +659,7 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.48", @@ -886,6 +937,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hex" version = "0.4.3" @@ -898,6 +955,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] + [[package]] name = "hex_lit" version = "0.1.1" @@ -1008,11 +1074,12 @@ dependencies = [ [[package]] name = "jsonrpc" -version = "0.14.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8128f36b47411cd3f044be8c1f5cc0c9e24d1d1bfdc45f0a57897b32513053f2" +checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" dependencies = [ "base64 0.13.1", + "minreq", "serde", "serde_json", ] @@ -1093,6 +1160,17 @@ dependencies = [ "adler", ] +[[package]] +name = "minreq" +version = "2.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64" +dependencies = [ + "log", + "serde", + "serde_json", +] + [[package]] name = "nom" version = "7.1.3" @@ -1141,12 +1219,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "oneshot-uniffi" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -1202,7 +1274,7 @@ dependencies = [ [[package]] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" dependencies = [ "base64 0.22.1", "bdk", @@ -1467,13 +1539,13 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes 0.12.0", + "bitcoin_hashes 0.13.0", "rand", - "secp256k1-sys 0.9.2", + "secp256k1-sys 0.10.0", "serde", ] @@ -1488,9 +1560,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" dependencies = [ "cc", ] @@ -1663,8 +1735,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" dependencies = [ "smawk", - "unicode-linebreak", - "unicode-width", ] [[package]] @@ -1760,12 +1830,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - [[package]] name = "unicode-normalization" version = "0.1.22" @@ -1775,17 +1839,11 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "uniffi" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5566fae48a5cb017005bf9cd622af5236b2a203a13fb548afde3506d3c68277" +checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", @@ -1798,19 +1856,18 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a77bb514bcd4bf27c9bd404d7c3f2a6a8131b957eba9c22cfeb7751c4278e09" +checksum = "96061d7e01b185aa405f7c9b134741ab3e50cc6796a47d6fd8ab9a5364b5feed" dependencies = [ "anyhow", "askama", "camino", "cargo_metadata", - "clap", "fs-err", "glob", "goblin", - "heck", + "heck 0.5.0", "once_cell", "paste", "serde", @@ -1823,9 +1880,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cba427aeb7b3a8b54830c4c915079a7a3c62608dd03dddba1d867a8a023eb4" +checksum = "9d6b86f9b221046af0c533eafe09ece04e2f1ded04ccdc9bba0ec09aec1c52bd" dependencies = [ "anyhow", "camino", @@ -1834,9 +1891,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e5a6c33b1dec3f255f57ec0b6af0f0b2bb3021868be1d5eec7a38e2905ebc" +checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" dependencies = [ "quote", "syn 2.0.48", @@ -1844,25 +1901,24 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea3eb5474d50fc149b7e4d86b9c5bd4a61dcc167f0683902bf18ae7bbb3deef" +checksum = "3210d57d6ab6065ab47a2898dacdb7c606fd6a4156196831fa3bf82e34ac58a6" dependencies = [ "anyhow", "bytes", "camino", "log", "once_cell", - "oneshot-uniffi", "paste", "static_assertions", ] [[package]] name = "uniffi_macros" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18331d35003f46f0d04047fbe4227291815b83a937a8c32bc057f990962182c4" +checksum = "b58691741080935437dc862122e68d7414432a11824ac1137868de46181a0bd2" dependencies = [ "bincode", "camino", @@ -1878,9 +1934,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7224422c4cfd181c7ca9fca2154abca4d21db962f926f270f996edd38b0c4b8" +checksum = "7663eacdbd9fbf4a88907ddcfe2e6fa85838eb6dc2418a7d91eebb3786f8e20b" dependencies = [ "anyhow", "bytes", @@ -1890,9 +1946,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce878d0bdfc288b58797044eaaedf748526c56eef3575380bb4d4b19d69eee" +checksum = "f922465f7566f25f8fe766920205fdfa9a3fcdc209c6bfb7557f0b5bf45b04dd" dependencies = [ "anyhow", "camino", @@ -1903,9 +1959,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c43c9ed40a8d20a5c3eae2d23031092db6b96dc8e571beb449ba9757484cea0" +checksum = "cef408229a3a407fafa4c36dc4f6ece78a6fb258ab28d2b64bddd49c8cb680f6" dependencies = [ "anyhow", "textwrap", diff --git a/Cargo.toml b/Cargo.toml index 4c62728..47d08fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" license = "MIT OR Apache-2.0" edition = "2021" exclude = ["tests"] @@ -10,16 +10,16 @@ crate-type = ["lib", "staticlib", "cdylib"] name = "payjoin_ffi" [build-dependencies] -uniffi = { version = "0.27.1", features = ["build"] } +uniffi = { version = "0.28.0", features = ["build"] } [dev-dependencies] -uniffi = { version = "0.27.1", features = ["bindgen-tests"] } +uniffi = { version = "0.28.0", features = ["bindgen-tests"] } bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bip39"] } -bitcoincore-rpc = "0.18.0" +bitcoincore-rpc = "0.19.0" [dependencies] #https://github.com/payjoin/rust-payjoin/commit/457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373 payjoin = { git= "https://github.com/payjoin/rust-payjoin", rev = "457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373", features = ["send", "receive", "base64", "v2"] } -uniffi = { version = "0.27.1" } +uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } url = "2.5.0" diff --git a/README.md b/README.md index 7d65e19..59729fe 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ rpc_port = "18443" ``` Now, run the integration tests: -The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). +The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). ```shell diff --git a/python/README.md b/python/README.md index be1cc22..1a9ae83 100644 --- a/python/README.md +++ b/python/README.md @@ -1,16 +1,17 @@ # Payjoin -The Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/). +Welcome to the Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! Let's get you up and running with some smooth transactions and a sprinkle of fun. ## Install from PyPI -Install the latest release using +Grab the latest release with a simple: ```shell pip install payjoin ``` -## Run the unit tests +## Running Unit Tests +Follow these steps to clone the repository and run the unit tests: ```shell @@ -27,34 +28,33 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run unit tests +# Run unit tests python -m unittest --verbose test/payjoin_unit_test.py + ``` -## Run the integration test +## Running the Integration Test -Before running the integration test, we need to set up the Bitcoin core properly in the regtest network. If you don't -have Bitcoin Core locally, please refer to this [page](https://learn.saylor.org/mod/page/view.php?id=36347). Or you can -install `Nigiri Bitcoin`, which is a tool designed to simplify the process of running local instances of Bitcoin and -Liquid networks for development and testing purposes. You can refer to -this [link](https://github.com/vulpemventures/nigiri), to install it on your local machine. +Before diving into the integration test, you'll need to set up Bitcoin Core on the regtest network. If you don't have Bitcoin Core installed locally, check out [this installation guide](https://learn.saylor.org/mod/page/view.php?id=36347). Alternatively, you can use `Nigiri Bitcoin`, a tool designed to streamline the process of running local instances of Bitcoin and Liquid networks for development and testing. Follow the instructions [here](https://github.com/vulpemventures/nigiri) to install it on your machine. -Once the nigiri bitcoin starts running, please replace following snippet in `payjoin_integration_test.py`, with you -nigiri bitcoin core credentials. +Once Nigiri Bitcoin is up and running, replace the following snippet in `payjoin_integration_test.py` with your `Nigiri Bitcoin` Core credentials: ``` rpc_user = "bitcoin" rpc_password = "bitcoin" + ``` -NB: The default credentials would be the following +By default, these credentials are: ``` rpc_user = "admin1" rpc_password = "123" rpc_host = "localhost" rpc_port = "18443" + ``` +Now, proceed with the integration test: ```shell @@ -71,11 +71,12 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run the integration test +# Run the integration test python -m unittest --verbose test/payjoin_integration_test.py + ``` -## Build the package +## Building the Package ```shell # Install dependencies @@ -86,4 +87,7 @@ bash ./scripts/generate_macos.sh # Build the wheel python setup.py --verbose bdist_wheel -``` \ No newline at end of file + +``` +We hope everything worked smoothly! Now go forth test, and may your test results be as reliable as the Bitcoin blockchain itself! +₿🔒🤝 From fc882a0ca584e9d55f96454920fc0f0290eb611d Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Thu, 13 Jun 2024 19:03:00 -0400 Subject: [PATCH 02/41] payjoin version updated to 0.18.0 --- Cargo.lock | 535 ++++++++++++++++++++++++++++++++++++++++++++++++----- Cargo.toml | 4 +- 2 files changed, 495 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0cfa7af..8201ede 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -361,7 +361,7 @@ dependencies = [ "bitcoin-io", "bitcoin-units", "bitcoin_hashes 0.14.0", - "hex-conservative 0.2.1", + "hex-conservative", "hex_lit", "secp256k1 0.29.0", "serde", @@ -373,12 +373,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f9997f8650dd818369931b5672a18dbef95324d0513aa99aae758de8ce86e5b" -[[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" @@ -426,16 +420,6 @@ 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.0" @@ -443,7 +427,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" dependencies = [ "bitcoin-io", - "hex-conservative 0.2.1", + "hex-conservative", "serde", ] @@ -802,7 +786,7 @@ dependencies = [ "byteorder", "libc", "log", - "rustls", + "rustls 0.21.7", "serde", "serde_json", "webpki", @@ -833,6 +817,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -858,6 +848,39 @@ dependencies = [ "winapi", ] +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -949,12 +972,6 @@ 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.1" @@ -1029,6 +1046,102 @@ dependencies = [ "zeroize", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "hyper" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "idna" version = "0.5.0" @@ -1057,6 +1170,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "itoa" version = "1.0.9" @@ -1171,6 +1290,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -1258,15 +1388,18 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" -version = "0.16.0" -source = "git+https://github.com/payjoin/rust-payjoin?rev=457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373#457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee9aa01c11521587baa45929246a9a570b2160faa4decd73e4b045e19c308d91" dependencies = [ "bhttp", "bip21", "bitcoin 0.30.1", "chacha20poly1305 0.10.1", + "http", "log", "ohttp", + "reqwest", "serde", "serde_json", "url", @@ -1299,12 +1432,38 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plain" version = "0.2.3" @@ -1426,6 +1585,47 @@ dependencies = [ "bitflags", ] +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.22.4", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.26.3", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -1452,7 +1652,7 @@ dependencies = [ "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1469,10 +1669,40 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring 0.16.20", - "rustls-webpki", + "rustls-webpki 0.101.6", "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.7", + "rustls-pki-types", + "rustls-webpki 0.102.5", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + [[package]] name = "rustls-webpki" version = "0.101.6" @@ -1483,6 +1713,17 @@ dependencies = [ "untrusted 0.7.1", ] +[[package]] +name = "rustls-webpki" +version = "0.102.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +dependencies = [ + "ring 0.17.7", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.15" @@ -1543,7 +1784,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes 0.14.0", "rand", "secp256k1-sys 0.10.0", "serde", @@ -1607,6 +1848,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1665,6 +1918,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "socks" version = "0.3.4" @@ -1728,6 +1991,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 = "textwrap" version = "0.16.0" @@ -1779,8 +2048,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", + "bytes", + "libc", + "mio", "pin-project-lite", + "socket2", "tokio-macros", + "windows-sys 0.48.0", ] [[package]] @@ -1794,6 +2068,17 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -1803,6 +2088,58 @@ dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -2012,8 +2349,8 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls", - "rustls-webpki", + "rustls 0.21.7", + "rustls-webpki 0.101.6", "serde", "serde_json", "socks", @@ -2030,6 +2367,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -2044,6 +2382,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2075,6 +2422,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2139,6 +2498,15 @@ version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +[[package]] +name = "webpki-roots" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weedle2" version = "5.0.0" @@ -2176,7 +2544,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -2185,13 +2562,29 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2200,42 +2593,100 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "x25519-dalek" version = "2.0.0-pre.1" diff --git a/Cargo.toml b/Cargo.toml index 47d08fc..db9a4d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ uniffi = { version = "0.28.0", features = ["bindgen-tests"] } bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bip39"] } bitcoincore-rpc = "0.19.0" [dependencies] -#https://github.com/payjoin/rust-payjoin/commit/457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373 -payjoin = { git= "https://github.com/payjoin/rust-payjoin", rev = "457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373", features = ["send", "receive", "base64", "v2"] } + +payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io"] } uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } From f6eee4dafdebfef153b013fe1cc07bb46dcb8c2e Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Fri, 14 Jun 2024 10:53:00 -0400 Subject: [PATCH 03/41] refactor: replaced Enroller & Enrolled with SessionInitializer & ActiveSession --- src/receive/v2.rs | 66 +++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 21aa52f..983daa7 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use std::io::Cursor; use std::str::FromStr; use std::sync::{Arc, Mutex, MutexGuard}; +use std::time::Duration; use payjoin::bitcoin::psbt::Psbt; use payjoin::bitcoin::FeeRate; @@ -12,6 +13,7 @@ use crate::receive::v1::{ CanBroadcast, IsOutputKnown, IsScriptOwned, ProcessPartiallySignedTransaction, }; use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; +use crate::types::Network; pub struct ClientResponse(Mutex>); @@ -33,29 +35,49 @@ pub struct RequestResponse { } #[derive(Clone, Debug)] -pub struct Enroller(pub payjoin::receive::v2::Enroller); -impl From for payjoin::receive::v2::Enroller { - fn from(value: Enroller) -> Self { +pub struct SessionInitializer(pub payjoin::receive::v2::SessionInitializer); +impl From for payjoin::receive::v2::SessionInitializer { + fn from(value: SessionInitializer) -> Self { value.0 } } -impl From for Enroller { - fn from(value: payjoin::receive::v2::Enroller) -> Self { +impl From for SessionInitializer { + fn from(value: payjoin::receive::v2::SessionInitializer) -> Self { Self(value) } } -impl Enroller { - pub fn from_directory_config( +impl SessionInitializer { + /// Creates a new `SessionInitializer` with the provided parameters. + /// + /// # Parameters + /// - `address`: The Bitcoin address for the payjoin session. + /// - `directory`: The URL of the store-and-forward payjoin directory. + /// - `ohttp_keys`: The OHTTP keys used for encrypting and decrypting HTTP requests and responses. + /// - `ohttp_relay`: The URL of the OHTTP relay, used to keep client IP address confidential. + /// - `expire_after`: The duration in seconds after which the session expires. + /// + /// # Returns + /// A new instance of `SessionInitializer`. + /// + /// # References + /// - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/pull/1483) + pub fn new( + address: String, + expire_after: u64, + network:Network, directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, ) -> Self { - payjoin::receive::v2::Enroller::from_directory_config( + let address = payjoin::bitcoin::Address::from_str(address.as_str())?.require_network(network.into())?; + payjoin::receive::v2::SessionInitializer::new( + address, (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), + Duration::from_secs(expire_after) ) .into() } @@ -81,10 +103,10 @@ impl Enroller { &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result { + >::into(self.clone()) .process_res(Cursor::new(body), ctx) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] @@ -92,30 +114,30 @@ impl Enroller { &self, body: Vec, ctx: Arc, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result, PayjoinError> { + >::into(self.clone()) .process_res(Cursor::new(body), ctx.as_ref().into()) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) } } #[derive(Clone, Debug)] -pub struct Enrolled(payjoin::receive::v2::Enrolled); +pub struct ActiveSession(payjoin::receive::v2::ActiveSession); -impl From for payjoin::receive::v2::Enrolled { - fn from(value: Enrolled) -> Self { +impl From for payjoin::receive::v2::ActiveSession { + fn from(value: ActiveSession) -> Self { value.0 } } -impl From for Enrolled { - fn from(value: payjoin::receive::v2::Enrolled) -> Self { +impl From for ActiveSession { + fn from(value: payjoin::receive::v2::ActiveSession) -> Self { Self(value) } } -impl Enrolled { +impl ActiveSession { pub fn fallback_target(&self) -> String { - >::into(self.clone()).fallback_target() + >::into(self.clone()).fallback_target() } #[cfg(feature = "uniffi")] pub fn extract_req(&self) -> Result { @@ -140,7 +162,7 @@ impl Enrolled { body: Vec, context: Arc, ) -> Result>, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), context.as_ref().into()) .map(|e| e.map(|x| Arc::new(x.into()))) .map_err(|e| e.into()) @@ -151,7 +173,7 @@ impl Enrolled { body: Vec, ctx: ohttp::ClientResponse, ) -> Result, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), ctx) .map(|e| e.map(|o| o.into())) .map_err(|e| e.into()) From d7a2cce8eba7999bc08b46f0badebbb8f98f781e Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sat, 15 Jun 2024 23:56:00 -0400 Subject: [PATCH 04/41] refactor: impl From for PjUriBuilder --- src/uri.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uri.rs b/src/uri.rs index 0e21089..e3652c1 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -90,6 +90,12 @@ impl Url { self.0.to_string() } } + +impl From for PjUriBuilder { + fn from(value: payjoin::PjUriBuilder) -> Self { + Self{inner:value} + } +} #[cfg(not(feature = "uniffi"))] pub struct PjUriBuilder { inner: payjoin::PjUriBuilder, From 7a28aac40650ca5d24446dcc4688440483b122ba Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sun, 16 Jun 2024 04:40:00 -0400 Subject: [PATCH 05/41] feat(ActiveSession): Exposed pj_uri_builder, pj_url & public_key --- src/receive/v2.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 983daa7..4dbc869 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -14,6 +14,7 @@ use crate::receive::v1::{ }; use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; use crate::types::Network; +use crate::uri::PjUriBuilder; pub struct ClientResponse(Mutex>); @@ -70,16 +71,16 @@ impl SessionInitializer { directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, - ) -> Self { + ) -> Result { let address = payjoin::bitcoin::Address::from_str(address.as_str())?.require_network(network.into())?; - payjoin::receive::v2::SessionInitializer::new( + Ok(payjoin::receive::v2::SessionInitializer::new( address, (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), Duration::from_secs(expire_after) ) - .into() + .into()) } #[cfg(feature = "uniffi")] @@ -136,9 +137,6 @@ impl From for ActiveSession { } } impl ActiveSession { - pub fn fallback_target(&self) -> String { - >::into(self.clone()).fallback_target() - } #[cfg(feature = "uniffi")] pub fn extract_req(&self) -> Result { match self.0.clone().extract_req() { @@ -156,6 +154,7 @@ impl ActiveSession { Err(e) => Err(PayjoinError::V2Error { message: e.to_string() }), } } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(feature = "uniffi")] pub fn process_res( &self, @@ -167,6 +166,7 @@ impl ActiveSession { .map(|e| e.map(|x| Arc::new(x.into()))) .map_err(|e| e.into()) } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(not(feature = "uniffi"))] pub fn process_res( &self, @@ -178,6 +178,20 @@ impl ActiveSession { .map(|e| e.map(|o| o.into())) .map_err(|e| e.into()) } + pub fn pj_uri_builder(&self) -> PjUriBuilder{ + >::into(self.clone()) + .pj_uri_builder().into() + } + /// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory. + /// This identifies a session at the payjoin directory server. + pub fn pj_url(&self) -> Url{ + >::into(self.clone()) + .pj_url().into() + } + ///The per-session public key to use as an identifier + pub fn public_key(&self) -> String{ + >::into(self.clone()).public_key().to_string() + } } #[derive(Clone)] From ad5fafd1111e204b0836413780f35bf91e5209e3 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Mon, 17 Jun 2024 10:05:00 -0400 Subject: [PATCH 06/41] feat(V2ProvisionalProposal): Exposed try_substitute_receiver_output --- src/receive/v2.rs | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 4dbc869..044c81f 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -435,15 +435,7 @@ impl V2ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::v2::ProvisionalProposal> { self.0.lock().unwrap() } - ///Just replace an output address with - pub fn substitute_output_address( - &self, - substitute_address: String, - ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) - } + pub fn contribute_witness_input( &self, txo: TxOut, @@ -487,6 +479,31 @@ impl V2ProvisionalProposal { Err(e) => Err(e.into()), } } + pub fn is_output_substitution_disabled(&self) -> bool{ + self.mutex_guard().is_output_substitution_disabled() + } + + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(),PayjoinError>{ + self.mutex_guard() + .try_substitute_receiver_output(|| generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(e.into()))) + .map_err(|e| e.into()) + } + //TODO; create try_substitute_receiver_output for uniffi build + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(),PayjoinError>{ + + } + #[cfg(feature = "uniffi")] pub fn finalize_proposal( &self, From b3dd9e04b4f216656b06b7ea45cffb7efa2ef496 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Tue, 18 Jun 2024 09:49:00 -0400 Subject: [PATCH 07/41] fix(V2ProvisionalProposal): mapped psbt parse error in finalize_proposal --- src/receive/v2.rs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 044c81f..e72b761 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -6,7 +6,7 @@ use std::time::Duration; use payjoin::bitcoin::psbt::Psbt; use payjoin::bitcoin::FeeRate; -use payjoin::receive as pdk; +use payjoin::{ receive as pdk}; #[cfg(feature = "uniffi")] use crate::receive::v1::{ @@ -513,11 +513,15 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt - .callback(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt + .callback(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(e.into()))?; + match processed{ + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(e.into())) + } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -533,10 +537,15 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(e.into()))?; + match processed{ + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(e.into())) + } + }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) From 399810fce21e8354bcfdc5b3e5b01e8e14d0d721 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Wed, 19 Jun 2024 04:23:00 -0400 Subject: [PATCH 08/41] fix(V2PayjoinProposal): renamed deserialize_res to process_res --- src/receive/v2.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index e72b761..f0ea7bc 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -615,25 +615,33 @@ impl V2PayjoinProposal { } } #[cfg(not(feature = "uniffi"))] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(body, ctx) - .map(|e| e.into()) + .process_res(body, ctx) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, res: Vec, ohttp_context: Arc, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(res, ohttp_context.as_ref().into()) - .map(|e| e) + .process_res(res, ohttp_context.as_ref().into()) .map_err(|e| e.into()) } } From 0e917c34b52656a063a18a0f9066f590da8e137d Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Thu, 20 Jun 2024 20:31:00 -0400 Subject: [PATCH 09/41] fix(ProvisionalProposal): replaced substitute_output_address with try_substitute_receiver_output --- src/receive/v1.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/receive/v1.rs b/src/receive/v1.rs index fa4cbd6..a42ed3e 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -304,13 +304,24 @@ impl ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::ProvisionalProposal> { self.0.lock().unwrap() } - pub fn substitute_output_address( + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( &self, - substitute_address: String, - ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(),PayjoinError>{ + self.mutex_guard() + .try_substitute_receiver_output(|| generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(e.into()))) + .map_err(|e| e.into()) + } + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(),PayjoinError>{ + } pub fn contribute_witness_input( &self, From 5d6605647024037c79b62093860b87185b0923c9 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Fri, 21 Jun 2024 21:06:00 -0400 Subject: [PATCH 10/41] added danger-local-https feature --- Cargo.lock | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8201ede..994ddc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1400,6 +1400,7 @@ dependencies = [ "log", "ohttp", "reqwest", + "rustls 0.22.4", "serde", "serde_json", "url", diff --git a/Cargo.toml b/Cargo.toml index db9a4d2..9607cd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bi bitcoincore-rpc = "0.19.0" [dependencies] -payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io"] } +payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } From d9d8001ab04b0c97a7db5e8e843a0950a3e789f6 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sat, 22 Jun 2024 20:55:00 -0400 Subject: [PATCH 11/41] refactor: IoError added & implemented From for PayjoinError --- src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/error.rs b/src/error.rs index 363c89e..e361369 100644 --- a/src/error.rs +++ b/src/error.rs @@ -59,6 +59,9 @@ pub enum PayjoinError { #[error("{message}")] UrlError { message: String }, + + #[error("{message}")] + IoError { message: String }, } macro_rules! impl_from_error { @@ -99,3 +102,9 @@ impl From for PayjoinError { } } } + +impl From for PayjoinError { + fn from(value: payjoin::io::Error) -> Self { + PayjoinError::IoError {message: value.to_string()} + } +} From de331183209e16986cd25ac02da753b1a5439e47 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sun, 23 Jun 2024 01:44:00 -0400 Subject: [PATCH 12/41] exposed fetch_ohttp_keys --- src/io.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/io.rs diff --git a/src/io.rs b/src/io.rs new file mode 100644 index 0000000..73ef63c --- /dev/null +++ b/src/io.rs @@ -0,0 +1,24 @@ +use crate::error::PayjoinError; +use crate::types::OhttpKeys; +use crate::uri::Url; + +/// Fetch the ohttp keys from the specified payjoin directory via proxy. +/// +/// * `ohttp_relay`: The http CONNNECT method proxy to request the ohttp keys from a payjoin +/// directory. Proxying requests for ohttp keys ensures a client IP address is never revealed to +/// the payjoin directory. +/// +/// * `payjoin_directory`: The payjoin directory from which to fetch the ohttp keys. This +/// directory stores and forwards payjoin client payloads. +/// +/// * `cert_der` (optional): The DER-encoded certificate to use for local HTTPS connections. This +/// parameter is only available when the "danger-local-https" feature is enabled. +pub async fn fetch_ohttp_keys( + ohttp_relay: Url, + payjoin_directory: Url, + cert_der: Vec, +) -> Result { + payjoin::io::fetch_ohttp_keys(ohttp_relay.into(), payjoin_directory.into(), cert_der).await + .map(|e| e.into()) + .map_err(|e| e.into()) +} \ No newline at end of file From 6fbc2864cc4851a91d7e4ac83efd5e102dbd3279 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Mon, 24 Jun 2024 10:24:00 -0400 Subject: [PATCH 13/41] changed exported --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f149923..e59b34d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,6 +5,8 @@ pub mod receive; pub mod send; pub mod types; pub mod uri; +pub mod io; + use crate::error::PayjoinError; #[cfg(feature = "uniffi")] use crate::receive::v1::{ @@ -17,7 +19,7 @@ use crate::receive::v1::{ }; #[allow(unused_imports)] use crate::receive::v2::{ - ClientResponse, Enrolled, Enroller, RequestResponse, V2MaybeInputsOwned, V2MaybeInputsSeen, + ClientResponse, SessionInitializer, ActiveSession, RequestResponse, V2MaybeInputsOwned, V2MaybeInputsSeen, V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, V2ProvisionalProposal, V2UncheckedProposal, }; From 8c36d1b321d2ab41648dbb83f46d75df0f55197f Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Tue, 25 Jun 2024 21:26:00 -0400 Subject: [PATCH 14/41] refactor(PjUri): implemented Clone --- src/uri.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uri.rs b/src/uri.rs index e3652c1..0129688 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -46,7 +46,9 @@ impl<'a> From for payjoin::PjUri<'a> { value.0 } } -pub struct PjUri(payjoin::PjUri<'static>); + +#[derive(Clone)] +pub struct PjUri(pub payjoin::PjUri<'static>); impl PjUri { pub fn address(&self) -> String { From 0fa674f0c87a47aee1056dbfa77542dcd0fe7906 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Wed, 26 Jun 2024 23:31:00 -0400 Subject: [PATCH 15/41] refactor(RequestBuilder): from_psbt_and_uri takes a PjUri instead of the Uri --- src/send/v1.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/send/v1.rs b/src/send/v1.rs index e390cd7..bef8eb1 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -7,7 +7,7 @@ pub use payjoin::send as pdk; use crate::error::PayjoinError; use crate::send::v2::ContextV2; use crate::types::Request; -use crate::uri::{Uri, Url}; +use crate::uri::{PjUri, Url}; ///Builder for sender-side payjoin parameters /// @@ -27,7 +27,7 @@ impl RequestBuilder { /// An HTTP client will own the Request data while Context sticks around so /// a `(Request, Context)` tuple is returned from `RequestBuilder::build()` /// to keep them separated. - pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { + pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { let psbt = payjoin::bitcoin::psbt::PartiallySignedTransaction::from_str(psbt.as_str())?; pdk::RequestBuilder::from_psbt_and_uri(psbt, (*uri).clone().into()) .map(|e| e.into()) From c7a1f3659a5f82451e3f67f468bd5e2ba4a723ca Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Thu, 27 Jun 2024 05:47:00 -0400 Subject: [PATCH 16/41] code formatted --- src/error.rs | 2 +- src/io.rs | 7 ++++--- src/lib.rs | 8 ++++---- src/receive/v1.rs | 13 ++++++------ src/receive/v2.rs | 51 ++++++++++++++++++++++++++--------------------- src/uri.rs | 2 +- 6 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/error.rs b/src/error.rs index e361369..a0bb791 100644 --- a/src/error.rs +++ b/src/error.rs @@ -105,6 +105,6 @@ impl From for PayjoinError { impl From for PayjoinError { fn from(value: payjoin::io::Error) -> Self { - PayjoinError::IoError {message: value.to_string()} + PayjoinError::IoError { message: value.to_string() } } } diff --git a/src/io.rs b/src/io.rs index 73ef63c..7a9be82 100644 --- a/src/io.rs +++ b/src/io.rs @@ -16,9 +16,10 @@ use crate::uri::Url; pub async fn fetch_ohttp_keys( ohttp_relay: Url, payjoin_directory: Url, - cert_der: Vec, + cert_der: Vec, ) -> Result { - payjoin::io::fetch_ohttp_keys(ohttp_relay.into(), payjoin_directory.into(), cert_der).await + payjoin::io::fetch_ohttp_keys(ohttp_relay.into(), payjoin_directory.into(), cert_der) + .await .map(|e| e.into()) .map_err(|e| e.into()) -} \ No newline at end of file +} diff --git a/src/lib.rs b/src/lib.rs index e59b34d..de43581 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,11 +1,11 @@ #![crate_name = "payjoin_ffi"] pub mod error; +pub mod io; pub mod receive; pub mod send; pub mod types; pub mod uri; -pub mod io; use crate::error::PayjoinError; #[cfg(feature = "uniffi")] @@ -19,9 +19,9 @@ use crate::receive::v1::{ }; #[allow(unused_imports)] use crate::receive::v2::{ - ClientResponse, SessionInitializer, ActiveSession, RequestResponse, V2MaybeInputsOwned, V2MaybeInputsSeen, - V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, V2ProvisionalProposal, - V2UncheckedProposal, + ActiveSession, ClientResponse, RequestResponse, SessionInitializer, V2MaybeInputsOwned, + V2MaybeInputsSeen, V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, + V2ProvisionalProposal, V2UncheckedProposal, }; #[allow(unused_imports)] use crate::send::v1::{ diff --git a/src/receive/v1.rs b/src/receive/v1.rs index a42ed3e..8387d59 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -309,19 +309,20 @@ impl ProvisionalProposal { pub fn try_substitute_receiver_output( &self, generate_script: impl Fn() -> Result, PayjoinError>, - ) -> Result<(),PayjoinError>{ + ) -> Result<(), PayjoinError> { self.mutex_guard() - .try_substitute_receiver_output(|| generate_script() - .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) - .map_err(|e| payjoin::Error::Server(e.into()))) + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(e.into())) + }) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] pub fn try_substitute_receiver_output( &self, generate_script: impl Fn() -> Result, PayjoinError>, - ) -> Result<(),PayjoinError>{ - + ) -> Result<(), PayjoinError> { } pub fn contribute_witness_input( &self, diff --git a/src/receive/v2.rs b/src/receive/v2.rs index f0ea7bc..2648d43 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -6,15 +6,15 @@ use std::time::Duration; use payjoin::bitcoin::psbt::Psbt; use payjoin::bitcoin::FeeRate; -use payjoin::{ receive as pdk}; +use payjoin::receive as pdk; #[cfg(feature = "uniffi")] use crate::receive::v1::{ CanBroadcast, IsOutputKnown, IsScriptOwned, ProcessPartiallySignedTransaction, }; -use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; use crate::types::Network; use crate::uri::PjUriBuilder; +use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; pub struct ClientResponse(Mutex>); @@ -67,18 +67,19 @@ impl SessionInitializer { pub fn new( address: String, expire_after: u64, - network:Network, + network: Network, directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, ) -> Result { - let address = payjoin::bitcoin::Address::from_str(address.as_str())?.require_network(network.into())?; + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; Ok(payjoin::receive::v2::SessionInitializer::new( address, (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), - Duration::from_secs(expire_after) + Duration::from_secs(expire_after), ) .into()) } @@ -178,19 +179,23 @@ impl ActiveSession { .map(|e| e.map(|o| o.into())) .map_err(|e| e.into()) } - pub fn pj_uri_builder(&self) -> PjUriBuilder{ + pub fn pj_uri_builder(&self) -> PjUriBuilder { >::into(self.clone()) - .pj_uri_builder().into() + .pj_uri_builder() + .into() } /// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory. /// This identifies a session at the payjoin directory server. - pub fn pj_url(&self) -> Url{ + pub fn pj_url(&self) -> Url { >::into(self.clone()) - .pj_url().into() + .pj_url() + .into() } ///The per-session public key to use as an identifier - pub fn public_key(&self) -> String{ - >::into(self.clone()).public_key().to_string() + pub fn public_key(&self) -> String { + >::into(self.clone()) + .public_key() + .to_string() } } @@ -479,7 +484,7 @@ impl V2ProvisionalProposal { Err(e) => Err(e.into()), } } - pub fn is_output_substitution_disabled(&self) -> bool{ + pub fn is_output_substitution_disabled(&self) -> bool { self.mutex_guard().is_output_substitution_disabled() } @@ -488,11 +493,13 @@ impl V2ProvisionalProposal { pub fn try_substitute_receiver_output( &self, generate_script: impl Fn() -> Result, PayjoinError>, - ) -> Result<(),PayjoinError>{ + ) -> Result<(), PayjoinError> { self.mutex_guard() - .try_substitute_receiver_output(|| generate_script() - .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) - .map_err(|e| payjoin::Error::Server(e.into()))) + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(e.into())) + }) .map_err(|e| e.into()) } //TODO; create try_substitute_receiver_output for uniffi build @@ -500,8 +507,7 @@ impl V2ProvisionalProposal { pub fn try_substitute_receiver_output( &self, generate_script: impl Fn() -> Result, PayjoinError>, - ) -> Result<(),PayjoinError>{ - + ) -> Result<(), PayjoinError> { } #[cfg(feature = "uniffi")] @@ -518,9 +524,9 @@ impl V2ProvisionalProposal { .callback(pre_processed.to_string()) .map(|e| Psbt::from_str(e.as_str())) .map_err(|e| pdk::Error::Server(e.into()))?; - match processed{ + match processed { Ok(e) => Ok(e), - Err(e) => Err(pdk::Error::Server(e.into())) + Err(e) => Err(pdk::Error::Server(e.into())), } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), @@ -541,11 +547,10 @@ impl V2ProvisionalProposal { let processed = process_psbt(pre_processed.to_string()) .map(|e| Psbt::from_str(e.as_str())) .map_err(|e| pdk::Error::Server(e.into()))?; - match processed{ + match processed { Ok(e) => Ok(e), - Err(e) => Err(pdk::Error::Server(e.into())) + Err(e) => Err(pdk::Error::Server(e.into())), } - }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) diff --git a/src/uri.rs b/src/uri.rs index 0129688..146dde0 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -95,7 +95,7 @@ impl Url { impl From for PjUriBuilder { fn from(value: payjoin::PjUriBuilder) -> Self { - Self{inner:value} + Self { inner: value } } } #[cfg(not(feature = "uniffi"))] From 164055f88608547d23608a3c3fb3df42006f1494 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Fri, 28 Jun 2024 17:39:00 -0400 Subject: [PATCH 17/41] refactor(PjUri): returns amount in btc. --- src/uri.rs | 101 +++++++++++++++++++---------------------------------- 1 file changed, 35 insertions(+), 66 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index 146dde0..f5515ac 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -54,9 +54,9 @@ impl PjUri { pub fn address(&self) -> String { self.0.clone().address.to_string() } - /// Amount in sats - pub fn amount(&self) -> Option { - self.0.clone().amount.map(|e| e.to_sat()) + /// Number of btc requested as payment + pub fn amount(&self) -> Option { + self.0.clone().amount.map(|e| e.to_btc()) } pub fn as_string(&self) -> String { self.0.clone().to_string() @@ -98,6 +98,8 @@ impl From for PjUriBuilder { Self { inner: value } } } +///Build a valid PjUri. +// Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] pub struct PjUriBuilder { inner: payjoin::PjUriBuilder, @@ -113,9 +115,9 @@ impl PjUriBuilder { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); Ok(Self { inner: payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)) }) } - ///Set the amount in btc you want to receive. - pub fn amount(self, amount: f64) -> Self { - let amount = payjoin::bitcoin::Amount::from_sat((amount * 100_001_890.0) as u64); + ///Accepts the amount you want to receive in sats and sets it in btc . + pub fn amount(self, amount: u64) -> Self { + let amount = payjoin::bitcoin::Amount::from_sat(amount); Self { inner: self.inner.amount(amount) } } ///Set the message. @@ -126,7 +128,7 @@ impl PjUriBuilder { pub fn label(self, label: String) -> Self { Self { inner: self.inner.label(label) } } - ///Set whether or not payjoin output substitution is allowed. + ///Set whether payjoin output substitution is allowed. pub fn pjos(self, pjos: bool) -> Self { Self { inner: self.inner.pjos(pjos) } } @@ -137,68 +139,35 @@ impl PjUriBuilder { } #[cfg(test)] mod tests { - use std::convert::TryFrom; - - use payjoin::Uri; - - #[test] - fn test_short() { - assert!(Uri::try_from("").is_err()); - assert!(Uri::try_from("bitcoin").is_err()); - assert!(Uri::try_from("bitcoin:").is_err()); - } - - #[ignore] - #[test] - fn test_todo_url_encoded() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=https://example.com?ciao"; - assert!(Uri::try_from(uri).is_err(), "pj url should be url encoded"); - } - - #[test] - fn test_valid_url() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=this_is_NOT_a_validURL"; - assert!(Uri::try_from(uri).is_err(), "pj is not a valid url"); - } - + use bdk::bitcoin; + use crate::uri::{PjUriBuilder, Url}; #[test] - fn test_missing_amount() { - let uri = - "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?pj=https://testnet.demo.btcpayserver.org/BTC/pj"; - assert!(Uri::try_from(uri).is_ok(), "missing amount should be ok"); - } - - #[test] - fn test_unencrypted() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=http://example.com"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=ftp://foo.onion"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - } - - #[test] - fn test_valid_uris() { - let https = "https://example.com"; - let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion"; - - let base58 = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; - let bech32_upper = "BITCOIN:TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; - let bech32_lower = "bitcoin:tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; - - for address in [base58, bech32_upper, bech32_lower].iter() { - for pj in [https, onion].iter() { - let uri = format!("{}?amount=1&pj={}", address, pj); - assert!(Uri::try_from(&*uri).is_ok()); + fn test_ffi_builder() { + let https = "https://example.com/"; + let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion/"; + let base58 = "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; + let bech32_upper = "TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; + let bech32_lower = "tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; + + for address in vec![base58, bech32_upper, bech32_lower] { + for pj in vec![https, onion] { + let amount = bitcoin::Amount::ONE_BTC; + let builder = PjUriBuilder::new( + address.to_string(), + Url::from_str(pj.to_string()).unwrap(), + None, + ).unwrap() + .amount(amount.to_sat()) + .message("message".to_string()) + .label("label".to_string()) + .pjos(true); + let uri = builder.build(); + assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); + print!("\n {}", uri.as_string()); + // assert_eq!(uri.extras()disable_output_substitution, true); + // assert_eq!(uri.extras.endpoint.to_string(), pj.to_string()); } } } - #[test] - fn test_unsupported() { - assert!(!Uri::try_from("bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX") - .unwrap() - .extras - .pj_is_supported()); - } } From 848c415f2dee4787f594a68ccca8b4c300128d9a Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sat, 29 Jun 2024 11:38:00 -0400 Subject: [PATCH 18/41] code format --- src/uri.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index f5515ac..17fa086 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -140,6 +140,7 @@ impl PjUriBuilder { #[cfg(test)] mod tests { use bdk::bitcoin; + use crate::uri::{PjUriBuilder, Url}; #[test] fn test_ffi_builder() { @@ -155,19 +156,19 @@ mod tests { let builder = PjUriBuilder::new( address.to_string(), Url::from_str(pj.to_string()).unwrap(), - None, - ).unwrap() - .amount(amount.to_sat()) - .message("message".to_string()) - .label("label".to_string()) - .pjos(true); + None, + ) + .unwrap() + .amount(amount.to_sat()) + .message("message".to_string()) + .label("label".to_string()) + .pjos(true); let uri = builder.build(); assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); - print!("\n {}", uri.as_string()); + print!("\n {}", uri.as_string()); // assert_eq!(uri.extras()disable_output_substitution, true); // assert_eq!(uri.extras.endpoint.to_string(), pj.to_string()); } } } - } From a640256bd60d561a3bd6e9d350878d9571b4850b Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sun, 30 Jun 2024 20:18:00 -0400 Subject: [PATCH 19/41] fix(SessionInitializer): added uniffi tag on new --- src/receive/v2.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 2648d43..28e4a86 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -64,6 +64,7 @@ impl SessionInitializer { /// /// # References /// - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/pull/1483) + #[cfg(feature = "uniffi")] pub fn new( address: String, expire_after: u64, @@ -83,6 +84,25 @@ impl SessionInitializer { ) .into()) } + pub fn new( + address: String, + expire_after: u64, + network: p, + directory: Arc, + ohttp_keys: Arc, + ohttp_relay: Arc, + ) -> Result { + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; + Ok(payjoin::receive::v2::SessionInitializer::new( + address, + (*directory).clone().into(), + (*ohttp_keys).clone().into(), + (*ohttp_relay).clone().into(), + Duration::from_secs(expire_after), + ) + .into()) + } #[cfg(feature = "uniffi")] pub fn extract_req(&self) -> Result { From ef2147fee5c0aa204554fd476f9ad0a35ae901a7 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Mon, 1 Jul 2024 14:00:00 -0400 Subject: [PATCH 20/41] dependency upgraded --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 994ddc7..567d4c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1059,9 +1059,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -1088,9 +1088,9 @@ checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -1124,9 +1124,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ "bytes", "futures-channel", @@ -1389,8 +1389,7 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee9aa01c11521587baa45929246a9a570b2160faa4decd73e4b045e19c308d91" +source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#cd02a360127ecc080f46ee8ea961bc17000ccbca" dependencies = [ "bhttp", "bip21", @@ -1399,6 +1398,7 @@ dependencies = [ "http", "log", "ohttp", + "percent-encoding-rfc3986", "reqwest", "rustls 0.22.4", "serde", diff --git a/Cargo.toml b/Cargo.toml index 9607cd8..010ea23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,8 @@ bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bi bitcoincore-rpc = "0.19.0" [dependencies] -payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } +#payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } +payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } From fb4ad6aa4f7678b0caf2cb4cb341b9f11243781a Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Tue, 2 Jul 2024 00:14:00 -0400 Subject: [PATCH 21/41] fix(SessionInitializer): fixed invalid network param in new --- src/receive/v2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 28e4a86..c00a7eb 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -87,7 +87,7 @@ impl SessionInitializer { pub fn new( address: String, expire_after: u64, - network: p, + network: Network, directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, From bf122817ed186b11fce22ca8d1f6cb4b37488ebc Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Wed, 3 Jul 2024 05:39:00 -0400 Subject: [PATCH 22/41] feat(RequestBuilder): exposed min_fee_rate param in build_non_incentivizing --- src/send/v1.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/send/v1.rs b/src/send/v1.rs index bef8eb1..9ac7cff 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -94,8 +94,8 @@ impl RequestBuilder { /// /// While it's generally better to offer some contribution some users may wish not to. /// This function disables contribution. - pub fn build_non_incentivizing(&self) -> Result, PayjoinError> { - match self.0.clone().build_non_incentivizing() { + pub fn build_non_incentivizing(&self, min_fee_rate: u64,) -> Result, PayjoinError> { + match self.0.clone().build_non_incentivizing( payjoin::bitcoin::FeeRate::from_sat_per_kwu(min_fee_rate)) { Ok(e) => Ok(Arc::new(e.into())), Err(e) => Err(e.into()), } From 422661687238b13582f950ea303b9a6de42cdcae Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Thu, 4 Jul 2024 16:44:00 -0400 Subject: [PATCH 23/41] feat(PjUriBuilder): functions return &Self --- src/uri.rs | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index 17fa086..b57a07e 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,4 +1,6 @@ + use std::str::FromStr; +use std::sync::{Mutex, MutexGuard}; use payjoin::bitcoin::address::NetworkChecked; @@ -93,19 +95,19 @@ impl Url { } } -impl From for PjUriBuilder { - fn from(value: payjoin::PjUriBuilder) -> Self { - Self { inner: value } - } -} ///Build a valid PjUri. // Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] -pub struct PjUriBuilder { - inner: payjoin::PjUriBuilder, +pub struct PjUriBuilder (pub Mutex); + +impl From for PjUriBuilder { + fn from(value: payjoin::PjUriBuilder) -> Self { + Self(Mutex::new(value)) + } } #[cfg(not(feature = "uniffi"))] impl PjUriBuilder { + ///Create a new PjUriBuilder with required parameters. pub fn new( address: String, @@ -113,30 +115,40 @@ impl PjUriBuilder { ohttp_keys: Option, ) -> Result { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); - Ok(Self { inner: payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)) }) + Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)).into()) + } + fn lock(&self) -> MutexGuard<'_, payjoin::PjUriBuilder> { + self.0.lock().unwrap() } ///Accepts the amount you want to receive in sats and sets it in btc . - pub fn amount(self, amount: u64) -> Self { + pub fn amount(&self, amount: u64) -> &PjUriBuilder { let amount = payjoin::bitcoin::Amount::from_sat(amount); - Self { inner: self.inner.amount(amount) } + *self.lock() = self.lock().clone().amount(amount); + self } ///Set the message. - pub fn message(self, message: String) -> Self { - Self { inner: self.inner.message(message) } + pub fn message(&self, message: String) -> &PjUriBuilder { + *self.lock() = self.lock().clone().message(message); + self } ///Set the label. - pub fn label(self, label: String) -> Self { - Self { inner: self.inner.label(label) } + pub fn label(&self, label: String) -> &PjUriBuilder { + *self.lock() = self.lock().clone().label(label); + self } ///Set whether payjoin output substitution is allowed. - pub fn pjos(self, pjos: bool) -> Self { - Self { inner: self.inner.pjos(pjos) } + pub fn pjos(&self, pjos: bool) -> &PjUriBuilder { + *self.lock() = self.lock().clone().pjos(pjos); + self } ///Constructs a Uri with PayjoinParams from the parameters set in the builder. - pub fn build(self) -> PjUri { - self.inner.build().into() + pub fn build(&self) -> PjUri { + self.lock().clone().build().into() } } + + + #[cfg(test)] mod tests { use bdk::bitcoin; From cd6748814d8fa33e683ec37c88379601f28eb3cd Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Fri, 5 Jul 2024 07:32:00 -0400 Subject: [PATCH 24/41] removed mutex --- src/uri.rs | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/src/uri.rs b/src/uri.rs index b57a07e..010f86d 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,6 +1,5 @@ use std::str::FromStr; -use std::sync::{Mutex, MutexGuard}; use payjoin::bitcoin::address::NetworkChecked; @@ -98,11 +97,11 @@ impl Url { ///Build a valid PjUri. // Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] -pub struct PjUriBuilder (pub Mutex); +pub struct PjUriBuilder (pub payjoin::PjUriBuilder); impl From for PjUriBuilder { fn from(value: payjoin::PjUriBuilder) -> Self { - Self(Mutex::new(value)) + Self(value) } } #[cfg(not(feature = "uniffi"))] @@ -117,33 +116,26 @@ impl PjUriBuilder { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)).into()) } - fn lock(&self) -> MutexGuard<'_, payjoin::PjUriBuilder> { - self.0.lock().unwrap() - } ///Accepts the amount you want to receive in sats and sets it in btc . - pub fn amount(&self, amount: u64) -> &PjUriBuilder { + pub fn amount(&self, amount: u64) -> Self { let amount = payjoin::bitcoin::Amount::from_sat(amount); - *self.lock() = self.lock().clone().amount(amount); - self + self.0.clone().amount(amount).into() } - ///Set the message. - pub fn message(&self, message: String) -> &PjUriBuilder { - *self.lock() = self.lock().clone().message(message); - self + /// Set the message. + pub fn message(&self, message: String) -> Self { + self.0.clone().message(message).into() } ///Set the label. - pub fn label(&self, label: String) -> &PjUriBuilder { - *self.lock() = self.lock().clone().label(label); - self + pub fn label(&self, label: String)-> Self { + self.0.clone().label(label).into() } ///Set whether payjoin output substitution is allowed. - pub fn pjos(&self, pjos: bool) -> &PjUriBuilder { - *self.lock() = self.lock().clone().pjos(pjos); - self + pub fn pjos(&self, pjos: bool) -> Self{ + self.0.clone().pjos(pjos).into() } ///Constructs a Uri with PayjoinParams from the parameters set in the builder. pub fn build(&self) -> PjUri { - self.lock().clone().build().into() + self.0.clone().build().into() } } @@ -170,16 +162,15 @@ mod tests { Url::from_str(pj.to_string()).unwrap(), None, ) - .unwrap() - .amount(amount.to_sat()) - .message("message".to_string()) - .label("label".to_string()) - .pjos(true); - let uri = builder.build(); - assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); + .unwrap(); + let uri = builder + .amount(amount.to_sat()) + .message("message".to_string()) + .pjos(true) + .label("label".to_string()) + .build(); + // assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); print!("\n {}", uri.as_string()); - // assert_eq!(uri.extras()disable_output_substitution, true); - // assert_eq!(uri.extras.endpoint.to_string(), pj.to_string()); } } } From 313e20e8fe7067266e006ac700555216930a121a Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sat, 6 Jul 2024 23:25:00 -0400 Subject: [PATCH 25/41] fix(OutputsUnknown): identify_receiver_outputs returns ProvisionalProposal --- src/receive/v1.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/receive/v1.rs b/src/receive/v1.rs index 8387d59..f1b1259 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -275,7 +275,7 @@ impl OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { @@ -283,7 +283,7 @@ impl OutputsUnknown { .map_err(|e| payjoin::receive::Error::Server(e.into())) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } From 2f9e0cdac2b910f2f67f09579c3e7f8c2e54a4ae Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sun, 7 Jul 2024 00:41:00 -0400 Subject: [PATCH 26/41] fix(V2OutputsUnknown): identify_receiver_outputs returns V2ProvisionalProposal --- src/receive/v2.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index c00a7eb..7931ec5 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -436,7 +436,7 @@ impl V2OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { @@ -444,10 +444,11 @@ impl V2OutputsUnknown { .map_err(|e| payjoin::receive::Error::Server(e.into())) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } -pub struct V2ProvisionalProposal(Mutex); + +pub struct V2ProvisionalProposal(pub Mutex); impl From for V2ProvisionalProposal { fn from(value: payjoin::receive::v2::ProvisionalProposal) -> Self { From c52a19a17c833cca6b100fbb8c24d881f94e4de7 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Mon, 8 Jul 2024 14:02:00 -0400 Subject: [PATCH 27/41] code formatted --- src/receive/v2.rs | 2 +- src/send/v1.rs | 11 +++++++++-- src/uri.rs | 14 +++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 7931ec5..21b84a9 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -101,7 +101,7 @@ impl SessionInitializer { (*ohttp_relay).clone().into(), Duration::from_secs(expire_after), ) - .into()) + .into()) } #[cfg(feature = "uniffi")] diff --git a/src/send/v1.rs b/src/send/v1.rs index 9ac7cff..570a1b5 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -94,8 +94,15 @@ impl RequestBuilder { /// /// While it's generally better to offer some contribution some users may wish not to. /// This function disables contribution. - pub fn build_non_incentivizing(&self, min_fee_rate: u64,) -> Result, PayjoinError> { - match self.0.clone().build_non_incentivizing( payjoin::bitcoin::FeeRate::from_sat_per_kwu(min_fee_rate)) { + pub fn build_non_incentivizing( + &self, + min_fee_rate: u64, + ) -> Result, PayjoinError> { + match self + .0 + .clone() + .build_non_incentivizing(payjoin::bitcoin::FeeRate::from_sat_per_kwu(min_fee_rate)) + { Ok(e) => Ok(Arc::new(e.into())), Err(e) => Err(e.into()), } diff --git a/src/uri.rs b/src/uri.rs index 010f86d..00157f3 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,4 +1,3 @@ - use std::str::FromStr; use payjoin::bitcoin::address::NetworkChecked; @@ -97,7 +96,7 @@ impl Url { ///Build a valid PjUri. // Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] -pub struct PjUriBuilder (pub payjoin::PjUriBuilder); +pub struct PjUriBuilder(pub payjoin::PjUriBuilder); impl From for PjUriBuilder { fn from(value: payjoin::PjUriBuilder) -> Self { @@ -106,7 +105,6 @@ impl From for PjUriBuilder { } #[cfg(not(feature = "uniffi"))] impl PjUriBuilder { - ///Create a new PjUriBuilder with required parameters. pub fn new( address: String, @@ -117,20 +115,20 @@ impl PjUriBuilder { Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)).into()) } ///Accepts the amount you want to receive in sats and sets it in btc . - pub fn amount(&self, amount: u64) -> Self { + pub fn amount(&self, amount: u64) -> Self { let amount = payjoin::bitcoin::Amount::from_sat(amount); self.0.clone().amount(amount).into() } /// Set the message. - pub fn message(&self, message: String) -> Self { + pub fn message(&self, message: String) -> Self { self.0.clone().message(message).into() } ///Set the label. - pub fn label(&self, label: String)-> Self { + pub fn label(&self, label: String) -> Self { self.0.clone().label(label).into() } ///Set whether payjoin output substitution is allowed. - pub fn pjos(&self, pjos: bool) -> Self{ + pub fn pjos(&self, pjos: bool) -> Self { self.0.clone().pjos(pjos).into() } ///Constructs a Uri with PayjoinParams from the parameters set in the builder. @@ -139,8 +137,6 @@ impl PjUriBuilder { } } - - #[cfg(test)] mod tests { use bdk::bitcoin; From b9a3ccf83d4c194988f6ab4122fff4dea6b2f53c Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Tue, 9 Jul 2024 14:36:00 -0400 Subject: [PATCH 28/41] PjUrlNotSupported added to PayjoinError --- src/error.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index a0bb791..70ba725 100644 --- a/src/error.rs +++ b/src/error.rs @@ -42,8 +42,7 @@ pub enum PayjoinError { #[error("Error parsing the Pj URL: {message}")] PjParseError { message: String }, - #[error("{message}")] - PjNotSupported { message: String }, + PjUrlNotSupported, #[error("Malformed response from receiver: {message}")] ValidationError { message: String }, From e976839a0df0bdd08ae6dfa7d2c61d4c6286963a Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Fri, 12 Jul 2024 22:38:00 -0400 Subject: [PATCH 29/41] feat(Uri): Added check_pj_supported & as_string --- src/uri.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/uri.rs b/src/uri.rs index 00157f3..d8e0c6c 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,6 +1,7 @@ use std::str::FromStr; use payjoin::bitcoin::address::NetworkChecked; +use payjoin::UriExt; use crate::error::PayjoinError; #[cfg(not(feature = "uniffi"))] @@ -31,8 +32,18 @@ impl Uri { } ///Gets the amount in satoshis. pub fn amount(&self) -> Option { + self.0.amount.map(|x| x.to_btc()) } + pub fn check_pj_supported(&self) -> Result { + match self.0.clone().check_pj_supported(){ + Ok(e) => Ok(e.into()), + Err(_) => Err(PayjoinError::PjUrlNotSupported) + } + } + pub fn as_string(&self) -> String { + self.0.clone().to_string() + } } impl From> for PjUri { From 2d4c26dfaf71fefc32399227b0a92c303f9077f0 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sat, 13 Jul 2024 19:07:00 -0400 Subject: [PATCH 30/41] missing #[error(...)] display attribute resolved --- src/error.rs | 3 ++- src/uri.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index 70ba725..eb4a830 100644 --- a/src/error.rs +++ b/src/error.rs @@ -42,7 +42,8 @@ pub enum PayjoinError { #[error("Error parsing the Pj URL: {message}")] PjParseError { message: String }, - PjUrlNotSupported, + #[error("Uri doesn't support payjoin")] + PjNotSupported, #[error("Malformed response from receiver: {message}")] ValidationError { message: String }, diff --git a/src/uri.rs b/src/uri.rs index d8e0c6c..547a5f5 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -38,7 +38,7 @@ impl Uri { pub fn check_pj_supported(&self) -> Result { match self.0.clone().check_pj_supported(){ Ok(e) => Ok(e.into()), - Err(_) => Err(PayjoinError::PjUrlNotSupported) + Err(_) => Err(PayjoinError::PjNotSupported) } } pub fn as_string(&self) -> String { From 1c6804f8923ee7ba1699d9f9bf084662fa68d3a3 Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Sun, 14 Jul 2024 23:57:00 -0400 Subject: [PATCH 31/41] code cleanup --- src/receive/v1.rs | 22 +++++++++++----------- src/receive/v2.rs | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/receive/v1.rs b/src/receive/v1.rs index f1b1259..5904f73 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -90,7 +90,7 @@ impl UncheckedProposal { |transaction| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -108,7 +108,7 @@ impl UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -151,7 +151,7 @@ impl MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -164,7 +164,7 @@ impl MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -222,7 +222,7 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -235,7 +235,7 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -266,7 +266,7 @@ impl OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -280,7 +280,7 @@ impl OutputsUnknown { .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| e.into()) @@ -314,7 +314,7 @@ impl ProvisionalProposal { .try_substitute_receiver_output(|| { generate_script() .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) - .map_err(|e| payjoin::Error::Server(e.into())) + .map_err(|e| payjoin::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) } @@ -375,7 +375,7 @@ impl ProvisionalProposal { process_psbt .callback(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -394,7 +394,7 @@ impl ProvisionalProposal { |psbt| { process_psbt(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 21b84a9..0807785 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -265,7 +265,7 @@ impl V2UncheckedProposal { |tx| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(tx)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -284,7 +284,7 @@ impl V2UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -320,7 +320,7 @@ impl V2MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -333,7 +333,7 @@ impl V2MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -382,7 +382,7 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -395,7 +395,7 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -427,7 +427,7 @@ impl V2OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -441,7 +441,7 @@ impl V2OutputsUnknown { .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| e.into()) @@ -519,7 +519,7 @@ impl V2ProvisionalProposal { .try_substitute_receiver_output(|| { generate_script() .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) - .map_err(|e| payjoin::Error::Server(e.into())) + .map_err(|e| payjoin::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) } @@ -544,10 +544,10 @@ impl V2ProvisionalProposal { let processed = process_psbt .callback(pre_processed.to_string()) .map(|e| Psbt::from_str(e.as_str())) - .map_err(|e| pdk::Error::Server(e.into()))?; + .map_err(|e| pdk::Error::Server(Box::new(e)))?; match processed { Ok(e) => Ok(e), - Err(e) => Err(pdk::Error::Server(e.into())), + Err(e) => Err(pdk::Error::Server(Box::new(e))), } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), @@ -567,10 +567,10 @@ impl V2ProvisionalProposal { |pre_processed| { let processed = process_psbt(pre_processed.to_string()) .map(|e| Psbt::from_str(e.as_str())) - .map_err(|e| pdk::Error::Server(e.into()))?; + .map_err(|e| pdk::Error::Server(Box::new(e)))?; match processed { Ok(e) => Ok(e), - Err(e) => Err(pdk::Error::Server(e.into())), + Err(e) => Err(pdk::Error::Server(Box::new(e))), } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), From 8d44d311c52832fdd1d786d1d1d9b7e693202f6e Mon Sep 17 00:00:00 2001 From: StaxOLotl Date: Mon, 15 Jul 2024 15:52:00 -0400 Subject: [PATCH 32/41] message param added to PjNotSupported --- src/error.rs | 4 ++-- src/uri.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index eb4a830..8a98ebc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -42,8 +42,8 @@ pub enum PayjoinError { #[error("Error parsing the Pj URL: {message}")] PjParseError { message: String }, - #[error("Uri doesn't support payjoin")] - PjNotSupported, + #[error("{message}")] + PjNotSupported{ message: String }, #[error("Malformed response from receiver: {message}")] ValidationError { message: String }, diff --git a/src/uri.rs b/src/uri.rs index 547a5f5..7de1a2b 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -38,7 +38,7 @@ impl Uri { pub fn check_pj_supported(&self) -> Result { match self.0.clone().check_pj_supported(){ Ok(e) => Ok(e.into()), - Err(_) => Err(PayjoinError::PjNotSupported) + Err(_) => Err(PayjoinError::PjNotSupported{message:"Uri doesn't support payjoin".to_string()}) } } pub fn as_string(&self) -> String { From a2da6eec6773ad9964655209f56c6c007b68b24b Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Tue, 16 Jul 2024 21:21:21 -0400 Subject: [PATCH 33/41] update cargo lock --- Cargo.lock | 708 +++++++++++++++++++++++++++++------------------------ 1 file changed, 394 insertions(+), 314 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 567d4c5..7858e39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -45,19 +45,19 @@ checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", "cipher 0.3.0", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "opaque-debug", ] [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher 0.4.4", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", ] [[package]] @@ -81,24 +81,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead 0.5.2", - "aes 0.8.3", + "aes 0.8.4", "cipher 0.4.4", "ctr 0.9.2", - "ghash 0.5.0", + "ghash 0.5.1", "subtle", ] [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] @@ -110,37 +111,37 @@ checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -150,9 +151,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "askama" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e" +checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" dependencies = [ "askama_derive", "askama_escape", @@ -160,18 +161,18 @@ dependencies = [ [[package]] name = "askama_derive" -version = "0.12.1" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94" +checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" dependencies = [ + "askama_parser", "basic-toml", "mime", "mime_guess", - "nom", "proc-macro2", "quote", "serde", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] @@ -180,28 +181,37 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" +[[package]] +name = "askama_parser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" +dependencies = [ + "nom", +] + [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -228,12 +238,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -242,9 +246,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "basic-toml" -version = "0.1.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" dependencies = [ "serde", ] @@ -258,7 +262,7 @@ dependencies = [ "async-trait", "bdk-macros", "bip39", - "bitcoin 0.30.1", + "bitcoin 0.30.2", "electrum-client", "esplora-client", "getrandom", @@ -319,7 +323,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9532c632b068e45a478f5e309126b6e2ec1dbf0bbd327b73836f33d9a43ede" dependencies = [ - "bitcoin 0.30.1", + "bitcoin 0.30.2", "percent-encoding-rfc3986", ] @@ -336,9 +340,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.30.1" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75" +checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462" dependencies = [ "base64 0.13.1", "bech32 0.9.1", @@ -481,9 +485,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -493,24 +497,24 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -531,12 +535,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" [[package]] name = "cfg-if" @@ -564,7 +565,7 @@ checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", "cipher 0.4.4", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", ] [[package]] @@ -615,51 +616,49 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.1" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.1" +version = "4.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" dependencies = [ "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", ] [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "cpufeatures" @@ -672,18 +671,18 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -699,9 +698,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -710,7 +709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core 0.6.4", + "rand_core", "typenum", ] @@ -744,15 +743,27 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures 0.2.12", + "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.71", ] [[package]] @@ -781,12 +792,12 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bc133f1c8d829d254f013f946653cbeb2b08674b960146361d1e9b67733ad19" dependencies = [ - "bitcoin 0.30.1", + "bitcoin 0.30.2", "bitcoin-private", "byteorder", "libc", "log", - "rustls 0.21.7", + "rustls 0.21.12", "serde", "serde_json", "webpki", @@ -800,18 +811,24 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cb1f7f2489cce83bc3bd92784f9ba5271eeb6e729b975895fc541f78cbfcdca" dependencies = [ - "bitcoin 0.30.1", + "bitcoin 0.30.2", "bitcoin-internals 0.1.0", "log", "serde", "ureq", ] +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -834,9 +851,12 @@ dependencies = [ [[package]] name = "fs-err" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] [[package]] name = "fs2" @@ -902,9 +922,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -923,19 +943,19 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", - "polyval 0.6.1", + "polyval 0.6.2", ] [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -945,21 +965,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "goblin" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07a4ffed2093b118a525b1d8f5204ae274faed5604537caf7135d0f18d9887" +checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" dependencies = [ "log", "plain", "scroll", ] -[[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" @@ -1027,9 +1041,9 @@ dependencies = [ [[package]] name = "hpke" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf39e5461bfdc6ad0fbc97067519fcaf96a7a2e67f24cc0eb8a1e7c0c45af792" +checksum = "e04a5933a381bb81f00b083fce6b4528e16d735dbeecbb2bdb45e0dbbf3f7e17" dependencies = [ "aead 0.5.2", "aes-gcm 0.10.3", @@ -1039,7 +1053,7 @@ dependencies = [ "generic-array", "hkdf 0.12.4", "hmac 0.12.1", - "rand_core 0.6.4", + "rand_core", "sha2 0.10.8", "subtle", "x25519-dalek", @@ -1107,19 +1121,20 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http", "hyper", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.11", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", + "webpki-roots 0.26.3", ] [[package]] @@ -1163,9 +1178,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -1176,17 +1191,23 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1205,21 +1226,21 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1227,15 +1248,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.6.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1245,9 +1266,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -1261,29 +1282,29 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniscript" -version = "10.0.0" +version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb102b66b2127a872dbcc73095b7b47aeb9d92f7b03c2b2298253ffc82c7594" +checksum = "70545cd04bd4eaf5689918aa8a9b155ecb29d8542d82537968cf9ce9e22460a3" dependencies = [ - "bitcoin 0.30.1", + "bitcoin 0.30.2", "bitcoin-private", "serde", ] [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "minreq" -version = "2.11.2" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64" +checksum = "763d142cdff44aaadd9268bebddb156ef6c65a0e13486bb81673cf2d8739f9b0" dependencies = [ "log", "serde", @@ -1313,18 +1334,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] [[package]] name = "ohttp" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578cb11a3fb5c85697ed8bb850d5ad1cbf819d3eea05c2b253cf1d240fbb10c5" +checksum = "4ea87785aa505c77b1447f9092b1bd583402bc5d986f8f36c7963df17eef9c8f" dependencies = [ "aead 0.4.3", "aes-gcm 0.9.2", @@ -1345,15 +1366,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "parking_lot" @@ -1382,23 +1403,22 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "payjoin" version = "0.18.0" -source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#cd02a360127ecc080f46ee8ea961bc17000ccbca" +source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#d9c76dd52b04ec7d4f783b54c258706a18801c9f" dependencies = [ "bhttp", "bip21", - "bitcoin 0.30.1", + "bitcoin 0.30.2", "chacha20poly1305 0.10.1", "http", "log", "ohttp", - "percent-encoding-rfc3986", "reqwest", "rustls 0.22.4", "serde", @@ -1450,14 +1470,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1477,7 +1497,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "opaque-debug", "universal-hash 0.4.0", ] @@ -1488,7 +1508,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "opaque-debug", "universal-hash 0.5.1", ] @@ -1500,19 +1520,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ "cfg-if", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "opaque-debug", "universal-hash 0.4.0", ] [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "opaque-debug", "universal-hash 0.5.1", ] @@ -1525,18 +1545,65 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] +[[package]] +name = "quinn" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.11", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls 0.23.11", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1549,7 +1616,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1559,15 +1626,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" - [[package]] name = "rand_core" version = "0.6.4" @@ -1588,9 +1649,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -1609,7 +1670,8 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.11", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1629,48 +1691,49 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", + "getrandom", "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", + "spin", + "untrusted", + "windows-sys 0.52.0", ] [[package]] -name = "ring" -version = "0.17.7" +name = "rustc-demangle" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" -dependencies = [ - "cc", - "getrandom", - "libc", - "spin 0.9.8", - "untrusted 0.9.0", - "windows-sys 0.48.0", -] +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] -name = "rustc-demangle" -version = "0.1.23" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring 0.16.20", - "rustls-webpki 0.101.6", + "ring", + "rustls-webpki 0.101.7", "sct", ] @@ -1681,7 +1744,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring 0.17.7", + "ring", + "rustls-pki-types", + "rustls-webpki 0.102.5", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +dependencies = [ + "log", + "once_cell", + "ring", "rustls-pki-types", "rustls-webpki 0.102.5", "subtle", @@ -1706,12 +1784,12 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring", + "untrusted", ] [[package]] @@ -1720,16 +1798,16 @@ version = "0.102.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" dependencies = [ - "ring 0.17.7", + "ring", "rustls-pki-types", - "untrusted 0.9.0", + "untrusted", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -1754,17 +1832,17 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring", + "untrusted", ] [[package]] @@ -1811,38 +1889,38 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.195" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "itoa", "ryu", @@ -1869,7 +1947,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "digest 0.9.0", "opaque-debug", ] @@ -1881,7 +1959,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "cpufeatures 0.2.9", + "cpufeatures 0.2.12", "digest 0.10.7", ] @@ -1891,6 +1969,15 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "sled" version = "0.34.7" @@ -1909,9 +1996,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smawk" @@ -1940,12 +2027,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -1960,15 +2041,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1983,9 +2064,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" dependencies = [ "proc-macro2", "quote", @@ -1994,44 +2075,44 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2044,9 +2125,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" dependencies = [ "backtrace", "bytes", @@ -2060,22 +2141,22 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.11", "rustls-pki-types", "tokio", ] @@ -2123,9 +2204,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.71", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -2158,15 +2251,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2205,7 +2298,7 @@ dependencies = [ "fs-err", "glob", "goblin", - "heck 0.5.0", + "heck", "once_cell", "paste", "serde", @@ -2234,7 +2327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.71", ] [[package]] @@ -2265,7 +2358,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.48", + "syn 2.0.71", "toml", "uniffi_meta", ] @@ -2328,12 +2421,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -2342,28 +2429,28 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" +checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "flate2", "log", "once_cell", - "rustls 0.21.7", - "rustls-webpki 0.101.6", + "rustls 0.23.11", + "rustls-pki-types", "serde", "serde_json", "socks", "url", - "webpki-roots 0.25.2", + "webpki-roots 0.26.3", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -2373,9 +2460,9 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" @@ -2400,9 +2487,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2410,24 +2497,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -2437,9 +2524,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2447,28 +2534,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -2480,8 +2567,8 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -2493,12 +2580,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "webpki-roots" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" - [[package]] name = "webpki-roots" version = "0.26.3" @@ -2690,20 +2771,19 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ "curve25519-dalek", - "rand_core 0.6.4", - "zeroize", + "rand_core", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -2716,5 +2796,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.71", ] From 3b549b4393e868fec9e7f09d2875840fffd0a571 Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Wed, 17 Jul 2024 21:50:40 -0400 Subject: [PATCH 34/41] Updating rust payjoin commit hash --- Cargo.lock | 705 ++++++++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 313 insertions(+), 394 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7858e39..9df150b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -45,19 +45,19 @@ checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", "cipher 0.3.0", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "opaque-debug", ] [[package]] name = "aes" -version = "0.8.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher 0.4.4", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", ] [[package]] @@ -81,25 +81,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead 0.5.2", - "aes 0.8.4", + "aes 0.8.3", "cipher 0.4.4", "ctr 0.9.2", - "ghash 0.5.1", + "ghash 0.5.0", "subtle", ] [[package]] name = "anstream" -version = "0.6.14" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is_terminal_polyfill", "utf8parse", ] @@ -111,37 +110,37 @@ checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arrayvec" @@ -151,9 +150,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "askama" -version = "0.12.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" +checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e" dependencies = [ "askama_derive", "askama_escape", @@ -161,18 +160,18 @@ dependencies = [ [[package]] name = "askama_derive" -version = "0.12.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" +checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94" dependencies = [ - "askama_parser", "basic-toml", "mime", "mime_guess", + "nom", "proc-macro2", "quote", "serde", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] @@ -181,37 +180,28 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" -[[package]] -name = "askama_parser" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" -dependencies = [ - "nom", -] - [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -238,6 +228,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -246,9 +242,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "basic-toml" -version = "0.1.9" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" dependencies = [ "serde", ] @@ -262,7 +258,7 @@ dependencies = [ "async-trait", "bdk-macros", "bip39", - "bitcoin 0.30.2", + "bitcoin 0.30.1", "electrum-client", "esplora-client", "getrandom", @@ -323,7 +319,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9532c632b068e45a478f5e309126b6e2ec1dbf0bbd327b73836f33d9a43ede" dependencies = [ - "bitcoin 0.30.2", + "bitcoin 0.30.1", "percent-encoding-rfc3986", ] @@ -340,9 +336,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.30.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462" +checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75" dependencies = [ "base64 0.13.1", "bech32 0.9.1", @@ -485,9 +481,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" @@ -497,24 +493,24 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "camino" -version = "1.1.7" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" dependencies = [ "serde", ] [[package]] name = "cargo-platform" -version = "0.1.8" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -535,9 +531,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.5" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -565,7 +564,7 @@ checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", "cipher 0.4.4", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", ] [[package]] @@ -616,49 +615,51 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.9" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" dependencies = [ "clap_builder", "clap_derive", + "once_cell", ] [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" dependencies = [ "anstream", "anstyle", "clap_lex", + "once_cell", "strsim", ] [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "cpufeatures" @@ -671,18 +672,18 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] @@ -698,9 +699,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -709,7 +710,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "typenum", ] @@ -743,27 +744,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.3" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ - "cfg-if", - "cpufeatures 0.2.12", - "curve25519-dalek-derive", - "fiat-crypto", - "rustc_version", + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", "subtle", -] - -[[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.71", + "zeroize", ] [[package]] @@ -792,12 +781,12 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bc133f1c8d829d254f013f946653cbeb2b08674b960146361d1e9b67733ad19" dependencies = [ - "bitcoin 0.30.2", + "bitcoin 0.30.1", "bitcoin-private", "byteorder", "libc", "log", - "rustls 0.21.12", + "rustls 0.21.7", "serde", "serde_json", "webpki", @@ -811,24 +800,18 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cb1f7f2489cce83bc3bd92784f9ba5271eeb6e729b975895fc541f78cbfcdca" dependencies = [ - "bitcoin 0.30.2", + "bitcoin 0.30.1", "bitcoin-internals 0.1.0", "log", "serde", "ureq", ] -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -851,12 +834,9 @@ dependencies = [ [[package]] name = "fs-err" -version = "2.11.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" -dependencies = [ - "autocfg", -] +checksum = "0845fa252299212f0389d64ba26f34fa32cfe41588355f21ed507c59a0f64541" [[package]] name = "fs2" @@ -922,9 +902,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -943,19 +923,19 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug", - "polyval 0.6.2", + "polyval 0.6.1", ] [[package]] name = "gimli" -version = "0.29.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glob" @@ -965,15 +945,21 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "goblin" -version = "0.8.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" +checksum = "bb07a4ffed2093b118a525b1d8f5204ae274faed5604537caf7135d0f18d9887" dependencies = [ "log", "plain", "scroll", ] +[[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" @@ -1041,9 +1027,9 @@ dependencies = [ [[package]] name = "hpke" -version = "0.11.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04a5933a381bb81f00b083fce6b4528e16d735dbeecbb2bdb45e0dbbf3f7e17" +checksum = "cf39e5461bfdc6ad0fbc97067519fcaf96a7a2e67f24cc0eb8a1e7c0c45af792" dependencies = [ "aead 0.5.2", "aes-gcm 0.10.3", @@ -1053,7 +1039,7 @@ dependencies = [ "generic-array", "hkdf 0.12.4", "hmac 0.12.1", - "rand_core", + "rand_core 0.6.4", "sha2 0.10.8", "subtle", "x25519-dalek", @@ -1121,20 +1107,19 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", "http", "hyper", "hyper-util", - "rustls 0.23.11", + "rustls 0.22.4", "rustls-pki-types", "tokio", "tokio-rustls", "tower-service", - "webpki-roots 0.26.3", ] [[package]] @@ -1178,9 +1163,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.13" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] @@ -1191,23 +1176,17 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "is_terminal_polyfill" -version = "1.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" - [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1226,21 +1205,21 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.5.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1248,15 +1227,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.7.4" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" [[package]] name = "mime" @@ -1266,9 +1245,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.5" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ "mime", "unicase", @@ -1282,29 +1261,29 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniscript" -version = "10.1.0" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70545cd04bd4eaf5689918aa8a9b155ecb29d8542d82537968cf9ce9e22460a3" +checksum = "1eb102b66b2127a872dbcc73095b7b47aeb9d92f7b03c2b2298253ffc82c7594" dependencies = [ - "bitcoin 0.30.2", + "bitcoin 0.30.1", "bitcoin-private", "serde", ] [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] [[package]] name = "minreq" -version = "2.12.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763d142cdff44aaadd9268bebddb156ef6c65a0e13486bb81673cf2d8739f9b0" +checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64" dependencies = [ "log", "serde", @@ -1334,18 +1313,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "ohttp" -version = "0.5.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea87785aa505c77b1447f9092b1bd583402bc5d986f8f36c7963df17eef9c8f" +checksum = "578cb11a3fb5c85697ed8bb850d5ad1cbf819d3eea05c2b253cf1d240fbb10c5" dependencies = [ "aead 0.4.3", "aes-gcm 0.9.2", @@ -1366,15 +1345,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "parking_lot" @@ -1403,9 +1382,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.15" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" @@ -1414,7 +1393,7 @@ source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-b dependencies = [ "bhttp", "bip21", - "bitcoin 0.30.2", + "bitcoin 0.30.1", "chacha20poly1305 0.10.1", "http", "log", @@ -1470,14 +1449,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1497,7 +1476,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "opaque-debug", "universal-hash 0.4.0", ] @@ -1508,7 +1487,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "opaque-debug", "universal-hash 0.5.1", ] @@ -1520,19 +1499,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" dependencies = [ "cfg-if", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "opaque-debug", "universal-hash 0.4.0", ] [[package]] name = "polyval" -version = "0.6.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "opaque-debug", "universal-hash 0.5.1", ] @@ -1545,65 +1524,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] -[[package]] -name = "quinn" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls 0.23.11", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" -dependencies = [ - "bytes", - "rand", - "ring", - "rustc-hash", - "rustls 0.23.11", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - -[[package]] -name = "quinn-udp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" -dependencies = [ - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.52.0", -] - [[package]] name = "quote" -version = "1.0.36" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1616,7 +1548,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -1626,9 +1558,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", ] +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + [[package]] name = "rand_core" version = "0.6.4" @@ -1649,9 +1587,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ "base64 0.22.1", "bytes", @@ -1670,8 +1608,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "quinn", - "rustls 0.23.11", + "rustls 0.22.4", "rustls-pemfile", "rustls-pki-types", "serde", @@ -1691,49 +1628,48 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", - "cfg-if", - "getrandom", "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", ] [[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" +name = "ring" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustc-demangle" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustls" -version = "0.21.12" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", - "ring", - "rustls-webpki 0.101.7", + "ring 0.16.20", + "rustls-webpki 0.101.6", "sct", ] @@ -1744,22 +1680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", - "rustls-pki-types", - "rustls-webpki 0.102.5", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls" -version = "0.23.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" -dependencies = [ - "log", - "once_cell", - "ring", + "ring 0.17.7", "rustls-pki-types", "rustls-webpki 0.102.5", "subtle", @@ -1784,12 +1705,12 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -1798,16 +1719,16 @@ version = "0.102.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" dependencies = [ - "ring", + "ring 0.17.7", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "scopeguard" @@ -1832,17 +1753,17 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "sct" -version = "0.7.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -1889,38 +1810,38 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.204" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1947,7 +1868,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "digest 0.9.0", "opaque-debug", ] @@ -1959,7 +1880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", - "cpufeatures 0.2.12", + "cpufeatures 0.2.9", "digest 0.10.7", ] @@ -1969,15 +1890,6 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - [[package]] name = "sled" version = "0.34.7" @@ -1996,9 +1908,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smawk" @@ -2027,6 +1939,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.8" @@ -2041,15 +1959,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.11.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.6.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -2064,9 +1982,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.71" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -2075,44 +1993,44 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "1.0.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "textwrap" -version = "0.16.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" dependencies = [ "smawk", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -2125,9 +2043,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -2141,22 +2059,22 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.23.11", + "rustls 0.22.4", "rustls-pki-types", "tokio", ] @@ -2204,21 +2122,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.71", -] - [[package]] name = "tracing-core" version = "0.1.32" @@ -2251,15 +2157,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -2298,7 +2204,7 @@ dependencies = [ "fs-err", "glob", "goblin", - "heck", + "heck 0.5.0", "once_cell", "paste", "serde", @@ -2327,7 +2233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" dependencies = [ "quote", - "syn 2.0.71", + "syn 2.0.48", ] [[package]] @@ -2358,7 +2264,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.71", + "syn 2.0.48", "toml", "uniffi_meta", ] @@ -2421,6 +2327,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -2429,28 +2341,28 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72139d247e5f97a3eff96229a7ae85ead5328a39efe76f8bf5a06313d505b6ea" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ - "base64 0.22.1", + "base64 0.21.7", "flate2", "log", "once_cell", - "rustls 0.23.11", - "rustls-pki-types", + "rustls 0.21.7", + "rustls-webpki 0.101.6", "serde", "serde_json", "socks", "url", - "webpki-roots 0.26.3", + "webpki-roots 0.25.2", ] [[package]] name = "url" -version = "2.5.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -2460,9 +2372,9 @@ dependencies = [ [[package]] name = "utf8parse" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "version_check" @@ -2487,9 +2399,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2497,24 +2409,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -2524,9 +2436,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2534,28 +2446,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -2567,8 +2479,8 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring", - "untrusted", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -2580,6 +2492,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "webpki-roots" version = "0.26.3" @@ -2771,19 +2689,20 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.1" +version = "2.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" dependencies = [ "curve25519-dalek", - "rand_core", + "rand_core 0.6.4", + "zeroize", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] @@ -2796,5 +2715,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.48", ] diff --git a/Cargo.toml b/Cargo.toml index 010ea23..a2bdbb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ bitcoincore-rpc = "0.19.0" [dependencies] #payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } -payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} +payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } From 3277aceb9df060276044065429ccb216d8cdb52d Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Wed, 17 Jul 2024 23:59:00 -0400 Subject: [PATCH 35/41] dependency upgraded --- Cargo.lock | 683 ++++++++++++++++++++++++++++++++++++++++------ Cargo.toml | 15 +- README.md | 2 +- python/README.md | 36 +-- src/error.rs | 11 +- src/io.rs | 25 ++ src/lib.rs | 8 +- src/receive/v1.rs | 46 ++-- src/receive/v2.rs | 222 ++++++++++----- src/send/v1.rs | 15 +- src/uri.rs | 148 +++++----- 11 files changed, 931 insertions(+), 280 deletions(-) create mode 100644 src/io.rs diff --git a/Cargo.lock b/Cargo.lock index 7f985c9..fb96797 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -142,6 +142,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "askama" version = "0.12.0" @@ -206,6 +212,16 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals 0.3.0", + "bitcoin_hashes 0.14.0", +] + [[package]] name = "base64" version = "0.13.1" @@ -275,9 +291,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bech32" -version = "0.10.0-beta" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bhttp" @@ -335,16 +351,19 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.31.2" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" +checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6" dependencies = [ - "bech32 0.10.0-beta", - "bitcoin-internals 0.2.0", - "bitcoin_hashes 0.13.0", + "base58ck", + "bech32 0.11.0", + "bitcoin-internals 0.3.0", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes 0.14.0", "hex-conservative", "hex_lit", - "secp256k1 0.28.2", + "secp256k1 0.29.0", "serde", ] @@ -356,19 +375,35 @@ checksum = "1f9997f8650dd818369931b5672a18dbef95324d0513aa99aae758de8ce86e5b" [[package]] name = "bitcoin-internals" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" dependencies = [ "serde", ] +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + [[package]] name = "bitcoin-private" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals 0.3.0", + "serde", +] + [[package]] name = "bitcoin_hashes" version = "0.11.0" @@ -387,20 +422,20 @@ dependencies = [ [[package]] name = "bitcoin_hashes" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" dependencies = [ - "bitcoin-internals 0.2.0", + "bitcoin-io", "hex-conservative", "serde", ] [[package]] name = "bitcoincore-rpc" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb70725a621848c83b3809913d5314c0d20ca84877d99dd909504b564edab00" +checksum = "aedd23ae0fd321affb4bbbc36126c6f49a32818dc6b979395d24da8c9d4e80ee" dependencies = [ "bitcoincore-rpc-json", "jsonrpc", @@ -411,11 +446,11 @@ dependencies = [ [[package]] name = "bitcoincore-rpc-json" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856ffbee2e492c23bca715d72ea34aae80d58400f2bda26a82015d6bc2ec3662" +checksum = "d8909583c5fab98508e80ef73e5592a651c954993dc6b7739963257d19f0e71a" dependencies = [ - "bitcoin 0.31.2", + "bitcoin 0.32.2", "serde", "serde_json", ] @@ -608,7 +643,7 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.48", @@ -751,7 +786,7 @@ dependencies = [ "byteorder", "libc", "log", - "rustls", + "rustls 0.21.7", "serde", "serde_json", "webpki", @@ -782,6 +817,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -807,6 +848,39 @@ dependencies = [ "winapi", ] +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -886,6 +960,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hex" version = "0.4.3" @@ -894,9 +974,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] [[package]] name = "hex_lit" @@ -963,6 +1046,102 @@ dependencies = [ "zeroize", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "idna" version = "0.5.0" @@ -991,6 +1170,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "itoa" version = "1.0.9" @@ -1008,11 +1193,12 @@ dependencies = [ [[package]] name = "jsonrpc" -version = "0.14.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8128f36b47411cd3f044be8c1f5cc0c9e24d1d1bfdc45f0a57897b32513053f2" +checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" dependencies = [ "base64 0.13.1", + "minreq", "serde", "serde_json", ] @@ -1093,6 +1279,28 @@ dependencies = [ "adler", ] +[[package]] +name = "minreq" +version = "2.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64" +dependencies = [ + "log", + "serde", + "serde_json", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -1141,12 +1349,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "oneshot-uniffi" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -1186,15 +1388,18 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" -version = "0.16.0" -source = "git+https://github.com/payjoin/rust-payjoin?rev=457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373#457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373" +version = "0.18.0" +source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#3b5bda95fc8ce63f506538f0ff9daed885810488" dependencies = [ "bhttp", "bip21", "bitcoin 0.30.1", "chacha20poly1305 0.10.1", + "http", "log", "ohttp", + "reqwest", + "rustls 0.22.4", "serde", "serde_json", "url", @@ -1202,7 +1407,7 @@ dependencies = [ [[package]] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" dependencies = [ "base64 0.22.1", "bdk", @@ -1227,12 +1432,38 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plain" version = "0.2.3" @@ -1354,6 +1585,47 @@ dependencies = [ "bitflags", ] +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.22.4", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.26.3", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -1380,7 +1652,7 @@ dependencies = [ "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1397,10 +1669,40 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring 0.16.20", - "rustls-webpki", + "rustls-webpki 0.101.6", "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.7", + "rustls-pki-types", + "rustls-webpki 0.102.5", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + [[package]] name = "rustls-webpki" version = "0.101.6" @@ -1411,6 +1713,17 @@ dependencies = [ "untrusted 0.7.1", ] +[[package]] +name = "rustls-webpki" +version = "0.102.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +dependencies = [ + "ring 0.17.7", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.15" @@ -1467,13 +1780,13 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes 0.12.0", + "bitcoin_hashes 0.14.0", "rand", - "secp256k1-sys 0.9.2", + "secp256k1-sys 0.10.0", "serde", ] @@ -1488,9 +1801,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" dependencies = [ "cc", ] @@ -1535,6 +1848,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1593,6 +1918,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "socks" version = "0.3.4" @@ -1656,6 +1991,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 = "textwrap" version = "0.16.0" @@ -1663,8 +2004,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" dependencies = [ "smawk", - "unicode-linebreak", - "unicode-width", ] [[package]] @@ -1709,8 +2048,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", + "bytes", + "libc", + "mio", "pin-project-lite", + "socket2", "tokio-macros", + "windows-sys 0.48.0", ] [[package]] @@ -1724,6 +2068,17 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -1733,6 +2088,58 @@ dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -1760,12 +2167,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - [[package]] name = "unicode-normalization" version = "0.1.22" @@ -1775,17 +2176,11 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "uniffi" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5566fae48a5cb017005bf9cd622af5236b2a203a13fb548afde3506d3c68277" +checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", @@ -1798,19 +2193,18 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a77bb514bcd4bf27c9bd404d7c3f2a6a8131b957eba9c22cfeb7751c4278e09" +checksum = "96061d7e01b185aa405f7c9b134741ab3e50cc6796a47d6fd8ab9a5364b5feed" dependencies = [ "anyhow", "askama", "camino", "cargo_metadata", - "clap", "fs-err", "glob", "goblin", - "heck", + "heck 0.5.0", "once_cell", "paste", "serde", @@ -1823,9 +2217,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cba427aeb7b3a8b54830c4c915079a7a3c62608dd03dddba1d867a8a023eb4" +checksum = "9d6b86f9b221046af0c533eafe09ece04e2f1ded04ccdc9bba0ec09aec1c52bd" dependencies = [ "anyhow", "camino", @@ -1834,9 +2228,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e5a6c33b1dec3f255f57ec0b6af0f0b2bb3021868be1d5eec7a38e2905ebc" +checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" dependencies = [ "quote", "syn 2.0.48", @@ -1844,25 +2238,24 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea3eb5474d50fc149b7e4d86b9c5bd4a61dcc167f0683902bf18ae7bbb3deef" +checksum = "3210d57d6ab6065ab47a2898dacdb7c606fd6a4156196831fa3bf82e34ac58a6" dependencies = [ "anyhow", "bytes", "camino", "log", "once_cell", - "oneshot-uniffi", "paste", "static_assertions", ] [[package]] name = "uniffi_macros" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18331d35003f46f0d04047fbe4227291815b83a937a8c32bc057f990962182c4" +checksum = "b58691741080935437dc862122e68d7414432a11824ac1137868de46181a0bd2" dependencies = [ "bincode", "camino", @@ -1878,9 +2271,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7224422c4cfd181c7ca9fca2154abca4d21db962f926f270f996edd38b0c4b8" +checksum = "7663eacdbd9fbf4a88907ddcfe2e6fa85838eb6dc2418a7d91eebb3786f8e20b" dependencies = [ "anyhow", "bytes", @@ -1890,9 +2283,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce878d0bdfc288b58797044eaaedf748526c56eef3575380bb4d4b19d69eee" +checksum = "f922465f7566f25f8fe766920205fdfa9a3fcdc209c6bfb7557f0b5bf45b04dd" dependencies = [ "anyhow", "camino", @@ -1903,9 +2296,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c43c9ed40a8d20a5c3eae2d23031092db6b96dc8e571beb449ba9757484cea0" +checksum = "cef408229a3a407fafa4c36dc4f6ece78a6fb258ab28d2b64bddd49c8cb680f6" dependencies = [ "anyhow", "textwrap", @@ -1956,8 +2349,8 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls", - "rustls-webpki", + "rustls 0.21.7", + "rustls-webpki 0.101.6", "serde", "serde_json", "socks", @@ -1974,6 +2367,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1988,6 +2382,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2019,6 +2422,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2083,6 +2498,15 @@ version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +[[package]] +name = "webpki-roots" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weedle2" version = "5.0.0" @@ -2120,7 +2544,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -2129,13 +2562,29 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2144,42 +2593,100 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "x25519-dalek" version = "2.0.0-pre.1" diff --git a/Cargo.toml b/Cargo.toml index 4c62728..a2bdbb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" license = "MIT OR Apache-2.0" edition = "2021" exclude = ["tests"] @@ -10,16 +10,17 @@ crate-type = ["lib", "staticlib", "cdylib"] name = "payjoin_ffi" [build-dependencies] -uniffi = { version = "0.27.1", features = ["build"] } +uniffi = { version = "0.28.0", features = ["build"] } [dev-dependencies] -uniffi = { version = "0.27.1", features = ["bindgen-tests"] } +uniffi = { version = "0.28.0", features = ["bindgen-tests"] } bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bip39"] } -bitcoincore-rpc = "0.18.0" +bitcoincore-rpc = "0.19.0" [dependencies] -#https://github.com/payjoin/rust-payjoin/commit/457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373 -payjoin = { git= "https://github.com/payjoin/rust-payjoin", rev = "457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373", features = ["send", "receive", "base64", "v2"] } -uniffi = { version = "0.27.1" } + +#payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } +payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} +uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } url = "2.5.0" diff --git a/README.md b/README.md index 7d65e19..59729fe 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ rpc_port = "18443" ``` Now, run the integration tests: -The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). +The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). ```shell diff --git a/python/README.md b/python/README.md index be1cc22..1a9ae83 100644 --- a/python/README.md +++ b/python/README.md @@ -1,16 +1,17 @@ # Payjoin -The Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/). +Welcome to the Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! Let's get you up and running with some smooth transactions and a sprinkle of fun. ## Install from PyPI -Install the latest release using +Grab the latest release with a simple: ```shell pip install payjoin ``` -## Run the unit tests +## Running Unit Tests +Follow these steps to clone the repository and run the unit tests: ```shell @@ -27,34 +28,33 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run unit tests +# Run unit tests python -m unittest --verbose test/payjoin_unit_test.py + ``` -## Run the integration test +## Running the Integration Test -Before running the integration test, we need to set up the Bitcoin core properly in the regtest network. If you don't -have Bitcoin Core locally, please refer to this [page](https://learn.saylor.org/mod/page/view.php?id=36347). Or you can -install `Nigiri Bitcoin`, which is a tool designed to simplify the process of running local instances of Bitcoin and -Liquid networks for development and testing purposes. You can refer to -this [link](https://github.com/vulpemventures/nigiri), to install it on your local machine. +Before diving into the integration test, you'll need to set up Bitcoin Core on the regtest network. If you don't have Bitcoin Core installed locally, check out [this installation guide](https://learn.saylor.org/mod/page/view.php?id=36347). Alternatively, you can use `Nigiri Bitcoin`, a tool designed to streamline the process of running local instances of Bitcoin and Liquid networks for development and testing. Follow the instructions [here](https://github.com/vulpemventures/nigiri) to install it on your machine. -Once the nigiri bitcoin starts running, please replace following snippet in `payjoin_integration_test.py`, with you -nigiri bitcoin core credentials. +Once Nigiri Bitcoin is up and running, replace the following snippet in `payjoin_integration_test.py` with your `Nigiri Bitcoin` Core credentials: ``` rpc_user = "bitcoin" rpc_password = "bitcoin" + ``` -NB: The default credentials would be the following +By default, these credentials are: ``` rpc_user = "admin1" rpc_password = "123" rpc_host = "localhost" rpc_port = "18443" + ``` +Now, proceed with the integration test: ```shell @@ -71,11 +71,12 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run the integration test +# Run the integration test python -m unittest --verbose test/payjoin_integration_test.py + ``` -## Build the package +## Building the Package ```shell # Install dependencies @@ -86,4 +87,7 @@ bash ./scripts/generate_macos.sh # Build the wheel python setup.py --verbose bdist_wheel -``` \ No newline at end of file + +``` +We hope everything worked smoothly! Now go forth test, and may your test results be as reliable as the Bitcoin blockchain itself! +₿🔒🤝 diff --git a/src/error.rs b/src/error.rs index 363c89e..8a98ebc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -43,7 +43,7 @@ pub enum PayjoinError { PjParseError { message: String }, #[error("{message}")] - PjNotSupported { message: String }, + PjNotSupported{ message: String }, #[error("Malformed response from receiver: {message}")] ValidationError { message: String }, @@ -59,6 +59,9 @@ pub enum PayjoinError { #[error("{message}")] UrlError { message: String }, + + #[error("{message}")] + IoError { message: String }, } macro_rules! impl_from_error { @@ -99,3 +102,9 @@ impl From for PayjoinError { } } } + +impl From for PayjoinError { + fn from(value: payjoin::io::Error) -> Self { + PayjoinError::IoError { message: value.to_string() } + } +} diff --git a/src/io.rs b/src/io.rs new file mode 100644 index 0000000..7a9be82 --- /dev/null +++ b/src/io.rs @@ -0,0 +1,25 @@ +use crate::error::PayjoinError; +use crate::types::OhttpKeys; +use crate::uri::Url; + +/// Fetch the ohttp keys from the specified payjoin directory via proxy. +/// +/// * `ohttp_relay`: The http CONNNECT method proxy to request the ohttp keys from a payjoin +/// directory. Proxying requests for ohttp keys ensures a client IP address is never revealed to +/// the payjoin directory. +/// +/// * `payjoin_directory`: The payjoin directory from which to fetch the ohttp keys. This +/// directory stores and forwards payjoin client payloads. +/// +/// * `cert_der` (optional): The DER-encoded certificate to use for local HTTPS connections. This +/// parameter is only available when the "danger-local-https" feature is enabled. +pub async fn fetch_ohttp_keys( + ohttp_relay: Url, + payjoin_directory: Url, + cert_der: Vec, +) -> Result { + payjoin::io::fetch_ohttp_keys(ohttp_relay.into(), payjoin_directory.into(), cert_der) + .await + .map(|e| e.into()) + .map_err(|e| e.into()) +} diff --git a/src/lib.rs b/src/lib.rs index f149923..de43581 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,12 @@ #![crate_name = "payjoin_ffi"] pub mod error; +pub mod io; pub mod receive; pub mod send; pub mod types; pub mod uri; + use crate::error::PayjoinError; #[cfg(feature = "uniffi")] use crate::receive::v1::{ @@ -17,9 +19,9 @@ use crate::receive::v1::{ }; #[allow(unused_imports)] use crate::receive::v2::{ - ClientResponse, Enrolled, Enroller, RequestResponse, V2MaybeInputsOwned, V2MaybeInputsSeen, - V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, V2ProvisionalProposal, - V2UncheckedProposal, + ActiveSession, ClientResponse, RequestResponse, SessionInitializer, V2MaybeInputsOwned, + V2MaybeInputsSeen, V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, + V2ProvisionalProposal, V2UncheckedProposal, }; #[allow(unused_imports)] use crate::send::v1::{ diff --git a/src/receive/v1.rs b/src/receive/v1.rs index fa4cbd6..5904f73 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -90,7 +90,7 @@ impl UncheckedProposal { |transaction| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -108,7 +108,7 @@ impl UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -151,7 +151,7 @@ impl MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -164,7 +164,7 @@ impl MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -222,7 +222,7 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -235,7 +235,7 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -266,7 +266,7 @@ impl OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -275,15 +275,15 @@ impl OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } @@ -304,13 +304,25 @@ impl ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::ProvisionalProposal> { self.0.lock().unwrap() } - pub fn substitute_output_address( + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + self.mutex_guard() + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(Box::new(e))) + }) + .map_err(|e| e.into()) + } + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( &self, - substitute_address: String, + generate_script: impl Fn() -> Result, PayjoinError>, ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) } pub fn contribute_witness_input( &self, @@ -363,7 +375,7 @@ impl ProvisionalProposal { process_psbt .callback(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -382,7 +394,7 @@ impl ProvisionalProposal { |psbt| { process_psbt(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 21aa52f..0807785 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use std::io::Cursor; use std::str::FromStr; use std::sync::{Arc, Mutex, MutexGuard}; +use std::time::Duration; use payjoin::bitcoin::psbt::Psbt; use payjoin::bitcoin::FeeRate; @@ -11,6 +12,8 @@ use payjoin::receive as pdk; use crate::receive::v1::{ CanBroadcast, IsOutputKnown, IsScriptOwned, ProcessPartiallySignedTransaction, }; +use crate::types::Network; +use crate::uri::PjUriBuilder; use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; pub struct ClientResponse(Mutex>); @@ -33,31 +36,72 @@ pub struct RequestResponse { } #[derive(Clone, Debug)] -pub struct Enroller(pub payjoin::receive::v2::Enroller); -impl From for payjoin::receive::v2::Enroller { - fn from(value: Enroller) -> Self { +pub struct SessionInitializer(pub payjoin::receive::v2::SessionInitializer); +impl From for payjoin::receive::v2::SessionInitializer { + fn from(value: SessionInitializer) -> Self { value.0 } } -impl From for Enroller { - fn from(value: payjoin::receive::v2::Enroller) -> Self { +impl From for SessionInitializer { + fn from(value: payjoin::receive::v2::SessionInitializer) -> Self { Self(value) } } -impl Enroller { - pub fn from_directory_config( +impl SessionInitializer { + /// Creates a new `SessionInitializer` with the provided parameters. + /// + /// # Parameters + /// - `address`: The Bitcoin address for the payjoin session. + /// - `directory`: The URL of the store-and-forward payjoin directory. + /// - `ohttp_keys`: The OHTTP keys used for encrypting and decrypting HTTP requests and responses. + /// - `ohttp_relay`: The URL of the OHTTP relay, used to keep client IP address confidential. + /// - `expire_after`: The duration in seconds after which the session expires. + /// + /// # Returns + /// A new instance of `SessionInitializer`. + /// + /// # References + /// - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/pull/1483) + #[cfg(feature = "uniffi")] + pub fn new( + address: String, + expire_after: u64, + network: Network, directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, - ) -> Self { - payjoin::receive::v2::Enroller::from_directory_config( + ) -> Result { + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; + Ok(payjoin::receive::v2::SessionInitializer::new( + address, (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), + Duration::from_secs(expire_after), ) - .into() + .into()) + } + pub fn new( + address: String, + expire_after: u64, + network: Network, + directory: Arc, + ohttp_keys: Arc, + ohttp_relay: Arc, + ) -> Result { + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; + Ok(payjoin::receive::v2::SessionInitializer::new( + address, + (*directory).clone().into(), + (*ohttp_keys).clone().into(), + (*ohttp_relay).clone().into(), + Duration::from_secs(expire_after), + ) + .into()) } #[cfg(feature = "uniffi")] @@ -81,10 +125,10 @@ impl Enroller { &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result { + >::into(self.clone()) .process_res(Cursor::new(body), ctx) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] @@ -92,31 +136,28 @@ impl Enroller { &self, body: Vec, ctx: Arc, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result, PayjoinError> { + >::into(self.clone()) .process_res(Cursor::new(body), ctx.as_ref().into()) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) } } #[derive(Clone, Debug)] -pub struct Enrolled(payjoin::receive::v2::Enrolled); +pub struct ActiveSession(payjoin::receive::v2::ActiveSession); -impl From for payjoin::receive::v2::Enrolled { - fn from(value: Enrolled) -> Self { +impl From for payjoin::receive::v2::ActiveSession { + fn from(value: ActiveSession) -> Self { value.0 } } -impl From for Enrolled { - fn from(value: payjoin::receive::v2::Enrolled) -> Self { +impl From for ActiveSession { + fn from(value: payjoin::receive::v2::ActiveSession) -> Self { Self(value) } } -impl Enrolled { - pub fn fallback_target(&self) -> String { - >::into(self.clone()).fallback_target() - } +impl ActiveSession { #[cfg(feature = "uniffi")] pub fn extract_req(&self) -> Result { match self.0.clone().extract_req() { @@ -134,28 +175,48 @@ impl Enrolled { Err(e) => Err(PayjoinError::V2Error { message: e.to_string() }), } } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(feature = "uniffi")] pub fn process_res( &self, body: Vec, context: Arc, ) -> Result>, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), context.as_ref().into()) .map(|e| e.map(|x| Arc::new(x.into()))) .map_err(|e| e.into()) } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(not(feature = "uniffi"))] pub fn process_res( &self, body: Vec, ctx: ohttp::ClientResponse, ) -> Result, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), ctx) .map(|e| e.map(|o| o.into())) .map_err(|e| e.into()) } + pub fn pj_uri_builder(&self) -> PjUriBuilder { + >::into(self.clone()) + .pj_uri_builder() + .into() + } + /// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory. + /// This identifies a session at the payjoin directory server. + pub fn pj_url(&self) -> Url { + >::into(self.clone()) + .pj_url() + .into() + } + ///The per-session public key to use as an identifier + pub fn public_key(&self) -> String { + >::into(self.clone()) + .public_key() + .to_string() + } } #[derive(Clone)] @@ -204,7 +265,7 @@ impl V2UncheckedProposal { |tx| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(tx)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -223,7 +284,7 @@ impl V2UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -259,7 +320,7 @@ impl V2MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -272,7 +333,7 @@ impl V2MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -321,7 +382,7 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -334,7 +395,7 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -366,7 +427,7 @@ impl V2OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -375,18 +436,19 @@ impl V2OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } -pub struct V2ProvisionalProposal(Mutex); + +pub struct V2ProvisionalProposal(pub Mutex); impl From for V2ProvisionalProposal { fn from(value: payjoin::receive::v2::ProvisionalProposal) -> Self { @@ -399,15 +461,7 @@ impl V2ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::v2::ProvisionalProposal> { self.0.lock().unwrap() } - ///Just replace an output address with - pub fn substitute_output_address( - &self, - substitute_address: String, - ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) - } + pub fn contribute_witness_input( &self, txo: TxOut, @@ -451,6 +505,32 @@ impl V2ProvisionalProposal { Err(e) => Err(e.into()), } } + pub fn is_output_substitution_disabled(&self) -> bool { + self.mutex_guard().is_output_substitution_disabled() + } + + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + self.mutex_guard() + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(Box::new(e))) + }) + .map_err(|e| e.into()) + } + //TODO; create try_substitute_receiver_output for uniffi build + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + } + #[cfg(feature = "uniffi")] pub fn finalize_proposal( &self, @@ -460,11 +540,15 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt - .callback(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt + .callback(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(Box::new(e)))?; + match processed { + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(Box::new(e))), + } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -480,10 +564,14 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(Box::new(e)))?; + match processed { + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(Box::new(e))), + } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -553,25 +641,33 @@ impl V2PayjoinProposal { } } #[cfg(not(feature = "uniffi"))] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(body, ctx) - .map(|e| e.into()) + .process_res(body, ctx) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, res: Vec, ohttp_context: Arc, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(res, ohttp_context.as_ref().into()) - .map(|e| e) + .process_res(res, ohttp_context.as_ref().into()) .map_err(|e| e.into()) } } diff --git a/src/send/v1.rs b/src/send/v1.rs index e390cd7..570a1b5 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -7,7 +7,7 @@ pub use payjoin::send as pdk; use crate::error::PayjoinError; use crate::send::v2::ContextV2; use crate::types::Request; -use crate::uri::{Uri, Url}; +use crate::uri::{PjUri, Url}; ///Builder for sender-side payjoin parameters /// @@ -27,7 +27,7 @@ impl RequestBuilder { /// An HTTP client will own the Request data while Context sticks around so /// a `(Request, Context)` tuple is returned from `RequestBuilder::build()` /// to keep them separated. - pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { + pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { let psbt = payjoin::bitcoin::psbt::PartiallySignedTransaction::from_str(psbt.as_str())?; pdk::RequestBuilder::from_psbt_and_uri(psbt, (*uri).clone().into()) .map(|e| e.into()) @@ -94,8 +94,15 @@ impl RequestBuilder { /// /// While it's generally better to offer some contribution some users may wish not to. /// This function disables contribution. - pub fn build_non_incentivizing(&self) -> Result, PayjoinError> { - match self.0.clone().build_non_incentivizing() { + pub fn build_non_incentivizing( + &self, + min_fee_rate: u64, + ) -> Result, PayjoinError> { + match self + .0 + .clone() + .build_non_incentivizing(payjoin::bitcoin::FeeRate::from_sat_per_kwu(min_fee_rate)) + { Ok(e) => Ok(Arc::new(e.into())), Err(e) => Err(e.into()), } diff --git a/src/uri.rs b/src/uri.rs index 0e21089..7de1a2b 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,6 +1,7 @@ use std::str::FromStr; use payjoin::bitcoin::address::NetworkChecked; +use payjoin::UriExt; use crate::error::PayjoinError; #[cfg(not(feature = "uniffi"))] @@ -31,8 +32,18 @@ impl Uri { } ///Gets the amount in satoshis. pub fn amount(&self) -> Option { + self.0.amount.map(|x| x.to_btc()) } + pub fn check_pj_supported(&self) -> Result { + match self.0.clone().check_pj_supported(){ + Ok(e) => Ok(e.into()), + Err(_) => Err(PayjoinError::PjNotSupported{message:"Uri doesn't support payjoin".to_string()}) + } + } + pub fn as_string(&self) -> String { + self.0.clone().to_string() + } } impl From> for PjUri { @@ -46,15 +57,17 @@ impl<'a> From for payjoin::PjUri<'a> { value.0 } } -pub struct PjUri(payjoin::PjUri<'static>); + +#[derive(Clone)] +pub struct PjUri(pub payjoin::PjUri<'static>); impl PjUri { pub fn address(&self) -> String { self.0.clone().address.to_string() } - /// Amount in sats - pub fn amount(&self) -> Option { - self.0.clone().amount.map(|e| e.to_sat()) + /// Number of btc requested as payment + pub fn amount(&self) -> Option { + self.0.clone().amount.map(|e| e.to_btc()) } pub fn as_string(&self) -> String { self.0.clone().to_string() @@ -90,9 +103,16 @@ impl Url { self.0.to_string() } } + +///Build a valid PjUri. +// Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] -pub struct PjUriBuilder { - inner: payjoin::PjUriBuilder, +pub struct PjUriBuilder(pub payjoin::PjUriBuilder); + +impl From for PjUriBuilder { + fn from(value: payjoin::PjUriBuilder) -> Self { + Self(value) + } } #[cfg(not(feature = "uniffi"))] impl PjUriBuilder { @@ -103,94 +123,62 @@ impl PjUriBuilder { ohttp_keys: Option, ) -> Result { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); - Ok(Self { inner: payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)) }) + Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)).into()) } - ///Set the amount in btc you want to receive. - pub fn amount(self, amount: f64) -> Self { - let amount = payjoin::bitcoin::Amount::from_sat((amount * 100_001_890.0) as u64); - Self { inner: self.inner.amount(amount) } + ///Accepts the amount you want to receive in sats and sets it in btc . + pub fn amount(&self, amount: u64) -> Self { + let amount = payjoin::bitcoin::Amount::from_sat(amount); + self.0.clone().amount(amount).into() } - ///Set the message. - pub fn message(self, message: String) -> Self { - Self { inner: self.inner.message(message) } + /// Set the message. + pub fn message(&self, message: String) -> Self { + self.0.clone().message(message).into() } ///Set the label. - pub fn label(self, label: String) -> Self { - Self { inner: self.inner.label(label) } + pub fn label(&self, label: String) -> Self { + self.0.clone().label(label).into() } - ///Set whether or not payjoin output substitution is allowed. - pub fn pjos(self, pjos: bool) -> Self { - Self { inner: self.inner.pjos(pjos) } + ///Set whether payjoin output substitution is allowed. + pub fn pjos(&self, pjos: bool) -> Self { + self.0.clone().pjos(pjos).into() } ///Constructs a Uri with PayjoinParams from the parameters set in the builder. - pub fn build(self) -> PjUri { - self.inner.build().into() + pub fn build(&self) -> PjUri { + self.0.clone().build().into() } } + #[cfg(test)] mod tests { - use std::convert::TryFrom; - - use payjoin::Uri; - - #[test] - fn test_short() { - assert!(Uri::try_from("").is_err()); - assert!(Uri::try_from("bitcoin").is_err()); - assert!(Uri::try_from("bitcoin:").is_err()); - } + use bdk::bitcoin; - #[ignore] + use crate::uri::{PjUriBuilder, Url}; #[test] - fn test_todo_url_encoded() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=https://example.com?ciao"; - assert!(Uri::try_from(uri).is_err(), "pj url should be url encoded"); - } - - #[test] - fn test_valid_url() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=this_is_NOT_a_validURL"; - assert!(Uri::try_from(uri).is_err(), "pj is not a valid url"); - } - - #[test] - fn test_missing_amount() { - let uri = - "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?pj=https://testnet.demo.btcpayserver.org/BTC/pj"; - assert!(Uri::try_from(uri).is_ok(), "missing amount should be ok"); - } - - #[test] - fn test_unencrypted() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=http://example.com"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=ftp://foo.onion"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - } - - #[test] - fn test_valid_uris() { - let https = "https://example.com"; - let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion"; - - let base58 = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; - let bech32_upper = "BITCOIN:TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; - let bech32_lower = "bitcoin:tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; - - for address in [base58, bech32_upper, bech32_lower].iter() { - for pj in [https, onion].iter() { - let uri = format!("{}?amount=1&pj={}", address, pj); - assert!(Uri::try_from(&*uri).is_ok()); + fn test_ffi_builder() { + let https = "https://example.com/"; + let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion/"; + let base58 = "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; + let bech32_upper = "TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; + let bech32_lower = "tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; + + for address in vec![base58, bech32_upper, bech32_lower] { + for pj in vec![https, onion] { + let amount = bitcoin::Amount::ONE_BTC; + let builder = PjUriBuilder::new( + address.to_string(), + Url::from_str(pj.to_string()).unwrap(), + None, + ) + .unwrap(); + let uri = builder + .amount(amount.to_sat()) + .message("message".to_string()) + .pjos(true) + .label("label".to_string()) + .build(); + // assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); + print!("\n {}", uri.as_string()); } } } - - #[test] - fn test_unsupported() { - assert!(!Uri::try_from("bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX") - .unwrap() - .extras - .pj_is_supported()); - } } From b005296130ae51d5599ea63269583f03385cd2ad Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 01:37:00 -0400 Subject: [PATCH 36/41] feat(PjUriBuilder): expiry added constructor. --- src/uri.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uri.rs b/src/uri.rs index 7de1a2b..53f1cda 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,4 +1,5 @@ use std::str::FromStr; +use std::time::{Duration, UNIX_EPOCH}; use payjoin::bitcoin::address::NetworkChecked; use payjoin::UriExt; @@ -117,13 +118,19 @@ impl From for PjUriBuilder { #[cfg(not(feature = "uniffi"))] impl PjUriBuilder { ///Create a new PjUriBuilder with required parameters. + /// Parameters + // address: Represents a bitcoin address. + // origin: Represents either the payjoin endpoint in v1 or the directory in v2. + // ohttp_keys: Optional OHTTP keys for v2 (only available if the "v2" feature is enabled). + // expiry: Optional non-default duration_since epoch expiry for the payjoin session (only available if the "v2" feature is enabled). pub fn new( address: String, pj: Url, ohttp_keys: Option, + expiry: Option, ) -> Result { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); - Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)).into()) + Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0), expiry.map(|e| UNIX_EPOCH + Duration::from_secs(e)),).into()) } ///Accepts the amount you want to receive in sats and sets it in btc . pub fn amount(&self, amount: u64) -> Self { @@ -168,6 +175,7 @@ mod tests { address.to_string(), Url::from_str(pj.to_string()).unwrap(), None, + None ) .unwrap(); let uri = builder From cde43549160494554b82efc1a3171db92e99a7a4 Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 08:22:00 -0400 Subject: [PATCH 37/41] fix(SessionInitializer): made expire_after optional in constructor --- src/receive/v2.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 0807785..e04dc3d 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -67,7 +67,7 @@ impl SessionInitializer { #[cfg(feature = "uniffi")] pub fn new( address: String, - expire_after: u64, + expire_after: Option, network: Network, directory: Arc, ohttp_keys: Arc, @@ -80,13 +80,13 @@ impl SessionInitializer { (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), - Duration::from_secs(expire_after), + expire_after.map(|e| Duration::from_secs(e)), ) .into()) } pub fn new( address: String, - expire_after: u64, + expire_after: Option, network: Network, directory: Arc, ohttp_keys: Arc, @@ -99,7 +99,7 @@ impl SessionInitializer { (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), - Duration::from_secs(expire_after), + expire_after.map(|e| Duration::from_secs(e)), ) .into()) } From 93ded991bd6e0e0b47aefb7c06be8a35ab95a4e5 Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 11:11:00 -0400 Subject: [PATCH 38/41] code formatted --- src/error.rs | 2 +- src/receive/v1.rs | 7 +++++-- src/receive/v2.rs | 7 +++++-- src/uri.rs | 23 ++++++++++++++++------- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/error.rs b/src/error.rs index 8a98ebc..a0bb791 100644 --- a/src/error.rs +++ b/src/error.rs @@ -43,7 +43,7 @@ pub enum PayjoinError { PjParseError { message: String }, #[error("{message}")] - PjNotSupported{ message: String }, + PjNotSupported { message: String }, #[error("Malformed response from receiver: {message}")] ValidationError { message: String }, diff --git a/src/receive/v1.rs b/src/receive/v1.rs index 5904f73..54c6a24 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -164,7 +164,8 @@ impl MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) + is_owned(&input.to_bytes()) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -222,7 +223,9 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) + is_known + .callback(outpoint.clone().into()) + .map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index e04dc3d..aea7b1f 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -333,7 +333,8 @@ impl V2MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(Box::new(e))) + is_owned(&input.to_bytes()) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -382,7 +383,9 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) + is_known + .callback(outpoint.clone().into()) + .map_err(|e| pdk::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) diff --git a/src/uri.rs b/src/uri.rs index 53f1cda..f144af7 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,5 +1,5 @@ use std::str::FromStr; -use std::time::{Duration, UNIX_EPOCH}; +use std::time::{Duration, UNIX_EPOCH}; use payjoin::bitcoin::address::NetworkChecked; use payjoin::UriExt; @@ -33,13 +33,16 @@ impl Uri { } ///Gets the amount in satoshis. pub fn amount(&self) -> Option { - self.0.amount.map(|x| x.to_btc()) } - pub fn check_pj_supported(&self) -> Result { - match self.0.clone().check_pj_supported(){ + pub fn check_pj_supported(&self) -> Result { + match self.0.clone().check_pj_supported() { Ok(e) => Ok(e.into()), - Err(_) => Err(PayjoinError::PjNotSupported{message:"Uri doesn't support payjoin".to_string()}) + Err(_) => { + Err(PayjoinError::PjNotSupported { + message: "Uri doesn't support payjoin".to_string(), + }) + } } } pub fn as_string(&self) -> String { @@ -130,7 +133,13 @@ impl PjUriBuilder { expiry: Option, ) -> Result { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); - Ok(payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0), expiry.map(|e| UNIX_EPOCH + Duration::from_secs(e)),).into()) + Ok(payjoin::PjUriBuilder::new( + address, + pj.into(), + ohttp_keys.map(|e| e.0), + expiry.map(|e| UNIX_EPOCH + Duration::from_secs(e)), + ) + .into()) } ///Accepts the amount you want to receive in sats and sets it in btc . pub fn amount(&self, amount: u64) -> Self { @@ -175,7 +184,7 @@ mod tests { address.to_string(), Url::from_str(pj.to_string()).unwrap(), None, - None + None, ) .unwrap(); let uri = builder From e4201d7cb3e0d1fb364f9484fdd5b92639f1db00 Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 11:14:00 -0400 Subject: [PATCH 39/41] integration tests updated --- tests/bdk_integration_test.rs | 6 +----- tests/bitcoin_core_integration.rs | 8 +++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/bdk_integration_test.rs b/tests/bdk_integration_test.rs index 2eb4d02..9b199d4 100644 --- a/tests/bdk_integration_test.rs +++ b/tests/bdk_integration_test.rs @@ -278,10 +278,6 @@ fn handle_proposal(proposal: UncheckedProposal, receiver: Wallet) -> Arc Result<(), BoxError> { pj_receiver_address.to_string(), Url::from_str("https://example.com".to_string())?, None, + None, )? - .amount(0.0083285) + .amount(832_850) .build() .as_string(); print!("pj_uri {}", pj_uri_string); @@ -60,7 +61,7 @@ fn v1_to_v1_full_cycle() -> Result<(), BoxError> { .psbt; let psbt_base64 = sender.wallet_process_psbt(&psbt, None, None, None)?.psbt; eprintln!("Original psbt: {:#?}", psbt_base64); - let req_ctx = RequestBuilder::from_psbt_and_uri(psbt_base64, Arc::new(pj_uri))? + let req_ctx = RequestBuilder::from_psbt_and_uri(psbt_base64, Arc::new(pj_uri.check_pj_supported().unwrap()))? .build_with_additional_fee(10000, None, 0, false)? .extract_v1()?; let req = req_ctx.request; @@ -175,9 +176,6 @@ fn handle_pj_proposal(proposal: UncheckedProposal, receiver: Arc) -> Arc .contribute_witness_input(txo_to_contribute, outpoint_to_contribute) .expect("contribute_witness_input error"); - let receiver_substitute_address = - receiver.get_new_address(None, None).unwrap().assume_checked(); - payjoin.substitute_output_address(receiver_substitute_address.to_string()).unwrap(); let payjoin_proposal = payjoin .finalize_proposal( |e| { From 1f781d6b999ffdbf90e260ebe8fab83c396b821a Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 15:50:00 -0400 Subject: [PATCH 40/41] Doc comments updated --- Cargo.lock | 683 ++++++++++++++++++++++++++---- Cargo.toml | 15 +- README.md | 2 +- python/README.md | 36 +- src/error.rs | 9 + src/io.rs | 25 ++ src/lib.rs | 8 +- src/receive/v1.rs | 49 ++- src/receive/v2.rs | 225 +++++++--- src/send/v1.rs | 15 +- src/uri.rs | 168 ++++---- tests/bdk_integration_test.rs | 6 +- tests/bitcoin_core_integration.rs | 8 +- 13 files changed, 958 insertions(+), 291 deletions(-) create mode 100644 src/io.rs diff --git a/Cargo.lock b/Cargo.lock index 7f985c9..fb96797 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -142,6 +142,12 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "askama" version = "0.12.0" @@ -206,6 +212,16 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals 0.3.0", + "bitcoin_hashes 0.14.0", +] + [[package]] name = "base64" version = "0.13.1" @@ -275,9 +291,9 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] name = "bech32" -version = "0.10.0-beta" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "bhttp" @@ -335,16 +351,19 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.31.2" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" +checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6" dependencies = [ - "bech32 0.10.0-beta", - "bitcoin-internals 0.2.0", - "bitcoin_hashes 0.13.0", + "base58ck", + "bech32 0.11.0", + "bitcoin-internals 0.3.0", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes 0.14.0", "hex-conservative", "hex_lit", - "secp256k1 0.28.2", + "secp256k1 0.29.0", "serde", ] @@ -356,19 +375,35 @@ checksum = "1f9997f8650dd818369931b5672a18dbef95324d0513aa99aae758de8ce86e5b" [[package]] name = "bitcoin-internals" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" dependencies = [ "serde", ] +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + [[package]] name = "bitcoin-private" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals 0.3.0", + "serde", +] + [[package]] name = "bitcoin_hashes" version = "0.11.0" @@ -387,20 +422,20 @@ dependencies = [ [[package]] name = "bitcoin_hashes" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" dependencies = [ - "bitcoin-internals 0.2.0", + "bitcoin-io", "hex-conservative", "serde", ] [[package]] name = "bitcoincore-rpc" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb70725a621848c83b3809913d5314c0d20ca84877d99dd909504b564edab00" +checksum = "aedd23ae0fd321affb4bbbc36126c6f49a32818dc6b979395d24da8c9d4e80ee" dependencies = [ "bitcoincore-rpc-json", "jsonrpc", @@ -411,11 +446,11 @@ dependencies = [ [[package]] name = "bitcoincore-rpc-json" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856ffbee2e492c23bca715d72ea34aae80d58400f2bda26a82015d6bc2ec3662" +checksum = "d8909583c5fab98508e80ef73e5592a651c954993dc6b7739963257d19f0e71a" dependencies = [ - "bitcoin 0.31.2", + "bitcoin 0.32.2", "serde", "serde_json", ] @@ -608,7 +643,7 @@ version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.48", @@ -751,7 +786,7 @@ dependencies = [ "byteorder", "libc", "log", - "rustls", + "rustls 0.21.7", "serde", "serde_json", "webpki", @@ -782,6 +817,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -807,6 +848,39 @@ dependencies = [ "winapi", ] +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -886,6 +960,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hex" version = "0.4.3" @@ -894,9 +974,12 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] [[package]] name = "hex_lit" @@ -963,6 +1046,102 @@ dependencies = [ "zeroize", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls 0.22.4", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "idna" version = "0.5.0" @@ -991,6 +1170,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "itoa" version = "1.0.9" @@ -1008,11 +1193,12 @@ dependencies = [ [[package]] name = "jsonrpc" -version = "0.14.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8128f36b47411cd3f044be8c1f5cc0c9e24d1d1bfdc45f0a57897b32513053f2" +checksum = "3662a38d341d77efecb73caf01420cfa5aa63c0253fd7bc05289ef9f6616e1bf" dependencies = [ "base64 0.13.1", + "minreq", "serde", "serde_json", ] @@ -1093,6 +1279,28 @@ dependencies = [ "adler", ] +[[package]] +name = "minreq" +version = "2.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fdef521c74c2884a4f3570bcdb6d2a77b3c533feb6b27ac2ae72673cc221c64" +dependencies = [ + "log", + "serde", + "serde_json", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -1141,12 +1349,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "oneshot-uniffi" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -1186,15 +1388,18 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" -version = "0.16.0" -source = "git+https://github.com/payjoin/rust-payjoin?rev=457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373#457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373" +version = "0.18.0" +source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#3b5bda95fc8ce63f506538f0ff9daed885810488" dependencies = [ "bhttp", "bip21", "bitcoin 0.30.1", "chacha20poly1305 0.10.1", + "http", "log", "ohttp", + "reqwest", + "rustls 0.22.4", "serde", "serde_json", "url", @@ -1202,7 +1407,7 @@ dependencies = [ [[package]] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" dependencies = [ "base64 0.22.1", "bdk", @@ -1227,12 +1432,38 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plain" version = "0.2.3" @@ -1354,6 +1585,47 @@ dependencies = [ "bitflags", ] +[[package]] +name = "reqwest" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.22.4", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.26.3", + "winreg", +] + [[package]] name = "ring" version = "0.16.20" @@ -1380,7 +1652,7 @@ dependencies = [ "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1397,10 +1669,40 @@ checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring 0.16.20", - "rustls-webpki", + "rustls-webpki 0.101.6", "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.7", + "rustls-pki-types", + "rustls-webpki 0.102.5", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + [[package]] name = "rustls-webpki" version = "0.101.6" @@ -1411,6 +1713,17 @@ dependencies = [ "untrusted 0.7.1", ] +[[package]] +name = "rustls-webpki" +version = "0.102.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +dependencies = [ + "ring 0.17.7", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.15" @@ -1467,13 +1780,13 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" dependencies = [ - "bitcoin_hashes 0.12.0", + "bitcoin_hashes 0.14.0", "rand", - "secp256k1-sys 0.9.2", + "secp256k1-sys 0.10.0", "serde", ] @@ -1488,9 +1801,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" dependencies = [ "cc", ] @@ -1535,6 +1848,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -1593,6 +1918,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "socks" version = "0.3.4" @@ -1656,6 +1991,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 = "textwrap" version = "0.16.0" @@ -1663,8 +2004,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" dependencies = [ "smawk", - "unicode-linebreak", - "unicode-width", ] [[package]] @@ -1709,8 +2048,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", + "bytes", + "libc", + "mio", "pin-project-lite", + "socket2", "tokio-macros", + "windows-sys 0.48.0", ] [[package]] @@ -1724,6 +2068,17 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -1733,6 +2088,58 @@ dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -1760,12 +2167,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - [[package]] name = "unicode-normalization" version = "0.1.22" @@ -1775,17 +2176,11 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - [[package]] name = "uniffi" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5566fae48a5cb017005bf9cd622af5236b2a203a13fb548afde3506d3c68277" +checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", @@ -1798,19 +2193,18 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a77bb514bcd4bf27c9bd404d7c3f2a6a8131b957eba9c22cfeb7751c4278e09" +checksum = "96061d7e01b185aa405f7c9b134741ab3e50cc6796a47d6fd8ab9a5364b5feed" dependencies = [ "anyhow", "askama", "camino", "cargo_metadata", - "clap", "fs-err", "glob", "goblin", - "heck", + "heck 0.5.0", "once_cell", "paste", "serde", @@ -1823,9 +2217,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cba427aeb7b3a8b54830c4c915079a7a3c62608dd03dddba1d867a8a023eb4" +checksum = "9d6b86f9b221046af0c533eafe09ece04e2f1ded04ccdc9bba0ec09aec1c52bd" dependencies = [ "anyhow", "camino", @@ -1834,9 +2228,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e5a6c33b1dec3f255f57ec0b6af0f0b2bb3021868be1d5eec7a38e2905ebc" +checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" dependencies = [ "quote", "syn 2.0.48", @@ -1844,25 +2238,24 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea3eb5474d50fc149b7e4d86b9c5bd4a61dcc167f0683902bf18ae7bbb3deef" +checksum = "3210d57d6ab6065ab47a2898dacdb7c606fd6a4156196831fa3bf82e34ac58a6" dependencies = [ "anyhow", "bytes", "camino", "log", "once_cell", - "oneshot-uniffi", "paste", "static_assertions", ] [[package]] name = "uniffi_macros" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18331d35003f46f0d04047fbe4227291815b83a937a8c32bc057f990962182c4" +checksum = "b58691741080935437dc862122e68d7414432a11824ac1137868de46181a0bd2" dependencies = [ "bincode", "camino", @@ -1878,9 +2271,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7224422c4cfd181c7ca9fca2154abca4d21db962f926f270f996edd38b0c4b8" +checksum = "7663eacdbd9fbf4a88907ddcfe2e6fa85838eb6dc2418a7d91eebb3786f8e20b" dependencies = [ "anyhow", "bytes", @@ -1890,9 +2283,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce878d0bdfc288b58797044eaaedf748526c56eef3575380bb4d4b19d69eee" +checksum = "f922465f7566f25f8fe766920205fdfa9a3fcdc209c6bfb7557f0b5bf45b04dd" dependencies = [ "anyhow", "camino", @@ -1903,9 +2296,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c43c9ed40a8d20a5c3eae2d23031092db6b96dc8e571beb449ba9757484cea0" +checksum = "cef408229a3a407fafa4c36dc4f6ece78a6fb258ab28d2b64bddd49c8cb680f6" dependencies = [ "anyhow", "textwrap", @@ -1956,8 +2349,8 @@ dependencies = [ "flate2", "log", "once_cell", - "rustls", - "rustls-webpki", + "rustls 0.21.7", + "rustls-webpki 0.101.6", "serde", "serde_json", "socks", @@ -1974,6 +2367,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] @@ -1988,6 +2382,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2019,6 +2422,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2083,6 +2498,15 @@ version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +[[package]] +name = "webpki-roots" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weedle2" version = "5.0.0" @@ -2120,7 +2544,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -2129,13 +2562,29 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -2144,42 +2593,100 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "x25519-dalek" version = "2.0.0-pre.1" diff --git a/Cargo.toml b/Cargo.toml index 4c62728..a2bdbb7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "payjoin_ffi" -version = "0.13.0" +version = "0.18.0" license = "MIT OR Apache-2.0" edition = "2021" exclude = ["tests"] @@ -10,16 +10,17 @@ crate-type = ["lib", "staticlib", "cdylib"] name = "payjoin_ffi" [build-dependencies] -uniffi = { version = "0.27.1", features = ["build"] } +uniffi = { version = "0.28.0", features = ["build"] } [dev-dependencies] -uniffi = { version = "0.27.1", features = ["bindgen-tests"] } +uniffi = { version = "0.28.0", features = ["bindgen-tests"] } bdk = { version = "0.29.0", features = ["all-keys", "use-esplora-ureq", "keys-bip39"] } -bitcoincore-rpc = "0.18.0" +bitcoincore-rpc = "0.19.0" [dependencies] -#https://github.com/payjoin/rust-payjoin/commit/457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373 -payjoin = { git= "https://github.com/payjoin/rust-payjoin", rev = "457a0dd5cb212ddd9ea169b7fa3842bfc3d5f373", features = ["send", "receive", "base64", "v2"] } -uniffi = { version = "0.27.1" } + +#payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } +payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} +uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" } url = "2.5.0" diff --git a/README.md b/README.md index 7d65e19..59729fe 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ rpc_port = "18443" ``` Now, run the integration tests: -The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). +The integration tests illustrates and verify integration using bitcoin core and with bitcoin dev kit(bdk). ```shell diff --git a/python/README.md b/python/README.md index be1cc22..1a9ae83 100644 --- a/python/README.md +++ b/python/README.md @@ -1,16 +1,17 @@ # Payjoin -The Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/). +Welcome to the Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! Let's get you up and running with some smooth transactions and a sprinkle of fun. ## Install from PyPI -Install the latest release using +Grab the latest release with a simple: ```shell pip install payjoin ``` -## Run the unit tests +## Running Unit Tests +Follow these steps to clone the repository and run the unit tests: ```shell @@ -27,34 +28,33 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run unit tests +# Run unit tests python -m unittest --verbose test/payjoin_unit_test.py + ``` -## Run the integration test +## Running the Integration Test -Before running the integration test, we need to set up the Bitcoin core properly in the regtest network. If you don't -have Bitcoin Core locally, please refer to this [page](https://learn.saylor.org/mod/page/view.php?id=36347). Or you can -install `Nigiri Bitcoin`, which is a tool designed to simplify the process of running local instances of Bitcoin and -Liquid networks for development and testing purposes. You can refer to -this [link](https://github.com/vulpemventures/nigiri), to install it on your local machine. +Before diving into the integration test, you'll need to set up Bitcoin Core on the regtest network. If you don't have Bitcoin Core installed locally, check out [this installation guide](https://learn.saylor.org/mod/page/view.php?id=36347). Alternatively, you can use `Nigiri Bitcoin`, a tool designed to streamline the process of running local instances of Bitcoin and Liquid networks for development and testing. Follow the instructions [here](https://github.com/vulpemventures/nigiri) to install it on your machine. -Once the nigiri bitcoin starts running, please replace following snippet in `payjoin_integration_test.py`, with you -nigiri bitcoin core credentials. +Once Nigiri Bitcoin is up and running, replace the following snippet in `payjoin_integration_test.py` with your `Nigiri Bitcoin` Core credentials: ``` rpc_user = "bitcoin" rpc_password = "bitcoin" + ``` -NB: The default credentials would be the following +By default, these credentials are: ``` rpc_user = "admin1" rpc_password = "123" rpc_host = "localhost" rpc_port = "18443" + ``` +Now, proceed with the integration test: ```shell @@ -71,11 +71,12 @@ python setup.py bdist_wheel --verbose # Force reinstall payjoin pip install ./dist/payjoin-.whl --force-reinstall -#Run the integration test +# Run the integration test python -m unittest --verbose test/payjoin_integration_test.py + ``` -## Build the package +## Building the Package ```shell # Install dependencies @@ -86,4 +87,7 @@ bash ./scripts/generate_macos.sh # Build the wheel python setup.py --verbose bdist_wheel -``` \ No newline at end of file + +``` +We hope everything worked smoothly! Now go forth test, and may your test results be as reliable as the Bitcoin blockchain itself! +₿🔒🤝 diff --git a/src/error.rs b/src/error.rs index 363c89e..a0bb791 100644 --- a/src/error.rs +++ b/src/error.rs @@ -59,6 +59,9 @@ pub enum PayjoinError { #[error("{message}")] UrlError { message: String }, + + #[error("{message}")] + IoError { message: String }, } macro_rules! impl_from_error { @@ -99,3 +102,9 @@ impl From for PayjoinError { } } } + +impl From for PayjoinError { + fn from(value: payjoin::io::Error) -> Self { + PayjoinError::IoError { message: value.to_string() } + } +} diff --git a/src/io.rs b/src/io.rs new file mode 100644 index 0000000..7a9be82 --- /dev/null +++ b/src/io.rs @@ -0,0 +1,25 @@ +use crate::error::PayjoinError; +use crate::types::OhttpKeys; +use crate::uri::Url; + +/// Fetch the ohttp keys from the specified payjoin directory via proxy. +/// +/// * `ohttp_relay`: The http CONNNECT method proxy to request the ohttp keys from a payjoin +/// directory. Proxying requests for ohttp keys ensures a client IP address is never revealed to +/// the payjoin directory. +/// +/// * `payjoin_directory`: The payjoin directory from which to fetch the ohttp keys. This +/// directory stores and forwards payjoin client payloads. +/// +/// * `cert_der` (optional): The DER-encoded certificate to use for local HTTPS connections. This +/// parameter is only available when the "danger-local-https" feature is enabled. +pub async fn fetch_ohttp_keys( + ohttp_relay: Url, + payjoin_directory: Url, + cert_der: Vec, +) -> Result { + payjoin::io::fetch_ohttp_keys(ohttp_relay.into(), payjoin_directory.into(), cert_der) + .await + .map(|e| e.into()) + .map_err(|e| e.into()) +} diff --git a/src/lib.rs b/src/lib.rs index f149923..de43581 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,12 @@ #![crate_name = "payjoin_ffi"] pub mod error; +pub mod io; pub mod receive; pub mod send; pub mod types; pub mod uri; + use crate::error::PayjoinError; #[cfg(feature = "uniffi")] use crate::receive::v1::{ @@ -17,9 +19,9 @@ use crate::receive::v1::{ }; #[allow(unused_imports)] use crate::receive::v2::{ - ClientResponse, Enrolled, Enroller, RequestResponse, V2MaybeInputsOwned, V2MaybeInputsSeen, - V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, V2ProvisionalProposal, - V2UncheckedProposal, + ActiveSession, ClientResponse, RequestResponse, SessionInitializer, V2MaybeInputsOwned, + V2MaybeInputsSeen, V2MaybeMixedInputScripts, V2OutputsUnknown, V2PayjoinProposal, + V2ProvisionalProposal, V2UncheckedProposal, }; #[allow(unused_imports)] use crate::send::v1::{ diff --git a/src/receive/v1.rs b/src/receive/v1.rs index fa4cbd6..54c6a24 100644 --- a/src/receive/v1.rs +++ b/src/receive/v1.rs @@ -90,7 +90,7 @@ impl UncheckedProposal { |transaction| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -108,7 +108,7 @@ impl UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -151,7 +151,7 @@ impl MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -164,7 +164,8 @@ impl MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -222,7 +223,9 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known + .callback(outpoint.clone().into()) + .map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -235,7 +238,7 @@ impl MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -266,7 +269,7 @@ impl OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -275,15 +278,15 @@ impl OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } @@ -304,13 +307,25 @@ impl ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::ProvisionalProposal> { self.0.lock().unwrap() } - pub fn substitute_output_address( + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + self.mutex_guard() + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(Box::new(e))) + }) + .map_err(|e| e.into()) + } + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( &self, - substitute_address: String, + generate_script: impl Fn() -> Result, PayjoinError>, ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) } pub fn contribute_witness_input( &self, @@ -363,7 +378,7 @@ impl ProvisionalProposal { process_psbt .callback(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -382,7 +397,7 @@ impl ProvisionalProposal { |psbt| { process_psbt(psbt.to_string()) .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + .map_err(|e| pdk::Error::Server(Box::new(e))) }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) diff --git a/src/receive/v2.rs b/src/receive/v2.rs index 21aa52f..aea7b1f 100644 --- a/src/receive/v2.rs +++ b/src/receive/v2.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use std::io::Cursor; use std::str::FromStr; use std::sync::{Arc, Mutex, MutexGuard}; +use std::time::Duration; use payjoin::bitcoin::psbt::Psbt; use payjoin::bitcoin::FeeRate; @@ -11,6 +12,8 @@ use payjoin::receive as pdk; use crate::receive::v1::{ CanBroadcast, IsOutputKnown, IsScriptOwned, ProcessPartiallySignedTransaction, }; +use crate::types::Network; +use crate::uri::PjUriBuilder; use crate::{OhttpKeys, OutPoint, PayjoinError, Request, TxOut, Url}; pub struct ClientResponse(Mutex>); @@ -33,31 +36,72 @@ pub struct RequestResponse { } #[derive(Clone, Debug)] -pub struct Enroller(pub payjoin::receive::v2::Enroller); -impl From for payjoin::receive::v2::Enroller { - fn from(value: Enroller) -> Self { +pub struct SessionInitializer(pub payjoin::receive::v2::SessionInitializer); +impl From for payjoin::receive::v2::SessionInitializer { + fn from(value: SessionInitializer) -> Self { value.0 } } -impl From for Enroller { - fn from(value: payjoin::receive::v2::Enroller) -> Self { +impl From for SessionInitializer { + fn from(value: payjoin::receive::v2::SessionInitializer) -> Self { Self(value) } } -impl Enroller { - pub fn from_directory_config( +impl SessionInitializer { + /// Creates a new `SessionInitializer` with the provided parameters. + /// + /// # Parameters + /// - `address`: The Bitcoin address for the payjoin session. + /// - `directory`: The URL of the store-and-forward payjoin directory. + /// - `ohttp_keys`: The OHTTP keys used for encrypting and decrypting HTTP requests and responses. + /// - `ohttp_relay`: The URL of the OHTTP relay, used to keep client IP address confidential. + /// - `expire_after`: The duration in seconds after which the session expires. + /// + /// # Returns + /// A new instance of `SessionInitializer`. + /// + /// # References + /// - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/pull/1483) + #[cfg(feature = "uniffi")] + pub fn new( + address: String, + expire_after: Option, + network: Network, directory: Arc, ohttp_keys: Arc, ohttp_relay: Arc, - ) -> Self { - payjoin::receive::v2::Enroller::from_directory_config( + ) -> Result { + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; + Ok(payjoin::receive::v2::SessionInitializer::new( + address, (*directory).clone().into(), (*ohttp_keys).clone().into(), (*ohttp_relay).clone().into(), + expire_after.map(|e| Duration::from_secs(e)), ) - .into() + .into()) + } + pub fn new( + address: String, + expire_after: Option, + network: Network, + directory: Arc, + ohttp_keys: Arc, + ohttp_relay: Arc, + ) -> Result { + let address = payjoin::bitcoin::Address::from_str(address.as_str())? + .require_network(network.into())?; + Ok(payjoin::receive::v2::SessionInitializer::new( + address, + (*directory).clone().into(), + (*ohttp_keys).clone().into(), + (*ohttp_relay).clone().into(), + expire_after.map(|e| Duration::from_secs(e)), + ) + .into()) } #[cfg(feature = "uniffi")] @@ -81,10 +125,10 @@ impl Enroller { &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result { + >::into(self.clone()) .process_res(Cursor::new(body), ctx) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] @@ -92,31 +136,28 @@ impl Enroller { &self, body: Vec, ctx: Arc, - ) -> Result, PayjoinError> { - >::into(self.clone()) + ) -> Result, PayjoinError> { + >::into(self.clone()) .process_res(Cursor::new(body), ctx.as_ref().into()) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) } } #[derive(Clone, Debug)] -pub struct Enrolled(payjoin::receive::v2::Enrolled); +pub struct ActiveSession(payjoin::receive::v2::ActiveSession); -impl From for payjoin::receive::v2::Enrolled { - fn from(value: Enrolled) -> Self { +impl From for payjoin::receive::v2::ActiveSession { + fn from(value: ActiveSession) -> Self { value.0 } } -impl From for Enrolled { - fn from(value: payjoin::receive::v2::Enrolled) -> Self { +impl From for ActiveSession { + fn from(value: payjoin::receive::v2::ActiveSession) -> Self { Self(value) } } -impl Enrolled { - pub fn fallback_target(&self) -> String { - >::into(self.clone()).fallback_target() - } +impl ActiveSession { #[cfg(feature = "uniffi")] pub fn extract_req(&self) -> Result { match self.0.clone().extract_req() { @@ -134,28 +175,48 @@ impl Enrolled { Err(e) => Err(PayjoinError::V2Error { message: e.to_string() }), } } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(feature = "uniffi")] pub fn process_res( &self, body: Vec, context: Arc, ) -> Result>, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), context.as_ref().into()) .map(|e| e.map(|x| Arc::new(x.into()))) .map_err(|e| e.into()) } + ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet. #[cfg(not(feature = "uniffi"))] pub fn process_res( &self, body: Vec, ctx: ohttp::ClientResponse, ) -> Result, PayjoinError> { - >::into(self.clone()) + >::into(self.clone()) .process_res(Cursor::new(body), ctx) .map(|e| e.map(|o| o.into())) .map_err(|e| e.into()) } + pub fn pj_uri_builder(&self) -> PjUriBuilder { + >::into(self.clone()) + .pj_uri_builder() + .into() + } + /// The contents of the `&pj=` query parameter including the base64url-encoded public key receiver subdirectory. + /// This identifies a session at the payjoin directory server. + pub fn pj_url(&self) -> Url { + >::into(self.clone()) + .pj_url() + .into() + } + ///The per-session public key to use as an identifier + pub fn public_key(&self) -> String { + >::into(self.clone()) + .public_key() + .to_string() + } } #[derive(Clone)] @@ -204,7 +265,7 @@ impl V2UncheckedProposal { |tx| { can_broadcast .callback(payjoin::bitcoin::consensus::encode::serialize(tx)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -223,7 +284,7 @@ impl V2UncheckedProposal { min_fee_rate.map(|x| FeeRate::from_sat_per_kwu(x)), |transaction| { can_broadcast(&payjoin::bitcoin::consensus::encode::serialize(transaction)) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }, ) .map(|e| Arc::new(e.into())) @@ -259,7 +320,7 @@ impl V2MaybeInputsOwned { .check_inputs_not_owned(|input| { is_owned .callback(input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -272,7 +333,8 @@ impl V2MaybeInputsOwned { self.0 .clone() .check_inputs_not_owned(|input| { - is_owned(&input.to_bytes()).map_err(|e| payjoin::receive::Error::Server(e.into())) + is_owned(&input.to_bytes()) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -321,7 +383,9 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known.callback(outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known + .callback(outpoint.clone().into()) + .map_err(|e| pdk::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -334,7 +398,7 @@ impl V2MaybeInputsSeen { self.0 .clone() .check_no_inputs_seen_before(|outpoint| { - is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(e.into())) + is_known(&outpoint.clone().into()).map_err(|e| pdk::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) .map(|e| Arc::new(e.into())) @@ -366,7 +430,7 @@ impl V2OutputsUnknown { .identify_receiver_outputs(|output_script| { is_receiver_output .callback(output_script.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map(|e| Arc::new(e.into())) .map_err(|e| e.into()) @@ -375,18 +439,19 @@ impl V2OutputsUnknown { pub fn identify_receiver_outputs( &self, is_receiver_output: impl Fn(&Vec) -> Result, - ) -> Result, PayjoinError> { + ) -> Result { self.0 .clone() .identify_receiver_outputs(|input| { is_receiver_output(&input.to_bytes()) - .map_err(|e| payjoin::receive::Error::Server(e.into())) + .map_err(|e| payjoin::receive::Error::Server(Box::new(e))) }) .map_err(|e| e.into()) - .map(|e| Arc::new(e.into())) + .map(|e| e.into()) } } -pub struct V2ProvisionalProposal(Mutex); + +pub struct V2ProvisionalProposal(pub Mutex); impl From for V2ProvisionalProposal { fn from(value: payjoin::receive::v2::ProvisionalProposal) -> Self { @@ -399,15 +464,7 @@ impl V2ProvisionalProposal { fn mutex_guard(&self) -> MutexGuard<'_, payjoin::receive::v2::ProvisionalProposal> { self.0.lock().unwrap() } - ///Just replace an output address with - pub fn substitute_output_address( - &self, - substitute_address: String, - ) -> Result<(), PayjoinError> { - let address = - payjoin::bitcoin::Address::from_str(substitute_address.as_str())?.assume_checked(); - Ok(self.mutex_guard().substitute_output_address(address)) - } + pub fn contribute_witness_input( &self, txo: TxOut, @@ -451,6 +508,32 @@ impl V2ProvisionalProposal { Err(e) => Err(e.into()), } } + pub fn is_output_substitution_disabled(&self) -> bool { + self.mutex_guard().is_output_substitution_disabled() + } + + #[cfg(not(feature = "uniffi"))] + ///If output substitution is enabled, replace the receiver’s output script with a new one. + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + self.mutex_guard() + .try_substitute_receiver_output(|| { + generate_script() + .map(|e| payjoin::bitcoin::ScriptBuf::from_bytes(e)) + .map_err(|e| payjoin::Error::Server(Box::new(e))) + }) + .map_err(|e| e.into()) + } + //TODO; create try_substitute_receiver_output for uniffi build + #[cfg(feature = "uniffi")] + pub fn try_substitute_receiver_output( + &self, + generate_script: impl Fn() -> Result, PayjoinError>, + ) -> Result<(), PayjoinError> { + } + #[cfg(feature = "uniffi")] pub fn finalize_proposal( &self, @@ -460,11 +543,15 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt - .callback(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt + .callback(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(Box::new(e)))?; + match processed { + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(Box::new(e))), + } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -480,10 +567,14 @@ impl V2ProvisionalProposal { self.mutex_guard() .clone() .finalize_proposal( - |psbt| { - process_psbt(psbt.to_string()) - .map(|e| Psbt::from_str(e.as_str()).expect("Invalid process_psbt ")) - .map_err(|e| pdk::Error::Server(e.into())) + |pre_processed| { + let processed = process_psbt(pre_processed.to_string()) + .map(|e| Psbt::from_str(e.as_str())) + .map_err(|e| pdk::Error::Server(Box::new(e)))?; + match processed { + Ok(e) => Ok(e), + Err(e) => Err(pdk::Error::Server(Box::new(e))), + } }, min_feerate_sat_per_vb.and_then(|x| FeeRate::from_sat_per_vb(x)), ) @@ -553,25 +644,33 @@ impl V2PayjoinProposal { } } #[cfg(not(feature = "uniffi"))] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, body: Vec, ctx: ohttp::ClientResponse, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(body, ctx) - .map(|e| e.into()) + .process_res(body, ctx) .map_err(|e| e.into()) } #[cfg(feature = "uniffi")] - pub fn deserialize_res( + ///Processes the response for the final POST message from the receiver client in the v2 Payjoin protocol. + /// + /// This function decapsulates the response using the provided OHTTP context. If the response status is successful, it indicates that the Payjoin proposal has been accepted. Otherwise, it returns an error with the status code. + /// + /// After this function is called, the receiver can either wait for the Payjoin transaction to be broadcast or choose to broadcast the original PSBT. + pub fn process_res( &self, res: Vec, ohttp_context: Arc, - ) -> Result, PayjoinError> { + ) -> Result<(), PayjoinError> { >::into(self.clone()) - .deserialize_res(res, ohttp_context.as_ref().into()) - .map(|e| e) + .process_res(res, ohttp_context.as_ref().into()) .map_err(|e| e.into()) } } diff --git a/src/send/v1.rs b/src/send/v1.rs index e390cd7..570a1b5 100644 --- a/src/send/v1.rs +++ b/src/send/v1.rs @@ -7,7 +7,7 @@ pub use payjoin::send as pdk; use crate::error::PayjoinError; use crate::send::v2::ContextV2; use crate::types::Request; -use crate::uri::{Uri, Url}; +use crate::uri::{PjUri, Url}; ///Builder for sender-side payjoin parameters /// @@ -27,7 +27,7 @@ impl RequestBuilder { /// An HTTP client will own the Request data while Context sticks around so /// a `(Request, Context)` tuple is returned from `RequestBuilder::build()` /// to keep them separated. - pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { + pub fn from_psbt_and_uri(psbt: String, uri: Arc) -> Result { let psbt = payjoin::bitcoin::psbt::PartiallySignedTransaction::from_str(psbt.as_str())?; pdk::RequestBuilder::from_psbt_and_uri(psbt, (*uri).clone().into()) .map(|e| e.into()) @@ -94,8 +94,15 @@ impl RequestBuilder { /// /// While it's generally better to offer some contribution some users may wish not to. /// This function disables contribution. - pub fn build_non_incentivizing(&self) -> Result, PayjoinError> { - match self.0.clone().build_non_incentivizing() { + pub fn build_non_incentivizing( + &self, + min_fee_rate: u64, + ) -> Result, PayjoinError> { + match self + .0 + .clone() + .build_non_incentivizing(payjoin::bitcoin::FeeRate::from_sat_per_kwu(min_fee_rate)) + { Ok(e) => Ok(Arc::new(e.into())), Err(e) => Err(e.into()), } diff --git a/src/uri.rs b/src/uri.rs index 0e21089..a3e8b1e 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -1,6 +1,8 @@ use std::str::FromStr; +use std::time::{Duration, UNIX_EPOCH}; use payjoin::bitcoin::address::NetworkChecked; +use payjoin::UriExt; use crate::error::PayjoinError; #[cfg(not(feature = "uniffi"))] @@ -33,6 +35,19 @@ impl Uri { pub fn amount(&self) -> Option { self.0.amount.map(|x| x.to_btc()) } + pub fn check_pj_supported(&self) -> Result { + match self.0.clone().check_pj_supported() { + Ok(e) => Ok(e.into()), + Err(_) => { + Err(PayjoinError::PjNotSupported { + message: "Uri doesn't support payjoin".to_string(), + }) + } + } + } + pub fn as_string(&self) -> String { + self.0.clone().to_string() + } } impl From> for PjUri { @@ -46,15 +61,17 @@ impl<'a> From for payjoin::PjUri<'a> { value.0 } } -pub struct PjUri(payjoin::PjUri<'static>); + +#[derive(Clone)] +pub struct PjUri(pub payjoin::PjUri<'static>); impl PjUri { pub fn address(&self) -> String { self.0.clone().address.to_string() } - /// Amount in sats - pub fn amount(&self) -> Option { - self.0.clone().amount.map(|e| e.to_sat()) + /// Number of btc requested as payment + pub fn amount(&self) -> Option { + self.0.clone().amount.map(|e| e.to_btc()) } pub fn as_string(&self) -> String { self.0.clone().to_string() @@ -90,107 +107,94 @@ impl Url { self.0.to_string() } } + +///Build a valid PjUri. +// Payjoin receiver can use this builder to create a payjoin uri to send to the sender. #[cfg(not(feature = "uniffi"))] -pub struct PjUriBuilder { - inner: payjoin::PjUriBuilder, +pub struct PjUriBuilder(pub payjoin::PjUriBuilder); + +impl From for PjUriBuilder { + fn from(value: payjoin::PjUriBuilder) -> Self { + Self(value) + } } #[cfg(not(feature = "uniffi"))] impl PjUriBuilder { ///Create a new PjUriBuilder with required parameters. + /// Parameters + /// address: Represents a bitcoin address. + /// ohttp_keys: Optional OHTTP keys for v2. + /// expiry: Optional non-default duration_since epoch expiry for the payjoin session. pub fn new( address: String, pj: Url, ohttp_keys: Option, + expiry: Option, ) -> Result { let address = payjoin::bitcoin::Address::from_str(&address)?.assume_checked(); - Ok(Self { inner: payjoin::PjUriBuilder::new(address, pj.into(), ohttp_keys.map(|e| e.0)) }) - } - ///Set the amount in btc you want to receive. - pub fn amount(self, amount: f64) -> Self { - let amount = payjoin::bitcoin::Amount::from_sat((amount * 100_001_890.0) as u64); - Self { inner: self.inner.amount(amount) } - } - ///Set the message. - pub fn message(self, message: String) -> Self { - Self { inner: self.inner.message(message) } + Ok(payjoin::PjUriBuilder::new( + address, + pj.into(), + ohttp_keys.map(|e| e.0), + expiry.map(|e| UNIX_EPOCH + Duration::from_secs(e)), + ) + .into()) + } + ///Accepts the amount you want to receive in sats and sets it in btc . + pub fn amount(&self, amount: u64) -> Self { + let amount = payjoin::bitcoin::Amount::from_sat(amount); + self.0.clone().amount(amount).into() + } + /// Set the message. + pub fn message(&self, message: String) -> Self { + self.0.clone().message(message).into() } ///Set the label. - pub fn label(self, label: String) -> Self { - Self { inner: self.inner.label(label) } + pub fn label(&self, label: String) -> Self { + self.0.clone().label(label).into() } - ///Set whether or not payjoin output substitution is allowed. - pub fn pjos(self, pjos: bool) -> Self { - Self { inner: self.inner.pjos(pjos) } + ///Set whether payjoin output substitution is allowed. + pub fn pjos(&self, pjos: bool) -> Self { + self.0.clone().pjos(pjos).into() } ///Constructs a Uri with PayjoinParams from the parameters set in the builder. - pub fn build(self) -> PjUri { - self.inner.build().into() + pub fn build(&self) -> PjUri { + self.0.clone().build().into() } } + #[cfg(test)] mod tests { - use std::convert::TryFrom; - - use payjoin::Uri; - - #[test] - fn test_short() { - assert!(Uri::try_from("").is_err()); - assert!(Uri::try_from("bitcoin").is_err()); - assert!(Uri::try_from("bitcoin:").is_err()); - } - - #[ignore] - #[test] - fn test_todo_url_encoded() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=https://example.com?ciao"; - assert!(Uri::try_from(uri).is_err(), "pj url should be url encoded"); - } - - #[test] - fn test_valid_url() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=this_is_NOT_a_validURL"; - assert!(Uri::try_from(uri).is_err(), "pj is not a valid url"); - } - - #[test] - fn test_missing_amount() { - let uri = - "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?pj=https://testnet.demo.btcpayserver.org/BTC/pj"; - assert!(Uri::try_from(uri).is_ok(), "missing amount should be ok"); - } + use bdk::bitcoin; + use crate::uri::{PjUriBuilder, Url}; #[test] - fn test_unencrypted() { - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=http://example.com"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - - let uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=ftp://foo.onion"; - assert!(Uri::try_from(uri).is_err(), "unencrypted connection"); - } - - #[test] - fn test_valid_uris() { - let https = "https://example.com"; - let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion"; - - let base58 = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; - let bech32_upper = "BITCOIN:TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; - let bech32_lower = "bitcoin:tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; - - for address in [base58, bech32_upper, bech32_lower].iter() { - for pj in [https, onion].iter() { - let uri = format!("{}?amount=1&pj={}", address, pj); - assert!(Uri::try_from(&*uri).is_ok()); + fn test_ffi_builder() { + let https = "https://example.com/"; + let onion = "http://vjdpwgybvubne5hda6v4c5iaeeevhge6jvo3w2cl6eocbwwvwxp7b7qd.onion/"; + let base58 = "12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"; + let bech32_upper = "TB1Q6D3A2W975YNY0ASUVD9A67NER4NKS58FF0Q8G4"; + let bech32_lower = "tb1q6d3a2w975yny0asuvd9a67ner4nks58ff0q8g4"; + + for address in vec![base58, bech32_upper, bech32_lower] { + for pj in vec![https, onion] { + let amount = bitcoin::Amount::ONE_BTC; + let builder = PjUriBuilder::new( + address.to_string(), + Url::from_str(pj.to_string()).unwrap(), + None, + None, + ) + .unwrap(); + let uri = builder + .amount(amount.to_sat()) + .message("message".to_string()) + .pjos(true) + .label("label".to_string()) + .build(); + // assert_eq!(uri.amount(), Some(bitcoin::Amount::ONE_BTC.to_btc())); + print!("\n {}", uri.as_string()); } } } - - #[test] - fn test_unsupported() { - assert!(!Uri::try_from("bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX") - .unwrap() - .extras - .pj_is_supported()); - } } diff --git a/tests/bdk_integration_test.rs b/tests/bdk_integration_test.rs index 2eb4d02..9b199d4 100644 --- a/tests/bdk_integration_test.rs +++ b/tests/bdk_integration_test.rs @@ -278,10 +278,6 @@ fn handle_proposal(proposal: UncheckedProposal, receiver: Wallet) -> Arc Result<(), BoxError> { pj_receiver_address.to_string(), Url::from_str("https://example.com".to_string())?, None, + None, )? - .amount(0.0083285) + .amount(832_850) .build() .as_string(); print!("pj_uri {}", pj_uri_string); @@ -60,7 +61,7 @@ fn v1_to_v1_full_cycle() -> Result<(), BoxError> { .psbt; let psbt_base64 = sender.wallet_process_psbt(&psbt, None, None, None)?.psbt; eprintln!("Original psbt: {:#?}", psbt_base64); - let req_ctx = RequestBuilder::from_psbt_and_uri(psbt_base64, Arc::new(pj_uri))? + let req_ctx = RequestBuilder::from_psbt_and_uri(psbt_base64, Arc::new(pj_uri.check_pj_supported().unwrap()))? .build_with_additional_fee(10000, None, 0, false)? .extract_v1()?; let req = req_ctx.request; @@ -175,9 +176,6 @@ fn handle_pj_proposal(proposal: UncheckedProposal, receiver: Arc) -> Arc .contribute_witness_input(txo_to_contribute, outpoint_to_contribute) .expect("contribute_witness_input error"); - let receiver_substitute_address = - receiver.get_new_address(None, None).unwrap().assume_checked(); - payjoin.substitute_output_address(receiver_substitute_address.to_string()).unwrap(); let payjoin_proposal = payjoin .finalize_proposal( |e| { From b967bd7944b1be1e7ccdcb7ba941da383746d5ca Mon Sep 17 00:00:00 2001 From: BitcoinZavior Date: Thu, 18 Jul 2024 20:20:00 -0400 Subject: [PATCH 41/41] payjoin updated --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb96797..b1940ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1388,8 +1388,8 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "payjoin" -version = "0.18.0" -source = "git+https://github.com/LtbLightning/rust-payjoin?branch=clone-pj-uri-builder#3b5bda95fc8ce63f506538f0ff9daed885810488" +version = "0.19.0" +source = "git+https://github.com/payjoin/rust-payjoin?rev=941a6798f52f60d72061fc0a02b5b42146321453#941a6798f52f60d72061fc0a02b5b42146321453" dependencies = [ "bhttp", "bip21", diff --git a/Cargo.toml b/Cargo.toml index a2bdbb7..8ffbcc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ bitcoincore-rpc = "0.19.0" [dependencies] #payjoin = {version = "=0.18.0", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"] } -payjoin={ git = "https://github.com/LtbLightning/rust-payjoin", branch = "clone-pj-uri-builder", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} +payjoin={ git = "https://github.com/payjoin/rust-payjoin", rev = "941a6798f52f60d72061fc0a02b5b42146321453", features = ["send", "receive", "base64", "v2", "io", "danger-local-https"]} uniffi = { version = "0.28.0" } thiserror = "1.0.47" ohttp = { version = "0.5.1" }