diff --git a/.cargo/config b/.cargo/config index b4b16b8..726f85b 100644 --- a/.cargo/config +++ b/.cargo/config @@ -3,6 +3,6 @@ wasm = "build --release --lib --target wasm32-unknown-unknown" unit-test = "test --lib" all-test = "test --workspace" schema = "run --bin schema" - +optimize = "run-script optimize" [env] RUSTFLAGS = "-C link-arg=-s" diff --git a/.gitignore b/.gitignore index fc708a1..3ade0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +.DS_Store # Generated by rust-optimizer artifacts/ diff --git a/Cargo.lock b/Cargo.lock index 3f29760..8dae911 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -388,6 +388,7 @@ name = "crypto" version = "0.1.0" dependencies = [ "base64 0.22.1", + "cosmwasm-std", "derive_more", "digest 0.10.7", "ecdsa", @@ -1066,21 +1067,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonwebtoken" -version = "9.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" -dependencies = [ - "base64 0.21.7", - "js-sys", - "pem", - "ring", - "serde", - "serde_json", - "simple_asn1", -] - [[package]] name = "k256" version = "0.13.3" @@ -1207,16 +1193,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num-bigint" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -1234,15 +1210,6 @@ dependencies = [ "syn 1.0.109", ] -[[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" @@ -1389,10 +1356,12 @@ version = "0.1.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", + "crypto", "cw-storage-plus", "cw2", + "hex", + "hex-literal", "itertools 0.12.1", - "jsonwebtoken", "mock-cosmwasm-contract", "osmosis-authenticators", "osmosis-std 0.24.0", @@ -1400,6 +1369,7 @@ dependencies = [ "rstest", "schemars", "serde", + "sha2 0.10.8", "thiserror", "time", ] @@ -1437,16 +1407,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" -[[package]] -name = "pem" -version = "3.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" -dependencies = [ - "base64 0.22.1", - "serde", -] - [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2112,18 +2072,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[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" @@ -2373,7 +2321,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", - "itoa", "num-conv", "powerfmt", "serde", diff --git a/PROCESS.md b/PROCESS.md new file mode 100644 index 0000000..742eaaa --- /dev/null +++ b/PROCESS.md @@ -0,0 +1,24 @@ +# PROCESS + +## Step #1 Silver thread - POC +1. Create a GRPC to talk directly to the smart contract from the mobile. +2. Use the webauthn sign to sign the message and using the query get an ok on the transaction being signed. + 1. We want to understand what the signed bytes are -- + 2. Use similar payload to one click trading but GRCP encoded and hit the node. + +## Step #2 Scaffolding - MVP for passkeys +1. Write the authenticate function in the authenticator using the secp verify. +2. Integrate unit tests, make sure that it's as production ready + 1. Define the authenticate params, that it is well documented and makes sense. + 2. Generating r1 keys on the Rust side, and calling the sudo-authenticate function. + 3. Spend some time on integration tests. + 4. Spend time on unit test. + 5. Code/pair/review with team memebers. + 6. Ensure Contract API is satisfied -- authenticate/track/confirm_exection + +## Step #3 E2E +1. (goland) Add Passkey authenticator to an address from +2. (mobile) execute signed swap messages in mobiles + 1. query sqs node + 2. get route + 3. swap. \ No newline at end of file diff --git a/contracts/passkey/Cargo.lock b/contracts/passkey/Cargo.lock new file mode 100644 index 0000000..142b35f --- /dev/null +++ b/contracts/passkey/Cargo.lock @@ -0,0 +1,2750 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[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.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "backtrace" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.66", + "which", +] + +[[package]] +name = "bip32" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e141fb0f8be1c7b45887af94c88b182472b57c96b56773250ae00cd6a14a164" +dependencies = [ + "bs58", + "hmac", + "k256", + "rand_core 0.6.4", + "ripemd", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[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 = "bnum" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d" + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2 0.10.8", +] + +[[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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +dependencies = [ + "serde", +] + +[[package]] +name = "cc" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "cosmos-sdk-proto" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" +dependencies = [ + "prost 0.12.6", + "prost-types 0.12.6", + "tendermint-proto", +] + +[[package]] +name = "cosmrs" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47126f5364df9387b9d8559dcef62e99010e1d4098f39eb3f7ee4b5c254e40ea" +dependencies = [ + "bip32", + "cosmos-sdk-proto", + "ecdsa", + "eyre", + "k256", + "rand_core 0.6.4", + "serde", + "serde_json", + "signature", + "subtle-encoding", + "tendermint", + "tendermint-rpc", + "thiserror", +] + +[[package]] +name = "cosmwasm-crypto" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6aa9f904de106fa16443ad14ec2abe75e94ba003bb61c681c0e43d4c58d2a" +dependencies = [ + "digest 0.10.7", + "ecdsa", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + +[[package]] +name = "cosmwasm-derive" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "242e98e7a231c122e08f300d9db3262d1007b51758a8732cd6210b3e9faa4f3a" +dependencies = [ + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7879036156092ad1c22fe0d7316efc5a5eceec2bc3906462a2560215f2a2f929" +dependencies = [ + "cosmwasm-schema-derive", + "schemars", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb57855fbfc83327f8445ae0d413b1a05ac0d68c396ab4d122b2abd7bb82cb6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-std" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad011ae7447188e26e4a7dbca2fcd0fc186aa21ae5c86df0503ea44c78f9e469" +dependencies = [ + "base64 0.21.7", + "bech32", + "bnum", + "cosmwasm-crypto", + "cosmwasm-derive", + "derivative", + "forward_ref", + "hex", + "schemars", + "serde", + "serde-json-wasm", + "sha2 0.10.8", + "static_assertions", + "thiserror", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto" +version = "0.1.0" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-ng" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.4", + "subtle-ng", + "zeroize", +] + +[[package]] +name = "cw-storage-plus" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" +dependencies = [ + "cosmwasm-std", + "schemars", + "serde", +] + +[[package]] +name = "cw2" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c120b24fbbf5c3bedebb97f2cc85fbfa1c3287e09223428e7e597b5293c1fa" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "schemars", + "semver", + "serde", + "thiserror", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "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 0.10.7", + "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-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[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 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "flex-error" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" +dependencies = [ + "eyre", + "paste", +] + +[[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 = "forward_ref" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +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", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[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" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[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 = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.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.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "9.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +dependencies = [ + "base64 0.21.7", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "mock-cosmwasm-contract" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e3a5e335749d6e15a9eb6bdd0715f12864b7b08767fc2a8f7d10956a0339bf" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "cw2", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[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 = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "osmosis-authenticators" +version = "0.22.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592ed3c1f64d2b910ffffef86d6c6297690c65029162b810541107cd0e1f97f5" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "sha2 0.10.8", +] + +[[package]] +name = "osmosis-std" +version = "0.24.0" +source = "git+https://github.com/osmosis-labs/osmosis-rust?rev=c475cb9#c475cb984bd70fd8a819445fbf3d3d59a72fac3f" +dependencies = [ + "chrono", + "cosmwasm-std", + "osmosis-std-derive 0.20.1 (git+https://github.com/osmosis-labs/osmosis-rust?rev=c475cb9)", + "prost 0.12.6", + "prost-types 0.12.6", + "schemars", + "serde", + "serde-cw-value", +] + +[[package]] +name = "osmosis-std" +version = "0.25.0" +source = "git+https://github.com/osmosis-labs/osmosis-rust?branch=main#63bf769ef085b66ec85da6b84827ef88969d1a5b" +dependencies = [ + "chrono", + "cosmwasm-std", + "osmosis-std-derive 0.20.1 (git+https://github.com/osmosis-labs/osmosis-rust?branch=main)", + "prost 0.12.6", + "prost-types 0.12.6", + "schemars", + "serde", + "serde-cw-value", +] + +[[package]] +name = "osmosis-std-derive" +version = "0.20.1" +source = "git+https://github.com/osmosis-labs/osmosis-rust?branch=main#63bf769ef085b66ec85da6b84827ef88969d1a5b" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types 0.11.9", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "osmosis-std-derive" +version = "0.20.1" +source = "git+https://github.com/osmosis-labs/osmosis-rust?rev=c475cb9#c475cb984bd70fd8a819445fbf3d3d59a72fac3f" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types 0.11.9", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "osmosis-test-tube" +version = "24.0.1" +source = "git+https://github.com/osmosis-labs/test-tube?rev=a7e1de5#a7e1de5a8067d369aa4b8f7edc56be41299aedfa" +dependencies = [ + "base64 0.21.7", + "bindgen", + "cosmrs", + "cosmwasm-std", + "osmosis-std 0.25.0", + "prost 0.12.6", + "serde", + "serde_json", + "test-tube", + "thiserror", +] + +[[package]] +name = "passkey-authenticator" +version = "0.1.0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", + "cw2", + "itertools 0.12.1", + "jsonwebtoken", + "mock-cosmwasm-contract", + "osmosis-authenticators", + "osmosis-std 0.24.0", + "osmosis-test-tube", + "rstest", + "schemars", + "serde", + "thiserror", + "time", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "peg" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a625d12ad770914cbf7eff6f9314c3ef803bfe364a1b20bc36ddf56673e71e5" +dependencies = [ + "peg-macros", + "peg-runtime", +] + +[[package]] +name = "peg-macros" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f241d42067ed3ab6a4fece1db720838e1418f36d868585a27931f95d6bc03582" +dependencies = [ + "peg-runtime", + "proc-macro2", + "quote", +] + +[[package]] +name = "peg-runtime" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a" + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.1", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[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 = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.66", +] + +[[package]] +name = "proc-macro2" +version = "1.0.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost 0.11.9", +] + +[[package]] +name = "prost-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +dependencies = [ + "prost 0.12.6", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +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 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "relative-path" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-native-certs", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[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 = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rstest" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97eeab2f3c0a199bc4be135c36c924b6590b88c377d416494288c14f2db30199" +dependencies = [ + "futures", + "futures-timer", + "rstest_macros", + "rustc_version", +] + +[[package]] +name = "rstest_macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d428f8247852f894ee1be110b375111b586d4fa431f6c46e64ba5a0dcccbe605" +dependencies = [ + "cfg-if", + "glob", + "proc-macro2", + "quote", + "regex", + "relative-path", + "rustc_version", + "syn 2.0.66", + "unicode-ident", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.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.66", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +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.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-cw-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75d32da6b8ed758b7d850b6c3c08f1d7df51a4df3cb201296e63e34a78e99d4" +dependencies = [ + "serde", +] + +[[package]] +name = "serde-json-wasm" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9213a07d53faa0b8dd81e767a54a8188a242fdb9be99ab75ec576a774bfdd7" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[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.66", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[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 = "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 = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "subtle-encoding" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" +dependencies = [ + "zeroize", +] + +[[package]] +name = "subtle-ng" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" + +[[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.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tendermint" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15ab8f0a25d0d2ad49ac615da054d6a76aa6603ff95f7d18bafdd34450a1a04b" +dependencies = [ + "bytes", + "digest 0.10.7", + "ed25519", + "ed25519-consensus", + "flex-error", + "futures", + "k256", + "num-traits", + "once_cell", + "prost 0.12.6", + "prost-types 0.12.6", + "ripemd", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto", + "time", + "zeroize", +] + +[[package]] +name = "tendermint-config" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a02da769166e2052cd537b1a97c78017632c2d9e19266367b27e73910434fc" +dependencies = [ + "flex-error", + "serde", + "serde_json", + "tendermint", + "toml", + "url", +] + +[[package]] +name = "tendermint-proto" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b797dd3d2beaaee91d2f065e7bdf239dc8d80bba4a183a288bc1279dd5a69a1e" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost 0.12.6", + "prost-types 0.12.6", + "serde", + "serde_bytes", + "subtle-encoding", + "time", +] + +[[package]] +name = "tendermint-rpc" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71afae8bb5f6b14ed48d4e1316a643b6c2c3cbad114f510be77b4ed20b7b3e42" +dependencies = [ + "async-trait", + "bytes", + "flex-error", + "futures", + "getrandom", + "peg", + "pin-project", + "rand", + "reqwest", + "semver", + "serde", + "serde_bytes", + "serde_json", + "subtle", + "subtle-encoding", + "tendermint", + "tendermint-config", + "tendermint-proto", + "thiserror", + "time", + "tokio", + "tracing", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "test-tube" +version = "0.6.0" +source = "git+https://github.com/osmosis-labs/test-tube?rev=a7e1de5#a7e1de5a8067d369aa4b8f7edc56be41299aedfa" +dependencies = [ + "base64 0.21.7", + "cosmrs", + "cosmwasm-std", + "osmosis-std 0.25.0", + "prost 0.12.6", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[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.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +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.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.66", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "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.66", +] diff --git a/contracts/passkey/Cargo.toml b/contracts/passkey/Cargo.toml index 97eb232..4dc91a8 100644 --- a/contracts/passkey/Cargo.toml +++ b/contracts/passkey/Cargo.toml @@ -11,8 +11,8 @@ cosmwasm-schema = "1.3.1" cosmwasm-std = { version = "1.4", features = ["stargate", "cosmwasm_1_1"] } cw-storage-plus = "1.1.0" cw2 = "1.1.2" +sha2 = "0.10" itertools = "0.12.1" -jsonwebtoken = "9.3.0" osmosis-authenticators = "0.22.0-alpha.19" osmosis-std = { git = "https://github.com/osmosis-labs/osmosis-rust", rev = "c475cb9" } rstest = "0.18.2" @@ -20,14 +20,18 @@ schemars = "0.8.12" serde = "1.0.180" thiserror = { version = "1.0.32" } time = { version = "0.3.31", features = ["macros"] } +crypto = { path = "../../crypto" } + [package.metadata.scripts] optimize = """docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/rust-optimizer:0.12.5 """ [dev-dependencies] mock-cosmwasm-contract = "0.1.2" -osmosis-test-tube = { git = "https://github.com/osmosis-labs/test-tube", rev = "a7e1de5"} +osmosis-test-tube = { git = "https://github.com/osmosis-labs/test-tube", rev = "a7e1de5" } rstest = "0.18.2" +hex-literal = "0.4.1" +hex = "0.4" diff --git a/contracts/passkey/schema/passkey-authenticator.json b/contracts/passkey/schema/passkey-authenticator.json deleted file mode 100644 index f60e515..0000000 --- a/contracts/passkey/schema/passkey-authenticator.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "contract_name": "passkey-authenticator", - "contract_version": "0.1.0", - "idl_version": "1.0.0", - "instantiate": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InstantiateMsg", - "type": "object", - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false - }, - "execute": null, - "query": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "admin" - ], - "properties": { - "admin": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "admin_candidate" - ], - "properties": { - "admin_candidate": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "migrate": null, - "sudo": null, - "responses": { - "admin": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminResponse", - "type": "object", - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false - }, - "admin_candidate": { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminCandidateResponse", - "type": "object", - "properties": { - "candidate": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false - } - } -} diff --git a/contracts/passkey/schema/raw/query.json b/contracts/passkey/schema/raw/query.json deleted file mode 100644 index 258ca88..0000000 --- a/contracts/passkey/schema/raw/query.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "object", - "required": [ - "admin" - ], - "properties": { - "admin": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "admin_candidate" - ], - "properties": { - "admin_candidate": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] -} diff --git a/contracts/passkey/schema/raw/response_to_admin_candidate.json b/contracts/passkey/schema/raw/response_to_admin_candidate.json deleted file mode 100644 index e5c2bb6..0000000 --- a/contracts/passkey/schema/raw/response_to_admin_candidate.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminCandidateResponse", - "type": "object", - "properties": { - "candidate": { - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false -} diff --git a/contracts/passkey/src/authenticator/handler/authenticate.rs b/contracts/passkey/src/authenticator/handler/authenticate.rs index 62ffaa7..ee89427 100644 --- a/contracts/passkey/src/authenticator/handler/authenticate.rs +++ b/contracts/passkey/src/authenticator/handler/authenticate.rs @@ -1,9 +1,9 @@ use cosmwasm_std::{DepsMut, Env, Response}; +use crypto::secp256r1_verify; use osmosis_authenticators::AuthenticationRequest; use crate::{ - error::ContractError, - passkey::update_and_check_passkey, + contract::verify_secp256r1, error::ContractError, passkey::update_and_check_passkey }; use super::validate_and_parse_params; @@ -13,13 +13,27 @@ pub fn authenticate( _env: Env, auth_request: AuthenticationRequest, ) -> Result { + // TODO: @amo] let params = validate_and_parse_params(auth_request.authenticator_params)?; - let _key = ( - &auth_request.account, - auth_request.authenticator_id.as_str(), - ); + // let _key = ( + // &auth_request.account, + // auth_request.authenticator_id.as_str(), + // ); + // hash auth_request.msg + + // TODO: @Amosel + // let message = auth_request.msg.value.0; + // hash 256 of message + // use sha2::{Sha256, Digest}; + // let message_hash = Sha256::digest(message.as_bytes()); + // let is_valid = secp256r1_verify( + // message_has, + // auth_request.signature_data, + // ¶ms.pub_key + // )?; + update_and_check_passkey(deps, ¶ms)?; Ok(Response::new().add_attribute("action", "authenticate")) diff --git a/contracts/passkey/src/contract.rs b/contracts/passkey/src/contract.rs new file mode 100644 index 0000000..1418564 --- /dev/null +++ b/contracts/passkey/src/contract.rs @@ -0,0 +1,340 @@ +use crate::authenticator::{self}; +use crate::error::ContractError; +use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, SudoMsg, VerifyResponse}; +// use crate::state::ADDRESS; +#[cfg(not(feature = "library"))] +use cosmwasm_std::entry_point; +use cosmwasm_std::{to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response}; +use crypto::{secp256r1_verify, webauthn_verify}; +use sha2::{Digest, Sha256}; + +// const CONTRACT_NAME: &str = "crates.io:passkey"; +// const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +// const MAX_LIMIT: u32 = 100; + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn instantiate( + mut _deps: DepsMut, + _env: Env, + _info: MessageInfo, + _msg: InstantiateMsg, +) -> Result { + Ok(Response::new().add_attribute("action", "instantiate")) +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn execute( + _deps: DepsMut, + _env: Env, + _info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + // ExecuteMsg::TransferAdmin { address } => transfer_admin(deps, info, address), + // ExecuteMsg::ClaimAdminTransfer {} => claim_admin_transfer(deps, info), + // ExecuteMsg::RejectAdminTransfer {} => reject_admin_transfer(deps, info), + // ExecuteMsg::CancelAdminTransfer {} => cancel_admin_transfer(deps, info), + // ExecuteMsg::RevokeAdmin {} => revoke_admin(deps, info), + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> Result { + match msg { + SudoMsg::OnAuthenticatorAdded(on_authenticator_added_request) => { + authenticator::on_authenticator_added(deps, env, on_authenticator_added_request) + .map_err(ContractError::from) + } + SudoMsg::OnAuthenticatorRemoved(on_authenticator_removed_request) => { + authenticator::on_authenticator_removed(deps, env, on_authenticator_removed_request) + .map_err(ContractError::from) + } + SudoMsg::Authenticate(auth_request) => authenticator::authenticate(deps, env, auth_request), + SudoMsg::Track(track_request) => { + authenticator::track(deps, env, track_request).map_err(ContractError::from) + } + SudoMsg::ConfirmExecution(confirm_execution_request) => { + authenticator::confirm_execution(deps, env, confirm_execution_request) + } + } +} + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn query(_deps: Deps, _env: Env, msg: QueryMsg) -> Result { + match msg { + QueryMsg::VerifySecp256R1Signature { + message, + signature, + public_key, + } => to_json_binary(&verify_secp256r1( + message.as_slice(), + signature.as_slice(), + public_key.as_slice(), + )?), + QueryMsg::VerifyWebauthn { + authenticator_data, + client_data_json, + challenge, + x, + y, + r, + s, + } => to_json_binary(&verify_webauthn( + &authenticator_data, + &client_data_json, + &challenge, + &x, + &y, + &r, + &s, + )?), + } + .map_err(ContractError::from) +} + +pub fn verify_secp256r1( + message: &[u8], + signature: &[u8], + public_key: &[u8], +) -> Result { + // Check if the message length is valid (e.g., not empty) + if message.is_empty() { + return Err(ContractError::InvalidHashFormat); + } + // Hashing + let hash = Sha256::digest(message); + + // Verification + let result = secp256r1_verify(hash.as_ref(), signature, public_key); + match result { + Ok(verifies) => Ok(VerifyResponse { verifies }), + Err(err) => Err(err.into()), + } +} + +#[allow(clippy::too_many_arguments)] +pub fn verify_webauthn( + authenticator_data: &[u8], + client_data_json: &str, + challenge: &[u8], + x: &[u8], + y: &[u8], + r: &[u8], + s: &[u8], +) -> Result { + let verifies = webauthn_verify(authenticator_data, client_data_json, challenge, x, y, r, s)?; + Ok(VerifyResponse { verifies }) +} + +#[cfg(test)] +mod tests { + use super::*; + use cosmwasm_std::testing::{ + mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage, + }; + use cosmwasm_std::{from_json, OwnedDeps}; + use hex_literal::hex; + + const CREATOR: &str = "creator"; + + const SECP256R1_MESSAGE_HEX: &str = + "4d55c99ef6bd54621662c3d110c3cb627c03d6311393b264ab97b90a4b15214a5593ba2510a53d63fb34be251facb697c973e11b665cb7920f1684b0031b4dd370cb927ca7168b0bf8ad285e05e9e31e34bc24024739fdc10b78586f29eff94412034e3b606ed850ec2c1900e8e68151fc4aee5adebb066eb6da4eaa5681378e"; + const SECP256R1_SIGNATURE_HEX: &str = "1cc628533d0004b2b20e7f4baad0b8bb5e0673db159bbccf92491aef61fc9620880e0bbf82a8cf818ed46ba03cf0fc6c898e36fca36cc7fdb1d2db7503634430"; + const SECP256R1_PUBLIC_KEY_HEX: &str = "04b8188bd68701fc396dab53125d4d28ea33a91daf6d21485f4770f6ea8c565dde423f058810f277f8fe076f6db56e9285a1bf2c2a1dae145095edd9c04970bc4a"; + + // Vectors sourced from + const WEBAUTHN_PUBLIC_KEY_X: &[u8] = + &hex!("80d9326e49eb6314d03f58830369ea5bafbc4e2709b30bff1f4379586ca869d9"); + const WEBAUTHN_PUBLIC_KEY_Y: &[u8] = + &hex!("806ed746d8ac6c2779a472d8c1ed4c200b07978d9d8d8d862be8b7d4b7fb6350"); + const WEBAUTHN_CLIENT_DATA_JSON: &str = r#"{"type":"webauthn.get","challenge":"dGVzdA","origin":"https://funny-froyo-3f9b75.netlify.app"}"#; + const WEBAUTHN_CHALLENGE: &[u8] = &hex!("74657374"); + const WEBAUTHN_AUTHENTICATOR_DATA: &[u8] = + &hex!("e0b592a7dd54eedeec65206e031fc196b8e5915f9b389735860c83854f65dc0e1d00000000"); + const WEBAUTHN_SIGNATURE_R: &[u8] = + &hex!("32e005a53ae49a96ac88c715243638dd5c985fbd463c727d8eefd05bee4e2570"); + const WEBAUTHN_SIGNATURE_S: &[u8] = + &hex!("7a4fef4d0b11187f95f69eefbb428df8ac799bbd9305066b1e9c9fe9a5bcf8c4"); + + fn setup() -> OwnedDeps { + let mut deps = mock_dependencies(); + let msg = InstantiateMsg {}; + let info = mock_info(CREATOR, &[]); + let res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap(); + assert_eq!(0, res.messages.len()); + deps + } + + #[test] + fn instantiate_works() { + setup(); + } + + enum AssertResult { + IsResult(T), + IsError(E), + } + + + macro_rules! test_query { + ( + $test_name:ident, + $msgs:expr, + $assert:expr, + $deps:expr + ) => { + #[test] + fn $test_name() { + let deps = $deps.unwrap_or_else(setup); + for msg in $msgs.iter() { + match $assert { + AssertResult::IsResult(expected) => { + let response: VerifyResponse = + from_json(query(deps.as_ref(), mock_env(), msg.clone()).unwrap()) + .unwrap(); + assert_eq!(response, expected); + } + AssertResult::IsError(expected) => { + let err = query(deps.as_ref(), mock_env(), msg.clone()).unwrap_err(); + assert_eq!(err, expected); + } + }; + } + } + }; + } + test_query!( + secp256r1_signature_verify_works, + vec![ + QueryMsg::VerifySecp256R1Signature { + message: hex::decode(&SECP256R1_MESSAGE_HEX).unwrap().into(), + signature: hex::decode(&SECP256R1_SIGNATURE_HEX).unwrap().into(), + public_key: hex::decode(&SECP256R1_PUBLIC_KEY_HEX).unwrap().into(), + } + ], + AssertResult::IsResult(VerifyResponse { verifies: true }), + None + ); + + test_query!( + secp256r1_signature_verify_fails, + vec![ + QueryMsg::VerifySecp256R1Signature { + message: hex::decode(&&{ + let mut message = hex::decode(SECP256R1_MESSAGE_HEX).unwrap(); + message[0] ^= 0x01; + hex::encode(message) + }) + .unwrap() + .into(), + signature: hex::decode(&SECP256R1_SIGNATURE_HEX).unwrap().into(), + public_key: hex::decode(&SECP256R1_PUBLIC_KEY_HEX).unwrap().into(), + } + ], + AssertResult::IsResult(VerifyResponse { verifies: false }), + None + ); + + test_query!( + secp256r1_signature_verify_errors_on_invalid_hash_format, + vec![ + QueryMsg::VerifySecp256R1Signature { + message: Binary(vec![]), + signature: hex::decode(&SECP256R1_SIGNATURE_HEX).unwrap().into(), + public_key: hex::decode(&SECP256R1_PUBLIC_KEY_HEX).unwrap().into(), + } + ], + AssertResult::IsError(ContractError::InvalidHashFormat), + None + ); + + test_query!( + secp256r1_signature_verify_errors_on_invalid_public_key_format, + vec![ + QueryMsg::VerifySecp256R1Signature { + message: hex::decode(&SECP256R1_MESSAGE_HEX).unwrap().into(), + signature: hex::decode(&SECP256R1_SIGNATURE_HEX).unwrap().into(), + public_key: hex::decode(&{ hex::encode(vec![]) }).unwrap().into(), + } + ], + AssertResult::IsError(ContractError::InvalidPubkeyFormat), + None + ); + + test_query!( + secp256r1_signature_verify_errors_on_invalid_signature_format, + vec![ + QueryMsg::VerifySecp256R1Signature { + message: hex::decode(&SECP256R1_MESSAGE_HEX).unwrap().into(), + signature: hex::decode(&&{ hex::encode(vec![]) }).unwrap().into(), + public_key: hex::decode(&SECP256R1_PUBLIC_KEY_HEX).unwrap().into(), + } + ], + AssertResult::IsError(ContractError::InvalidSignatureFormat), + None + ); + + test_query!( + webauthn_verify_works, + vec![ + QueryMsg::VerifyWebauthn { + authenticator_data: WEBAUTHN_AUTHENTICATOR_DATA.into(), + client_data_json: WEBAUTHN_CLIENT_DATA_JSON.into(), + challenge: WEBAUTHN_CHALLENGE.into(), + x: WEBAUTHN_PUBLIC_KEY_X.into(), + y: WEBAUTHN_PUBLIC_KEY_Y.into(), + r: WEBAUTHN_SIGNATURE_R.into(), + s: WEBAUTHN_SIGNATURE_S.into(), + } + ], + AssertResult::IsResult(VerifyResponse { verifies: true }), + None + ); + + test_query!( + webauthn_verify_fails_on_invalid_signature, + vec![ + QueryMsg::VerifyWebauthn { + authenticator_data: WEBAUTHN_AUTHENTICATOR_DATA.into(), + client_data_json: WEBAUTHN_CLIENT_DATA_JSON.into(), + challenge: WEBAUTHN_CHALLENGE.into(), + x: WEBAUTHN_PUBLIC_KEY_X.into(), + y: WEBAUTHN_PUBLIC_KEY_Y.into(), + r: { + let mut r = WEBAUTHN_SIGNATURE_R.to_vec(); + r[0] ^= 3; + r.into() + }, + s: WEBAUTHN_SIGNATURE_S.into(), + } + ], + AssertResult::IsResult(VerifyResponse { verifies: false }), + None + ); + + test_query!( + webauthn_verify_fails_on_invalid_signature2, + vec![ + QueryMsg::VerifyWebauthn { + authenticator_data: WEBAUTHN_AUTHENTICATOR_DATA.into(), + client_data_json: { + let mut client_data_json = WEBAUTHN_CLIENT_DATA_JSON.to_string(); + client_data_json.push_str("tampering with hashes is fun"); + client_data_json + }, + challenge: WEBAUTHN_CHALLENGE.into(), + x: WEBAUTHN_PUBLIC_KEY_X.into(), + y: WEBAUTHN_PUBLIC_KEY_Y.into(), + r: { + let mut r = WEBAUTHN_SIGNATURE_R.to_vec(); + r[0] ^= 3; + r.into() + }, + s: WEBAUTHN_SIGNATURE_S.into(), + } + ], + AssertResult::IsResult(VerifyResponse { verifies: false }), + None + ); +} diff --git a/contracts/passkey/src/error.rs b/contracts/passkey/src/error.rs index ccc5248..986d336 100644 --- a/contracts/passkey/src/error.rs +++ b/contracts/passkey/src/error.rs @@ -1,6 +1,7 @@ use thiserror::Error; use cosmwasm_std::StdError; +use crypto::Secp256R1VerifyError; use crate::{authenticator::AuthenticatorError, passkey::PasskeyError}; @@ -12,13 +13,31 @@ pub enum Never {} pub enum ContractError { #[error("{0}")] Std(#[from] StdError), - #[error("Unauthorized")] Unauthorized {}, - #[error("Authenticator error: {0}")] AuthenticatorError(#[from] AuthenticatorError), - #[error("Passkey error: {0}")] PasskeyError(#[from] PasskeyError), + #[error("Invalid hash format")] + InvalidHashFormat, + #[error("Invalid public key format")] + InvalidPubkeyFormat, + #[error("Invalid signature format")] + InvalidSignatureFormat, + #[error("Generic crypto error: {0}")] + GenericError(String), +} + +// Implement From for ContractError +impl From for ContractError { + fn from(err: Secp256R1VerifyError) -> Self { + match err.code() { + 3 => ContractError::InvalidHashFormat, + 4 => ContractError::InvalidSignatureFormat, + 5 => ContractError::InvalidPubkeyFormat, + 10 => ContractError::GenericError(err.to_string()), + _ => ContractError::GenericError(format!("Unknown crypto error: {}", err)), + } + } } diff --git a/contracts/passkey/src/lib.rs b/contracts/passkey/src/lib.rs index e899396..a0faf28 100644 --- a/contracts/passkey/src/lib.rs +++ b/contracts/passkey/src/lib.rs @@ -1,7 +1,7 @@ - -pub mod error; +pub mod admin; pub mod authenticator; +pub mod contract; +pub mod error; +pub mod msg; pub mod passkey; pub mod state; -pub mod admin; -pub mod msg; \ No newline at end of file diff --git a/contracts/passkey/src/msg.rs b/contracts/passkey/src/msg.rs index 9c4d572..147755d 100644 --- a/contracts/passkey/src/msg.rs +++ b/contracts/passkey/src/msg.rs @@ -1,4 +1,5 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::Binary; pub use osmosis_std::types::osmosis::poolmanager::v1beta1::SwapAmountInRoute; // re-export the structs from osmosis_authenticators @@ -11,31 +12,67 @@ pub enum DenomRemovalTarget { } #[cw_serde] -pub struct InstantiateMsg { - pub admin: Option, -} +pub struct InstantiateMsg {} #[cw_serde] pub enum ExecuteMsg { - TransferAdmin { - address: String, - }, - ClaimAdminTransfer {}, - RejectAdminTransfer {}, - CancelAdminTransfer {}, - RevokeAdmin {}, + // TransferAdmin { address: String }, + // ClaimAdminTransfer {}, + // RejectAdminTransfer {}, + // CancelAdminTransfer {}, + // RevokeAdmin {}, } #[cw_serde] #[derive(QueryResponses)] pub enum QueryMsg { - #[returns(AdminResponse)] - Admin {}, + // #[returns(AdminResponse)] + // Admin {}, - #[returns(AdminCandidateResponse)] - AdminCandidate {}, + // #[returns(AdminCandidateResponse)] + // AdminCandidate {}, + /// Cosmos format (secp256r1 verification scheme). + #[returns(VerifyResponse)] + VerifySecp256R1Signature { + /// Message to verify. + message: Binary, + /// Serialized signature. Cosmos format (64 bytes). + signature: Binary, + /// Serialized compressed (33 bytes) or uncompressed (65 bytes) public key. + public_key: Binary, + }, + /// Webauthn component verification + #[returns(VerifyResponse)] + VerifyWebauthn { + /// Authenticator data + authenticator_data: Binary, + /// Client data (JSON encoded) + client_data_json: String, + /// Challenge value + challenge: Binary, + /// X coordinate of public key point + /// + /// Untagged big-endian serialized byte sequence representing the X coordinate on the secp256r1 elliptic curve + x: Binary, + /// Y coordinate of public key point + /// + /// Untagged big-endian serialized byte sequence representing the Y coordinate on the secp256r1 elliptic curve + y: Binary, + /// r component of signature + /// + /// The representation of this component is a big-endian encoded 256bit integer + r: Binary, + /// s component of signature + /// + /// The representation of this component is a big-endian encoded 256bit integer + s: Binary, + }, } +#[cw_serde] +pub struct VerifyResponse { + pub verifies: bool, +} #[cw_serde] pub struct PasskeyResponse { diff --git a/contracts/passkey/src/passkey/app-check.rs b/contracts/passkey/src/passkey/app-check.rs deleted file mode 100644 index 38f683a..0000000 --- a/contracts/passkey/src/passkey/app-check.rs +++ /dev/null @@ -1,65 +0,0 @@ -use std::collections::HashMap; -use std::fs::File; -use std::io::BufReader; -use jsonwebtoken::{decode, DecodingKey, Validation}; -use serde::Deserialize; - -#[derive(Debug, Deserialize)] -struct Jwks { - keys: Vec, -} - -#[derive(Debug, Deserialize)] -struct JwkKey { - kty: String, - use_: String, - alg: String, - kid: String, - n: String, - e: String, -} - -fn get_jwks() -> Result> { - let file = File::open("app-check-google-jwks.json")?; - let reader = BufReader::new(file); - let jwks: Jwks = serde_json::from_reader(reader)?; - Ok(jwks) -} - -#[derive(Clone)] -struct AppCheckVerification { - project_number: String, - -} - -impl AppCheckVerification { - fn new(project_number: String) -> Self { - Self { - project_number, - } - } - - fn verify(&self, token: Vec) -> Result> { - let token = String::from_utf8(token)?; - - // Obtain the Firebase App Check Public Keys - let jwks = get_jwks()?; - - // Verify the signature on the App Check token - let token_data = decode::>( - &token, - &DecodingKey::from_rsa_components(&jwks.keys[0].n, &jwks.keys[0].e), - &Validation::new(jsonwebtoken::Algorithm::RS256), - )?; - - let claims = token_data.claims; - - // Check issuer and audience - if claims["iss"] != format!("https://firebaseappcheck.googleapis.com/{}", self.project_number) || - claims["aud"] != format!("projects/{}", self.project_number) { - return Err("invalid issuer or audience".into()); - } - - Ok(claims["sub"].as_str().unwrap().to_string()) - } -} diff --git a/contracts/passkey/src/passkey/app_check.rs b/contracts/passkey/src/passkey/app_check.rs new file mode 100644 index 0000000..0ab6cdd --- /dev/null +++ b/contracts/passkey/src/passkey/app_check.rs @@ -0,0 +1,65 @@ +// use std::collections::HashMap; +// use std::fs::File; +// use std::io::BufReader; +// use jsonwebtoken::{decode, DecodingKey, Validation}; +// use serde::Deserialize; + +// #[derive(Debug, Deserialize)] +// struct Jwks { +// keys: Vec, +// } + +// #[derive(Debug, Deserialize)] +// struct JwkKey { +// kty: String, +// use_: String, +// alg: String, +// kid: String, +// n: String, +// e: String, +// } + +// fn get_jwks() -> Result> { +// let file = File::open("app-check-google-jwks.json")?; +// let reader = BufReader::new(file); +// let jwks: Jwks = serde_json::from_reader(reader)?; +// Ok(jwks) +// } + +// #[derive(Clone)] +// struct AppCheckVerification { +// project_number: String, + +// } + +// impl AppCheckVerification { +// fn new(project_number: String) -> Self { +// Self { +// project_number, +// } +// } + +// fn verify(&self, token: Vec) -> Result> { +// let token = String::from_utf8(token)?; + +// // Obtain the Firebase App Check Public Keys +// let jwks = get_jwks()?; + +// // Verify the signature on the App Check token +// let token_data = decode::>( +// &token, +// &DecodingKey::from_rsa_components(&jwks.keys[0].n, &jwks.keys[0].e), +// &Validation::new(jsonwebtoken::Algorithm::RS256), +// )?; + +// let claims = token_data.claims; + +// // Check issuer and audience +// if claims["iss"] != format!("https://firebaseappcheck.googleapis.com/{}", self.project_number) || +// claims["aud"] != format!("projects/{}", self.project_number) { +// return Err("invalid issuer or audience".into()); +// } + +// Ok(claims["sub"].as_str().unwrap().to_string()) +// } +// } diff --git a/contracts/passkey/src/passkey/attestation.rs b/contracts/passkey/src/passkey/attestation.rs new file mode 100644 index 0000000..9c82fe1 --- /dev/null +++ b/contracts/passkey/src/passkey/attestation.rs @@ -0,0 +1,97 @@ +// extern crate ring; +// extern crate untrusted; + +// use ring::signature; +// use untrusted::Input; + +// use crate::contract::verify_secp256r1; + +// struct StoredCredential { +// public_key: Vec, +// counter: u32, +// } + +// struct Attestation { +// public_key: Vec, +// signature: Vec, +// auth_data: Vec, +// client_data_hash: Vec, +// } + +// fn parse_attestation(attestation_object: &[u8]) -> Result { +// // Parse the attestation object according to the "packed" format +// // This is a simplified example; actual parsing may require handling CBOR and other details + +// // For this example, we'll assume the attestation_object contains: +// // - public_key (33 bytes for P-256) +// // - signature (variable length) +// // - auth_data (variable length) +// // - client_data_hash (32 bytes) + +// let public_key = &attestation_object[0..33]; +// let signature_length = attestation_object[33] as usize; +// let signature = &attestation_object[34..34 + signature_length]; +// let auth_data = &attestation_object[34 + signature_length..34 + signature_length + 37]; +// let client_data_hash = &attestation_object[34 + signature_length + 37..]; + +// Ok(Attestation { +// public_key: public_key.to_vec(), +// signature: signature.to_vec(), +// auth_data: auth_data.to_vec(), +// client_data_hash: client_data_hash.to_vec(), +// }) +// } + +// pub fn verify_signature(attestation: &Attestation) -> bool { +// let public_key = Input::from(&attestation.public_key); +// let signature = Input::from(&attestation.signature); +// let msg = [ +// attestation.auth_data.clone(), +// attestation.client_data_hash.clone(), +// ] +// .concat(); +// let msg = Input::from(&msg); + +// let public_key_alg = &signature::ECDSA_P256_SHA256_FIXED; + +// return true; +// // verify_secp256r1(msg, signature, public_key).is_ok() +// } + +// fn verify_attestation( +// attestation_object: &[u8], +// expected_public_key: &[u8], +// ) -> Result { +// let attestation = parse_attestation(attestation_object)?; + +// // Verify the public key +// if attestation.public_key != expected_public_key { +// return Err("Public key does not match"); +// } + +// // Verify the signature +// if !verify_signature(&attestation) { +// return Err("Attestation signature verification failed"); +// } + +// Ok(true) +// } + +// // fn main() { +// // let attestation_object = vec![/* ... */]; // Attestation object received from the Dapp +// // let expected_public_key = vec![/* ... */]; // Public key expected to be verified + +// // match verify_attestation(&attestation_object, &expected_public_key) { +// // Ok(valid) => { +// // if valid { +// // println!("Attestation verification succeeded"); +// // // Accept transactions signed by the mobile app +// // } else { +// // println!("Attestation verification failed"); +// // } +// // } +// // Err(error) => { +// // println!("Error during attestation verification: {}", error); +// // } +// // } +// // } diff --git a/contracts/passkey/src/passkey/mod.rs b/contracts/passkey/src/passkey/mod.rs index 2ca5b06..3b0de7f 100644 --- a/contracts/passkey/src/passkey/mod.rs +++ b/contracts/passkey/src/passkey/mod.rs @@ -1,8 +1,11 @@ +mod attestation; mod error; mod params; + use cosmwasm_std::DepsMut; use crate::error::ContractError; + pub use error::PasskeyError; pub use params::PasskeyParams; diff --git a/contracts/passkey/src/passkey/params.rs b/contracts/passkey/src/passkey/params.rs index 769f1fb..251cbc1 100644 --- a/contracts/passkey/src/passkey/params.rs +++ b/contracts/passkey/src/passkey/params.rs @@ -2,14 +2,6 @@ use cosmwasm_schema::cw_serde; #[cw_serde] pub struct PasskeyParams { - // signature of the requesting public key - pub seal: Vec, - pub jwt: Vec, - pub attestation: Vec, - // jwt generated by google - pub app_check_jwt: Vec, - pub passkey_name: Vec, - pub raw_client_data_jsonb64: Vec, - pub raw_authenticator_data_b64: Vec, - pub signature_b64: Vec, + // pubkey: [32;u8]; + pub pub_key: Vec, } diff --git a/contracts/passkey/src/state.rs b/contracts/passkey/src/state.rs index 5395428..df54852 100644 --- a/contracts/passkey/src/state.rs +++ b/contracts/passkey/src/state.rs @@ -1,9 +1,7 @@ use cw_storage_plus::Item; -use crate::{ - admin::Admin, - // passkey::, -}; +use crate::admin::Admin; /// Admin address, Optional. pub const ADMIN: Item = Item::new("admin"); +pub const ADDRESS: Item = Item::new("pubKey"); diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index cf3244f..6c9bac6 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -24,7 +24,7 @@ serde = { version = "1.0.103", default-features = false, features = [ ] } sha2 = "0.10" base64 = "0.22.0" - +cosmwasm-std = { version = "1.4", features = ["stargate", "cosmwasm_1_1"] } [dev-dependencies] sha2 = "0.10" @@ -34,4 +34,3 @@ serde_json = "1.0.40" p256 = { version = "0.13.2", features = ["alloc", "ecdsa"] } sha3 = "0.10" english-numbers = "0.3" - diff --git a/crypto/src/errors.rs b/crypto/src/errors.rs index bd3a6cc..80d218a 100644 --- a/crypto/src/errors.rs +++ b/crypto/src/errors.rs @@ -4,47 +4,11 @@ use derive_more::Display; use crate::BT; -pub type CryptoResult = core::result::Result; +pub type Secp256R1Result = core::result::Result; #[derive(Debug, Display)] #[cfg_attr(feature = "std", derive(thiserror::Error))] -pub enum Aggregation { - #[display("List of points is empty")] - Empty, - #[display("List is not a multiple of {expected_multiple}. Remainder: {remainder}")] - NotMultiple { - expected_multiple: usize, - remainder: usize, - }, -} - -#[derive(Debug, Display)] -#[cfg_attr(feature = "std", derive(thiserror::Error))] -pub enum PairingEquality { - #[display("List is not a multiple of 48. Remainder: {remainder}")] - NotMultipleG1 { remainder: usize }, - #[display("List is not a multiple of 96. Remainder: {remainder}")] - NotMultipleG2 { remainder: usize }, - #[display("Not the same amount of points passed. Left: {left}, Right: {right}")] - UnequalPointAmount { left: usize, right: usize }, -} - -#[derive(Debug, Display)] -#[cfg_attr(feature = "std", derive(thiserror::Error))] -pub enum InvalidPoint { - #[display("Invalid input length for point (must be in compressed format): Expected {expected}, actual: {actual}")] - InvalidLength { expected: usize, actual: usize }, - #[display("Invalid point")] - DecodingError {}, -} - -#[derive(Display, Debug)] -#[cfg_attr(feature = "std", derive(thiserror::Error))] -pub enum CryptoError { - #[display("Point aggregation error: {source}")] - Aggregation { source: Aggregation, backtrace: BT }, - #[display("Batch verify error: {msg}")] - BatchErr { msg: String, backtrace: BT }, +pub enum Secp256R1VerifyError { #[display("Crypto error: {msg}")] GenericErr { msg: String, backtrace: BT }, #[display("Invalid hash format")] @@ -55,123 +19,47 @@ pub enum CryptoError { InvalidSignatureFormat { backtrace: BT }, #[display("Invalid recovery parameter. Supported values: 0 and 1.")] InvalidRecoveryParam { backtrace: BT }, - #[display("Invalid point: {source}")] - InvalidPoint { source: InvalidPoint, backtrace: BT }, - #[display("Pairing equality error: {source}")] - PairingEquality { - source: PairingEquality, - backtrace: BT, - }, - #[display("Unknown hash function")] - UnknownHashFunction { backtrace: BT }, } -impl CryptoError { - pub fn batch_err(msg: impl Into) -> Self { - CryptoError::BatchErr { - msg: msg.into(), - backtrace: BT::capture(), +impl Secp256R1VerifyError { + /// Numeric error code that can easily be passed over the + /// contract VM boundary. + pub fn code(&self) -> u32 { + match self { + Secp256R1VerifyError::InvalidHashFormat { .. } => 3, + Secp256R1VerifyError::InvalidSignatureFormat { .. } => 4, + Secp256R1VerifyError::InvalidPubkeyFormat { .. } => 5, + Secp256R1VerifyError::GenericErr { .. } => 10, + Secp256R1VerifyError::InvalidRecoveryParam { .. } => 6, } } pub fn generic_err(msg: impl Into) -> Self { - CryptoError::GenericErr { + Secp256R1VerifyError::GenericErr { msg: msg.into(), backtrace: BT::capture(), } } pub fn invalid_hash_format() -> Self { - CryptoError::InvalidHashFormat { + Secp256R1VerifyError::InvalidHashFormat { backtrace: BT::capture(), } } pub fn invalid_pubkey_format() -> Self { - CryptoError::InvalidPubkeyFormat { + Secp256R1VerifyError::InvalidPubkeyFormat { backtrace: BT::capture(), } } pub fn invalid_signature_format() -> Self { - CryptoError::InvalidSignatureFormat { + Secp256R1VerifyError::InvalidSignatureFormat { backtrace: BT::capture(), } } - pub fn invalid_recovery_param() -> Self { - CryptoError::InvalidRecoveryParam { - backtrace: BT::capture(), - } - } - - pub fn unknown_hash_function() -> Self { - CryptoError::UnknownHashFunction { - backtrace: BT::capture(), - } - } - - /// Numeric error code that can easily be passed over the - /// contract VM boundary. - pub fn code(&self) -> u32 { - match self { - CryptoError::InvalidHashFormat { .. } => 3, - CryptoError::InvalidSignatureFormat { .. } => 4, - CryptoError::InvalidPubkeyFormat { .. } => 5, - CryptoError::InvalidRecoveryParam { .. } => 6, - CryptoError::BatchErr { .. } => 7, - CryptoError::InvalidPoint { .. } => 8, - CryptoError::UnknownHashFunction { .. } => 9, - CryptoError::GenericErr { .. } => 10, - CryptoError::PairingEquality { - source: PairingEquality::NotMultipleG1 { .. }, - .. - } => 11, - CryptoError::PairingEquality { - source: PairingEquality::NotMultipleG2 { .. }, - .. - } => 12, - CryptoError::PairingEquality { - source: PairingEquality::UnequalPointAmount { .. }, - .. - } => 13, - CryptoError::Aggregation { - source: Aggregation::Empty, - .. - } => 14, - CryptoError::Aggregation { - source: Aggregation::NotMultiple { .. }, - .. - } => 15, - } - } -} - -impl From for CryptoError { - #[track_caller] - fn from(value: Aggregation) -> Self { - Self::Aggregation { - source: value, - backtrace: BT::capture(), - } - } -} - -impl From for CryptoError { - #[track_caller] - fn from(value: PairingEquality) -> Self { - Self::PairingEquality { - source: value, - backtrace: BT::capture(), - } - } -} - -impl From for CryptoError { - #[track_caller] - fn from(value: InvalidPoint) -> Self { - Self::InvalidPoint { - source: value, + Secp256R1VerifyError::InvalidRecoveryParam { backtrace: BT::capture(), } } @@ -182,22 +70,11 @@ mod tests { use super::*; // constructors - #[test] - fn batch_err_works() { - let error = CryptoError::batch_err("something went wrong in a batch way"); - match error { - CryptoError::BatchErr { msg, .. } => { - assert_eq!(msg, "something went wrong in a batch way") - } - _ => panic!("wrong error type!"), - } - } - #[test] fn generic_err_works() { - let error = CryptoError::generic_err("something went wrong in a general way"); + let error = Secp256R1VerifyError::generic_err("something went wrong in a general way"); match error { - CryptoError::GenericErr { msg, .. } => { + Secp256R1VerifyError::GenericErr { msg, .. } => { assert_eq!(msg, "something went wrong in a general way") } _ => panic!("wrong error type!"), @@ -206,27 +83,27 @@ mod tests { #[test] fn invalid_hash_format_works() { - let error = CryptoError::invalid_hash_format(); + let error = Secp256R1VerifyError::invalid_hash_format(); match error { - CryptoError::InvalidHashFormat { .. } => {} + Secp256R1VerifyError::InvalidHashFormat { .. } => {} _ => panic!("wrong error type!"), } } #[test] fn invalid_signature_format_works() { - let error = CryptoError::invalid_signature_format(); + let error = Secp256R1VerifyError::invalid_signature_format(); match error { - CryptoError::InvalidSignatureFormat { .. } => {} + Secp256R1VerifyError::InvalidSignatureFormat { .. } => {} _ => panic!("wrong error type!"), } } #[test] fn invalid_pubkey_format_works() { - let error = CryptoError::invalid_pubkey_format(); + let error = Secp256R1VerifyError::invalid_pubkey_format(); match error { - CryptoError::InvalidPubkeyFormat { .. } => {} + Secp256R1VerifyError::InvalidPubkeyFormat { .. } => {} _ => panic!("wrong error type!"), } } diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs index 6ad2000..24527b9 100644 --- a/crypto/src/lib.rs +++ b/crypto/src/lib.rs @@ -14,7 +14,7 @@ mod webauthn; pub use crate::ecdsa::{ECDSA_PUBKEY_MAX_LEN, ECDSA_SIGNATURE_LEN, MESSAGE_HASH_MAX_LEN}; -pub use crate::errors::{CryptoError, CryptoResult}; +pub use crate::errors::{Secp256R1Result, Secp256R1VerifyError}; pub use crate::secp256r1::{secp256r1_recover_pubkey, secp256r1_verify}; pub(crate) use backtrace::BT; -pub use webauthn::verify_webauthn; +pub use webauthn::webauthn_verify; diff --git a/crypto/src/secp256r1.rs b/crypto/src/secp256r1.rs index 8778569..f0a057c 100644 --- a/crypto/src/secp256r1.rs +++ b/crypto/src/secp256r1.rs @@ -7,7 +7,7 @@ use p256::{ }; use crate::ecdsa::{ECDSA_COMPRESSED_PUBKEY_LEN, ECDSA_UNCOMPRESSED_PUBKEY_LEN}; -use crate::errors::{CryptoError, CryptoResult}; +use crate::errors::{Secp256R1Result, Secp256R1VerifyError}; use crate::identity_digest::Identity256; /// ECDSA secp256r1 implementation. @@ -24,7 +24,7 @@ pub fn secp256r1_verify( message_hash: &[u8], signature: &[u8], public_key: &[u8], -) -> CryptoResult { +) -> Secp256R1Result { let message_hash = read_hash(message_hash)?; let signature = read_signature(signature)?; check_pubkey(public_key)?; @@ -33,7 +33,7 @@ pub fn secp256r1_verify( let message_digest = Identity256::new().chain(message_hash); let mut signature = Signature::from_bytes(&signature.into()) - .map_err(|e| CryptoError::generic_err(e.to_string()))?; + .map_err(|e| Secp256R1VerifyError::generic_err(e.to_string()))?; // High-S signatures require normalization since our verification implementation // rejects them by default. If we had a verifier that does not restrict to @@ -43,7 +43,7 @@ pub fn secp256r1_verify( } let public_key = VerifyingKey::from_sec1_bytes(public_key) - .map_err(|e| CryptoError::generic_err(e.to_string()))?; + .map_err(|e| Secp256R1VerifyError::generic_err(e.to_string()))?; match public_key.verify_digest(message_digest, &signature) { Ok(()) => Ok(true), @@ -68,23 +68,23 @@ pub fn secp256r1_recover_pubkey( message_hash: &[u8], signature: &[u8], recovery_param: u8, -) -> Result, CryptoError> { +) -> Result, Secp256R1VerifyError> { let message_hash = read_hash(message_hash)?; let signature = read_signature(signature)?; // params other than 0, 1, 2 or 3 are explicitly not supported let Some(id) = RecoveryId::from_byte(recovery_param) else { - return Err(CryptoError::invalid_recovery_param()); + return Err(Secp256R1VerifyError::invalid_recovery_param()); }; // Compose extended signature let signature = p256::ecdsa::Signature::from_bytes(&signature.into()) - .map_err(|e| CryptoError::generic_err(e.to_string()))?; + .map_err(|e| Secp256R1VerifyError::generic_err(e.to_string()))?; // Recover let message_digest = Identity256::new().chain(message_hash); let pubkey = p256::ecdsa::VerifyingKey::recover_from_digest(message_digest, &signature, id) - .map_err(|e| CryptoError::generic_err(e.to_string()))?; + .map_err(|e| Secp256R1VerifyError::generic_err(e.to_string()))?; let encoded: Vec = pubkey.to_encoded_point(false).as_bytes().into(); Ok(encoded) } @@ -92,9 +92,9 @@ pub fn secp256r1_recover_pubkey( /// Error raised when hash is not 32 bytes long struct InvalidSecp256r1HashFormat; -impl From for CryptoError { +impl From for Secp256R1VerifyError { fn from(_original: InvalidSecp256r1HashFormat) -> Self { - CryptoError::invalid_hash_format() + Secp256R1VerifyError::invalid_hash_format() } } @@ -105,9 +105,9 @@ fn read_hash(data: &[u8]) -> Result<[u8; 32], InvalidSecp256r1HashFormat> { /// Error raised when signature is not 64 bytes long (32 bytes r, 32 bytes s) struct InvalidSecp256r1SignatureFormat; -impl From for CryptoError { +impl From for Secp256R1VerifyError { fn from(_original: InvalidSecp256r1SignatureFormat) -> Self { - CryptoError::invalid_signature_format() + Secp256R1VerifyError::invalid_signature_format() } } @@ -120,9 +120,9 @@ fn read_signature(data: &[u8]) -> Result<[u8; 64], InvalidSecp256r1SignatureForm /// 2. Compressed: 33 bytes starting with 0x02 or 0x03 struct InvalidSecp256r1PubkeyFormat; -impl From for CryptoError { +impl From for Secp256R1VerifyError { fn from(_original: InvalidSecp256r1PubkeyFormat) -> Self { - CryptoError::invalid_pubkey_format() + Secp256R1VerifyError::invalid_pubkey_format() } } @@ -146,7 +146,7 @@ mod tests { use std::io::BufReader; use crate::secp256r1_recover_pubkey; - use alloc::string::String; + use alloc::{string::String, vec}; use ecdsa::RecoveryId; use p256::{ ecdsa::signature::DigestSigner, ecdsa::SigningKey, elliptic_curve::rand_core::OsRng, @@ -184,6 +184,38 @@ mod tests { public_key: String, } + #[test] + fn sanity_check_read_hash() { + let message_hash:Vec = vec![]; + let fn_res = read_hash(&message_hash); + assert!(fn_res.is_err()); + let message_digest = Sha256::new().chain(MSG); + + // Signing + let secret_key = SigningKey::random(&mut OsRng); // Serialize with `::to_bytes()` + + // Note: the signature type must be annotated or otherwise inferrable as + // `Signer` has many impls of the `Signer` trait (for both regular and + // recoverable signature types). + let (signature, _recovery_id): (Signature, RecoveryId) = + secret_key.sign_digest(message_digest); + + let public_key = VerifyingKey::from(&secret_key); // Serialize with `::to_encoded_point()` + let res = secp256r1_verify( + &vec![], + signature.to_bytes().as_slice(), + public_key.to_encoded_point(false).as_bytes() + ); + assert!(res.is_err()); + let err = res.unwrap_err(); + match err { + Secp256R1VerifyError::InvalidHashFormat {..} => { + assert!(true); + } + _ => panic!("expected something else") + } + } + #[test] fn test_secp256r1_verify() { // Explicit / external hashing @@ -331,12 +363,12 @@ mod tests { let recovery_param: u8 = 4; match secp256r1_recover_pubkey(&message_hash, &r_s, recovery_param).unwrap_err() { - CryptoError::InvalidRecoveryParam { .. } => {} + Secp256R1VerifyError::InvalidRecoveryParam { .. } => {} err => panic!("Unexpected error: {err}"), } let recovery_param: u8 = 255; match secp256r1_recover_pubkey(&message_hash, &r_s, recovery_param).unwrap_err() { - CryptoError::InvalidRecoveryParam { .. } => {} + Secp256R1VerifyError::InvalidRecoveryParam { .. } => {} err => panic!("Unexpected error: {err}"), } } diff --git a/crypto/src/webauthn.rs b/crypto/src/webauthn.rs index 4647ac2..7279559 100644 --- a/crypto/src/webauthn.rs +++ b/crypto/src/webauthn.rs @@ -3,11 +3,10 @@ use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; use p256::{ecdsa::Signature, elliptic_curve::sec1::FromEncodedPoint, EncodedPoint, PublicKey}; use sha2::{digest::generic_array::GenericArray, Digest, Sha256}; -use crate::secp256r1_verify; -use crate::CryptoResult; +use crate::{secp256r1_verify, Secp256R1Result}; #[allow(clippy::too_many_arguments)] -pub fn verify_webauthn( +pub fn webauthn_verify( authenticator_data: &[u8], client_data_json: &str, challenge: &[u8], @@ -15,7 +14,7 @@ pub fn verify_webauthn( y: &[u8], r: &[u8], s: &[u8], -) -> CryptoResult { +) -> Secp256R1Result { // We are making a lot of assumptions here about the coordinates, such as: // // - the length of the encoded bytes being correct diff --git a/schema/passkey-authenticator.json b/schema/passkey-authenticator.json index f60e515..9ffc259 100644 --- a/schema/passkey-authenticator.json +++ b/schema/passkey-authenticator.json @@ -6,14 +6,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "type": "object", - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - } - }, "additionalProperties": false }, "execute": null, @@ -22,60 +14,162 @@ "title": "QueryMsg", "oneOf": [ { + "description": "Cosmos format (secp256r1 verification scheme).", "type": "object", "required": [ - "admin" + "verify_secp256_r1_signature" ], "properties": { - "admin": { + "verify_secp256_r1_signature": { "type": "object", + "required": [ + "message", + "public_key", + "signature" + ], + "properties": { + "message": { + "description": "Message to verify.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "public_key": { + "description": "Serialized compressed (33 bytes) or uncompressed (65 bytes) public key.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "signature": { + "description": "Serialized signature. Cosmos format (64 bytes).", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + }, "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Webauthn component verification", "type": "object", "required": [ - "admin_candidate" + "verify_webauthn" ], "properties": { - "admin_candidate": { + "verify_webauthn": { "type": "object", + "required": [ + "authenticator_data", + "challenge", + "client_data_json", + "r", + "s", + "x", + "y" + ], + "properties": { + "authenticator_data": { + "description": "Authenticator data", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "challenge": { + "description": "Challenge value", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "client_data_json": { + "description": "Client data (JSON encoded)", + "type": "string" + }, + "r": { + "description": "r component of signature\n\nThe representation of this component is a big-endian encoded 256bit integer", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "s": { + "description": "s component of signature\n\nThe representation of this component is a big-endian encoded 256bit integer", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "x": { + "description": "X coordinate of public key point\n\nUntagged big-endian serialized byte sequence representing the X coordinate on the secp256r1 elliptic curve", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "y": { + "description": "Y coordinate of public key point\n\nUntagged big-endian serialized byte sequence representing the Y coordinate on the secp256r1 elliptic curve", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + }, "additionalProperties": false } }, "additionalProperties": false } - ] + ], + "definitions": { + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + } + } }, "migrate": null, "sudo": null, "responses": { - "admin": { + "verify_secp256_r1_signature": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminResponse", + "title": "VerifyResponse", "type": "object", + "required": [ + "verifies" + ], "properties": { - "admin": { - "type": [ - "string", - "null" - ] + "verifies": { + "type": "boolean" } }, "additionalProperties": false }, - "admin_candidate": { + "verify_webauthn": { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminCandidateResponse", + "title": "VerifyResponse", "type": "object", + "required": [ + "verifies" + ], "properties": { - "candidate": { - "type": [ - "string", - "null" - ] + "verifies": { + "type": "boolean" } }, "additionalProperties": false diff --git a/schema/raw/instantiate.json b/schema/raw/instantiate.json index 2edfeca..1352613 100644 --- a/schema/raw/instantiate.json +++ b/schema/raw/instantiate.json @@ -2,13 +2,5 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "InstantiateMsg", "type": "object", - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - } - }, "additionalProperties": false } diff --git a/schema/raw/query.json b/schema/raw/query.json index 258ca88..4178471 100644 --- a/schema/raw/query.json +++ b/schema/raw/query.json @@ -3,30 +3,132 @@ "title": "QueryMsg", "oneOf": [ { + "description": "Cosmos format (secp256r1 verification scheme).", "type": "object", "required": [ - "admin" + "verify_secp256_r1_signature" ], "properties": { - "admin": { + "verify_secp256_r1_signature": { "type": "object", + "required": [ + "message", + "public_key", + "signature" + ], + "properties": { + "message": { + "description": "Message to verify.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "public_key": { + "description": "Serialized compressed (33 bytes) or uncompressed (65 bytes) public key.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "signature": { + "description": "Serialized signature. Cosmos format (64 bytes).", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + }, "additionalProperties": false } }, "additionalProperties": false }, { + "description": "Webauthn component verification", "type": "object", "required": [ - "admin_candidate" + "verify_webauthn" ], "properties": { - "admin_candidate": { + "verify_webauthn": { "type": "object", + "required": [ + "authenticator_data", + "challenge", + "client_data_json", + "r", + "s", + "x", + "y" + ], + "properties": { + "authenticator_data": { + "description": "Authenticator data", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "challenge": { + "description": "Challenge value", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "client_data_json": { + "description": "Client data (JSON encoded)", + "type": "string" + }, + "r": { + "description": "r component of signature\n\nThe representation of this component is a big-endian encoded 256bit integer", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "s": { + "description": "s component of signature\n\nThe representation of this component is a big-endian encoded 256bit integer", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "x": { + "description": "X coordinate of public key point\n\nUntagged big-endian serialized byte sequence representing the X coordinate on the secp256r1 elliptic curve", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "y": { + "description": "Y coordinate of public key point\n\nUntagged big-endian serialized byte sequence representing the Y coordinate on the secp256r1 elliptic curve", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + } + }, "additionalProperties": false } }, "additionalProperties": false } - ] + ], + "definitions": { + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + } + } } diff --git a/contracts/passkey/schema/raw/instantiate.json b/schema/raw/response_to_verify_secp256_r1_signature.json similarity index 56% rename from contracts/passkey/schema/raw/instantiate.json rename to schema/raw/response_to_verify_secp256_r1_signature.json index 2edfeca..a2cdc34 100644 --- a/contracts/passkey/schema/raw/instantiate.json +++ b/schema/raw/response_to_verify_secp256_r1_signature.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InstantiateMsg", + "title": "VerifyResponse", "type": "object", + "required": [ + "verifies" + ], "properties": { - "admin": { - "type": [ - "string", - "null" - ] + "verifies": { + "type": "boolean" } }, "additionalProperties": false diff --git a/contracts/passkey/schema/raw/response_to_admin.json b/schema/raw/response_to_verify_webauthn.json similarity index 56% rename from contracts/passkey/schema/raw/response_to_admin.json rename to schema/raw/response_to_verify_webauthn.json index 809d3a7..a2cdc34 100644 --- a/contracts/passkey/schema/raw/response_to_admin.json +++ b/schema/raw/response_to_verify_webauthn.json @@ -1,13 +1,13 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AdminResponse", + "title": "VerifyResponse", "type": "object", + "required": [ + "verifies" + ], "properties": { - "admin": { - "type": [ - "string", - "null" - ] + "verifies": { + "type": "boolean" } }, "additionalProperties": false diff --git a/test-run.md b/test-run.md new file mode 100644 index 0000000..e6a67f5 --- /dev/null +++ b/test-run.md @@ -0,0 +1,114 @@ + +## Uplading and Instantiating the contract + + +### Compile the passkey_authenticator + +```bash +cargo optimize +``` +or +```bash +cargo run-script optimize +``` +or +```bash +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/optimizer:0.15.0 +``` + + +### Find an edgenet node +- http://164.92.247.225:26657 this one is the one we use for the front end. + +--> `NODE_ADDR` is http://164.92.247.225:26657 +```bash +export NODE_ADDR=http://164.92.247.225:26657 +``` + + + ### get testnet keys + make localnet --help + ```bash + ≈ + ``` + +### Upload the binary using the following this store command - and grab the transaction hash +```bash + cd artifacts + osmosisd tx wasm store ./artifacts/passkey_authenticator.wasm --from val --keyring-backend test --chain-id smartaccount --node $NODE_ADDR --fees 40000uosmo --gas 10000000 +``` + +--> `tx` is: D5B3E5AC07C623C1D7F63A8B0F702157939AFB734AF34FCD6C13DD31FDD2529C + + ### Query the Tx to get the code-id + ```bash + osmosisd query tx --node $NODE_ADDR D5B3E5AC07C623C1D7F63A8B0F702157939AFB734AF34FCD6C13DD31FDD2529C +``` +--> `code-id` is 827 +```bash +export CODE_ID=827 +``` + +### Query the code-id to verify the wasm blob + +**(<-- This just verifies that it works, just for safty or if something goes wrong. We don't really need this.)** +```bash +osmosisd query wasm code-info 827 --node $NODE_ADDR +``` + + ## Instantiate the contract, with no argyument in the `InstantiateMsg` +```bash + osmosisd tx wasm instantiate 827 "{}" --label "passkey" --no-admin --gas-prices 0.25uosmo --gas auto --gas-adjustment 1.5 --from val --keyring-backend test --chain-id smartaccount --node $NODE_ADDR +``` + +## Grab the `txhash` from the (instantiate) payload, and query the tx to get the contract address: +```bash +osmosisd query tx --node $NODE_ADDR 5B979E9A998BCD8430168E03CFE0141AC2C9AC0F443F325B7E866397947D2A09 +``` + +## Grab the contract address (`_contract_address`) from the attributes in the (`query tx`) payload. (by default it returns yaml but you can add `--output json`) +Example: +```yaml +- attributes: + - index: true + key: _contract_address + value: osmo1a23pnstucdzrzgdd34x4g28xawxg4mausk5ptt5dul3808wk4cpqutdztq + - index: true + key: action + value: instantiate + - index: true + key: msg_index + value: "0" + type: wasm +``` + +## we are going to use this contract from here on out: +```bash +export CONTRACT_ADDR = osmo1a23pnstucdzrzgdd34x4g28xawxg4mausk5ptt5dul3808wk4cpqutdztq +``` + +```bash +export CONTRACT_ADDR = osmo1a23pnstucdzrzgdd34x4g28xawxg4mausk5ptt5dul3808wk4cpqutdztq +``` + +## Query `VerifySecp256R1Signature` (`VerifySecp256R1Signature` query converts into `verify_secp256_r1_signature` when called with the cli) +```bash +osmosisd query wasm contract-state smart osmo1a23pnstucdzrzgdd34x4g28xawxg4mausk5ptt5dul3808wk4cpqutdztq '{"verify_secp256_r1_signature": { "message": "ZHNmbGtqYWpkc2ZhZHNm", "signature": "2Cj9wMWx3DUUii2IKQ4mDcsaZ6O6Y4F5aa973kFK1lZtlMjTVfxG1aSrFA4IfEECRBPV/4dG5VWwF+BXz/Mx3g==", "public_key": "A2MR6q+pOpLtdxh0tHHe2JrEY2KOcvRogtLxHDHzJvOh" }}' --node http://164.92.247.225:26657 +``` +// turning intu a curl command: +// Create curl this node: http://164.92.247.225:9090 using grpc with that json {"verify_secp256_r1_signature": { "message": "ZHNmbGtqYWpkc2ZhZHNm", "signature": "2Cj9wMWx3DUUii2IKQ4mDcsaZ6O6Y4F5aa973kFK1lZtlMjTVfxG1aSrFA4IfEECRBPV/4dG5VWwF+BXz/Mx3g==", "public_key": "A2MR6q+pOpLtdxh0tHHe2JrEY2KOcvRogtLxHDHzJvOh" }} + + +generate the passkye and query the verify_secp256_r1_signature with that a payload. + +curl http://164.92.247.225:1317/cosmswasm/wasm/v1/contract/osmo177xfj8lvtywmjxw0ep42cuyuz9fuym7nx3x6ldj5s37yjtn782hq5h8eed/smart/eyJ2ZXJpZnlfc2VjcDI1Nl9yMV9zaWduYXR1cmUiOiB7ICJtZXNzYWdlIjogIlpITm1iR3RxWVdwa2MyWmhaSE5tIiwgInNpZ25hdHVyZSI6ICIyQ2o5d01XeDNEVVVpaTJJS1E0bURjc2FaNk82WTRGNWFhOTcza0ZLMWxadGxNalRWZnhHMWFTckZBNElmRUVDUkJQVi80ZEc1Vld3RitCWHovTXgzZz09IiwgInB1YmxpY19rZXkiOiAiQTJNUjZxK3BPcEx0ZHhoMHRISGUySnJFWTJLT2N2Um9ndEx4SERIekp2T2giIH19 + +curl http://164.92.247.225:1317/cosmswasm/wasm/v1/code/827 +curl http://164.92.247.225:26657/cosmswasm/wasm/v1/code/827 + +curl -X POST http://164.92.247.225:9090 \ + -H "Content-Type: application/json" \ + -d '{"verify_secp256_r1_signature": { "message": "ZHNmbGtqYWpkc2ZhZHNm", "signature": "2Cj9wMWx3DUUii2IKQ4mDcsaZ6O6Y4F5aa973kFK1lZtlMjTVfxG1aSrFA4IfEECRBPV/4dG5VWwF+BXz/Mx3g==", "public_key": "A2MR6q+pOpLtdxh0tHHe2JrEY2KOcvRogtLxHDHzJvOh" }}' diff --git a/upload-authenticator-to-testnet.sh b/upload-authenticator-to-testnet.sh new file mode 100644 index 0000000..8f63e90 --- /dev/null +++ b/upload-authenticator-to-testnet.sh @@ -0,0 +1,78 @@ +#!/bin/bash +set -e + +# Description: +# This script stores a contract code, instantiates a contract, and retrieves the contract address. + +# Color variables +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +# Configuration +NODE="--node http://164.92.247.225:26657" +CHAIN="--chain-id smartaccount" +KEYRING="--keyring-backend test" +FEES="--fees 62500uosmo" +GAS="--gas 25000000" +OPTS="$KEYRING $CHAIN $NODE $FEES $GAS $BROADCAST" +SENDER="--from val" +ARTIFACTS="./artifacts/passkey_authenticator.wasm" +LABEL="passkey" + +# Function to handle error checking +check_error() { + local error_code=$1 + local error_message=$2 + if [ "$error_code" != "0" ]; then + echo "${RED}Error: $error_message${NC}" + exit 1 + fi +} + +echo "${YELLOW}Storing code...${NC}" +echo "${CYAN}osmosisd tx wasm store $ARTIFACTS $SENDER $OPTS -o json${NC}" +RESP=$(osmosisd tx wasm store $ARTIFACTS $SENDER $OPTS -y -o json) +check_error "$(echo "$RESP" | jq -r '.code')" "Error in transaction: $(echo "$RESP" | jq -r '.raw_log')" + +TX_HASH=$(echo "$RESP" | jq -r '.txhash') +echo "${GREEN}Stored code in transaction:${NC} $TX_HASH" + +echo "${YELLOW}Waiting for transaction to be processed...${NC}" +sleep 3 +echo "${GREEN}Transaction processed!${NC}" + +echo "${YELLOW}Querying transaction...${NC}" +CMD="osmosisd query tx $NODE $TX_HASH -o json" +echo "${CYAN}$CMD${NC}" +RESP=$($CMD) +SANITIZED_RESP=$(echo "$RESP" | sed 's/^[^,{]*//') +CODE_ID=$(echo "$SANITIZED_RESP" | jq -r '.events[] | select(.type=="store_code") | .attributes[] | select(.key=="code_id") | .value') +echo "${GREEN}* Code id:${NC} $CODE_ID" + +INIT="{}" +echo "${YELLOW}Instantiating contract...${NC}" +CMD="osmosisd tx wasm instantiate --label $LABEL --no-admin "$CODE_ID" "$INIT" $SENDER $OPTS -y" +echo "${CYAN}$CMD${NC}" +RESP=$($CMD) + +echo "${YELLOW}Waiting for contract instantiation...${NC}" +sleep 3 +echo "${GREEN}Contract instantiated!${NC}" + +CMD="osmosisd query wasm list-contract-by-code "$CODE_ID" -o json" +echo "${CYAN}$CMD${NC}" +RESP=$($CMD) +CONTRACT=$(echo "$RESP" | jq -r '.contracts[-1]') +echo "${GREEN}## Contract address:${NC} $CONTRACT" + +echo "${PURPLE}------------------------------------------${NC}" +echo "${GREEN}Summary:${NC}" +echo "${YELLOW}Transaction Hash:${NC} $TX_HASH" +echo "${YELLOW}Code ID:${NC} $CODE_ID" +echo "${YELLOW}Contract Address:${NC} $CONTRACT" +echo "${PURPLE}------------------------------------------${NC}" \ No newline at end of file