From bc39148b632ff27ef34d5b1b8c568b23d0998977 Mon Sep 17 00:00:00 2001 From: Cobb Date: Mon, 4 May 2026 11:09:00 -0700 Subject: [PATCH] =?UTF-8?q?phase=201:=20full=20read=20path=20=E2=80=94=20b?= =?UTF-8?q?ip39=20+=20cip-3=20+=20cip-1852=20+=20koios=20+=20age-mnemonic?= =?UTF-8?q?=20+=20rmcp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit end-to-end working wallet: paste 24-word mnemonic, age-encrypt at rest, on unlock derive root + payment + stake keys, build cip-19 base address, serve four tools over mcp stdio (wallet.address, wallet.network, wallet.balance, wallet.utxos). deps added: ed25519-bip32 0.4 (pallas only ships raw ed25519, not the cardano variant of bip32 hd derivation), cryptoxide 0.4 for pbkdf2-hmac-sha512, age 0.10 for at-rest mnemonic encryption, rpassword 7 for tty-only passphrase prompts, toml 0.9 for config.toml. new modules: - crates/aldabra-core/src/derive.rs — payment + stake key derivation, hash - crates/aldabra-chain/src/koios.rs — real reqwest impl, asset aggregation - crates/aldabra-mcp/src/{bootstrap,config,tools}.rs caught one bug pre-flight: get_balance was clobbering same-asset quantities across utxos instead of summing. fixed + regression test. headless support via ALDABRA_PASSPHRASE env (mcp clients own stdin so the rpassword prompt path can't run). docker secret / systemd EnvironmentFile sources it in production. dockerfile: multi-stage rust:1.95-bookworm → debian:bookworm-slim, tini as pid1, non-root aldabra user, /var/lib/aldabra owned 700. 29 unit tests + 1 ignored live-koios test. preprod smoke test exercised initialize → tools/list → tools/call wallet.address end-to-end via piped json-rpc; correct preprod address came back from canonical abandon-art mnemonic. phase 2 (send) is next. --- .dockerignore | 9 + Cargo.lock | 2956 +++++++++++++++++++++++++++ Cargo.toml | 20 +- Dockerfile | 72 + crates/aldabra-chain/src/koios.rs | 328 +++ crates/aldabra-chain/src/lib.rs | 76 +- crates/aldabra-core/Cargo.toml | 2 + crates/aldabra-core/src/derive.rs | 168 ++ crates/aldabra-core/src/lib.rs | 277 ++- crates/aldabra-mcp/Cargo.toml | 5 + crates/aldabra-mcp/src/bootstrap.rs | 211 ++ crates/aldabra-mcp/src/config.rs | 194 ++ crates/aldabra-mcp/src/main.rs | 119 +- crates/aldabra-mcp/src/tools.rs | 119 ++ 14 files changed, 4389 insertions(+), 167 deletions(-) create mode 100644 .dockerignore create mode 100644 Cargo.lock create mode 100644 Dockerfile create mode 100644 crates/aldabra-chain/src/koios.rs create mode 100644 crates/aldabra-core/src/derive.rs create mode 100644 crates/aldabra-mcp/src/bootstrap.rs create mode 100644 crates/aldabra-mcp/src/config.rs create mode 100644 crates/aldabra-mcp/src/tools.rs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5ae9fba --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +target +**/target +.git +.gitignore +*.age +.openclaw-test* +README-build.md +Dockerfile +.dockerignore diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..9284ea2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2956 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "age" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77de71da1ca673855aacea507a7aed363beb8934cf61b62364fc4b479d2e8cda" +dependencies = [ + "age-core", + "base64 0.21.7", + "bech32", + "chacha20poly1305", + "cookie-factory", + "hmac", + "i18n-embed", + "i18n-embed-fl", + "lazy_static", + "nom", + "pin-project", + "rand 0.8.6", + "rust-embed", + "scrypt", + "sha2", + "subtle", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "age-core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5f11899bc2bbddd135edbc30c36b1924fa59d0746bb45beb5933fafe3fe509b" +dependencies = [ + "base64 0.21.7", + "chacha20poly1305", + "cookie-factory", + "hkdf", + "io_tee", + "nom", + "rand 0.8.6", + "secrecy", + "sha2", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "aldabra-chain" +version = "0.0.1" +dependencies = [ + "async-trait", + "reqwest", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "aldabra-core" +version = "0.0.1" +dependencies = [ + "bip39", + "cryptoxide", + "ed25519-bip32", + "pallas-addresses", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "serde", + "thiserror 1.0.69", + "zeroize", +] + +[[package]] +name = "aldabra-mcp" +version = "0.0.1" +dependencies = [ + "age", + "aldabra-chain", + "aldabra-core", + "anyhow", + "rmcp", + "rpassword", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "toml 0.9.12+spec-1.1.0", + "tracing", + "tracing-subscriber", + "zeroize", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arc-swap" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3a1fd6f75306b68087b831f025c712524bcb19aad54e557b1129cfa0a2b207" +dependencies = [ + "rustversion", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "basic-toml" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" +dependencies = [ + "serde", +] + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bip39" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" +dependencies = [ + "bitcoin_hashes", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" +dependencies = [ + "hex-conservative", +] + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "cookie-factory" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" +dependencies = [ + "futures", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cryptoxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382ce8820a5bb815055d3553a610e8cb542b2d767bbacea99038afda96cd760d" + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "ed25519-bip32" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb588f93c0d91b2f668849fd6d030cddb0b2e31f105963be189da5acdf492a21" +dependencies = [ + "cryptoxide", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-crate" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a98bbaacea1c0eb6a0876280051b892eb73594fd90cf3b20e9c817029c57d2" +dependencies = [ + "toml 0.5.11", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fluent" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb74634707bebd0ce645a981148e8fb8c7bccd4c33c652aeffd28bf2f96d555a" +dependencies = [ + "fluent-bundle", + "unic-langid", +] + +[[package]] +name = "fluent-bundle" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe0a21ee80050c678013f82edf4b705fe2f26f1f9877593d13198612503f493" +dependencies = [ + "fluent-langneg", + "fluent-syntax", + "intl-memoizer", + "intl_pluralrules", + "rustc-hash 1.1.0", + "self_cell 0.10.3", + "smallvec", + "unic-langid", +] + +[[package]] +name = "fluent-langneg" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eebbe59450baee8282d71676f3bfed5689aeab00b27545e83e5f14b1195e8b0" +dependencies = [ + "unic-langid", +] + +[[package]] +name = "fluent-syntax" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a530c4694a6a8d528794ee9bbd8ba0122e779629ac908d15ad5a7ae7763a33d" +dependencies = [ + "thiserror 1.0.69", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "i18n-config" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e06b90c8a0d252e203c94344b21e35a30f3a3a85dc7db5af8f8df9f3e0c63ef" +dependencies = [ + "basic-toml", + "log", + "serde", + "serde_derive", + "thiserror 1.0.69", + "unic-langid", +] + +[[package]] +name = "i18n-embed" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94205d95764f5bb9db9ea98fa77f89653365ca748e27161f5bbea2ffd50e459c" +dependencies = [ + "arc-swap", + "fluent", + "fluent-langneg", + "fluent-syntax", + "i18n-embed-impl", + "intl-memoizer", + "lazy_static", + "log", + "parking_lot", + "rust-embed", + "thiserror 1.0.69", + "unic-langid", + "walkdir", +] + +[[package]] +name = "i18n-embed-fl" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc1f8715195dffc4caddcf1cf3128da15fe5d8a137606ea8856c9300047d5a2" +dependencies = [ + "dashmap", + "find-crate", + "fluent", + "fluent-syntax", + "i18n-config", + "i18n-embed", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", + "unic-langid", +] + +[[package]] +name = "i18n-embed-impl" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2cc0e0523d1fe6fc2c6f66e5038624ea8091b3e7748b5e8e0c84b1698db6c2" +dependencies = [ + "find-crate", + "i18n-config", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "intl-memoizer" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310da2e345f5eb861e7a07ee182262e94975051db9e4223e909ba90f392f163f" +dependencies = [ + "type-map", + "unic-langid", +] + +[[package]] +name = "intl_pluralrules" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972" +dependencies = [ + "unic-langid", +] + +[[package]] +name = "io_tee" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b3f7cef34251886990511df1c61443aa928499d598a9473929ab5a90a527304" + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "minicbor" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0452a60c1863c1f50b5f77cd295e8d2786849f35883f0b9e18e7e6e1b5691b0" +dependencies = [ + "half", + "minicbor-derive", +] + +[[package]] +name = "minicbor-derive" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd2209fff77f705b00c737016a48e73733d7fbccb8b007194db148f03561fb70" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "pallas-addresses" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a7e0425ec22afe8e80c9f9dfb086cbad569fd2ba3e51d6ab8caa20423b7488" +dependencies = [ + "base58", + "bech32", + "crc", + "cryptoxide", + "hex", + "pallas-codec", + "pallas-crypto", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-codec" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e344b3e39ca3bd79bb7547b65b980869c3c377a00c48ece70430f4611c32a18b" +dependencies = [ + "hex", + "minicbor", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-crypto" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c89ea16190a87a1d8bd36923093740a2b659ed6129f4636329319a70cc4db3" +dependencies = [ + "cryptoxide", + "hex", + "pallas-codec", + "rand_core 0.6.4", + "serde", + "thiserror 1.0.69", + "zeroize", +] + +[[package]] +name = "pallas-primitives" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1912f4f4a0719e36ac061f7f3557b687e8ef7285b573608fb5c71eba64c1b04c" +dependencies = [ + "base58", + "bech32", + "hex", + "log", + "pallas-codec", + "pallas-crypto", + "serde", + "serde_json", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.2", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.4", + "ring", + "rustc-hash 2.1.2", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rmcp" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33a0110d28bd076f39e14bfd5b0340216dd18effeb5d02b43215944cc3e5c751" +dependencies = [ + "base64 0.21.7", + "chrono", + "futures", + "paste", + "pin-project-lite", + "rmcp-macros", + "schemars", + "serde", + "serde_json", + "thiserror 2.0.18", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "rmcp-macros" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e2b2fd7497540489fa2db285edd43b7ed14c49157157438664278da6e42a7a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "rpassword" +version = "7.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac5b223d9738ef56e0b98305410be40fa0941bf6036c56f1506751e43552d64" +dependencies = [ + "libc", + "rtoolbox", + "windows-sys 0.61.2", +] + +[[package]] +name = "rtoolbox" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50a0e551c1e27e1731aba276dbeaeac73f53c7cd34d1bda485d02bd1e0f36844" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "rust-embed" +version = "8.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "8.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa" +dependencies = [ + "proc-macro2", + "quote", + "rust-embed-utils", + "syn 2.0.117", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "8.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1" +dependencies = [ + "sha2", + "walkdir", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.117", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "self_cell" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14e4d63b804dc0c7ec4a1e52bcb63f02c7ac94476755aa579edac21e01f915d" +dependencies = [ + "self_cell 1.2.2", +] + +[[package]] +name = "self_cell" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[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.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "110a78583f19d5cdb2c5ccf321d1290344e71313c6c37d43520d386027d18386" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.2", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.2", +] + +[[package]] +name = "typenum" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" + +[[package]] +name = "unic-langid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ba52c9b05311f4f6e62d5d9d46f094bd6e84cb8df7b3ef952748d752a7d05" +dependencies = [ + "unic-langid-impl", +] + +[[package]] +name = "unic-langid-impl" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce1bf08044d4b7a94028c93786f8566047edc11110595914de93362559bc658" +dependencies = [ + "serde", + "tinystr", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[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.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.120" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[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]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[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 0.52.6", + "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]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[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_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[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_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core 0.6.4", + "serde", + "zeroize", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index e83263f..49f77cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,9 +41,18 @@ pallas-addresses = "0.32" pallas-txbuilder = "0.32" pallas-network = "0.32" -# Mnemonic + key derivation. bip39 for the wordlist, then pallas-crypto -# handles the Cardano-specific CIP-3 / CIP-1852 derivation paths. +# Mnemonic + key derivation. +# bip39 — 24-word wordlist parsing + BIP-39 entropy extraction. +# ed25519-bip32 — Cardano's variant of BIP-32-Ed25519 HD derivation +# (XPrv + DerivationScheme::V2 hard/soft children). +# pallas-crypto only ships raw ed25519, not HD derivation. +# cryptoxide — PBKDF2-HMAC-SHA512 for Icarus master-key generation +# (CIP-3). Already pulled in transitively by +# ed25519-bip32; declared here so we can use pbkdf2 + Sha512 +# directly in aldabra-core. bip39 = "2" +ed25519-bip32 = "0.4" +cryptoxide = "0.4" # At-rest encryption for the mnemonic + derived keys on disk. age is # what the cauldron Fernet pattern would have been if we'd had it back @@ -73,3 +82,10 @@ rmcp = { version = "0.1", features = ["server", "transport-io"] } # Logging tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } + +# Config file parsing — TOML at $ALDABRA_DATA/config.toml. +toml = "0.9" + +# Hidden-input passphrase prompts for the mnemonic bootstrap CLI. +# rpassword is the standard "tty echo off" prompt crate. +rpassword = "7" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..04b1eca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,72 @@ +# aldabra — Cardano lite wallet over MCP. +# +# Multi-stage: +# 1. builder — rust toolchain, cargo build --release +# 2. runtime — debian:bookworm-slim, just the binary + ca-certs. +# +# Built nightly on Lucy (see lucy-infra/scripts/nightly-builds.sh) and +# published as `lucy-registry:5000/aldabra/mcp:{SHA,latest}`. Pulled +# anywhere we want the MCP server available — usually as a sidecar +# spawned by an MCP client (Claude Code, OpenClaw). +# +# Required env at runtime: +# ALDABRA_DATA directory containing mnemonic.age (must +# already exist; bootstrap separately on +# first install) +# ALDABRA_NETWORK mainnet | preview | preprod (default preprod) +# ALDABRA_KOIOS_BASE defaults to public Koios for the network +# ALDABRA_PASSPHRASE unlocks mnemonic.age. Source from a docker +# secret or systemd EnvironmentFile — never +# commit it. + +FROM rust:1.95-bookworm AS builder + +WORKDIR /build + +# Cache deps separately from source. Copy manifests + dummy bins so +# `cargo build` resolves and downloads everything before the real +# source rebuilds invalidate the layer. +COPY Cargo.toml ./ +COPY crates/aldabra-core/Cargo.toml crates/aldabra-core/ +COPY crates/aldabra-chain/Cargo.toml crates/aldabra-chain/ +COPY crates/aldabra-mcp/Cargo.toml crates/aldabra-mcp/ + +RUN mkdir -p crates/aldabra-core/src crates/aldabra-chain/src crates/aldabra-mcp/src && \ + echo 'fn main() {}' > crates/aldabra-mcp/src/main.rs && \ + echo '' > crates/aldabra-core/src/lib.rs && \ + echo '' > crates/aldabra-chain/src/lib.rs && \ + cargo build --release --bin aldabra || true && \ + rm -rf crates/*/src + +COPY crates ./crates + +# Touch every src file so cargo notices and rebuilds. The dummy-source +# trick above leaves stale build artifacts otherwise. +RUN find crates -name '*.rs' -exec touch {} + + +RUN cargo build --release --bin aldabra && \ + strip target/release/aldabra + +FROM debian:bookworm-slim AS runtime + +# rustls-tls needs ca-certificates to verify Koios's TLS cert. +# tini for proper signal forwarding when running as PID 1. +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates tini && \ + rm -rf /var/lib/apt/lists/* + +COPY --from=builder /build/target/release/aldabra /usr/local/bin/aldabra + +# Default data dir — mount a volume here in compose / k8s / docker run. +ENV ALDABRA_DATA=/var/lib/aldabra +RUN mkdir -p /var/lib/aldabra && chmod 700 /var/lib/aldabra + +# Non-root user for runtime. Mnemonic.age is owner-readable only +# (chmod 600 from the bootstrap path), so the runtime UID must own +# the data dir. +RUN groupadd -r aldabra && useradd -r -g aldabra -d /var/lib/aldabra aldabra && \ + chown -R aldabra:aldabra /var/lib/aldabra +USER aldabra + +# tini handles SIGTERM and reaps zombies. +ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/aldabra"] diff --git a/crates/aldabra-chain/src/koios.rs b/crates/aldabra-chain/src/koios.rs new file mode 100644 index 0000000..0b21c59 --- /dev/null +++ b/crates/aldabra-chain/src/koios.rs @@ -0,0 +1,328 @@ +//! Koios REST client — POST queries against the Cardano node feature +//! set Koios provides on top of cardano-db-sync. +//! +//! All Koios POST endpoints take a body of `{"_addresses": [...]}` +//! plus optional flags. We use `/address_utxos` for the UTXO set and +//! `/address_info` for the aggregate balance + nested UTXO snapshot. +//! +//! Numeric quantities come back as strings — Cardano amounts are +//! uint64s and JSON-as-spec doesn't safely round-trip those through +//! a JS Number. We parse them into `u64` here. +//! +//! ## Endpoint URLs +//! +//! - mainnet: `https://api.koios.rest/api/v1` +//! - preprod: `https://preprod.koios.rest/api/v1` +//! - preview: `https://preview.koios.rest/api/v1` +//! +//! Sulkta-hosted Koios on Rackham (when it lands) drops in here too — +//! it's the same API. + +use std::collections::BTreeMap; +use std::time::Duration; + +use async_trait::async_trait; +use reqwest::Client; +use serde::{Deserialize, Serialize}; + +use crate::{Balance, ChainBackend, ChainError, Utxo}; + +/// Default timeout for a single Koios HTTP call. 10 s covers the +/// public mainnet endpoint's worst case. +const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10); + +#[derive(Serialize)] +struct AddressesBody<'a> { + #[serde(rename = "_addresses")] + addresses: Vec<&'a str>, +} + +#[derive(Deserialize)] +struct KoiosAsset { + policy_id: String, + /// Hex-encoded asset name (NOT bech32 fingerprint). + asset_name: String, + /// uint64 wrapped in a string per Koios conventions. + quantity: String, +} + +#[derive(Deserialize)] +struct KoiosUtxo { + tx_hash: String, + tx_index: u32, + /// Lovelace at this UTXO, uint64 in a string. + value: String, + #[serde(default)] + asset_list: Vec, +} + +#[derive(Deserialize)] +struct KoiosAddressInfo { + /// Total lovelace at this address. + balance: String, + #[serde(default)] + utxo_set: Vec, +} + +pub struct KoiosClient { + base_url: String, + http: Client, +} + +impl KoiosClient { + /// Construct a client with the default 10-second timeout. + pub fn new(base_url: impl Into) -> Self { + Self::with_timeout(base_url, DEFAULT_TIMEOUT) + } + + /// Construct a client with a custom request timeout. + pub fn with_timeout(base_url: impl Into, timeout: Duration) -> Self { + Self { + base_url: base_url.into(), + http: Client::builder() + .timeout(timeout) + .build() + .expect("reqwest client builds with rustls + json features"), + } + } + + fn url(&self, path: &str) -> String { + format!("{}/{}", self.base_url.trim_end_matches('/'), path) + } + + async fn post_json(&self, path: &str, body: &T) -> Result + where + T: Serialize, + R: for<'de> Deserialize<'de>, + { + self.http + .post(self.url(path)) + .json(body) + .send() + .await + .map_err(|e| ChainError::Network(e.to_string()))? + .error_for_status() + .map_err(|e| ChainError::Network(e.to_string()))? + .json::() + .await + .map_err(|e| ChainError::Decode(e.to_string())) + } +} + +fn parse_u64(s: &str, field: &str) -> Result { + s.parse::() + .map_err(|e| ChainError::Decode(format!("{field}: {e} (got {s:?})"))) +} + +fn asset_key(policy_id: &str, asset_name_hex: &str) -> String { + let mut k = String::with_capacity(policy_id.len() + asset_name_hex.len()); + k.push_str(policy_id); + k.push_str(asset_name_hex); + k +} + +fn convert_utxo(k: KoiosUtxo) -> Result { + let lovelace = parse_u64(&k.value, "utxo.value")?; + let mut assets = BTreeMap::new(); + for a in k.asset_list { + let qty = parse_u64(&a.quantity, "utxo.asset.quantity")?; + assets.insert(asset_key(&a.policy_id, &a.asset_name), qty); + } + Ok(Utxo { + tx_hash: k.tx_hash, + output_index: k.tx_index, + lovelace, + assets, + }) +} + +#[async_trait] +impl ChainBackend for KoiosClient { + async fn get_utxos(&self, address: &str) -> Result, ChainError> { + let body = AddressesBody { addresses: vec![address] }; + let raw: Vec = self.post_json("address_utxos", &body).await?; + raw.into_iter().map(convert_utxo).collect() + } + + async fn get_balance(&self, address: &str) -> Result { + let body = AddressesBody { addresses: vec![address] }; + let raw: Vec = self.post_json("address_info", &body).await?; + + // Empty array = address has no on-chain history yet — treat + // as a zero balance rather than an error. Match Koios's own + // semantics. + let Some(info) = raw.into_iter().next() else { + return Ok(Balance { + lovelace: 0, + assets: BTreeMap::new(), + }); + }; + + let lovelace = parse_u64(&info.balance, "address_info.balance")?; + let mut assets: BTreeMap = BTreeMap::new(); + for u in info.utxo_set { + for a in u.asset_list { + let qty = parse_u64(&a.quantity, "address_info.utxo.asset.quantity")?; + let key = asset_key(&a.policy_id, &a.asset_name); + let entry = assets.entry(key).or_insert(0); + *entry = entry.saturating_add(qty); + } + } + Ok(Balance { lovelace, assets }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + /// Hand-crafted Koios `/address_utxos` response shape — verifies + /// our deserialize path without hitting the network. + const SAMPLE_UTXOS: &str = r#"[ + { + "tx_hash": "1a2b3c4d5e6f00000000000000000000000000000000000000000000000000aa", + "tx_index": 0, + "value": "1500000", + "asset_list": [] + }, + { + "tx_hash": "1a2b3c4d5e6f00000000000000000000000000000000000000000000000000bb", + "tx_index": 1, + "value": "10000000", + "asset_list": [ + { + "policy_id": "ee0a1234", + "asset_name": "deadbeef", + "quantity": "42" + } + ] + } + ]"#; + + const SAMPLE_ADDRESS_INFO: &str = r#"[ + { + "address": "addr1...", + "balance": "11500000", + "stake_address": "stake1...", + "script_address": false, + "utxo_set": [ + { + "tx_hash": "1a2b3c4d5e6f00000000000000000000000000000000000000000000000000aa", + "tx_index": 0, + "value": "1500000", + "asset_list": [] + }, + { + "tx_hash": "1a2b3c4d5e6f00000000000000000000000000000000000000000000000000bb", + "tx_index": 1, + "value": "10000000", + "asset_list": [ + { + "policy_id": "ee0a1234", + "asset_name": "deadbeef", + "quantity": "42" + } + ] + } + ] + } + ]"#; + + #[test] + fn deserializes_utxo_response() { + let raw: Vec = serde_json::from_str(SAMPLE_UTXOS).unwrap(); + let utxos: Vec = raw.into_iter().map(convert_utxo).collect::>().unwrap(); + assert_eq!(utxos.len(), 2); + assert_eq!(utxos[0].lovelace, 1_500_000); + assert!(utxos[0].assets.is_empty()); + assert_eq!(utxos[1].lovelace, 10_000_000); + assert_eq!(utxos[1].assets.get("ee0a1234deadbeef"), Some(&42)); + } + + #[test] + fn deserializes_address_info_response() { + let raw: Vec = serde_json::from_str(SAMPLE_ADDRESS_INFO).unwrap(); + assert_eq!(raw.len(), 1); + assert_eq!(raw[0].balance, "11500000"); + assert_eq!(raw[0].utxo_set.len(), 2); + } + + /// Two UTXOs holding the same asset must aggregate into a single + /// balance entry — protects against the get/insert bug where the + /// running total gets clobbered. + #[test] + fn balance_aggregates_same_asset_across_utxos() { + const TWO_UTXOS_SAME_ASSET: &str = r#"[ + { + "address": "addr1...", + "balance": "20000000", + "stake_address": null, + "script_address": false, + "utxo_set": [ + { + "tx_hash": "00aa", + "tx_index": 0, + "value": "10000000", + "asset_list": [ + {"policy_id": "ee0a1234", "asset_name": "deadbeef", "quantity": "100"} + ] + }, + { + "tx_hash": "00bb", + "tx_index": 1, + "value": "10000000", + "asset_list": [ + {"policy_id": "ee0a1234", "asset_name": "deadbeef", "quantity": "23"} + ] + } + ] + } + ]"#; + let raw: Vec = serde_json::from_str(TWO_UTXOS_SAME_ASSET).unwrap(); + let info = raw.into_iter().next().unwrap(); + let mut assets: BTreeMap = BTreeMap::new(); + for u in info.utxo_set { + for a in u.asset_list { + let qty = parse_u64(&a.quantity, "test").unwrap(); + let key = asset_key(&a.policy_id, &a.asset_name); + let entry = assets.entry(key).or_insert(0); + *entry = entry.saturating_add(qty); + } + } + assert_eq!(assets.get("ee0a1234deadbeef"), Some(&123)); + } + + #[test] + fn parse_u64_rejects_garbage() { + let err = parse_u64("not-a-number", "test").unwrap_err(); + match err { + ChainError::Decode(msg) => assert!(msg.contains("test")), + other => panic!("expected Decode, got {other:?}"), + } + } + + #[test] + fn url_helper_handles_trailing_slash() { + let c = KoiosClient::new("https://api.koios.rest/api/v1/"); + assert_eq!( + c.url("address_info"), + "https://api.koios.rest/api/v1/address_info" + ); + } + + /// Live network test against the public Koios mainnet endpoint. + /// Marked `#[ignore]` so `cargo test` skips it; run with + /// `cargo test -- --ignored live_koios_round_trip` to exercise. + #[tokio::test] + #[ignore] + async fn live_koios_round_trip() { + // A well-known mainnet address with stable history (IOG + // genesis treasury — historical). + let known_addr = "addr1q9zd6lvqu63rynk3kmzv0aphukk23gn37vfaq8e5kpdg45fkfsdfh67aae3eag2u4d97n6sm5qzcfmsrcgujhppfvxasn0nwt7"; + let client = KoiosClient::new("https://api.koios.rest/api/v1"); + let result = client.get_balance(known_addr).await; + // We don't assert a specific balance — just that the + // request shape is valid and the response decodes. + assert!(result.is_ok(), "live balance call failed: {:?}", result.err()); + } +} diff --git a/crates/aldabra-chain/src/lib.rs b/crates/aldabra-chain/src/lib.rs index 22fb90b..eecb81b 100644 --- a/crates/aldabra-chain/src/lib.rs +++ b/crates/aldabra-chain/src/lib.rs @@ -1,15 +1,28 @@ //! aldabra chain backends — Koios first, Ogmios next. //! -//! Trait-first design: the MCP server depends on `ChainBackend`, not on -//! a specific implementation. Swapping Koios → Ogmios is a config change. +//! Trait-first design: the MCP server depends on [`ChainBackend`], not +//! on a specific implementation. Swapping Koios → Ogmios is a config +//! change. //! -//! ## Phase 1 -//! Just the trait + a stub `KoiosClient` that returns hardcoded data. -//! Real HTTP wired up next pass. +//! Phase 1: read-only queries (`get_utxos`, `get_balance`) against +//! Koios over HTTPS. +//! +//! Phase 2 (TODO): submission paths — `submit_tx`, `tx_status`. +//! +//! ## Backends +//! +//! - [`koios::KoiosClient`] — Koios REST client (POST `/address_utxos`, +//! `/address_info`). Sulkta runs its own Koios on Rackham; the +//! public `https://api.koios.rest/api/v1` works as a fallback. +//! - Ogmios (TODO) — websocket client. use serde::{Deserialize, Serialize}; use thiserror::Error; +pub mod koios; + +pub use koios::KoiosClient; + #[derive(Debug, Error)] pub enum ChainError { #[error("network error: {0}")] @@ -23,9 +36,9 @@ pub enum ChainError { } /// One UTXO at an address. Multi-asset bundle is a flat map of -/// {policy_id+asset_name → quantity} for now; we'll model it more -/// strictly when minting lands in phase 3. -#[derive(Debug, Clone, Serialize, Deserialize)] +/// `policy_id || asset_name_hex` → quantity for now. We'll model it +/// more strictly when minting lands in phase 3. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Utxo { pub tx_hash: String, pub output_index: u32, @@ -36,7 +49,7 @@ pub struct Utxo { } /// Aggregated balance at an address. -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Balance { pub lovelace: u64, pub assets: std::collections::BTreeMap, @@ -50,48 +63,3 @@ pub trait ChainBackend: Send + Sync { // async fn submit_tx(&self, raw_tx_cbor: &[u8]) -> Result; // async fn tx_status(&self, tx_hash: &str) -> Result; } - -/// Stub Koios client. Phase 1: returns deterministic placeholder data -/// so the MCP server can be smoke-tested end-to-end without a chain -/// dependency. Phase 2: real reqwest calls to a Koios endpoint. -pub struct KoiosClient { - /// Base URL — typically https://api.koios.rest/api/v1 - /// or your own self-hosted Koios deployment. - pub base_url: String, -} - -impl KoiosClient { - pub fn new(base_url: impl Into) -> Self { - Self { - base_url: base_url.into(), - } - } -} - -#[async_trait::async_trait] -impl ChainBackend for KoiosClient { - async fn get_utxos(&self, _address: &str) -> Result, ChainError> { - // TODO(phase 1): POST /address_utxos with {"_addresses": [
]} - Ok(vec![]) - } - - async fn get_balance(&self, _address: &str) -> Result { - // TODO(phase 1): POST /address_info, sum balances across UTXOs - Ok(Balance { - lovelace: 0, - assets: Default::default(), - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn stub_koios_returns_empty() { - let client = KoiosClient::new("https://api.koios.rest/api/v1"); - let bal = client.get_balance("addr1...").await.unwrap(); - assert_eq!(bal.lovelace, 0); - } -} diff --git a/crates/aldabra-core/Cargo.toml b/crates/aldabra-core/Cargo.toml index cf13388..fd3aabe 100644 --- a/crates/aldabra-core/Cargo.toml +++ b/crates/aldabra-core/Cargo.toml @@ -30,6 +30,8 @@ pallas-codec = { workspace = true } pallas-crypto = { workspace = true } pallas-addresses = { workspace = true } bip39 = { workspace = true } +ed25519-bip32 = { workspace = true } +cryptoxide = { workspace = true } zeroize = { workspace = true } thiserror = { workspace = true } serde = { workspace = true } diff --git a/crates/aldabra-core/src/derive.rs b/crates/aldabra-core/src/derive.rs new file mode 100644 index 0000000..c430ab2 --- /dev/null +++ b/crates/aldabra-core/src/derive.rs @@ -0,0 +1,168 @@ +//! CIP-1852 child key derivation. +//! +//! Cardano hardened-account / soft-chain HD paths land here. The +//! external surface is two key types ([`PaymentKey`], [`StakeKey`]) +//! and two derivation entry points ([`derive_payment_key`], +//! [`derive_stake_key`]). +//! +//! ## CIP-1852 path layout +//! +//! ```text +//! m / 1852' / 1815' / account' / chain / index +//! ``` +//! +//! - `1852'` — purpose (Cardano Shelley) +//! - `1815'` — Cardano coin type (Ada Lovelace's birth year) +//! - `account'` — hardened account index, usually 0 +//! - `chain` — `0` external (payment), `1` internal (change), +//! `2` stake key +//! - `index` — soft index within the chain +//! +//! ## Hardened indexing +//! +//! BIP-32 hardened indices are `index | 0x8000_0000`. The first +//! three components of the path above are hardened; the last two +//! (`chain`, `index`) are soft. +//! +//! ## Why a separate module +//! +//! Keeping derivation in its own file means [`lib.rs`] stays focused +//! on the security-boundary types (Mnemonic, RootKey). New chain +//! types (Byron, future Conway-era keys) plug in here without +//! mutating the root crate. + +use ed25519_bip32::{DerivationScheme, XPrv}; +use pallas_crypto::hash::{Hash, Hasher}; + +use crate::RootKey; + +const SCHEME: DerivationScheme = DerivationScheme::V2; + +/// Hardened-bit OR mask. BIP-32 hardened indices are `n | HARDENED`. +const HARDENED: u32 = 0x8000_0000; + +/// CIP-1852 purpose constant: Shelley. +const PURPOSE: u32 = HARDENED | 1852; + +/// Cardano coin type per SLIP-44 / CIP-1852. +const COIN_TYPE: u32 = HARDENED | 1815; + +/// Chain index for external (payment) addresses per CIP-1852. +const CHAIN_PAYMENT: u32 = 0; + +/// Chain index for stake keys per CIP-1852. +const CHAIN_STAKE: u32 = 2; + +/// A payment key derived at `m/1852'/1815'/account'/0/index`. Wraps +/// an [`XPrv`] whose own [`Drop`] impl wipes the bytes. +pub struct PaymentKey { + xprv: XPrv, +} + +impl PaymentKey { + /// Blake2b-224 hash of the 32-byte raw public key — the canonical + /// payment-key hash that goes into a Shelley base address's + /// payment part. + pub fn public_key_hash(&self) -> Hash<28> { + Hasher::<224>::hash(self.xprv.public().public_key_bytes()) + } +} + +/// A stake key derived at `m/1852'/1815'/account'/2/0`. Same memory +/// hygiene as [`PaymentKey`]. +pub struct StakeKey { + xprv: XPrv, +} + +impl StakeKey { + /// Blake2b-224 hash of the raw stake public key — goes into the + /// delegation part of a Shelley base address. + pub fn public_key_hash(&self) -> Hash<28> { + Hasher::<224>::hash(self.xprv.public().public_key_bytes()) + } +} + +/// Derive a payment key at `m/1852'/1815'/account'/0/index`. +pub fn derive_payment_key(root: &RootKey, account: u32, index: u32) -> PaymentKey { + let xprv = root + .xprv() + .derive(SCHEME, PURPOSE) + .derive(SCHEME, COIN_TYPE) + .derive(SCHEME, HARDENED | account) + .derive(SCHEME, CHAIN_PAYMENT) + .derive(SCHEME, index); + PaymentKey { xprv } +} + +/// Derive the account stake key at `m/1852'/1815'/account'/2/0`. +/// Each account has exactly one stake key (chain index 2, soft 0). +pub fn derive_stake_key(root: &RootKey, account: u32) -> StakeKey { + let xprv = root + .xprv() + .derive(SCHEME, PURPOSE) + .derive(SCHEME, COIN_TYPE) + .derive(SCHEME, HARDENED | account) + .derive(SCHEME, CHAIN_STAKE) + .derive(SCHEME, 0); + StakeKey { xprv } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::Mnemonic; + + const ABANDON_ART: &str = concat!( + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon art", + ); + + fn root_from_canonical() -> RootKey { + Mnemonic::from_phrase(ABANDON_ART) + .unwrap() + .into_root_key() + .unwrap() + } + + #[test] + fn payment_and_stake_key_hashes_are_28_bytes() { + let root = root_from_canonical(); + let payment = derive_payment_key(&root, 0, 0); + let stake = derive_stake_key(&root, 0); + // Hash<28> is a strong type, but we still want to confirm the + // raw byte length matches what pallas-addresses expects. + assert_eq!(payment.public_key_hash().as_ref().len(), 28); + assert_eq!(stake.public_key_hash().as_ref().len(), 28); + } + + #[test] + fn derivation_is_deterministic() { + let root_a = root_from_canonical(); + let root_b = root_from_canonical(); + let pa = derive_payment_key(&root_a, 0, 0); + let pb = derive_payment_key(&root_b, 0, 0); + assert_eq!(pa.public_key_hash(), pb.public_key_hash()); + } + + #[test] + fn account_and_index_change_the_payment_hash() { + let root = root_from_canonical(); + let p_0_0 = derive_payment_key(&root, 0, 0); + let p_0_1 = derive_payment_key(&root, 0, 1); + let p_1_0 = derive_payment_key(&root, 1, 0); + assert_ne!(p_0_0.public_key_hash(), p_0_1.public_key_hash()); + assert_ne!(p_0_0.public_key_hash(), p_1_0.public_key_hash()); + } + + #[test] + fn payment_and_stake_keys_differ_at_same_account() { + let root = root_from_canonical(); + let payment = derive_payment_key(&root, 0, 0); + let stake = derive_stake_key(&root, 0); + // Same account but chain index 0 vs 2 — must produce + // different key hashes. + assert_ne!(payment.public_key_hash(), stake.public_key_hash()); + } +} diff --git a/crates/aldabra-core/src/lib.rs b/crates/aldabra-core/src/lib.rs index e0349d9..c3f8d19 100644 --- a/crates/aldabra-core/src/lib.rs +++ b/crates/aldabra-core/src/lib.rs @@ -3,28 +3,41 @@ //! This crate is the security boundary. Everything that touches private //! key material lives here, and only here. No I/O, no network, no MCP. //! -//! ## Layout (target) +//! ## Layout //! -//! - [`mnemonic`] — 24-word BIP-39 input → root key (CIP-3) -//! - [`derive`] — Root key → payment + stake key (CIP-1852 paths) -//! - [`address`] — Public keys → bech32 addresses (mainnet / testnet) -//! - [`signing`] — Sign an unsigned transaction body +//! - [`Mnemonic`] — 24-word BIP-39 input → entropy bytes. +//! - [`Mnemonic::into_root_key`] — Icarus CIP-3 master-key generation. +//! - [`RootKey`] — wraps [`ed25519_bip32::XPrv`]. +//! - [`Network`] — bech32 prefix + protocol magic selector. //! -//! ## Phase 1 (this scaffold) -//! -//! Just types + a placeholder address-derivation function. Real impl -//! lands as we wire up `pallas-crypto`'s key derivation API. +//! Phases 1.3 (CIP-1852 child derivation), 1.4 (real base-address +//! construction), and signing land in follow-up modules; the placeholder +//! [`derive_base_address`] returns a sentinel address until then. //! //! ## Memory hygiene rule //! -//! Anything that holds a private key MUST `derive(ZeroizeOnDrop)` or -//! manually zeroize when going out of scope. Use the `zeroize` crate. -//! This is non-negotiable — RAM-resident keys leak via core dumps, -//! swap, hibernate state, etc. +//! Anything holding private-key material zeroizes on drop: +//! - [`Mnemonic`]'s entropy via `ZeroizeOnDrop`. +//! - [`RootKey`]'s [`XPrv`] via its own [`Drop`] impl in `ed25519-bip32`. +//! +//! The decrypted phrase passed into [`Mnemonic::from_phrase`] is the +//! caller's responsibility to drop promptly — we copy the entropy out +//! and don't hold the source string. +use bip39::{Language, Mnemonic as Bip39Mnemonic}; +use cryptoxide::hmac::Hmac; +use cryptoxide::pbkdf2::pbkdf2; +use cryptoxide::sha2::Sha512; +use ed25519_bip32::{XPrv, XPRV_SIZE}; +use pallas_addresses::{ + Network as PallasNetwork, ShelleyAddress, ShelleyDelegationPart, ShelleyPaymentPart, +}; use thiserror::Error; use zeroize::ZeroizeOnDrop; +pub mod derive; +pub use derive::{derive_payment_key, derive_stake_key, PaymentKey, StakeKey}; + #[derive(Debug, Error)] pub enum WalletError { #[error("invalid mnemonic: {0}")] @@ -40,53 +53,87 @@ pub enum WalletError { NotYetImplemented, } -/// A 24-word BIP-39 mnemonic. Held in memory only while deriving keys; -/// callers should drop this immediately after `derive_root_key`. +/// A 24-word BIP-39 mnemonic, parsed and validated. Stores the raw +/// 32-byte entropy rather than the phrase — the source string is the +/// caller's responsibility to drop. +/// +/// `ZeroizeOnDrop` ensures the entropy is wiped from RAM when this +/// struct is dropped. #[derive(ZeroizeOnDrop)] pub struct Mnemonic { - /// Stored as a single string (joined with spaces). The - /// `ZeroizeOnDrop` derive ensures this gets wiped from RAM when - /// the struct is dropped. - phrase: String, + /// 256 bits of entropy (24 BIP-39 words × 11 bits = 264 bits, the + /// trailing 8 are the checksum). The bip39 crate's `to_entropy()` + /// returns exactly the 32 entropy bytes. + entropy: [u8; 32], } impl Mnemonic { - /// Parse a 24-word mnemonic from a whitespace-separated string. - /// Validates word count + checksum via the `bip39` crate. - /// - /// # Phase 1 - /// TODO: wire up `bip39::Mnemonic::parse_in` once we lock the - /// API. For now this just stores the phrase verbatim — DO NOT - /// rely on validation yet. + /// Parse a 24-word English mnemonic, validating word count + checksum. + /// Drops the source phrase reference immediately after extracting + /// entropy. pub fn from_phrase(phrase: &str) -> Result { - // TODO(phase 1): real validation - if phrase.split_whitespace().count() != 24 { - return Err(WalletError::InvalidMnemonic( - "expected 24 words".into(), - )); + let parsed = Bip39Mnemonic::parse_in(Language::English, phrase) + .map_err(|e| WalletError::InvalidMnemonic(e.to_string()))?; + if parsed.word_count() != 24 { + return Err(WalletError::InvalidMnemonic(format!( + "expected 24 words, got {}", + parsed.word_count() + ))); } - Ok(Self { - phrase: phrase.to_string(), - }) + let entropy_vec = parsed.to_entropy(); + let entropy: [u8; 32] = entropy_vec.try_into().map_err(|v: Vec| { + WalletError::InvalidMnemonic(format!( + "expected 32 entropy bytes for 24-word mnemonic, got {}", + v.len() + )) + })?; + Ok(Self { entropy }) } - /// Derive the Cardano CIP-3 root key from this mnemonic. Consumes - /// the mnemonic so the source phrase is dropped + zeroized - /// immediately after. + /// Derive the Cardano CIP-3 root extended private key (Icarus + /// variant, no passphrase). Consumes the mnemonic so the entropy + /// is dropped + zeroized immediately after. pub fn into_root_key(self) -> Result { - // TODO(phase 1): pallas-crypto's PBKDF2 + entropy + chain code - // derivation per CIP-3. Reference: - // https://input-output-hk.github.io/cardano-wallet/concepts/master-key-generation - Err(WalletError::NotYetImplemented) + self.into_root_key_with_passphrase("") + } + + /// Derive the Cardano CIP-3 root extended private key with a + /// caller-supplied BIP-39 passphrase. Empty string = no passphrase + /// = the default Icarus / Yoroi behaviour. + /// + /// Algorithm (per Cardano Icarus master-key generation): + /// 1. `xprv = PBKDF2-HMAC-SHA512(password=passphrase, salt=entropy, + /// c=4096, dkLen=96)` + /// 2. Bit-clamp the first 32 bytes so the result is a valid extended + /// Ed25519 scalar with the 3rd-highest bit cleared + /// (`normalize_bytes_force3rd`). + pub fn into_root_key_with_passphrase( + self, + passphrase: &str, + ) -> Result { + let mut xprv_bytes = [0u8; XPRV_SIZE]; + let mut hmac = Hmac::new(Sha512::new(), passphrase.as_bytes()); + pbkdf2(&mut hmac, &self.entropy, 4096, &mut xprv_bytes); + + let xprv = XPrv::normalize_bytes_force3rd(xprv_bytes); + Ok(RootKey { xprv }) } } -/// CIP-3 root key. Holds the seed material from which payment + stake -/// keys are derived via CIP-1852 paths. Zeroized on drop. -#[derive(ZeroizeOnDrop)] +/// CIP-3 root extended private key. Wraps an [`XPrv`] +/// (96 bytes: extended secret + chain code). [`XPrv`]'s own [`Drop`] +/// impl wipes the bytes from memory when this struct drops. pub struct RootKey { - /// 96 bytes per CIP-3 (extended secret + chain code). - bytes: [u8; 96], + pub(crate) xprv: XPrv, +} + +impl RootKey { + /// Borrow the underlying [`XPrv`] for derivation. Crate-internal + /// code uses this; external callers should go through the + /// `derive_*` helpers which return purpose-specific key types. + pub(crate) fn xprv(&self) -> &XPrv { + &self.xprv + } } /// Network parameter — bech32 prefix + protocol magic. @@ -104,39 +151,139 @@ impl Network { Network::Preview | Network::Preprod => "addr_test", } } + + /// Map our three-variant Network onto pallas-addresses' two + /// real variants. Cardano's network header byte only distinguishes + /// `Mainnet` from `Testnet` — the protocol magic differentiates + /// Preview vs Preprod at the chain layer, not at the address layer. + /// Both testnet flavours therefore share the `addr_test1…` HRP. + pub fn to_pallas(&self) -> PallasNetwork { + match self { + Network::Mainnet => PallasNetwork::Mainnet, + Network::Preview | Network::Preprod => PallasNetwork::Testnet, + } + } } -/// Derive a base address (payment + stake) at account 0, address index 0. +/// Derive a Shelley base address (payment + stake) at the given +/// account / payment-index path: /// -/// # Phase 1 -/// TODO: real CIP-1852 derivation using pallas-crypto's HD key derivation. -/// For now this returns a placeholder that lets the MCP layer be tested -/// without real keys. +/// - payment path: `m/1852'/1815'/account'/0/index` +/// - stake path: `m/1852'/1815'/account'/2/0` +/// +/// Both keys hash through Blake2b-224 to produce 28-byte key hashes, +/// which combine via [`ShelleyPaymentPart::key_hash`] + +/// [`ShelleyDelegationPart::key_hash`] into a Shelley base address, +/// emitted as bech32 with the right HRP for the chosen network. pub fn derive_base_address( - _root: &RootKey, + root: &RootKey, network: Network, - _account: u32, - _index: u32, + account: u32, + index: u32, ) -> Result { - // TODO(phase 1): real implementation - let prefix = network.bech32_hrp_prefix(); - Ok(format!("{prefix}1placeholder_phase_1_scaffold")) + let payment = derive_payment_key(root, account, index); + let stake = derive_stake_key(root, account); + + let address = ShelleyAddress::new( + network.to_pallas(), + ShelleyPaymentPart::key_hash(payment.public_key_hash()), + ShelleyDelegationPart::key_hash(stake.public_key_hash()), + ); + + address + .to_bech32() + .map_err(|e| WalletError::Address(e.to_string())) } #[cfg(test)] mod tests { use super::*; - #[test] - fn mnemonic_word_count_validation() { - let too_few = "one two three"; - assert!(Mnemonic::from_phrase(too_few).is_err()); + /// Canonical 24-word BIP-39 test mnemonic. Used widely in the + /// Cardano ecosystem (cardano-address, cardano-cli docs) so derived + /// vectors are easy to cross-check. + const ABANDON_ART: &str = concat!( + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon art", + ); + + /// `Mnemonic` deliberately doesn't `derive(Debug)` — printing the + /// entropy in a panic message would leak key material. Tests use + /// this helper instead of `.unwrap_err()` (which requires `Debug` + /// on the `Ok` variant). + fn expect_invalid(result: Result) -> WalletError { + match result { + Ok(_) => panic!("expected WalletError::InvalidMnemonic, got Ok(_)"), + Err(e) => e, + } } #[test] - fn placeholder_address_has_network_prefix() { - let dummy_root = RootKey { bytes: [0u8; 96] }; - let addr = derive_base_address(&dummy_root, Network::Mainnet, 0, 0).unwrap(); - assert!(addr.starts_with("addr1")); + fn rejects_short_phrase() { + let err = expect_invalid(Mnemonic::from_phrase("one two three")); + assert!(matches!(err, WalletError::InvalidMnemonic(_))); + } + + #[test] + fn rejects_bad_checksum() { + // 24 abandons in a row has a bad checksum — the canonical valid + // form ends in "art". + let bad = "abandon ".repeat(24); + let err = expect_invalid(Mnemonic::from_phrase(bad.trim())); + assert!(matches!(err, WalletError::InvalidMnemonic(_))); + } + + #[test] + fn parses_canonical_24_word_mnemonic() { + let m = Mnemonic::from_phrase(ABANDON_ART).expect("valid mnemonic"); + // 24 abandon-mostly words → entropy is all zeros. + assert_eq!(m.entropy, [0u8; 32]); + } + + #[test] + fn derives_root_key_from_canonical_mnemonic() { + let m = Mnemonic::from_phrase(ABANDON_ART).unwrap(); + let root = m.into_root_key().expect("CIP-3 derivation works"); + // The derived XPrv must be 96 bytes total and the bit-clamp + // must have cleared the 3rd highest bit at byte 31. + assert_eq!(root.xprv().as_ref().len(), XPRV_SIZE); + assert!(root.xprv().is_3rd_highest_bit_clear()); + } + + #[test] + fn mainnet_base_address_round_trips() { + let m = Mnemonic::from_phrase(ABANDON_ART).unwrap(); + let root = m.into_root_key().unwrap(); + let addr = derive_base_address(&root, Network::Mainnet, 0, 0).unwrap(); + assert!(addr.starts_with("addr1"), "got: {addr}"); + // Round-trip — pallas should parse what we just emitted and + // give back a Shelley mainnet address. + let parsed = pallas_addresses::Address::from_bech32(&addr) + .expect("our own bech32 output parses"); + match parsed { + pallas_addresses::Address::Shelley(s) => { + assert_eq!(s.network(), pallas_addresses::Network::Mainnet); + } + other => panic!("expected Shelley address, got {other:?}"), + } + } + + #[test] + fn preprod_base_address_uses_testnet_hrp() { + let m = Mnemonic::from_phrase(ABANDON_ART).unwrap(); + let root = m.into_root_key().unwrap(); + let addr = derive_base_address(&root, Network::Preprod, 0, 0).unwrap(); + assert!(addr.starts_with("addr_test1"), "got: {addr}"); + } + + #[test] + fn different_indices_produce_different_addresses() { + let m = Mnemonic::from_phrase(ABANDON_ART).unwrap(); + let root = m.into_root_key().unwrap(); + let a0 = derive_base_address(&root, Network::Mainnet, 0, 0).unwrap(); + let a1 = derive_base_address(&root, Network::Mainnet, 0, 1).unwrap(); + assert_ne!(a0, a1); } } diff --git a/crates/aldabra-mcp/Cargo.toml b/crates/aldabra-mcp/Cargo.toml index 2e4000a..94b5f64 100644 --- a/crates/aldabra-mcp/Cargo.toml +++ b/crates/aldabra-mcp/Cargo.toml @@ -25,6 +25,11 @@ tokio = { workspace = true } anyhow = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +thiserror = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } rmcp = { workspace = true } +age = { workspace = true } +toml = { workspace = true } +rpassword = { workspace = true } +zeroize = { workspace = true } diff --git a/crates/aldabra-mcp/src/bootstrap.rs b/crates/aldabra-mcp/src/bootstrap.rs new file mode 100644 index 0000000..8222be1 --- /dev/null +++ b/crates/aldabra-mcp/src/bootstrap.rs @@ -0,0 +1,211 @@ +//! First-run mnemonic bootstrap + subsequent unlock. +//! +//! On startup, the daemon expects to find an age-encrypted mnemonic at +//! `$ALDABRA_DATA/mnemonic.age`. If it doesn't exist, we run a one-time +//! interactive bootstrap: prompt the user to paste a 24-word mnemonic, +//! prompt for an encryption passphrase, and write the encrypted file. +//! On subsequent runs we just prompt for the passphrase, decrypt, and +//! derive the root key. +//! +//! ## Memory hygiene +//! +//! - `Mnemonic` (in `aldabra-core`) zeroizes the entropy on drop. +//! - The decrypted phrase is held in a `Zeroizing` for the +//! ~milliseconds between decrypt and `Mnemonic::from_phrase`. +//! - Passphrases pass through `age::secrecy::SecretString`, which +//! zeroizes its internal buffer on drop. +//! +//! Hygiene is best-effort. Live RAM in this process is the security +//! boundary; if the host is hostile, no amount of zeroize helps. The +//! threat model here is post-mortem dumps + swap leaks, not active +//! attackers. + +use std::fs; +use std::io::{BufRead, Read, Write}; +use std::path::Path; + +use age::secrecy::SecretString; +use age::{Decryptor, Encryptor}; +use aldabra_core::{Mnemonic, RootKey}; +use anyhow::{anyhow, Context, Result}; +use zeroize::Zeroizing; + +const MNEMONIC_FILENAME: &str = "mnemonic.age"; + +/// Encrypt a mnemonic phrase with a passphrase. Pure — no I/O, no +/// prompts. Used by the interactive bootstrap and exposed for tests. +pub fn encrypt_mnemonic(phrase: &str, passphrase: &str) -> Result> { + let pp = SecretString::new(passphrase.to_string()); + let encryptor = Encryptor::with_user_passphrase(pp); + let mut encrypted = Vec::with_capacity(phrase.len() + 256); + let mut writer = encryptor + .wrap_output(&mut encrypted) + .context("age: wrap_output")?; + writer.write_all(phrase.as_bytes())?; + writer.finish().context("age: finish writer")?; + Ok(encrypted) +} + +/// Decrypt an age-encrypted mnemonic blob with a passphrase. Returns +/// the phrase wrapped in [`Zeroizing`] so it gets wiped from RAM when +/// dropped. +pub fn decrypt_mnemonic(blob: &[u8], passphrase: &str) -> Result> { + let pp = SecretString::new(passphrase.to_string()); + let decryptor = match Decryptor::new(blob).context("age: parse header")? { + Decryptor::Passphrase(d) => d, + Decryptor::Recipients(_) => { + return Err(anyhow!( + "expected passphrase-encrypted age file, got recipients-encrypted" + )) + } + }; + let mut reader = decryptor + .decrypt(&pp, None) + .context("age: passphrase rejected or file corrupt")?; + + let mut bytes = Zeroizing::new(Vec::with_capacity(256)); + reader.read_to_end(&mut bytes)?; + let phrase = std::str::from_utf8(&bytes) + .context("decrypted mnemonic is not valid utf-8")? + .to_string(); + Ok(Zeroizing::new(phrase)) +} + +/// Path of the encrypted mnemonic for a given data dir. +pub fn mnemonic_path(data_dir: &Path) -> std::path::PathBuf { + data_dir.join(MNEMONIC_FILENAME) +} + +/// Interactive bootstrap. If `mnemonic.age` exists at `data_dir`, +/// prompt for the passphrase and unlock it. Otherwise, run the +/// first-run flow: prompt for phrase + passphrase, encrypt, write, +/// then derive. +/// +/// Stderr-only output. stdout is reserved for the MCP transport. +pub fn load_or_create_root_key(data_dir: &Path) -> Result { + let path = mnemonic_path(data_dir); + + if path.exists() { + eprintln!("aldabra: unlocking mnemonic at {}", path.display()); + let blob = fs::read(&path).with_context(|| format!("reading {}", path.display()))?; + // Headless-friendly: if ALDABRA_PASSPHRASE is set, use it + // and skip the prompt. Required when the daemon runs under + // an MCP client that owns stdin. Caller is responsible for + // sourcing the env from a secure place (systemd + // EnvironmentFile, docker secret, etc.). + let passphrase = match std::env::var("ALDABRA_PASSPHRASE") { + Ok(p) => p, + Err(_) => rpassword::prompt_password("passphrase: ")?, + }; + let phrase = decrypt_mnemonic(&blob, &passphrase)?; + let mnemonic = Mnemonic::from_phrase(&phrase)?; + Ok(mnemonic.into_root_key()?) + } else { + eprintln!("aldabra: no mnemonic found at {}", path.display()); + eprintln!("first-run bootstrap — this writes an encrypted mnemonic to disk.\n"); + fs::create_dir_all(data_dir) + .with_context(|| format!("creating {}", data_dir.display()))?; + + eprint!("paste 24-word BIP-39 mnemonic (visible) and press Enter: "); + std::io::stderr().flush().ok(); + let mut phrase_buf = Zeroizing::new(String::new()); + std::io::stdin() + .lock() + .read_line(&mut phrase_buf) + .context("reading mnemonic from stdin")?; + let trimmed: &str = phrase_buf.trim(); + + // Validate before asking for passphrase — fail fast on bad input. + Mnemonic::from_phrase(trimmed)?; + + // Headless-friendly: if ALDABRA_PASSPHRASE is set, use it + // for the bootstrap passphrase too. No confirm loop in that + // case — the env var IS the source of truth. + let passphrase = match std::env::var("ALDABRA_PASSPHRASE") { + Ok(p) => p, + Err(_) => { + let p = rpassword::prompt_password("set encryption passphrase: ")?; + let confirm = rpassword::prompt_password("confirm passphrase: ")?; + if p != confirm { + return Err(anyhow!("passphrases did not match — re-run to retry")); + } + p + } + }; + + let blob = encrypt_mnemonic(trimmed, &passphrase)?; + fs::write(&path, &blob).with_context(|| format!("writing {}", path.display()))?; + restrict_to_owner(&path)?; + eprintln!("aldabra: mnemonic encrypted to {}", path.display()); + + let mnemonic = Mnemonic::from_phrase(trimmed)?; + Ok(mnemonic.into_root_key()?) + } +} + +#[cfg(unix)] +fn restrict_to_owner(path: &Path) -> Result<()> { + use std::os::unix::fs::PermissionsExt; + let mut perms = fs::metadata(path)?.permissions(); + perms.set_mode(0o600); + fs::set_permissions(path, perms).context("chmod 600")?; + Ok(()) +} + +#[cfg(not(unix))] +fn restrict_to_owner(_path: &Path) -> Result<()> { + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + const ABANDON_ART: &str = concat!( + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon abandon ", + "abandon abandon abandon abandon abandon art", + ); + + #[test] + fn encrypt_decrypt_round_trip() { + let blob = encrypt_mnemonic(ABANDON_ART, "hunter2").unwrap(); + let decrypted = decrypt_mnemonic(&blob, "hunter2").unwrap(); + assert_eq!(&*decrypted as &str, ABANDON_ART); + } + + #[test] + fn wrong_passphrase_fails() { + let blob = encrypt_mnemonic(ABANDON_ART, "hunter2").unwrap(); + let result = decrypt_mnemonic(&blob, "wrong"); + assert!(result.is_err(), "decrypt with wrong passphrase should fail"); + } + + #[test] + fn ciphertext_differs_from_plaintext() { + let blob = encrypt_mnemonic(ABANDON_ART, "hunter2").unwrap(); + // Sanity — make sure we're actually encrypting, not echoing. + let cipher_str = String::from_utf8_lossy(&blob); + assert!(!cipher_str.contains("abandon")); + } + + #[test] + fn random_passphrases_produce_different_ciphertexts() { + // Same plaintext + different passphrases must not produce the + // same ciphertext (no deterministic-key reuse). + let a = encrypt_mnemonic(ABANDON_ART, "alpha").unwrap(); + let b = encrypt_mnemonic(ABANDON_ART, "beta").unwrap(); + assert_ne!(a, b); + } + + #[test] + fn same_passphrase_produces_different_ciphertexts() { + // age uses random salt — repeat encryption with the SAME + // passphrase must still produce different ciphertexts. This + // is a salt sanity check. + let a = encrypt_mnemonic(ABANDON_ART, "hunter2").unwrap(); + let b = encrypt_mnemonic(ABANDON_ART, "hunter2").unwrap(); + assert_ne!(a, b); + } +} diff --git a/crates/aldabra-mcp/src/config.rs b/crates/aldabra-mcp/src/config.rs new file mode 100644 index 0000000..b2dfbbc --- /dev/null +++ b/crates/aldabra-mcp/src/config.rs @@ -0,0 +1,194 @@ +//! Daemon configuration. +//! +//! Sources, in priority order: +//! 1. Environment variables (`ALDABRA_NETWORK`, `ALDABRA_KOIOS_BASE`, +//! `ALDABRA_ACCOUNT`, `ALDABRA_INDEX`, `ALDABRA_DATA`) +//! 2. `$ALDABRA_DATA/config.toml` if it exists +//! 3. Hardcoded defaults — preprod, public Koios, account 0, index 0, +//! data dir `~/.aldabra` (or `/var/lib/aldabra` if running as root) +//! +//! Env wins so a docker compose override doesn't require a config file +//! mount. + +use std::path::PathBuf; + +use aldabra_core::Network; +use serde::Deserialize; +use thiserror::Error; + +#[derive(Debug, Clone)] +pub struct Config { + pub network: Network, + pub koios_base: String, + pub account: u32, + pub index: u32, + pub data_dir: PathBuf, +} + +#[derive(Debug, Default, Deserialize)] +struct FileConfig { + #[serde(default)] + network: Option, + #[serde(default)] + koios_base: Option, + #[serde(default)] + account: Option, + #[serde(default)] + index: Option, +} + +fn parse_network(s: &str) -> Result { + match s.to_ascii_lowercase().as_str() { + "mainnet" => Ok(Network::Mainnet), + "preview" => Ok(Network::Preview), + "preprod" => Ok(Network::Preprod), + other => Err(ConfigError::InvalidNetwork(other.to_string())), + } +} + +fn default_koios_for(network: Network) -> &'static str { + match network { + Network::Mainnet => "https://api.koios.rest/api/v1", + Network::Preview => "https://preview.koios.rest/api/v1", + Network::Preprod => "https://preprod.koios.rest/api/v1", + } +} + +fn default_data_dir() -> PathBuf { + if let Ok(home) = std::env::var("HOME") { + PathBuf::from(home).join(".aldabra") + } else { + PathBuf::from("/var/lib/aldabra") + } +} + +#[derive(Debug, Error)] +pub enum ConfigError { + #[error("invalid network {0:?}: expected mainnet|preview|preprod")] + InvalidNetwork(String), + + #[error("config file at {path}: {source}")] + File { + path: PathBuf, + #[source] + source: std::io::Error, + }, + + #[error("config file at {path}: {source}")] + Parse { + path: PathBuf, + #[source] + source: toml::de::Error, + }, + + #[error("env var {var} not parseable: {value:?}")] + EnvParse { var: &'static str, value: String }, +} + +impl Config { + /// Resolve the effective config from env + file + defaults. + pub fn load() -> Result { + let data_dir: PathBuf = std::env::var("ALDABRA_DATA") + .map(PathBuf::from) + .unwrap_or_else(|_| default_data_dir()); + + // Optional file at $ALDABRA_DATA/config.toml + let file_path = data_dir.join("config.toml"); + let file_cfg = if file_path.exists() { + let raw = std::fs::read_to_string(&file_path).map_err(|e| ConfigError::File { + path: file_path.clone(), + source: e, + })?; + toml::from_str::(&raw).map_err(|e| ConfigError::Parse { + path: file_path.clone(), + source: e, + })? + } else { + FileConfig::default() + }; + + let network = if let Ok(env) = std::env::var("ALDABRA_NETWORK") { + parse_network(&env)? + } else if let Some(s) = file_cfg.network.as_deref() { + parse_network(s)? + } else { + Network::Preprod + }; + + let koios_base = std::env::var("ALDABRA_KOIOS_BASE") + .ok() + .or(file_cfg.koios_base) + .unwrap_or_else(|| default_koios_for(network).to_string()); + + let account = match std::env::var("ALDABRA_ACCOUNT") { + Ok(s) => s + .parse::() + .map_err(|_| ConfigError::EnvParse { var: "ALDABRA_ACCOUNT", value: s })?, + Err(_) => file_cfg.account.unwrap_or(0), + }; + + let index = match std::env::var("ALDABRA_INDEX") { + Ok(s) => s + .parse::() + .map_err(|_| ConfigError::EnvParse { var: "ALDABRA_INDEX", value: s })?, + Err(_) => file_cfg.index.unwrap_or(0), + }; + + Ok(Self { + network, + koios_base, + account, + index, + data_dir, + }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parses_full_toml() { + let toml = r#" + network = "mainnet" + koios_base = "https://my.koios/api/v1" + account = 7 + index = 3 + "#; + let cfg: FileConfig = toml::from_str(toml).unwrap(); + assert_eq!(cfg.network.as_deref(), Some("mainnet")); + assert_eq!(cfg.koios_base.as_deref(), Some("https://my.koios/api/v1")); + assert_eq!(cfg.account, Some(7)); + assert_eq!(cfg.index, Some(3)); + } + + #[test] + fn empty_toml_is_ok() { + let cfg: FileConfig = toml::from_str("").unwrap(); + assert!(cfg.network.is_none()); + assert!(cfg.koios_base.is_none()); + } + + #[test] + fn parse_network_accepts_canonical_names() { + assert!(matches!(parse_network("mainnet").unwrap(), Network::Mainnet)); + assert!(matches!(parse_network("Preview").unwrap(), Network::Preview)); + assert!(matches!(parse_network("PREPROD").unwrap(), Network::Preprod)); + } + + #[test] + fn parse_network_rejects_garbage() { + assert!(matches!( + parse_network("ghostnet"), + Err(ConfigError::InvalidNetwork(_)) + )); + } + + #[test] + fn default_koios_per_network() { + assert!(default_koios_for(Network::Mainnet).contains("api.koios.rest")); + assert!(default_koios_for(Network::Preprod).contains("preprod.koios.rest")); + assert!(default_koios_for(Network::Preview).contains("preview.koios.rest")); + } +} diff --git a/crates/aldabra-mcp/src/main.rs b/crates/aldabra-mcp/src/main.rs index d293679..90df55d 100644 --- a/crates/aldabra-mcp/src/main.rs +++ b/crates/aldabra-mcp/src/main.rs @@ -3,72 +3,99 @@ //! Speaks MCP over stdio. Any MCP client (Claude Code, OpenClaw, etc.) //! launches this as a subprocess and gets a wallet's worth of tools. //! -//! ## Phase 1 tools +//! ## Phase 1 tools (target — server wiring lands in 1.7) //! -//! - `wallet.address` — return the derived base address (placeholder -//! until aldabra-core's CIP-1852 derivation lands) -//! - `wallet.balance` — query balance via the configured chain backend +//! - `wallet.address` — derived CIP-1852 base address +//! - `wallet.balance` — ADA + native-asset balance via chain backend +//! - `wallet.utxos` — list UTXOs at the wallet address +//! - `wallet.network` — configured network selector //! -//! ## Phase 2-4 tools (TODO) +//! ## Phase 2-4 tools //! -//! See ROADMAP.md at the repo root. -//! -//! ## Config -//! -//! For now: hardcoded mainnet + a stub Koios client. Real config -//! loading + mnemonic-from-encrypted-file lands once the core -//! derivation API is real. +//! See `ROADMAP.md` at the repo root. //! //! ## Logging //! //! Stderr only — stdout is the MCP transport, must stay clean. +mod bootstrap; +mod config; +mod tools; + +use std::process::ExitCode; + use anyhow::Result; +use rmcp::{transport::stdio, ServiceExt}; use tracing_subscriber::EnvFilter; +use crate::config::Config; +use crate::tools::WalletService; + #[tokio::main] -async fn main() -> Result<()> { - // Stderr only — stdout is MCP transport +async fn main() -> ExitCode { tracing_subscriber::fmt() .with_writer(std::io::stderr) .with_env_filter(EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into())) .init(); - tracing::info!("aldabra starting (phase 1 scaffold)"); + match run().await { + Ok(()) => ExitCode::SUCCESS, + Err(e) => { + tracing::error!("{e:#}"); + ExitCode::FAILURE + } + } +} - // TODO(phase 1): - // 1. Load config (network, koios url, mnemonic path) - // 2. Bootstrap mnemonic (interactive on first run, age-decrypt thereafter) - // 3. Derive root key - // 4. Build the chain backend - // 5. Construct the MCP server with tool handlers - // 6. Run it on stdio - - // For now: a smoke-test print so the binary actually does something - // when invoked manually (not through MCP). +async fn run() -> Result<()> { + let cfg = Config::load()?; tracing::info!( - target_address = %aldabra_core::derive_base_address( - &dummy_root_key()?, - aldabra_core::Network::Mainnet, - 0, - 0, - )?, - "scaffold smoke test — derived placeholder address", + network = ?cfg.network, + koios = %cfg.koios_base, + account = cfg.account, + index = cfg.index, + data_dir = %cfg.data_dir.display(), + "aldabra starting" ); + // First-run bootstrap reads the mnemonic from stdin, which would + // collide with the MCP transport once `serve()` runs. So + // bootstrap is gated behind a `--bootstrap` arg: do that once + // out-of-band, then start the daemon normally. + let bootstrap_only = std::env::args().any(|a| a == "--bootstrap"); + let mnemonic_path = bootstrap::mnemonic_path(&cfg.data_dir); + + if !mnemonic_path.exists() && !bootstrap_only { + anyhow::bail!( + "no mnemonic at {}. run `aldabra --bootstrap` first to set one up.", + mnemonic_path.display() + ); + } + + let root = bootstrap::load_or_create_root_key(&cfg.data_dir)?; + let address = aldabra_core::derive_base_address( + &root, + cfg.network, + cfg.account, + cfg.index, + )?; + tracing::info!(%address, "derived base address"); + + if bootstrap_only { + eprintln!("aldabra: bootstrap complete. address = {address}"); + return Ok(()); + } + + // Hand off to the MCP server. From this point on stdin/stdout + // belong to the JSON-RPC transport — no more eprintln-prompting. + let service = WalletService::new(cfg.network, address, cfg.koios_base); + let server = service + .serve(stdio()) + .await + .map_err(|e| anyhow::anyhow!("rmcp serve failed: {e}"))?; + server + .waiting() + .await + .map_err(|e| anyhow::anyhow!("rmcp wait failed: {e}"))?; Ok(()) } - -/// Phase 1 only — produces a zero-bytes RootKey so the placeholder -/// address derivation runs. Will be deleted once real mnemonic loading -/// lands. -fn dummy_root_key() -> Result { - // Need a way to construct one from this crate without exposing - // private fields. Phase 1: temporary public constructor on - // aldabra-core, gated behind a #[cfg(test)] or feature flag and - // removed before phase 2. - // - // For tonight: this fn is a TODO marker — the smoke test won't - // actually run until we finish aldabra-core::Mnemonic::into_root_key. - anyhow::bail!("phase 1 scaffold: real mnemonic loading not yet implemented") -} diff --git a/crates/aldabra-mcp/src/tools.rs b/crates/aldabra-mcp/src/tools.rs new file mode 100644 index 0000000..2c87ceb --- /dev/null +++ b/crates/aldabra-mcp/src/tools.rs @@ -0,0 +1,119 @@ +//! MCP tool handlers — Phase 1 read-path tools. +//! +//! Each `#[tool]` becomes a discoverable MCP tool. Tool names use +//! dotted notation per the MCP convention; the underlying Rust fn +//! names use snake_case. +//! +//! Returns: +//! - `String` results pass through `IntoContents` directly. +//! - `Result` lets us surface chain errors as MCP +//! tool-call errors instead of crashing the daemon. + +use std::sync::Arc; + +use aldabra_chain::{ChainBackend, KoiosClient}; +use aldabra_core::Network; +use rmcp::{model::ServerInfo, tool, ServerHandler}; + +#[derive(Clone)] +pub struct WalletService { + inner: Arc, +} + +struct WalletInner { + network: Network, + address: String, + chain: KoiosClient, +} + +impl WalletService { + pub fn new(network: Network, address: String, koios_base: String) -> Self { + Self { + inner: Arc::new(WalletInner { + network, + address, + chain: KoiosClient::new(koios_base), + }), + } + } +} + +#[tool(tool_box)] +impl WalletService { + #[tool( + name = "wallet.address", + description = "Return the wallet's primary base address (CIP-1852, account 0, index 0) as a bech32 string" + )] + async fn wallet_address(&self) -> String { + self.inner.address.clone() + } + + #[tool( + name = "wallet.network", + description = "Return the configured Cardano network: mainnet, preview, or preprod" + )] + async fn wallet_network(&self) -> String { + match self.inner.network { + Network::Mainnet => "mainnet".into(), + Network::Preview => "preview".into(), + Network::Preprod => "preprod".into(), + } + } + + #[tool( + name = "wallet.balance", + description = "Query ADA + native-asset balance at the wallet address. Returns JSON {lovelace, assets}." + )] + async fn wallet_balance(&self) -> Result { + let bal = self + .inner + .chain + .get_balance(&self.inner.address) + .await + .map_err(|e| e.to_string())?; + serde_json::to_string(&bal).map_err(|e| e.to_string()) + } + + #[tool( + name = "wallet.utxos", + description = "List UTXOs at the wallet address as a JSON array of {tx_hash, output_index, lovelace, assets}." + )] + async fn wallet_utxos(&self) -> Result { + let utxos = self + .inner + .chain + .get_utxos(&self.inner.address) + .await + .map_err(|e| e.to_string())?; + serde_json::to_string(&utxos).map_err(|e| e.to_string()) + } +} + +#[tool(tool_box)] +impl ServerHandler for WalletService { + fn get_info(&self) -> ServerInfo { + ServerInfo { + instructions: Some( + "aldabra — Cardano lite wallet over MCP. Phase 1 (read path): wallet.address, wallet.network, wallet.balance, wallet.utxos. Spending tools land in phase 2.".into(), + ), + ..Default::default() + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn service_constructs_and_clones() { + let svc = WalletService::new( + Network::Preprod, + "addr_test1qxyz".into(), + "https://preprod.koios.rest/api/v1".into(), + ); + let cloned = svc.clone(); + // Arc means clone is cheap and shares state. + assert_eq!(svc.inner.address, cloned.inner.address); + } +}