From 63a0cde47b2b90f6dd1b5e5e50633710694144c7 Mon Sep 17 00:00:00 2001 From: OluRemiFour Date: Sat, 17 Oct 2026 21:19:36 +0100 Subject: [PATCH] Compile the Rust quickstart as a real crate --- .github/workflows/snippets.yml | 19 + .gitignore | 3 + guides/quickstarts/rust.mdx | 72 +- snippets/rust-quickstart/Cargo.lock | 1886 +++++++++++++++++++++++ snippets/rust-quickstart/Cargo.toml | 36 + snippets/rust-quickstart/src/keypair.rs | 60 + snippets/rust-quickstart/src/main.rs | 70 + snippets/rust-quickstart/src/network.rs | 34 + snippets/rust-quickstart/src/scan.rs | 76 + snippets/rust-quickstart/src/send.rs | 58 + snippets/rust-quickstart/src/stealth.rs | 289 ++++ 11 files changed, 2566 insertions(+), 37 deletions(-) create mode 100644 snippets/rust-quickstart/Cargo.lock create mode 100644 snippets/rust-quickstart/Cargo.toml create mode 100644 snippets/rust-quickstart/src/keypair.rs create mode 100644 snippets/rust-quickstart/src/main.rs create mode 100644 snippets/rust-quickstart/src/network.rs create mode 100644 snippets/rust-quickstart/src/scan.rs create mode 100644 snippets/rust-quickstart/src/send.rs create mode 100644 snippets/rust-quickstart/src/stealth.rs diff --git a/.github/workflows/snippets.yml b/.github/workflows/snippets.yml index a0b13f1..de16b69 100644 --- a/.github/workflows/snippets.yml +++ b/.github/workflows/snippets.yml @@ -101,6 +101,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: "1.78.0" + components: rustfmt # ----------------------------------------------------------------------- # Python — pinned minor version; patch resolved by setup-python. @@ -134,6 +135,24 @@ jobs: - name: Check extended snippets (Rust / Python / shell / JSON / TOML / YAML) run: pnpm run check:snippets-extended + # ----------------------------------------------------------------------- + # Compile the Rust quickstart crate — this is the ground-truth check + # that all documented crypto code actually compiles and its tests pass. + # The "network" feature (reqwest / tokio / soroban-client) is intentionally + # excluded here; it is only needed for live RPC calls, not for type-checking. + # ----------------------------------------------------------------------- + - name: Compile Rust quickstart crate + working-directory: snippets/rust-quickstart + run: cargo build --features testnet 2>&1 + + - name: Check Rust quickstart formatting + working-directory: snippets/rust-quickstart + run: cargo fmt --check + + - name: Run Rust quickstart unit tests + working-directory: snippets/rust-quickstart + run: cargo test --features testnet 2>&1 + stellar-testnet-snippets: name: Stellar snippet testnet validation runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 5379ce5..fbbb4bd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ node_modules/ .npm/ test-results/ playwright-report/ + +# Rust build artifacts +snippets/rust-quickstart/target/ diff --git a/guides/quickstarts/rust.mdx b/guides/quickstarts/rust.mdx index 649713d..132ff77 100644 --- a/guides/quickstarts/rust.mdx +++ b/guides/quickstarts/rust.mdx @@ -44,27 +44,30 @@ default = ["testnet"] testnet = [] futurenet = [] mainnet = [] +# "network" enables the scan + send modules (reqwest / tokio / soroban-client). +# Leave it off for a pure compile/type-check of the crypto modules. +network = ["dep:reqwest", "dep:serde_json", "dep:tokio"] [dependencies] -ed25519-dalek = { version = "2", features = ["rand_core"] } -x25519-dalek = { version = "2", features = ["static_secrets"] } +ed25519-dalek = { version = "2", features = ["rand_core"] } +x25519-dalek = { version = "2", features = ["static_secrets"] } curve25519-dalek = "4" -sha2 = "0.10" -rand = "0.8" -hex = "0.4" -stellar-strkey = "0.0.6" -stellar-xdr = { version = "20", features = ["std", "base64"] } -soroban-client = "0.10" -tokio = { version = "1", features = ["full"] } -reqwest = { version = "0.12", features = ["json"] } -serde_json = "1" -anyhow = "1" +sha2 = "0.10" +rand = "0.8" +hex = "0.4" +stellar-strkey = "0.0.8" +anyhow = "1" + +# Optional — only needed when "network" is enabled. +reqwest = { version = "0.12", features = ["json"], optional = true } +serde_json = { version = "1", optional = true } +tokio = { version = "1", features = ["full"], optional = true } [profile.release] opt-level = 3 ``` -```rust no-check +```rust // src/network.rs // Compile-time network selection. Flip with --features futurenet / --features mainnet. @@ -105,11 +108,10 @@ pub const STEALTH_SIGNING_MESSAGE: &str = Decode the `S...` secret seed with `stellar-strkey`, then build an `ed25519-dalek` signing key. Keep the seed in memory only — never log it. -```rust no-check +```rust // src/keypair.rs use anyhow::Result; use ed25519_dalek::{Signer, SigningKey}; -use stellar_strkey::Decode; pub struct Account { pub seed: [u8; 32], @@ -118,11 +120,13 @@ pub struct Account { } pub fn load_keypair(secret: &str) -> Result { - // `S...` -> 32-byte ed25519 seed - let seed = stellar_strkey::Decode::ed25519_secret_seed(secret)?; + // `S...` -> 32-byte ed25519 seed via stellar-strkey + let private = stellar_strkey::ed25519::PrivateKey::from_string(secret) + .map_err(|e| anyhow::anyhow!("invalid stellar secret: {e:?}"))?; + let seed: [u8; 32] = private.0; let signing_key = SigningKey::from_bytes(&seed); - let address = stellar_strkey::Ed25519PublicKey(signing_key.verifying_key().to_bytes()).to_string(); - + let address = + stellar_strkey::ed25519::PublicKey(signing_key.verifying_key().to_bytes()).to_string(); Ok(Account { seed, signing_key, address }) } @@ -150,7 +154,7 @@ cargo run --features testnet This is the core of the Rust path: a self-contained reimplementation of the Wraith Stellar stealth spec (ed25519 + X25519, domain-separated SHA-256). It mirrors `deriveStealthKeys` / `generateStealthAddress` / `scanAnnouncements` from `@wraith-protocol/sdk/chains/stellar`. -```rust no-check +```rust // src/stealth.rs use anyhow::Result; use curve25519_dalek::{ @@ -183,7 +187,7 @@ pub struct MatchedStealth { } ``` -```rust no-check +```rust // src/stealth.rs (continued) // --- domain-separated derivation (mirrors the TS spec) --- @@ -226,7 +230,7 @@ pub fn derive_stealth_keys(sig: &[u8; 64]) -> StealthKeys { } ``` -```rust no-check +```rust // src/stealth.rs (continued) // --- X25519 ECDH between ed25519 keys (Montgomery form) --- @@ -258,18 +262,18 @@ pub fn compute_view_tag(shared: &[u8; 32]) -> u8 { } ``` -```rust no-check +```rust // src/stealth.rs (continued) // --- generate a one-time stealth address for a recipient --- pub fn generate_stealth_address( spending_pub: &[u8; 32], - viewing_pub: &[u8; 32], + viewing_seed: &[u8; 32], // the recipient's viewing seed (not just the public key) ephemeral_seed: &[u8; 32], ) -> GeneratedStealth { let eph_pub = SigningKey::from_bytes(ephemeral_seed).verifying_key().to_bytes(); // shared = X25519(viewing_priv, ephemeral_pub) - let shared = x25519_shared(viewing_seed_for_pub(viewing_pub), &eph_pub); + let shared = x25519_shared(viewing_seed, &eph_pub); let view_tag = compute_view_tag(&shared); let h_scalar = hash_to_scalar("wraith:scalar:", &shared); @@ -279,7 +283,7 @@ pub fn generate_stealth_address( let stealth_point: EdwardsPoint = spend_point + h_scalar * ED25519_BASEPOINT_POINT; let stealth_pub = stealth_point.compress().to_bytes(); - let stealth_address = stellar_strkey::Ed25519PublicKey(stealth_pub).to_string(); + let stealth_address = stellar_strkey::ed25519::PublicKey(stealth_pub).to_string(); GeneratedStealth { stealth_address, @@ -287,17 +291,11 @@ pub fn generate_stealth_address( view_tag, } } - -// Helper: recover the viewing seed from its public key is impossible, so callers -// pass both the viewing seed (for ECDH) and the viewing pub (for the API shape). -fn viewing_seed_for_pub(_pub: &[u8; 32]) -> &'static [u8; 32] { - unreachable!("pass the real viewing seed; placeholder only") -} ``` -For the recipient side you already hold the viewing seed, so replace `viewing_seed_for_pub` with the real seed and call `generate_stealth_address(spending_pub, viewing_pub, &ephemeral_seed)` directly from `derive_stealth_keys`. +After calling `derive_stealth_keys`, the `viewing_seed` is available directly on the returned `StealthKeys` struct. Pass it here: `generate_stealth_address(&keys.spending_pub, &keys.viewing_seed, &ephemeral_seed)`. -```rust no-check +```rust // src/stealth.rs (continued) // --- scan announcements and recover the stealth private scalar --- @@ -321,7 +319,7 @@ pub fn scan_announcements( let h_scalar = hash_to_scalar("wraith:scalar:", &shared); let stealth_point = spend_point + h_scalar * ED25519_BASEPOINT_POINT; let stealth_pub = stealth_point.compress().to_bytes(); - if stellar_strkey::Ed25519PublicKey(stealth_pub).to_string() == *addr { + if stellar_strkey::ed25519::PublicKey(stealth_pub).to_string() == *addr { matched.push(MatchedStealth { stealth_address: addr.clone(), stealth_scalar: spending_scalar + h_scalar, @@ -441,7 +439,7 @@ pub async fn send_stealth_payment( sender_address: &str, token: &str, // Stellar Asset Contract id, e.g. XLM or USDC SAC recipient_spending: &[u8; 32], - recipient_viewing: &[u8; 32], + recipient_viewing_seed: &[u8; 32], // recipient's viewing seed (from derive_stealth_keys) amount: i128, ) -> Result { // 1. Fresh ephemeral key for this payment @@ -449,7 +447,7 @@ pub async fn send_stealth_payment( OsRng.fill_bytes(&mut eph_seed); // 2. Recipient's one-time address - let stealth = generate_stealth_address(recipient_spending, recipient_viewing, &eph_seed); + let stealth = generate_stealth_address(recipient_spending, recipient_viewing_seed, &eph_seed); // 3. Build + submit a `stealth-sender.send` invocation. // Shape is stable across soroban-client 0.9–0.11; adapt builder methods to your version. diff --git a/snippets/rust-quickstart/Cargo.lock b/snippets/rust-quickstart/Cargo.lock new file mode 100644 index 0000000..93ccde8 --- /dev/null +++ b/snippets/rust-quickstart/Cargo.lock @@ -0,0 +1,1886 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crate-git-revision" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + +[[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 = "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", + "digest", + "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.119", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[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 = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[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-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "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", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +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.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[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.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[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.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[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 = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +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-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[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", +] + +[[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 = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[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", + "encoding_rs", + "futures-core", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[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 = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[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.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[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 = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[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 = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stellar-strkey" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" +dependencies = [ + "base32", + "crate-git-revision", + "thiserror", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +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.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[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.119", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" +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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[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.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[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-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[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 = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +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 = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + +[[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", +] + +[[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", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wraith-rust-quickstart" +version = "0.1.0" +dependencies = [ + "anyhow", + "curve25519-dalek", + "ed25519-dalek", + "hex", + "rand", + "reqwest", + "serde_json", + "sha2", + "stellar-strkey", + "tokio", + "x25519-dalek", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[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", + "serde", + "zeroize", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/snippets/rust-quickstart/Cargo.toml b/snippets/rust-quickstart/Cargo.toml new file mode 100644 index 0000000..ad5d5d6 --- /dev/null +++ b/snippets/rust-quickstart/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "wraith-rust-quickstart" +version = "0.1.0" +edition = "2021" +description = "Compiled reference implementation of the Wraith Rust quickstart guide" +publish = false + +# ── Feature flags ───────────────────────────────────────────────────────────── +# Network selection: exactly one of testnet / futurenet / mainnet must be active. +# "network" gates the scan + send modules that pull in reqwest/tokio; CI leaves +# this off so the heavy deps and live RPC calls are not required to type-check. +[features] +default = ["testnet"] +testnet = [] +futurenet = [] +mainnet = [] +network = ["dep:reqwest", "dep:serde_json", "dep:tokio"] + +# ── Dependencies ─────────────────────────────────────────────────────────────── +[dependencies] +ed25519-dalek = { version = "2.1.1", features = ["rand_core"] } +x25519-dalek = { version = "2.0.1", features = ["static_secrets"] } +curve25519-dalek = { version = "4.1.3" } +sha2 = "0.10.8" +rand = "0.8.5" +hex = "0.4.3" +stellar-strkey = "0.0.8" +anyhow = "1.0.86" + +# Optional — only materialise when the "network" feature is enabled. +reqwest = { version = "0.12.5", features = ["json"], optional = true } +serde_json = { version = "1.0.117", optional = true } +tokio = { version = "1.38.0", features = ["full"], optional = true } + +[profile.release] +opt-level = 3 diff --git a/snippets/rust-quickstart/src/keypair.rs b/snippets/rust-quickstart/src/keypair.rs new file mode 100644 index 0000000..589abf7 --- /dev/null +++ b/snippets/rust-quickstart/src/keypair.rs @@ -0,0 +1,60 @@ +// src/keypair.rs +use anyhow::Result; +use ed25519_dalek::SigningKey; + +pub struct Account { + pub seed: [u8; 32], + pub signing_key: SigningKey, + pub address: String, +} + +pub fn load_keypair(secret: &str) -> Result { + // `S...` -> 32-byte ed25519 seed via stellar-strkey ed25519::PrivateKey + let private = stellar_strkey::ed25519::PrivateKey::from_string(secret) + .map_err(|e| anyhow::anyhow!("invalid stellar secret: {e:?}"))?; + let seed: [u8; 32] = private.0; + let signing_key = SigningKey::from_bytes(&seed); + let address = + stellar_strkey::ed25519::PublicKey(signing_key.verifying_key().to_bytes()).to_string(); + Ok(Account { + seed, + signing_key, + address, + }) +} + +/// Fixture keypair used in tests and CI verification. +/// +/// This is a well-known test vector: the all-zeros 32-byte seed encoded as a +/// Stellar secret key. It is never funded on any network. +pub fn fixture_keypair() -> Account { + // All-zeros seed encoded as a Stellar S... secret key. + // stellar_strkey::ed25519::PrivateKey([0u8; 32]).to_string() + // == "SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSU2" + const FIXTURE_SECRET: &str = "SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSU2"; + load_keypair(FIXTURE_SECRET).expect("fixture keypair is always valid") +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::network::STEALTH_SIGNING_MESSAGE; + use ed25519_dalek::Signer; + + #[test] + fn fixture_loads_and_signs() { + let acct = fixture_keypair(); + // Public key must be a valid G... Stellar address. + assert!(acct.address.starts_with('G'), "address should start with G"); + // Must be able to produce a 64-byte signing signature. + let sig = acct.signing_key.sign(STEALTH_SIGNING_MESSAGE.as_bytes()); + assert_eq!(sig.to_bytes().len(), 64); + } + + #[test] + fn fixture_seed_is_not_all_zeros() { + // Sanity: the fixture key must be loadable and its signing key usable. + let acct = fixture_keypair(); + assert_eq!(acct.seed.len(), 32); + } +} diff --git a/snippets/rust-quickstart/src/main.rs b/snippets/rust-quickstart/src/main.rs new file mode 100644 index 0000000..9bd0126 --- /dev/null +++ b/snippets/rust-quickstart/src/main.rs @@ -0,0 +1,70 @@ +// src/main.rs +// +// Entry point for `cargo run`. When the "network" feature is active the binary +// scans the Soroban testnet for stealth payments addressed to the keypair +// supplied via STELLAR_SECRET. Without "network" it just derives keys and +// prints them — useful for local testing without an RPC call. + +pub mod keypair; +pub mod network; +pub mod scan; +pub mod send; +pub mod stealth; + +use network::STEALTH_SIGNING_MESSAGE; + +#[cfg(not(feature = "network"))] +fn main() -> anyhow::Result<()> { + use ed25519_dalek::Signer; + use keypair::load_keypair; + + let secret = std::env::var("STELLAR_SECRET").unwrap_or_else(|_| { + keypair::fixture_keypair() + .signing_key + .to_bytes() + .iter() + .fold(String::new(), |acc, _| acc) + }); // unreachable branch; just satisfies the type + let secret = if secret.is_empty() { + // No env var — use the fixture keypair for a smoke-run. + println!("STELLAR_SECRET not set; using built-in fixture keypair."); + return run_with_fixture(); + } else { + secret + }; + + let account = load_keypair(&secret)?; + println!("Loaded account: {}", account.address); + + let sig: [u8; 64] = account + .signing_key + .sign(STEALTH_SIGNING_MESSAGE.as_bytes()) + .to_bytes(); + let keys = stealth::derive_stealth_keys(&sig); + println!("spending pub : {}", hex::encode(keys.spending_pub)); + println!("viewing pub : {}", hex::encode(keys.viewing_pub)); + Ok(()) +} + +#[cfg(not(feature = "network"))] +fn run_with_fixture() -> anyhow::Result<()> { + use ed25519_dalek::Signer; + + let acct = keypair::fixture_keypair(); + println!("Fixture account: {}", acct.address); + let sig: [u8; 64] = acct + .signing_key + .sign(STEALTH_SIGNING_MESSAGE.as_bytes()) + .to_bytes(); + let keys = stealth::derive_stealth_keys(&sig); + println!("spending pub : {}", hex::encode(keys.spending_pub)); + println!("viewing pub : {}", hex::encode(keys.viewing_pub)); + Ok(()) +} + +#[cfg(feature = "network")] +#[tokio::main] +async fn main() -> anyhow::Result<()> { + let secret = std::env::var("STELLAR_SECRET")?; + scan::run_scan(&secret).await +} diff --git a/snippets/rust-quickstart/src/network.rs b/snippets/rust-quickstart/src/network.rs new file mode 100644 index 0000000..a6c3565 --- /dev/null +++ b/snippets/rust-quickstart/src/network.rs @@ -0,0 +1,34 @@ +// src/network.rs +// Compile-time network selection. Flip with --features futurenet / --features mainnet. + +#[cfg(feature = "testnet")] +pub const NETWORK_PASSPHRASE: &str = "Test SDF Network ; September 2015"; +#[cfg(feature = "testnet")] +pub const RPC_URL: &str = "https://soroban-testnet.stellar.org"; +#[cfg(feature = "testnet")] +pub const FRIENDBOT: Option<&str> = Some("https://friendbot.stellar.org"); +#[cfg(feature = "testnet")] +pub const ANNOUNCER: &str = "CCJLJ2QRBJAAKIG6ELNQVXLLWMKKWVN5O2FKWUETHZGMPAD4MHK7WVWL"; + +#[cfg(feature = "futurenet")] +pub const NETWORK_PASSPHRASE: &str = "Test SDF Future Network ; October 2022"; +#[cfg(feature = "futurenet")] +pub const RPC_URL: &str = "https://rpc-futurenet.stellar.org"; +#[cfg(feature = "futurenet")] +pub const FRIENDBOT: Option<&str> = Some("https://friendbot-futurenet.stellar.org"); +// Wraith contracts are NOT deployed on futurenet yet — deploy them or point ANNOUNCER at your own. +#[cfg(feature = "futurenet")] +pub const ANNOUNCER: &str = ""; + +#[cfg(feature = "mainnet")] +pub const NETWORK_PASSPHRASE: &str = "Public Global Stellar Network ; September 2015"; +#[cfg(feature = "mainnet")] +pub const RPC_URL: &str = "https://mainnet.stellar.validationcloud.io/v1/"; +#[cfg(feature = "mainnet")] +pub const FRIENDBOT: Option<&str> = None; +#[cfg(feature = "mainnet")] +pub const ANNOUNCER: &str = ""; + +pub const SCHEME_ID: u32 = 1; +pub const STEALTH_SIGNING_MESSAGE: &str = + "Sign this message to generate your Wraith stealth keys.\n\nChain: Stellar\nNote: This signature is used for key derivation only and does not authorize any transaction."; diff --git a/snippets/rust-quickstart/src/scan.rs b/snippets/rust-quickstart/src/scan.rs new file mode 100644 index 0000000..3117de8 --- /dev/null +++ b/snippets/rust-quickstart/src/scan.rs @@ -0,0 +1,76 @@ +// src/scan.rs +// +// Fetch announcements from the Soroban RPC getEvents endpoint and scan them. +// Gated behind the "network" feature so CI can compile the crypto modules +// without reqwest / tokio. + +#[cfg(feature = "network")] +use anyhow::Result; +#[cfg(feature = "network")] +use serde_json::Value; + +#[cfg(feature = "network")] +use crate::network::{ANNOUNCER, RPC_URL}; +#[cfg(feature = "network")] +use crate::stealth::scan_announcements; + +#[cfg(feature = "network")] +pub async fn fetch_announcements(start_ledger: u32) -> Result> { + let client = reqwest::Client::new(); + let req = serde_json::json!({ + "jsonrpc": "2.0", "id": 1, "method": "getEvents", + "params": { + "startLedger": start_ledger, + "filters": [{ + "type": "contract", + "contractIds": [ANNOUNCER], + "topics": [["announce"]] + }], + "pagination": { "limit": 100 } + } + }); + + let resp: Value = client.post(RPC_URL).json(&req).send().await?.json().await?; + let events = resp["result"]["events"].as_array().unwrap(); + + let mut out = Vec::new(); + for e in events { + // `data` is base64 XDR of a ContractEvent. Decode with stellar-xdr: + // let ev: stellar_xdr::ContractEvent = + // stellar_xdr::ContractEvent::from_xdr_base64(&e["data"], stellar_xdr::Limits::none())?; + // Topics (index >= 1) carry: caller, scheme_id, stealth_address(Address), + // ephemeral_pub_key(Bytes), metadata(Bytes, first byte == view tag). + let stealth_address = e["topics"][3].as_str().unwrap().to_string(); + let ephemeral_hex = e["topics"][4].as_str().unwrap(); + let ephemeral_pub: [u8; 32] = hex::decode(ephemeral_hex)?.try_into().unwrap(); + let metadata_hex = e["topics"][5].as_str().unwrap(); + let metadata = hex::decode(metadata_hex)?; + let view_tag = metadata[0]; + out.push((stealth_address, ephemeral_pub, view_tag)); + } + Ok(out) +} + +#[cfg(feature = "network")] +pub async fn run_scan(secret: &str) -> Result<()> { + use crate::keypair::load_keypair; + use crate::network::STEALTH_SIGNING_MESSAGE; + use ed25519_dalek::Signer; + + let account = load_keypair(secret)?; + let sig: [u8; 64] = account + .signing_key + .sign(STEALTH_SIGNING_MESSAGE.as_bytes()) + .to_bytes(); + let keys = crate::stealth::derive_stealth_keys(&sig); + + let announcements = fetch_announcements(1).await?; + let matched = scan_announcements( + &announcements, + &keys.viewing_seed, + &keys.spending_pub, + keys.spending_scalar, + ); + println!("found {} incoming stealth payment(s)", matched.len()); + Ok(()) +} diff --git a/snippets/rust-quickstart/src/send.rs b/snippets/rust-quickstart/src/send.rs new file mode 100644 index 0000000..d8fefb0 --- /dev/null +++ b/snippets/rust-quickstart/src/send.rs @@ -0,0 +1,58 @@ +// src/send.rs +// +// Build and submit a stealth payment via the stealth-sender Soroban contract. +// Gated behind the "network" feature — soroban-client and reqwest are not +// pulled in for the CI compile-only check. + +// NOTE: soroban-client does not yet expose a stable Rust API matching the +// builder shape shown in the quickstart guide (the guide documents the planned +// interface). This module compiles as a structural stub so that the types, +// function signatures, and overall shape are verified by rustc, while the +// concrete RPC calls remain behind the "network" feature gate. + +#[cfg(feature = "network")] +use anyhow::Result; +#[cfg(feature = "network")] +use rand::{rngs::OsRng, RngCore}; + +#[cfg(feature = "network")] +use crate::network::{ANNOUNCER, RPC_URL, SCHEME_ID}; +#[cfg(feature = "network")] +use crate::stealth::generate_stealth_address; + +/// Send a stealth payment to a recipient identified by their spending and +/// viewing public keys. +/// +/// Returns the transaction hash on success. +#[cfg(feature = "network")] +pub async fn send_stealth_payment( + sender_seed: &[u8; 32], + sender_address: &str, + token: &str, // Stellar Asset Contract id, e.g. XLM or USDC SAC + recipient_spending: &[u8; 32], + recipient_viewing_seed: &[u8; 32], + amount: i128, +) -> Result { + // 1. Fresh ephemeral key for this payment. + let mut eph_seed = [0u8; 32]; + OsRng.fill_bytes(&mut eph_seed); + + // 2. Recipient's one-time stealth address. + let stealth = generate_stealth_address(recipient_spending, recipient_viewing_seed, &eph_seed); + + // 3. Build + submit a `stealth-sender.send` invocation via soroban-client. + // The exact builder API depends on the soroban-client version you target; + // the shape below matches the planned 0.10+ interface documented in the + // quickstart guide. Adapt method names to your installed version. + let _ = ( + sender_seed, + sender_address, + token, + amount, + stealth, + ANNOUNCER, + RPC_URL, + SCHEME_ID, + ); + anyhow::bail!("send_stealth_payment: wire up soroban-client builder for your target version") +} diff --git a/snippets/rust-quickstart/src/stealth.rs b/snippets/rust-quickstart/src/stealth.rs new file mode 100644 index 0000000..b4ceee3 --- /dev/null +++ b/snippets/rust-quickstart/src/stealth.rs @@ -0,0 +1,289 @@ +// src/stealth.rs +// +// Self-contained reimplementation of the Wraith Stellar stealth spec. +// Mirrors deriveStealthKeys / generateStealthAddress / scanAnnouncements +// from @wraith-protocol/sdk/chains/stellar. +// +// Cryptographic primitives: ed25519 + X25519, domain-separated SHA-256. + +use curve25519_dalek::{ + constants::ED25519_BASEPOINT_POINT, edwards::CompressedEdwardsY, EdwardsPoint, Scalar, +}; +use ed25519_dalek::SigningKey; +use sha2::{Digest, Sha256, Sha512}; +use x25519_dalek::{PublicKey as X25519PublicKey, StaticSecret}; + +// ── Public types ────────────────────────────────────────────────────────────── + +pub struct StealthKeys { + pub spending_seed: [u8; 32], + pub viewing_seed: [u8; 32], + pub spending_scalar: Scalar, + pub spending_pub: [u8; 32], + pub viewing_pub: [u8; 32], +} + +pub struct GeneratedStealth { + pub stealth_address: String, + pub ephemeral_pub: [u8; 32], + pub view_tag: u8, +} + +pub struct MatchedStealth { + pub stealth_address: String, + pub stealth_scalar: Scalar, + pub stealth_pub: [u8; 32], +} + +// ── Domain-separated derivation (mirrors the TS spec) ──────────────────────── + +fn derive_seed(tag: &str, sig: &[u8; 64]) -> [u8; 32] { + let mut h = Sha256::new(); + h.update(tag.as_bytes()); + h.update(sig); + let out = h.finalize(); + let mut b = [0u8; 32]; + b.copy_from_slice(&out); + b +} + +/// ed25519 private scalar: SHA-512(seed)[0..32], clamped (RFC 8032 §5.1.5). +fn seed_to_scalar(seed: &[u8; 32]) -> Scalar { + let h = Sha512::digest(seed); + let mut a = [0u8; 32]; + a.copy_from_slice(&h[0..32]); + a[0] &= 248; + a[31] &= 127; + a[31] |= 64; + Scalar::from_bytes_mod_order(a) +} + +fn pubkey_from_seed(seed: &[u8; 32]) -> [u8; 32] { + SigningKey::from_bytes(seed).verifying_key().to_bytes() +} + +pub fn derive_stealth_keys(sig: &[u8; 64]) -> StealthKeys { + let spending_seed = derive_seed("wraith:spending:", sig); + let viewing_seed = derive_seed("wraith:viewing:", sig); + let spending_scalar = seed_to_scalar(&spending_seed); + StealthKeys { + spending_seed, + viewing_seed, + spending_scalar, + spending_pub: pubkey_from_seed(&spending_seed), + viewing_pub: pubkey_from_seed(&viewing_seed), + } +} + +// ── X25519 ECDH between ed25519 keys (Montgomery form) ─────────────────────── + +fn edwards_pub_to_mont_pub(pub_bytes: &[u8; 32]) -> [u8; 32] { + let compressed = CompressedEdwardsY::from_slice(pub_bytes) + .expect("32-byte slice always fits CompressedEdwardsY"); + let point = compressed.decompress().expect("valid ed25519 public key"); + point.to_montgomery().to_bytes() +} + +fn x25519_shared(priv_seed: &[u8; 32], peer_pub: &[u8; 32]) -> [u8; 32] { + // The clamped ed25519 scalar bytes are a valid x25519 private key. + let a = seed_to_scalar(priv_seed).to_bytes(); + let secret = StaticSecret::from(a); + let peer = X25519PublicKey::from(edwards_pub_to_mont_pub(peer_pub)); + secret.diffie_hellman(&peer).to_bytes() +} + +fn hash_to_scalar(domain: &str, shared: &[u8; 32]) -> Scalar { + let mut h = Sha256::new(); + h.update(domain.as_bytes()); + h.update(shared); + let out = h.finalize(); + let mut b = [0u8; 32]; + b.copy_from_slice(&out); + Scalar::from_bytes_mod_order(b) +} + +pub fn compute_view_tag(shared: &[u8; 32]) -> u8 { + hash_to_scalar("wraith:tag:", shared).to_bytes()[0] +} + +// ── Generate a one-time stealth address for a recipient ─────────────────────── +// +// Callers supply the recipient's viewing *seed* (not just the public key) +// because ECDH requires the private scalar. After calling derive_stealth_keys +// the viewing_seed is available directly on StealthKeys. + +pub fn generate_stealth_address( + spending_pub: &[u8; 32], + viewing_seed: &[u8; 32], + ephemeral_seed: &[u8; 32], +) -> GeneratedStealth { + let eph_pub = SigningKey::from_bytes(ephemeral_seed) + .verifying_key() + .to_bytes(); + // shared = X25519(viewing_priv, ephemeral_pub) + let shared = x25519_shared(viewing_seed, &eph_pub); + let view_tag = compute_view_tag(&shared); + let h_scalar = hash_to_scalar("wraith:scalar:", &shared); + + let spend_point = CompressedEdwardsY::from_slice(spending_pub) + .expect("32-byte slice always fits CompressedEdwardsY") + .decompress() + .expect("valid spending pub"); + let stealth_point: EdwardsPoint = spend_point + h_scalar * ED25519_BASEPOINT_POINT; + let stealth_pub = stealth_point.compress().to_bytes(); + let stealth_address = stellar_strkey::ed25519::PublicKey(stealth_pub).to_string(); + + GeneratedStealth { + stealth_address, + ephemeral_pub: eph_pub, + view_tag, + } +} + +// ── Scan announcements and recover the stealth private scalar ───────────────── + +pub fn scan_announcements( + announcements: &[(String, [u8; 32], u8)], // (stealth_address, ephemeral_pub, view_tag) + viewing_seed: &[u8; 32], + spending_pub: &[u8; 32], + spending_scalar: Scalar, +) -> Vec { + let spend_point = CompressedEdwardsY::from_slice(spending_pub) + .expect("32-byte slice always fits CompressedEdwardsY") + .decompress() + .expect("valid spending pub"); + let mut matched = Vec::new(); + + for (addr, eph_pub, tag) in announcements { + // Fast prefilter: skip ~255/256 non-matches on the view tag alone. + let shared = x25519_shared(viewing_seed, eph_pub); + if compute_view_tag(&shared) != *tag { + continue; + } + let h_scalar = hash_to_scalar("wraith:scalar:", &shared); + let stealth_point = spend_point + h_scalar * ED25519_BASEPOINT_POINT; + let stealth_pub = stealth_point.compress().to_bytes(); + if stellar_strkey::ed25519::PublicKey(stealth_pub).to_string() == *addr { + matched.push(MatchedStealth { + stealth_address: addr.clone(), + stealth_scalar: spending_scalar + h_scalar, + stealth_pub, + }); + } + } + matched +} + +// ── Sign with a raw stealth scalar (ed25519 / RFC 8032) ─────────────────────── +// +// Needed to spend funds received at a stealth address. + +pub fn sign_with_scalar(scalar_le: &[u8; 32], message: &[u8], pubkey: &[u8; 32]) -> [u8; 64] { + let a = Scalar::from_bytes_mod_order(*scalar_le); + let mut h = Sha512::new(); + h.update(scalar_le); + h.update(message); + let r = Scalar::from_bytes_mod_order(h.finalize()[0..32].try_into().unwrap()); + let r_point = r * ED25519_BASEPOINT_POINT; + let r_bytes = r_point.compress().to_bytes(); + let mut k = Sha512::new(); + k.update(&r_bytes); + k.update(pubkey); + k.update(message); + let k = Scalar::from_bytes_mod_order(k.finalize()[0..32].try_into().unwrap()); + let s = r + k * a; + let mut sig = [0u8; 64]; + sig[0..32].copy_from_slice(&r_bytes); + sig[32..64].copy_from_slice(&s.to_bytes()); + sig +} + +// ── Tests ───────────────────────────────────────────────────────────────────── + +#[cfg(test)] +mod tests { + use super::*; + use crate::keypair::fixture_keypair; + use crate::network::STEALTH_SIGNING_MESSAGE; + use ed25519_dalek::Signer; + + fn fixture_sig() -> [u8; 64] { + fixture_keypair() + .signing_key + .sign(STEALTH_SIGNING_MESSAGE.as_bytes()) + .to_bytes() + } + + #[test] + fn derive_stealth_keys_is_deterministic() { + let sig = fixture_sig(); + let k1 = derive_stealth_keys(&sig); + let k2 = derive_stealth_keys(&sig); + assert_eq!(k1.spending_pub, k2.spending_pub); + assert_eq!(k1.viewing_pub, k2.viewing_pub); + } + + #[test] + fn spending_and_viewing_seeds_differ() { + let sig = fixture_sig(); + let keys = derive_stealth_keys(&sig); + assert_ne!( + keys.spending_seed, keys.viewing_seed, + "seeds must be distinct" + ); + } + + #[test] + fn generate_and_scan_round_trip() { + let sig = fixture_sig(); + let keys = derive_stealth_keys(&sig); + + // Use a fixed ephemeral seed so the test is deterministic. + let ephemeral_seed = [0x42u8; 32]; + + let generated = + generate_stealth_address(&keys.spending_pub, &keys.viewing_seed, &ephemeral_seed); + + // The generated address must be a valid G... Stellar address. + assert!(generated.stealth_address.starts_with('G')); + + // Scanning with the correct keys must find exactly one match. + let announcements = vec![( + generated.stealth_address.clone(), + generated.ephemeral_pub, + generated.view_tag, + )]; + let found = scan_announcements( + &announcements, + &keys.viewing_seed, + &keys.spending_pub, + keys.spending_scalar, + ); + assert_eq!(found.len(), 1, "should find exactly one match"); + assert_eq!(found[0].stealth_address, generated.stealth_address); + } + + #[test] + fn wrong_view_tag_is_filtered() { + let sig = fixture_sig(); + let keys = derive_stealth_keys(&sig); + let ephemeral_seed = [0x07u8; 32]; + let generated = + generate_stealth_address(&keys.spending_pub, &keys.viewing_seed, &ephemeral_seed); + + // Corrupt the view tag: scan should produce no matches. + let bad_tag = generated.view_tag.wrapping_add(1); + let announcements = vec![( + generated.stealth_address.clone(), + generated.ephemeral_pub, + bad_tag, + )]; + let found = scan_announcements( + &announcements, + &keys.viewing_seed, + &keys.spending_pub, + keys.spending_scalar, + ); + assert_eq!(found.len(), 0, "corrupted view tag must be filtered"); + } +}