diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index da9c09502..6eb8a98e9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -69,6 +69,7 @@ /rust/send_http_post/ @dfinity/growth /rust/simd/ @dfinity/execution /rust/threshold-ecdsa/ @dfinity/crypto-team +/rust/threshold-mock/ @dfinity/crypto-team /rust/threshold-schnorr/ @dfinity/crypto-team /rust/token_transfer/ @dfinity/growth /rust/token_transfer_from/ @dfinity/growth diff --git a/.github/workflows/rust-threshold-mock-example.yml b/.github/workflows/rust-threshold-mock-example.yml new file mode 100644 index 000000000..d2d7cb944 --- /dev/null +++ b/.github/workflows/rust-threshold-mock-example.yml @@ -0,0 +1,66 @@ +name: rust-threshold-mock +on: + push: + branches: + - master + pull_request: + paths: + - rust/threshold-mock/** + - .github/workflows/provision-darwin.sh + - .github/workflows/provision-linux.sh + - .github/workflows/rust-threshold-mock-example.yml + - .ic-commit +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + rust-threshold-mock-darwin: + runs-on: macos-12 + steps: + - uses: actions/checkout@v1 + - name: Provision Darwin + run: bash .github/workflows/provision-darwin.sh + - name: Install PocketIC server Darwin + uses: dfinity/pocketic@main + with: + pocket-ic-server-version: "6.0.0" + - name: Build threshold-mock Darwin + run: | + pushd rust/threshold-mock + cargo build --target wasm32-unknown-unknown --release + popd + - name: Lint threshold-mock Darwin + run: | + pushd rust/threshold-mock + cargo fmt --all -- --check && cargo clippy --all-targets --all-features -- -D warnings + popd + - name: Test threshold-mock Darwin + run: | + pushd rust/threshold-mock + cargo test + popd + rust-threshold-mock-linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v1 + - name: Provision Linux + run: bash .github/workflows/provision-linux.sh + - name: Install PocketIC server Linux + uses: dfinity/pocketic@main + with: + pocket-ic-server-version: "6.0.0" + - name: Build threshold-mock Linux + run: | + pushd rust/threshold-mock + cargo build --target wasm32-unknown-unknown --release + popd + - name: Lint threshold-mock Linux + run: | + pushd rust/threshold-mock + cargo fmt --all -- --check && cargo clippy --all-targets --all-features -- -D warnings + popd + - name: Test threshold-mock Linux + run: | + pushd rust/threshold-mock + cargo test + popd \ No newline at end of file diff --git a/rust/threshold-mock/.gitignore b/rust/threshold-mock/.gitignore new file mode 100644 index 000000000..b662ab841 --- /dev/null +++ b/rust/threshold-mock/.gitignore @@ -0,0 +1,17 @@ +# Various IDEs and Editors +.vscode/ +.idea/ +**/*~ + +# Mac OSX temporary files +.DS_Store +**/.DS_Store + +# dfx temporary files +.dfx/ + +# rust +target/ + +# environment variables +.env \ No newline at end of file diff --git a/rust/threshold-mock/CONTRIBUTING.md b/rust/threshold-mock/CONTRIBUTING.md new file mode 100644 index 000000000..bbbaea5c4 --- /dev/null +++ b/rust/threshold-mock/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# Contributing + +## Contributing code changes + +This repository is currently not open to direct contributions. However, if you want to contribute a feature or bug fix, please **reach out to us** so that we can discuss feasibility and implementation strategies. You can reach out to us: + +- on the [forum] +- by opening [GitHub issues] + +Make sure to read the [README] and [LICENSE] first. + +## Bug reports + +We always appreciate bug reports through [GitHub issues]. + +[GitHub issues]: https://github.com/dfinity/TODO/issues +[forum]: https://forum.dfinity.org/ +[LICENSE]: LICENSE +[HACKING]: HACKING.md +[README]: README.md diff --git a/rust/threshold-mock/Cargo.lock b/rust/threshold-mock/Cargo.lock new file mode 100644 index 000000000..90bcc0243 --- /dev/null +++ b/rust/threshold-mock/Cargo.lock @@ -0,0 +1,2624 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "binread" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16598dfc8e6578e9b597d9910ba2e73618385dc9f4b1d43dd92c349d6be6418f" +dependencies = [ + "binread_derive", + "lazy_static", + "rustversion", +] + +[[package]] +name = "binread_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9672209df1714ee804b1f4d4f68c8eb2a90b1f7a07acf472f88ce198ef1fed" +dependencies = [ + "either", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" + +[[package]] +name = "candid" +version = "0.10.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c30ee7f886f296b6422c0ff017e89dd4f831521dfdcc76f3f71aae1ce817222" +dependencies = [ + "anyhow", + "binread", + "byteorder", + "candid_derive", + "hex", + "ic_principal", + "leb128", + "num-bigint", + "num-traits", + "paste", + "pretty", + "serde", + "serde_bytes", + "stacker", + "thiserror", +] + +[[package]] +name = "candid_derive" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3de398570c386726e7a59d9887b68763c481477f9a043fb998a2e09d428df1a9" +dependencies = [ + "lazy_static", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "cc" +version = "1.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chainkey_testing_canister" +version = "0.1.0" +dependencies = [ + "assert_matches", + "candid", + "ed25519-dalek", + "getrandom", + "hex", + "ic-cdk 0.16.0", + "ic-cdk-timers", + "ic-crypto-ed25519", + "ic-crypto-internal-bls12-381-type", + "ic-crypto-internal-bls12-381-vetkd", + "ic-crypto-secp256k1", + "ic-stable-structures", + "ic-vetkd-utils", + "k256", + "lazy_static", + "pocket-ic", + "rand", + "rand_chacha", + "serde", +] + +[[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-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "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", + "group", + "rand_core", + "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.85", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[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.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "merlin", + "rand_core", + "serde", + "sha2", + "signature", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "erased-serde" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" +dependencies = [ + "serde", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "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", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "ic-cdk" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1da6a25b045f9da3c9459c0cb2b0700ac368ee16382975a17185a23b9c18ab" +dependencies = [ + "candid", + "ic-cdk-macros 0.13.2", + "ic0 0.21.1", + "serde", + "serde_bytes", +] + +[[package]] +name = "ic-cdk" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8ecacd682fa05a985253592963306cb9799622d7b1cce4b1edb89c6ec85be1" +dependencies = [ + "candid", + "ic-cdk-macros 0.16.0", + "ic0 0.23.0", + "serde", + "serde_bytes", +] + +[[package]] +name = "ic-cdk-macros" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45800053d80a6df839a71aaea5797e723188c0b992618208ca3b941350c7355" +dependencies = [ + "candid", + "proc-macro2", + "quote", + "serde", + "serde_tokenstream 0.1.7", + "syn 1.0.109", +] + +[[package]] +name = "ic-cdk-macros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4d857135deef20cc7ea8f3869a30cd9cfeb1392b3a81043790b2cd82adc3e0" +dependencies = [ + "candid", + "proc-macro2", + "quote", + "serde", + "serde_tokenstream 0.2.2", + "syn 2.0.85", +] + +[[package]] +name = "ic-cdk-timers" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7c528bbb3d4d934b43a364855995d318649217c7510f40f92ad52eba3ff7be" +dependencies = [ + "futures", + "ic-cdk 0.16.0", + "ic0 0.23.0", + "serde", + "serde_bytes", + "slotmap", +] + +[[package]] +name = "ic-crypto-ed25519" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "curve25519-dalek", + "ed25519-dalek", + "hkdf", + "pem", + "rand", + "thiserror", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-bls12-381-type" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "hex", + "ic_bls12_381", + "itertools", + "lazy_static", + "pairing", + "paste", + "rand", + "rand_chacha", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "ic-crypto-internal-bls12-381-vetkd" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "ic-crypto-internal-bls12-381-type", + "ic-sha3", + "rand", + "zeroize", +] + +[[package]] +name = "ic-crypto-secp256k1" +version = "0.9.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "hmac", + "k256", + "lazy_static", + "num-bigint", + "pem", + "rand", + "rand_chacha", + "simple_asn1", + "zeroize", +] + +[[package]] +name = "ic-sha3" +version = "1.0.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "sha3", +] + +[[package]] +name = "ic-stable-structures" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03f3044466a69802de74e710dc0300b706a05696a0531c942ca856751a13b0db" +dependencies = [ + "ic_principal", +] + +[[package]] +name = "ic-vetkd-utils" +version = "0.1.0" +source = "git+https://github.com/dfinity/ic#d265b130647f04aa25909ec1fbb8294ce0139d1c" +dependencies = [ + "getrandom", + "ic_bls12_381", + "lazy_static", + "pairing", + "rand", + "rand_chacha", + "sha2", + "sha3", + "subtle", + "wasm-bindgen", + "zeroize", +] + +[[package]] +name = "ic0" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a54b5297861c651551676e8c43df805dad175cc33bc97dbd992edbbb85dcbcdf" + +[[package]] +name = "ic0" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de254dd67bbd58073e23dc1c8553ba12fa1dc610a19de94ad2bbcd0460c067f" + +[[package]] +name = "ic_bls12_381" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22c65787944f32af084dffd0c68c1e544237b76e215654ddea8cd9f527dd8b69" +dependencies = [ + "digest", + "ff", + "group", + "pairing", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "ic_principal" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1762deb6f7c8d8c2bdee4b6c5a47b60195b74e9b5280faa5ba29692f8e17429c" +dependencies = [ + "crc32fast", + "data-encoding", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pocket-ic" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beff607d4dbebff8d003453ced669d2645e905de496ca93713f3d47633357e6c" +dependencies = [ + "base64 0.13.1", + "candid", + "hex", + "ic-cdk 0.13.5", + "reqwest", + "schemars", + "serde", + "serde_bytes", + "serde_json", + "sha2", + "slog", + "tokio", + "tracing", + "tracing-appender", + "tracing-subscriber", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "pretty" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55c4d17d994b637e2f4daf6e5dc5d660d209d5642377d675d7a1c3ab69fa579" +dependencies = [ + "arrayvec", + "typed-arena", + "unicode-width", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" +dependencies = [ + "cc", +] + +[[package]] +name = "quinn" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +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", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-native-certs", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-socks", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", + "windows-registry", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[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.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schannel" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.85", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[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.85", +] + +[[package]] +name = "serde_json" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_tokenstream" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "797ba1d80299b264f3aac68ab5d12e5825a561749db4df7cd7c8083900c5d4e9" +dependencies = [ + "proc-macro2", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "serde_tokenstream" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64060d864397305347a78851c51588fd283767e7e7589829e8121d65512340f1" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 2.0.85", +] + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slog" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8347046d4ebd943127157b94d63abb990fcf729dc4e9978927fdf4ac3c998d06" +dependencies = [ + "erased-serde", +] + +[[package]] +name = "slotmap" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stacker" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.59.0", +] + +[[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", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "thiserror" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +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.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-socks" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" +dependencies = [ + "either", + "futures-util", + "thiserror", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[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.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +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-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicase" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" + +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + +[[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.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[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 = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] diff --git a/rust/threshold-mock/Cargo.toml b/rust/threshold-mock/Cargo.toml new file mode 100644 index 000000000..d3a698c3f --- /dev/null +++ b/rust/threshold-mock/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "chainkey_testing_canister" +version = "0.1.0" +edition = "2021" + +resolver = "2" + +[profile.release] +lto = true +opt-level = 'z' +panic = 'abort' + +[lib] +crate-type = ["lib", "cdylib"] + +[dependencies] +candid = "0.10.10" +# Enable `custom` feature of indirect getrandom dependency. See lib.rs for more details. +getrandom = { version = "0.2", features = ["custom"] } +hex = "0.4" +ic-cdk = "0.16.0" +ic-cdk-timers = "0.10.0" +ic-crypto-ed25519 = { git = "https://github.com/dfinity/ic" } +ic-crypto-secp256k1 = { git = "https://github.com/dfinity/ic" } +ic-crypto-internal-bls12-381-vetkd = { git = "https://github.com/dfinity/ic" } +ic-crypto-internal-bls12-381-type = { git = "https://github.com/dfinity/ic" } +ic-stable-structures = "0.6.5" +lazy_static = "1.4" +rand = "0.8" +rand_chacha = "0.3" +serde = "1" + +[dev-dependencies] +assert_matches = "1.5.0" +ed25519-dalek = "2.1" +ic-vetkd-utils = { git = "https://github.com/dfinity/ic" } +k256 = "0.13.4" +pocket-ic = "5.0.0" diff --git a/rust/threshold-mock/LICENSE.txt b/rust/threshold-mock/LICENSE.txt new file mode 100644 index 000000000..5c11a3ec7 --- /dev/null +++ b/rust/threshold-mock/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2024 DFINITY Stiftung. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/rust/threshold-mock/Makefile b/rust/threshold-mock/Makefile new file mode 100644 index 000000000..be473c1f5 --- /dev/null +++ b/rust/threshold-mock/Makefile @@ -0,0 +1,15 @@ +.PHONY: build +.SILENT: build +build: + cargo build --target wasm32-unknown-unknown --release + +.PHONY: test +.SILENT: test +test: build + cargo test + +.PHONY: clean +.SILENT: clean +clean: + rm -rf .dfx + cargo clean diff --git a/rust/threshold-mock/README.md b/rust/threshold-mock/README.md new file mode 100644 index 000000000..20aa007cf --- /dev/null +++ b/rust/threshold-mock/README.md @@ -0,0 +1,31 @@ +# Chain-key testing canister + +The chain-key testing canister is a canister smart contract that provides a [fake](https://www.martinfowler.com/articles/mocksArentStubs.html#TheDifferenceBetweenMocksAndStubs) implementation of the APIs of various chain-key-related features including threshold ECDSA, threshold Schnorr, and threshold key derivation (vetKeys) **for testing purposes**. The shortcut that this canister takes (compared to the production APIs) is that it relies on a cryptographic key that is hard-coded into the canister, rather than relying on a key that is distributed among the subnet nodes. With this, the implementation is inherently **insecure**: see [Disclaimer](#disclaimer). + +The main advantage of using this canister is to *save costs during testing*, because there are [fees](https://internetcomputer.org/docs/current/references/t-sigs-how-it-works#api-fees) associated with using the chain-key features via the Internet Computer's management canister APIs. + +In particular, the canister provides fake implementations of the following Internet Computer features: +* [Threshold ECDSA](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/signatures/t-ecdsa) + * [ecdsa_public_key](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-ecdsa_public_key), [sign_with_ecdsa](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-sign_with_ecdsa) +* [Threshold Schnorr](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/signatures/t-schnorr) + * [schnorr_public_key](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-schnorr_public_key), [sign_with_schnorr](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-sign_with_schnorr) +* Preview: [Threshold Key Derivation (vetKeys)](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/encryption/vetkeys) + * `vetkd_public_key`, `vetkd_encrypted_key` (see [API proposal PR](https://github.com/dfinity/interface-spec/pull/158)) + +## Usage + +The canister is deployed on mainnet: the canister ID is `vrqyr-saaaa-aaaan-qzn4q-cai` ([dashboard](https://dashboard.internetcomputer.org/canister/vrqyr-saaaa-aaaan-qzn4q-cai), [candid-ui](https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=vrqyr-saaaa-aaaan-qzn4q-cai)). + +All APIs support a single key ID: `insecure_test_key_1`. + +For the time being, no fees are charged. If canister usage becomes excessive, we will introduce fees but aim to keep these fees significantly lower than the [fees of the production APIs](https://internetcomputer.org/docs/current/references/t-sigs-how-it-works#api-fee). The community is invited to top up the canister with cycles. + +As this repository contains the canister's source code, developers can also deploy their own, private instance of this canister. + +## Disclaimer + +The implementation underlying the chain-key testing canister is **unsafe** and for **testing purposes only**: the master secret keys are **hard-coded** in the canister, rather than distributed among the subnet nodes. **Do not use this in production or for sensitive data**!. + +## License + +Please see the [LICENSE](LICENSE) and [Contribution guidelines](CONTRIBUTING.md). \ No newline at end of file diff --git a/rust/threshold-mock/canister_ids.json b/rust/threshold-mock/canister_ids.json new file mode 100644 index 000000000..853948d7e --- /dev/null +++ b/rust/threshold-mock/canister_ids.json @@ -0,0 +1,5 @@ +{ + "chainkey_testing_canister": { + "ic": "vrqyr-saaaa-aaaan-qzn4q-cai" + } +} \ No newline at end of file diff --git a/rust/threshold-mock/chainkey_testing_canister.did b/rust/threshold-mock/chainkey_testing_canister.did new file mode 100644 index 000000000..4bb354917 --- /dev/null +++ b/rust/threshold-mock/chainkey_testing_canister.did @@ -0,0 +1,95 @@ +type canister_id = principal; + +type ecdsa_curve = variant { + secp256k1; +}; +type schnorr_algorithm = variant { + bip340secp256k1; + ed25519; +}; + +type vetkd_curve = variant { bls12_381 }; + +type ecdsa_public_key_args = record { + canister_id : opt canister_id; + derivation_path : vec blob; + key_id : record { curve : ecdsa_curve; name : text }; +}; + +type ecdsa_public_key_result = record { + public_key : blob; + chain_code : blob; +}; + +type sign_with_ecdsa_args = record { + message_hash : blob; + derivation_path : vec blob; + key_id : record { curve : ecdsa_curve; name : text }; +}; + +type sign_with_ecdsa_result = record { + signature : blob; +}; + +type schnorr_public_key_args = record { + canister_id : opt canister_id; + derivation_path : vec blob; + key_id : record { algorithm : schnorr_algorithm; name : text }; +}; + +type schnorr_public_key_result = record { + public_key : blob; + chain_code : blob; +}; + +type sign_with_schnorr_args = record { + message : blob; + derivation_path : vec blob; + key_id : record { algorithm : schnorr_algorithm; name : text }; +}; + +type sign_with_schnorr_result = record { + signature : blob; +}; + +type vetkd_public_key_args = record { + canister_id : opt canister_id; + derivation_path : vec blob; + key_id : record { curve : vetkd_curve; name : text }; +}; + +type vetkd_public_key_result = record { + public_key : blob; +}; + +type vetkd_encrypted_key_args = record { + public_key_derivation_path : vec blob; + derivation_id : blob; + key_id : record { curve : vetkd_curve; name : text }; + encryption_public_key : blob; +}; + +type vetkd_encrypted_key_result = record { + encrypted_key : blob; +}; + +type call_counts_result = record { + call_counts : vec record { method_name : text; call_count : nat64 }; +}; + +service : { + // Threshold ECDSA signature + ecdsa_public_key : (ecdsa_public_key_args) -> (ecdsa_public_key_result); + sign_with_ecdsa : (sign_with_ecdsa_args) -> (sign_with_ecdsa_result); + + // Threshold Schnorr signature + schnorr_public_key : (schnorr_public_key_args) -> (schnorr_public_key_result); + sign_with_schnorr : (sign_with_schnorr_args) -> (sign_with_schnorr_result); + + // Threshold key derivation + vetkd_public_key : (vetkd_public_key_args) -> (vetkd_public_key_result); + vetkd_encrypted_key : (vetkd_encrypted_key_args) -> (vetkd_encrypted_key_result); + + // Statistics: call counts + call_counts : () -> (call_counts_result); +}; diff --git a/rust/threshold-mock/dfx.json b/rust/threshold-mock/dfx.json new file mode 100644 index 000000000..b98ae026f --- /dev/null +++ b/rust/threshold-mock/dfx.json @@ -0,0 +1,16 @@ +{ + "canisters": { + "chainkey_testing_canister": { + "candid": "chainkey_testing_canister.did", + "package": "chainkey_testing_canister", + "type": "rust" + } + }, + "defaults": { + "build": { + "args": "", + "packtool": "" + } + }, + "version": 1 +} \ No newline at end of file diff --git a/rust/threshold-mock/src/ecdsa.rs b/rust/threshold-mock/src/ecdsa.rs new file mode 100644 index 000000000..2a8b905d8 --- /dev/null +++ b/rust/threshold-mock/src/ecdsa.rs @@ -0,0 +1,70 @@ +use crate::ensure_call_is_paid; +use crate::inc_call_count; + +use super::ensure_derivation_path_is_valid; +use ic_cdk::api::management_canister::ecdsa::EcdsaCurve; +use ic_cdk::api::management_canister::ecdsa::EcdsaKeyId; +use ic_cdk::api::management_canister::ecdsa::EcdsaPublicKeyArgument; +use ic_cdk::api::management_canister::ecdsa::EcdsaPublicKeyResponse; +use ic_cdk::api::management_canister::ecdsa::SignWithEcdsaArgument; +use ic_cdk::api::management_canister::ecdsa::SignWithEcdsaResponse; +use ic_cdk::update; + +/// DISCLAIMER: This canister here provides an *unsafe* example implementation +/// of the Internet Computer's management canister API for demonstration purposes. +/// Because of this, in the following we hard-code a randomly generated master +/// secret key. Do NOT use this in production. +const MASTER_SK_SECP256K1_HEX: &str = + "bcd854ea5112b314b5d306442376b57a6e6f2ffc34c2d0f6918823b0f7c0bfac"; + +lazy_static::lazy_static! { + static ref MASTER_SK_SECP256K1: ic_crypto_secp256k1::PrivateKey = ic_crypto_secp256k1::PrivateKey::deserialize_sec1( + &hex::decode(MASTER_SK_SECP256K1_HEX).expect("failed to hex-decode") + ).expect("failed to deserialize secp256k1 private key"); + static ref MASTER_PK_SECP256K1: ic_crypto_secp256k1::PublicKey = MASTER_SK_SECP256K1.public_key(); +} + +#[update] +async fn ecdsa_public_key(args: EcdsaPublicKeyArgument) -> EcdsaPublicKeyResponse { + inc_call_count("ecdsa_public_key".to_string()); + ensure_secp256k1_insecure_test_key_1(&args.key_id); + ensure_derivation_path_is_valid(&args.derivation_path); + let derivation_path = ic_crypto_secp256k1::DerivationPath::from_canister_id_and_path( + args.canister_id.unwrap_or_else(ic_cdk::caller).as_slice(), + &args.derivation_path, + ); + let (public_key, chain_code) = MASTER_PK_SECP256K1.derive_subkey(&derivation_path); + EcdsaPublicKeyResponse { + public_key: public_key.serialize_sec1(true).to_vec(), + chain_code: chain_code.to_vec(), + } +} + +#[update] +async fn sign_with_ecdsa(args: SignWithEcdsaArgument) -> SignWithEcdsaResponse { + inc_call_count("sign_with_ecdsa".to_string()); + ensure_call_is_paid(0); + ensure_secp256k1_insecure_test_key_1(&args.key_id); + ensure_derivation_path_is_valid(&args.derivation_path); + if args.message_hash.len() != 32 { + ic_cdk::trap("message hash must be 32 bytes"); + } + let derivation_path = ic_crypto_secp256k1::DerivationPath::from_canister_id_and_path( + ic_cdk::caller().as_slice(), + &args.derivation_path, + ); + let (derived_private_key, _chain_code) = MASTER_SK_SECP256K1.derive_subkey(&derivation_path); + let signature = derived_private_key.sign_digest_with_ecdsa(&args.message_hash); + SignWithEcdsaResponse { + signature: signature.to_vec(), + } +} + +fn ensure_secp256k1_insecure_test_key_1(key_id: &EcdsaKeyId) { + if key_id.curve != EcdsaCurve::Secp256k1 { + ic_cdk::trap("unsupported key ID curve"); + } + if key_id.name.as_str() != "insecure_test_key_1" { + ic_cdk::trap("unsupported key ID name"); + } +} diff --git a/rust/threshold-mock/src/lib.rs b/rust/threshold-mock/src/lib.rs new file mode 100644 index 000000000..f57ae2f9c --- /dev/null +++ b/rust/threshold-mock/src/lib.rs @@ -0,0 +1,117 @@ +use candid::{CandidType, Principal}; +use ic_stable_structures::memory_manager::{MemoryId, MemoryManager, VirtualMemory}; +use ic_stable_structures::{DefaultMemoryImpl, StableBTreeMap}; +use rand::SeedableRng; +use rand_chacha::ChaCha20Rng; +use std::cell::RefCell; +use std::time::Duration; + +type Memory = VirtualMemory; + +pub mod ecdsa; +pub mod schnorr; +pub mod vetkd; + +thread_local! { + static RNG: RefCell> = const { RefCell::new(None) }; + static MEMORY_MANAGER: RefCell> = + RefCell::new(MemoryManager::init(DefaultMemoryImpl::default())); + static CALL_COUNTS: RefCell> = RefCell::new( + StableBTreeMap::init( + MEMORY_MANAGER.with_borrow(|m| m.get(MemoryId::new(1))), + ) + ); +} + +const SEEDING_INTERVAL: Duration = Duration::from_secs(3600); + +#[ic_cdk::init] +fn init() { + // Initialize randomness during canister install or reinstall + schedule_seeding(Duration::ZERO); +} + +#[ic_cdk::post_upgrade] +fn post_upgrade() { + // Initialize randomness after a canister upgrade + schedule_seeding(Duration::ZERO); +} + +fn schedule_seeding(duration: Duration) { + ic_cdk_timers::set_timer(duration, || { + ic_cdk::spawn(async { + seed_randomness().await; + // Schedule reseeding on a timer with duration SEEDING_INTERVAL + schedule_seeding(SEEDING_INTERVAL); + }) + }); +} + +async fn seed_randomness() { + let (seed,): ([u8; 32],) = ic_cdk::call(Principal::management_canister(), "raw_rand", ()) + .await + .expect("Failed to call the management canister's raw_rand"); + RNG.with_borrow_mut(|rng| *rng = Some(ChaCha20Rng::from_seed(seed))); + ic_cdk::println!("RNG (re-)seeded"); +} + +async fn with_rng(fn_with_rng: impl FnOnce(&mut ChaCha20Rng) -> T) -> T { + RNG.with_borrow_mut(|option_rng| fn_with_rng(option_rng.as_mut().expect("missing RNG"))) +} + +fn ensure_derivation_path_is_valid(derivation_path: &[Vec]) { + if derivation_path.len() > 255 { + ic_cdk::trap("derivation path too long") + } +} + +fn inc_call_count(method_name: String) { + CALL_COUNTS.with_borrow_mut(|call_counts| { + let previous_call_count = call_counts.get(&method_name).unwrap_or_default(); + call_counts.insert(method_name, previous_call_count + 1); + }); +} + +#[derive(CandidType)] +pub struct CallCountsResult { + pub call_counts: Vec, +} + +#[derive(CandidType)] +pub struct CallCount { + pub method_name: String, + pub call_count: u64, +} + +#[ic_cdk::query] +async fn call_counts() -> CallCountsResult { + CALL_COUNTS.with_borrow(|call_counts| { + let call_counts: Vec<_> = call_counts + .iter() + .map(|(method_name, call_count)| CallCount { + method_name, + call_count, + }) + .collect(); + CallCountsResult { call_counts } + }) +} + +fn ensure_call_is_paid(cycles: u64) { + if ic_cdk::api::call::msg_cycles_accept(cycles) < cycles { + ic_cdk::trap("insufficient cycles"); + } +} + +// In the following, we register a custom getrandom implementation because +// otherwise getrandom (which is an indirect dependency) fails to compile. +// This is necessary because getrandom by default fails to compile for the +// wasm32-unknown-unknown target (which is required for deploying a canister). +// Our custom implementation always fails, which is sufficient here because +// we always provide randomness explicitly in API calls (via an RNG that is +// seeded from the IC's `raw_rand`) and never request randomness from the +// environment. +getrandom::register_custom_getrandom!(always_fail); +pub fn always_fail(_buf: &mut [u8]) -> Result<(), getrandom::Error> { + Err(getrandom::Error::UNSUPPORTED) +} diff --git a/rust/threshold-mock/src/schnorr.rs b/rust/threshold-mock/src/schnorr.rs new file mode 100644 index 000000000..739117922 --- /dev/null +++ b/rust/threshold-mock/src/schnorr.rs @@ -0,0 +1,167 @@ +use crate::ensure_call_is_paid; +use crate::inc_call_count; + +use super::ensure_derivation_path_is_valid; +use super::with_rng; +use candid::CandidType; +use candid::Deserialize; +use candid::Principal; +use ic_cdk::update; + +pub type CanisterId = Principal; + +#[derive(Clone, CandidType, Deserialize)] +pub struct SchnorrKeyId { + pub algorithm: SchnorrAlgorithm, + pub name: String, +} + +#[derive(Clone, PartialEq, Eq, CandidType, Deserialize)] +pub enum SchnorrAlgorithm { + #[serde(rename = "bip340secp256k1")] + Bip340Secp256k1, + #[serde(rename = "ed25519")] + Ed25519, +} + +#[derive(CandidType, Deserialize)] +pub struct SchnorrPublicKeyArgs { + pub canister_id: Option, + pub derivation_path: Vec>, + pub key_id: SchnorrKeyId, +} + +#[derive(CandidType, Deserialize)] +pub struct SchnorrPublicKeyResult { + pub public_key: Vec, + pub chain_code: Vec, +} + +#[derive(CandidType, Deserialize)] +pub struct SignWithSchnorrArgs { + pub message: Vec, + pub derivation_path: Vec>, + pub key_id: SchnorrKeyId, +} + +#[derive(CandidType, Deserialize)] +pub struct SignWithSchnorrResult { + pub signature: Vec, +} + +/// DISCLAIMER: This canister here provides an *unsafe* example implementation +/// of the Internet Computer's management canister API for demonstration purposes. +/// Because of this, in the following we hard-code a randomly generated master +/// secret key. Do NOT use this in production. +const MASTER_SK_ED25519_HEX: &str = + "e7183596fae9139be990cdccc7d81341ac628e825c70044e902656a0a3f76b04"; + +lazy_static::lazy_static! { + static ref MASTER_SK_ED25519: ic_crypto_ed25519::PrivateKey = ic_crypto_ed25519::PrivateKey::deserialize_raw( + &hex::decode(MASTER_SK_ED25519_HEX).expect("failed to hex-decode") + ).expect("failed to deserialize Ed25519 private key"); + static ref MASTER_PK_Ed25519: ic_crypto_ed25519::PublicKey = MASTER_SK_ED25519.public_key(); +} + +/// DISCLAIMER: This canister here provides an *unsafe* example implementation +/// of the Internet Computer's management canister API for demonstration purposes. +/// Because of this, in the following we hard-code a randomly generated master +/// secret key. Do NOT use this in production. +const MASTER_SK_SECP256K1_HEX: &str = + "4dbfb616fec0d02573e9219607814c4dc9774b164a5da9e44079db91f4de0c2d"; + +lazy_static::lazy_static! { + static ref MASTER_SK_SECP256K1: ic_crypto_secp256k1::PrivateKey = ic_crypto_secp256k1::PrivateKey::deserialize_sec1( + &hex::decode(MASTER_SK_SECP256K1_HEX).expect("failed to hex-decode") + ).expect("failed to deserialize secp256k1 private key"); + static ref MASTER_PK_SECP256K1: ic_crypto_secp256k1::PublicKey = MASTER_SK_SECP256K1.public_key(); +} + +#[update] +async fn schnorr_public_key(args: SchnorrPublicKeyArgs) -> SchnorrPublicKeyResult { + ensure_derivation_path_is_valid(&args.derivation_path); + match args.key_id.algorithm { + SchnorrAlgorithm::Bip340Secp256k1 => { + inc_call_count("schnorr_public_key_bip340Secp256k1".to_string()); + ensure_bip340secp256k1_insecure_test_key_1(&args.key_id); + let derivation_path = ic_crypto_secp256k1::DerivationPath::from_canister_id_and_path( + args.canister_id.unwrap_or_else(ic_cdk::caller).as_slice(), + &args.derivation_path, + ); + let (public_key, chain_code) = MASTER_PK_SECP256K1.derive_subkey(&derivation_path); + SchnorrPublicKeyResult { + public_key: public_key.serialize_sec1(true).to_vec(), + chain_code: chain_code.to_vec(), + } + } + SchnorrAlgorithm::Ed25519 => { + inc_call_count("schnorr_public_key_ed25519".to_string()); + ensure_ed25519_insecure_test_key_1(&args.key_id); + let derivation_path = ic_crypto_ed25519::DerivationPath::from_canister_id_and_path( + args.canister_id.unwrap_or_else(ic_cdk::caller).as_slice(), + &args.derivation_path, + ); + let (public_key, chain_code) = MASTER_PK_Ed25519.derive_subkey(&derivation_path); + SchnorrPublicKeyResult { + public_key: public_key.serialize_raw().to_vec(), + chain_code: chain_code.to_vec(), + } + } + } +} + +#[update] +async fn sign_with_schnorr(args: SignWithSchnorrArgs) -> SignWithSchnorrResult { + ensure_call_is_paid(0); + ensure_derivation_path_is_valid(&args.derivation_path); + match args.key_id.algorithm { + SchnorrAlgorithm::Bip340Secp256k1 => { + inc_call_count("sign_with_schnorr_bip340Secp256k1".to_string()); + ensure_bip340secp256k1_insecure_test_key_1(&args.key_id); + let derivation_path = ic_crypto_secp256k1::DerivationPath::from_canister_id_and_path( + ic_cdk::caller().as_slice(), + &args.derivation_path, + ); + let (derived_private_key, _chain_code) = + MASTER_SK_SECP256K1.derive_subkey(&derivation_path); + let signature = + with_rng(|rng| derived_private_key.sign_message_with_bip340(&args.message, rng)) + .await; + SignWithSchnorrResult { + signature: signature.to_vec(), + } + } + SchnorrAlgorithm::Ed25519 => { + inc_call_count("sign_with_schnorr_ed25519".to_string()); + ensure_ed25519_insecure_test_key_1(&args.key_id); + let derivation_path = ic_crypto_ed25519::DerivationPath::from_canister_id_and_path( + ic_cdk::caller().as_slice(), + &args.derivation_path, + ); + let (derived_private_key, _chain_code) = + MASTER_SK_ED25519.derive_subkey(&derivation_path); + let signature = derived_private_key.sign_message(&args.message); + SignWithSchnorrResult { + signature: signature.to_vec(), + } + } + } +} + +fn ensure_ed25519_insecure_test_key_1(key_id: &SchnorrKeyId) { + if key_id.algorithm != SchnorrAlgorithm::Ed25519 { + ic_cdk::trap("unsupported key ID algorithm"); + } + if key_id.name.as_str() != "insecure_test_key_1" { + ic_cdk::trap("unsupported key ID name"); + } +} + +fn ensure_bip340secp256k1_insecure_test_key_1(key_id: &SchnorrKeyId) { + if key_id.algorithm != SchnorrAlgorithm::Bip340Secp256k1 { + ic_cdk::trap("unsupported key ID algorithm"); + } + if key_id.name.as_str() != "insecure_test_key_1" { + ic_cdk::trap("unsupported key ID name"); + } +} diff --git a/rust/threshold-mock/src/vetkd.rs b/rust/threshold-mock/src/vetkd.rs new file mode 100644 index 000000000..e64e30d9a --- /dev/null +++ b/rust/threshold-mock/src/vetkd.rs @@ -0,0 +1,137 @@ +use crate::ensure_call_is_paid; +use crate::inc_call_count; + +use super::ensure_derivation_path_is_valid; +use super::with_rng; +use candid::CandidType; +use candid::Deserialize; +use candid::Principal; +use ic_cdk::update; +use ic_crypto_internal_bls12_381_type::{G2Affine, Scalar}; +use ic_crypto_internal_bls12_381_vetkd::{ + DerivationPath, DerivedPublicKey, EncryptedKey, EncryptedKeyShare, TransportPublicKey, + TransportPublicKeyDeserializationError, +}; + +pub type CanisterId = Principal; + +#[derive(CandidType, Clone, Deserialize, Eq, PartialEq)] +pub enum VetKDCurve { + #[serde(rename = "bls12_381")] + Bls12_381, +} + +#[derive(CandidType, Clone, Deserialize, Eq, PartialEq)] +pub struct VetKDKeyId { + pub curve: VetKDCurve, + pub name: String, +} + +#[derive(CandidType, Deserialize)] +pub struct VetKDPublicKeyRequest { + pub canister_id: Option, + pub derivation_path: Vec>, + pub key_id: VetKDKeyId, +} + +#[derive(CandidType, Deserialize)] +pub struct VetKDPublicKeyReply { + pub public_key: Vec, +} + +#[derive(CandidType, Deserialize)] +pub struct VetKDEncryptedKeyRequest { + pub public_key_derivation_path: Vec>, + pub derivation_id: Vec, + pub key_id: VetKDKeyId, + pub encryption_public_key: Vec, +} + +#[derive(CandidType, Deserialize)] +pub struct VetKDEncryptedKeyReply { + pub encrypted_key: Vec, +} + +/// DISCLAIMER: This canister here provides an *unsafe* example implementation +/// of a [proposed](https://github.com/dfinity/interface-spec/pull/158) vetKD +/// system API for demonstration purposes. Because of this, in the following +/// we hard-code a randomly generated master secret key. In case vetKD will be +/// integrated into the Internet Computer protocol, then such a key would be +/// created in a secure manner with distributed key generation so that the key +/// never exists in combined form anywyere and nodes can use it only collectively. +const MASTER_SK_HEX: &str = "718c36cd1dcf3501fd04bbe24c3bb9eedfd066d2420e794dd9342cf71d04176f"; + +lazy_static::lazy_static! { + static ref MASTER_SK: Scalar = Scalar::deserialize( + &hex::decode(MASTER_SK_HEX).expect("failed to hex-decode") + ).expect("failed to deserialize Scalar"); + static ref MASTER_PK: G2Affine = G2Affine::from(G2Affine::generator() * &*MASTER_SK); +} + +#[update] +async fn vetkd_public_key(request: VetKDPublicKeyRequest) -> VetKDPublicKeyReply { + inc_call_count("vetkd_public_key".to_string()); + ensure_bls12_381_insecure_test_key_1(request.key_id); + ensure_derivation_path_is_valid(&request.derivation_path); + let derivation_path = { + let canister_id = request.canister_id.unwrap_or_else(ic_cdk::caller); + DerivationPath::new(canister_id.as_slice(), &request.derivation_path) + }; + let derived_public_key = DerivedPublicKey::compute_derived_key(&MASTER_PK, &derivation_path); + VetKDPublicKeyReply { + public_key: derived_public_key.serialize().to_vec(), + } +} + +#[update] +async fn vetkd_encrypted_key(request: VetKDEncryptedKeyRequest) -> VetKDEncryptedKeyReply { + inc_call_count("vetkd_encrypted_key".to_string()); + ensure_call_is_paid(0); + ensure_bls12_381_insecure_test_key_1(request.key_id); + ensure_derivation_path_is_valid(&request.public_key_derivation_path); + let derivation_path = DerivationPath::new( + ic_cdk::caller().as_slice(), + &request.public_key_derivation_path, + ); + let tpk = + TransportPublicKey::deserialize(&request.encryption_public_key).unwrap_or_else( + |e| match e { + TransportPublicKeyDeserializationError::InvalidPublicKey => { + ic_cdk::trap("invalid encryption public key") + } + }, + ); + let eks = with_rng(|rng| { + EncryptedKeyShare::create( + rng, + &MASTER_PK, + &MASTER_SK, + &tpk, + &derivation_path, + &request.derivation_id, + ) + }) + .await; + let ek = EncryptedKey::combine( + &vec![(0, MASTER_PK.clone(), eks)], + 1, + &MASTER_PK, + &tpk, + &derivation_path, + &request.derivation_id, + ) + .unwrap_or_else(|_e| ic_cdk::trap("bad key share")); + + VetKDEncryptedKeyReply { + encrypted_key: ek.serialize().to_vec(), + } +} + +fn ensure_bls12_381_insecure_test_key_1(key_id: VetKDKeyId) { + if key_id.curve != VetKDCurve::Bls12_381 { + ic_cdk::trap("unsupported key ID curve"); + } + if key_id.name.as_str() != "insecure_test_key_1" { + ic_cdk::trap("unsupported key ID name"); + } +} diff --git a/rust/threshold-mock/tests/tests.rs b/rust/threshold-mock/tests/tests.rs new file mode 100644 index 000000000..74ca3b0e1 --- /dev/null +++ b/rust/threshold-mock/tests/tests.rs @@ -0,0 +1,324 @@ +use assert_matches::assert_matches; +use candid::{Decode, Encode, Principal}; +use ic_cdk::api::management_canister::main::CanisterId; +use ic_vetkd_utils::TransportSecretKey; +use pocket_ic::{PocketIc, WasmResult}; + +use chainkey_testing_canister::schnorr::SchnorrAlgorithm; +use chainkey_testing_canister::schnorr::SchnorrKeyId; +use chainkey_testing_canister::schnorr::SchnorrPublicKeyArgs; +use chainkey_testing_canister::schnorr::SchnorrPublicKeyResult; +use chainkey_testing_canister::schnorr::SignWithSchnorrArgs; +use chainkey_testing_canister::schnorr::SignWithSchnorrResult; +use chainkey_testing_canister::vetkd::VetKDCurve; +use chainkey_testing_canister::vetkd::VetKDEncryptedKeyReply; +use chainkey_testing_canister::vetkd::VetKDEncryptedKeyRequest; +use chainkey_testing_canister::vetkd::VetKDKeyId; +use chainkey_testing_canister::vetkd::VetKDPublicKeyReply; +use chainkey_testing_canister::vetkd::VetKDPublicKeyRequest; +use ic_cdk::api::management_canister::ecdsa::EcdsaCurve; +use ic_cdk::api::management_canister::ecdsa::EcdsaKeyId; +use ic_cdk::api::management_canister::ecdsa::EcdsaPublicKeyArgument; +use ic_cdk::api::management_canister::ecdsa::EcdsaPublicKeyResponse; +use ic_cdk::api::management_canister::ecdsa::SignWithEcdsaArgument; +use ic_cdk::api::management_canister::ecdsa::SignWithEcdsaResponse; + +pub const CANISTER_WASM: &[u8] = + include_bytes!("../target/wasm32-unknown-unknown/release/chainkey_testing_canister.wasm"); + +#[test] +fn should_verify_ecdsa_signature() { + let canister = CanisterSetup::default(); + + let derivation_path = vec!["test-derivation-path".as_bytes().to_vec()]; + let key_id = EcdsaKeyId { + curve: EcdsaCurve::Secp256k1, + name: "insecure_test_key_1".to_string(), + }; + let message_hash = b"12345678901234567890123456789012".to_vec(); + + let public_key_raw = canister + .ecdsa_public_key(EcdsaPublicKeyArgument { + canister_id: None, + derivation_path: derivation_path.clone(), + key_id: key_id.clone(), + }) + .public_key; + + let signature_raw = canister + .sign_with_ecdsa(SignWithEcdsaArgument { + message_hash: message_hash.clone(), + derivation_path, + key_id, + }) + .signature; + + let signature = k256::ecdsa::Signature::try_from(signature_raw.as_slice()) + .expect("failed to deserialize signature"); + let verifying_key = k256::ecdsa::VerifyingKey::from_sec1_bytes(&public_key_raw) + .expect("failed to sec1 deserialize public key"); + + use k256::ecdsa::signature::hazmat::PrehashVerifier; + assert_matches!( + verifying_key.verify_prehash(&message_hash, &signature), + Ok(()) + ); +} + +#[test] +fn should_verify_schnorr_bip340_secp256k1_signature() { + let canister = CanisterSetup::default(); + + let derivation_path = vec!["test-derivation-path".as_bytes().to_vec()]; + let key_id = SchnorrKeyId { + algorithm: SchnorrAlgorithm::Bip340Secp256k1, + name: "insecure_test_key_1".to_string(), + }; + let message = b"test-message".to_vec(); + + let public_key_raw = canister + .schnorr_public_key(SchnorrPublicKeyArgs { + canister_id: None, + derivation_path: derivation_path.clone(), + key_id: key_id.clone(), + }) + .public_key; + + let signature_raw = canister + .sign_with_schnorr(SignWithSchnorrArgs { + message: message.clone(), + derivation_path, + key_id, + }) + .signature; + + let signature = k256::schnorr::Signature::try_from(signature_raw.as_slice()) + .expect("failed to deserialize signature"); + let verifying_key = k256::schnorr::VerifyingKey::from_bytes(&public_key_raw[1..]) + .expect("failed to sec1 deserialize public key"); + + assert_matches!(verifying_key.verify_raw(&message, &signature), Ok(())); +} + +#[test] +fn should_verify_schnorr_ed25519_signature() { + let canister = CanisterSetup::default(); + + let derivation_path = vec!["test-derivation-path".as_bytes().to_vec()]; + let key_id = SchnorrKeyId { + algorithm: SchnorrAlgorithm::Ed25519, + name: "insecure_test_key_1".to_string(), + }; + let message = b"test-message".to_vec(); + + let public_key_raw = canister + .schnorr_public_key(SchnorrPublicKeyArgs { + canister_id: None, + derivation_path: derivation_path.clone(), + key_id: key_id.clone(), + }) + .public_key; + + let signature_raw = canister + .sign_with_schnorr(SignWithSchnorrArgs { + message: message.clone(), + derivation_path, + key_id, + }) + .signature; + + let signature = ed25519_dalek::Signature::try_from(signature_raw.as_slice()) + .expect("failed to deserialize signature"); + let verifying_key = ed25519_dalek::VerifyingKey::from_bytes( + &<[u8; 32]>::try_from(public_key_raw).expect("ed25519 public key should be 32 bytes"), + ) + .expect("failed to sec1 deserialize public key"); + + use ed25519_dalek::Verifier; + assert_matches!(verifying_key.verify(&message, &signature), Ok(())); +} + +#[test] +fn should_consistently_derive_vetkey() { + let canister = CanisterSetup::default(); + + let derivation_path = vec!["test-derivation-path".as_bytes().to_vec()]; + let key_id = VetKDKeyId { + curve: VetKDCurve::Bls12_381, + name: "insecure_test_key_1".to_string(), + }; + let derivation_id = b"test-derivation-id".to_vec(); + + let public_key_bytes = canister + .vetkd_public_key(VetKDPublicKeyRequest { + canister_id: None, + derivation_path: derivation_path.clone(), + key_id: key_id.clone(), + }) + .public_key; + + let tsk_1 = TransportSecretKey::from_seed([101; 32].to_vec()) + .expect("failed to create transport secret key"); + let encrypted_key_1 = canister + .vetkd_encrypted_key(VetKDEncryptedKeyRequest { + public_key_derivation_path: derivation_path.clone(), + derivation_id: derivation_id.clone(), + encryption_public_key: tsk_1.public_key(), + key_id: key_id.clone(), + }) + .encrypted_key; + let decrypted_key_1 = tsk_1 + .decrypt(&encrypted_key_1, &public_key_bytes, &derivation_id) + .expect("failed to decrypted vetKey"); + + let tsk_2 = TransportSecretKey::from_seed([102; 32].to_vec()) + .expect("failed to create transport secret key"); + let encrypted_key_2 = canister + .vetkd_encrypted_key(VetKDEncryptedKeyRequest { + public_key_derivation_path: derivation_path, + derivation_id: derivation_id.clone(), + encryption_public_key: tsk_2.public_key(), + key_id, + }) + .encrypted_key; + let decrypted_key_2 = tsk_2 + .decrypt(&encrypted_key_2, &public_key_bytes, &derivation_id) + .expect("failed to decrypted vetKey"); + + assert_eq!(decrypted_key_1, decrypted_key_2); +} + +pub struct CanisterSetup { + env: PocketIc, + canister_id: CanisterId, +} + +impl CanisterSetup { + pub fn new() -> Self { + let env = PocketIc::new(); + let canister_id = env.create_canister(); + env.add_cycles(canister_id, u128::MAX); + env.install_canister(canister_id, CANISTER_WASM.to_vec(), vec![], None); + Self { env, canister_id } + } + + pub fn ecdsa_public_key(&self, args: EcdsaPublicKeyArgument) -> EcdsaPublicKeyResponse { + let method = "ecdsa_public_key"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode ecdsa_public_key args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, EcdsaPublicKeyResponse).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } + + pub fn sign_with_ecdsa(&self, args: SignWithEcdsaArgument) -> SignWithEcdsaResponse { + let method = "sign_with_ecdsa"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, SignWithEcdsaResponse).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } + + pub fn schnorr_public_key(&self, args: SchnorrPublicKeyArgs) -> SchnorrPublicKeyResult { + let method = "schnorr_public_key"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, SchnorrPublicKeyResult).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } + + pub fn sign_with_schnorr(&self, args: SignWithSchnorrArgs) -> SignWithSchnorrResult { + let method = "sign_with_schnorr"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, SignWithSchnorrResult).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } + + pub fn vetkd_public_key(&self, args: VetKDPublicKeyRequest) -> VetKDPublicKeyReply { + let method = "vetkd_public_key"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, VetKDPublicKeyReply).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } + + pub fn vetkd_encrypted_key(&self, args: VetKDEncryptedKeyRequest) -> VetKDEncryptedKeyReply { + let method = "vetkd_encrypted_key"; + let result = self.env.update_call( + self.canister_id, + Principal::anonymous(), + method, + Encode!(&args).expect("failed to encode args"), + ); + match result { + Ok(WasmResult::Reply(bytes)) => { + Decode!(&bytes, VetKDEncryptedKeyReply).expect("failed to decode {method} result") + } + Ok(WasmResult::Reject(error)) => { + panic!("canister rejected call to {method}: {error}") + } + Err(user_error) => panic!("{method} user error: {user_error}"), + } + } +} + +impl Default for CanisterSetup { + fn default() -> Self { + Self::new() + } +}