diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ceb6310 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +--- +name: Rust compile & test + +on: + push: + tags: + - "*" + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + targets: wasm32-unknown-unknown + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - uses: taiki-e/install-action@nextest + - uses: Swatinem/rust-cache@v2 + - name: Run tests (Native) + run: cargo nextest run --verbose --release + - name: Run tests (WASM) + run: wasm-pack test --release --headless --chrome + - name: Upload test results + uses: softprops/action-gh-release@v1 + with: + files: target/nextest/default/junit.xml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6bca5be..52a52f7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,4 @@ +--- name: Rust compile & test on: @@ -17,23 +18,19 @@ jobs: env: CARGO_TERM_COLOR: always steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - components: clippy - targets: wasm32-unknown-unknown - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - - run: cargo check --tests --benches - - run: cargo build --verbose - - run: cargo clippy -- -D warnings - - name: Run tests (Native) - run: cargo nextest run --verbose --release - - name: Run tests (WASM) - run: wasm-pack test --release --headless --chrome - - name: Upload test results - uses: softprops/action-gh-release@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable with: - files: target/nextest/default/junit.xml + components: clippy + targets: wasm32-unknown-unknown + - name: Install wasm-pack + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + - uses: taiki-e/install-action@nextest + - uses: Swatinem/rust-cache@v2 + - run: cargo check --tests --benches + - run: cargo build --verbose + - run: cargo clippy -- -D warnings + - name: Run tests (Native) + run: cargo nextest run --verbose --release + - name: Run tests (WASM) + run: wasm-pack test --release --headless --chrome diff --git a/.gitignore b/.gitignore index 61f84a0..ae06777 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ target -Cargo.lock *.swp *.swo tags diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..9207417 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1824 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand 2.1.0", + "futures-lite 2.3.0", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io 2.3.4", + "async-lock 3.4.0", + "blocking", + "futures-lite 2.3.0", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock 2.8.0", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" +dependencies = [ + "async-lock 3.4.0", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite 2.3.0", + "parking", + "polling 3.7.3", + "rustix 0.38.34", + "slab", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-attributes", + "async-channel 1.9.0", + "async-global-executor", + "async-io 1.13.0", + "async-lock 2.8.0", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite 1.13.0", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel 2.3.1", + "async-task", + "futures-io", + "futures-lite 2.3.0", + "piper", +] + +[[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 = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cbor-codec" +version = "0.7.1" +dependencies = [ + "base64", + "byteorder", + "half", + "hex", + "json-codec", + "quickcheck", + "quickcheck_macros", + "rand", +] + +[[package]] +name = "cbor-codec" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e083a023562b37c52837e850131a51b1154cceb9d149f41ee3d386737b140f46" +dependencies = [ + "byteorder", + "libc", +] + +[[package]] +name = "cc" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cpufeatures" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +dependencies = [ + "libc", +] + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[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 = "cryptobox" +version = "1.0.3" +source = "git+https://github.com/wireapp/cryptobox?tag=v1.0.3#7efb84db709da829589939a34a6183c492092720" +dependencies = [ + "byteorder", + "cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proteus", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[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 = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "merlin", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "env_logger" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" +dependencies = [ + "log", + "regex", +] + +[[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 = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite", +] + +[[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 = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand 2.1.0", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "serde", + "typenum", + "version_check", +] + +[[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 = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hkdf" +version = "0.3.2" +source = "git+https://github.com/wireapp/hkdf?tag=v0.3.2#3a40aafeb47337015d5478a43429fb9072a6dc53" +dependencies = [ + "sodiumoxide", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +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.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json-codec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f041c1c34939023f8ccf58d7c61f57533f49aadb6f92a0b6f1f2eae6b1a5071f" + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libsodium-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd" +dependencies = [ + "cc", + "libc", + "pkg-config", + "walkdir", +] + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[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.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +dependencies = [ + "value-bag", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + +[[package]] +name = "minicov" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "oorandom" +version = "11.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" + +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + +[[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 = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand 2.1.0", + "futures-io", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite", + "rustix 0.38.34", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proteus" +version = "1.0.3" +source = "git+https://github.com/wireapp//proteus?branch=otak/fix-1.0.3#f3cd17da5f788d243a17bf624be71794358724f8" +dependencies = [ + "cbor-codec 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hkdf 0.3.2", + "sodiumoxide", +] + +[[package]] +name = "proteus-traits" +version = "2.1.0" +dependencies = [ + "async-trait", +] + +[[package]] +name = "proteus-wasm" +version = "2.1.0" +dependencies = [ + "async-std", + "async-trait", + "cbor-codec 0.7.1", + "chacha20", + "ciborium", + "criterion", + "cryptobox", + "curve25519-dalek", + "ed25519-dalek", + "eyre", + "generic-array", + "getrandom", + "hex", + "hkdf 0.12.4", + "hmac", + "pretty_assertions", + "proteus", + "proteus-traits", + "proteus-wasm", + "rand", + "rand_chacha", + "rand_core", + "serde", + "sha2", + "subtle", + "thiserror", + "wasm-bindgen-test", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "quickcheck" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6" +dependencies = [ + "env_logger", + "log", + "rand", +] + +[[package]] +name = "quickcheck_macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[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", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[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.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys 0.4.14", + "windows-sys 0.52.0", +] + +[[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 = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[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.207" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.207" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "serde_json" +version = "1.0.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[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.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "sodiumoxide" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585232e78a4fc18133eef9946d3080befdf68b906c51b621531c37e91787fa2b" +dependencies = [ + "libc", + "libsodium-sys", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[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" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "value-bag" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + +[[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 = "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.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.74", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "minicov", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "web-sys" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-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.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "serde", + "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.74", +] diff --git a/Cargo.toml b/Cargo.toml index f29ad56..ce65ff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ eyre = "0.6" serde = { version = "1", features = ["derive"], optional = true } [dev-dependencies] -criterion = "0.5" +criterion = { version = "0.5", default-features = false } pretty_assertions = "1.3" proteus-wasm = { path = ".", package = "proteus-wasm", features = ["hazmat", "cryptobox-identity", "public-key-batch-verification"] } wasm-bindgen-test = "0.3" diff --git a/crates/cbor-codec/Cargo.toml b/crates/cbor-codec/Cargo.toml index dd654c4..beb5835 100644 --- a/crates/cbor-codec/Cargo.toml +++ b/crates/cbor-codec/Cargo.toml @@ -13,12 +13,10 @@ edition = "2021" [lib] name = "cbor" -[features] -random = ["quickcheck"] - [dependencies] byteorder = "1.4" half = "2.1" +rand = "0.8" [dependencies.quickcheck] version = "1.0" diff --git a/crates/cbor-codec/src/decoder.rs b/crates/cbor-codec/src/decoder.rs index c4c5f75..96730b7 100644 --- a/crates/cbor-codec/src/decoder.rs +++ b/crates/cbor-codec/src/decoder.rs @@ -15,10 +15,10 @@ //! The module is structured as follows: //! //! 1. `Kernel` contains the basic decoding functionality, capable of -//! decoding simple unstructured types. +//! decoding simple unstructured types. //! 2. `Decoder` directly decodes into native Rust types. //! 3. `GenericDecoder` handles arbitrary CBOR items and decodes them -//! into an `Value` AST. +//! into an `Value` AST. //! //! # Example 1: Direct decoding //! @@ -36,19 +36,17 @@ //! use cbor::{Config, Decoder}; //! use std::io::Cursor; //! -//! fn main() { -//! let input = Cursor::new(hex::decode("828301020383010203").unwrap()); -//! let mut dec = Decoder::new(Config::default(), input); -//! let mut res = Vec::new(); +//! let input = Cursor::new(hex::decode("828301020383010203").unwrap()); +//! let mut dec = Decoder::new(Config::default(), input); +//! let mut res = Vec::new(); +//! for _ in 0 .. dec.array().unwrap() { +//! let mut vec = Vec::new(); //! for _ in 0 .. dec.array().unwrap() { -//! let mut vec = Vec::new(); -//! for _ in 0 .. dec.array().unwrap() { -//! vec.push(dec.u8().unwrap()) -//! } -//! res.push(vec) +//! vec.push(dec.u8().unwrap()) //! } -//! assert_eq!(vec![vec![1, 2, 3], vec![1, 2, 3]], res) +//! res.push(vec) //! } +//! assert_eq!(vec![vec![1, 2, 3], vec![1, 2, 3]], res) //! ``` //! //! # Example 3: Generic decoding @@ -58,14 +56,12 @@ //! use cbor::value::{self, Key}; //! use std::io::Cursor; //! -//! fn main() { -//! let input = Cursor::new(hex::decode("a2616101028103").unwrap()); -//! let mut d = GenericDecoder::new(Config::default(), input); -//! let value = d.value().unwrap(); -//! let c = value::Cursor::new(&value); -//! assert_eq!(Some(1), c.field("a").u8()); -//! assert_eq!(Some(3), c.get(Key::u64(2)).at(0).u8()) -//! } +//! let input = Cursor::new(hex::decode("a2616101028103").unwrap()); +//! let mut d = GenericDecoder::new(Config::default(), input); +//! let value = d.value().unwrap(); +//! let c = value::Cursor::new(&value); +//! assert_eq!(Some(1), c.field("a").u8()); +//! assert_eq!(Some(3), c.get(Key::u64(2)).at(0).u8()) //! ``` //! //! # Example 4: Direct decoding (optional value) @@ -90,7 +86,6 @@ use std::fmt; use std::io; use std::str::{from_utf8, Utf8Error}; use std::string; -use std::{i16, i32, i64, i8}; // Decoder Configuration //////////////////////////////////////////////////// @@ -1349,7 +1344,6 @@ mod tests { use crate::value::{self, Int, Key, Simple, Value}; use std::collections::BTreeMap; use std::io::Cursor; - use std::{f32, f64, u64}; #[test] fn unsigned() { diff --git a/crates/cbor-codec/src/encoder.rs b/crates/cbor-codec/src/encoder.rs index 4546c22..8341d46 100644 --- a/crates/cbor-codec/src/encoder.rs +++ b/crates/cbor-codec/src/encoder.rs @@ -15,11 +15,9 @@ //! use cbor::Encoder; //! use std::io::Cursor; //! -//! fn main() { -//! let mut e = Encoder::new(Cursor::new(Vec::new())); -//! e.u16(1000).unwrap(); -//! assert_eq!(hex::decode("1903e8").unwrap(), e.into_writer().into_inner()) -//! } +//! let mut e = Encoder::new(Cursor::new(Vec::new())); +//! e.u16(1000).unwrap(); +//! assert_eq!(hex::decode("1903e8").unwrap(), e.into_writer().into_inner()) //! ``` //! //! # Example 2: Direct encoding (indefinite string) @@ -28,12 +26,10 @@ //! use cbor::Encoder; //! use std::io::Cursor; //! -//! fn main() { -//! let mut e = Encoder::new(Cursor::new(Vec::new())); -//! e.text_iter(vec!["strea", "ming"].into_iter()).unwrap(); -//! let output = hex::decode("7f657374726561646d696e67ff").unwrap(); -//! assert_eq!(output, e.into_writer().into_inner()) -//! } +//! let mut e = Encoder::new(Cursor::new(Vec::new())); +//! e.text_iter(vec!["strea", "ming"].into_iter()).unwrap(); +//! let output = hex::decode("7f657374726561646d696e67ff").unwrap(); +//! assert_eq!(output, e.into_writer().into_inner()) //! ``` //! //! # Example 3: Direct encoding (nested array) @@ -43,16 +39,14 @@ //! use cbor::Encoder; //! use std::io::Cursor; //! -//! fn main() { -//! let mut e = Encoder::new(Cursor::new(Vec::new())); -//! e.array(3) -//! .and(e.u8(1)) -//! .and(e.array(2)).and(e.u8(2)).and(e.u8(3)) -//! .and(e.array(2)).and(e.u8(4)).and(e.u8(5)) -//! .unwrap(); -//! let output = hex::decode("8301820203820405").unwrap(); -//! assert_eq!(output, e.into_writer().into_inner()) -//! } +//! let mut e = Encoder::new(Cursor::new(Vec::new())); +//! e.array(3) +//! .and(e.u8(1)) +//! .and(e.array(2)).and(e.u8(2)).and(e.u8(3)) +//! .and(e.array(2)).and(e.u8(4)).and(e.u8(5)) +//! .unwrap(); +//! let output = hex::decode("8301820203820405").unwrap(); +//! assert_eq!(output, e.into_writer().into_inner()) //! ``` use crate::types::{Tag, Type}; @@ -727,7 +721,7 @@ mod tests { where F: FnMut(Encoder>) -> EncodeResult, { - let mut buffer = vec![0u8; 128]; + let mut buffer = [0u8; 128]; assert!(f(Encoder::new(Cursor::new(&mut buffer[..]))).is_ok()); assert_eq!( &hex::decode(expected).unwrap()[..], diff --git a/crates/cbor-codec/src/lib.rs b/crates/cbor-codec/src/lib.rs index d744417..bef6e11 100644 --- a/crates/cbor-codec/src/lib.rs +++ b/crates/cbor-codec/src/lib.rs @@ -12,9 +12,6 @@ pub mod slice; pub mod types; pub mod value; -#[cfg(feature = "random")] -pub mod random; - pub use crate::decoder::{maybe, opt, or_break}; pub use crate::decoder::{Config, DecodeError, DecodeResult, Decoder, GenericDecoder}; pub use crate::encoder::{EncodeError, EncodeResult, Encoder, GenericEncoder}; diff --git a/crates/cbor-codec/src/random.rs b/crates/cbor-codec/src/random.rs deleted file mode 100644 index 16195ba..0000000 --- a/crates/cbor-codec/src/random.rs +++ /dev/null @@ -1,172 +0,0 @@ -// This Source Code Form is subject to the terms of -// the Mozilla Public License, v. 2.0. If a copy of -// the MPL was not distributed with this file, You -// can obtain one at http://mozilla.org/MPL/2.0/. - -//! Generate random `cbor::Value`s. -//! -//! This module is only available with `--features="random"`. - -use quickcheck::{Arbitrary, Gen}; -use std::collections::{BTreeMap, LinkedList}; -use types::Tag; -use value::{Int, Value, Simple, Key, Bytes, Text}; - -/// Generate a random `cbor::Value`. -/// Mostly useful for quickcheck related tests. -/// The parameter `level` denotes the maximum nesting of this value. -pub fn gen_value(level: u16, g: &mut G) -> Value { - match g.gen_range(0, 20) { - 0 => Value::Null, - 1 => Value::Undefined, - 2 => Value::U8(g.gen()), - 3 => Value::U16(g.gen()), - 4 => Value::U32(g.gen()), - 5 => Value::U64(g.gen()), - 6 => Value::I8(g.gen()), - 7 => Value::I16(g.gen()), - 8 => Value::I32(g.gen()), - 9 => Value::I64(g.gen()), - 10 => Value::F32(g.gen()), - 11 => Value::F64(g.gen()), - 12 => Value::Text(gen_text(g)), - 13 => Value::Bytes(gen_bytes(g)), - 14 => Value::Array( - if level > 0 { - gen_array(level - 1, g) - } else { - Vec::with_capacity(0) - }), - 15 => Value::Bool(g.gen()), - 16 => Value::Simple(gen_simple(g)), - 17 => Value::Map( - if level > 0 { - gen_map(level - 1, g) - } else { - BTreeMap::new() - }), - 18 => Value::Int(gen_int(g)), - _ => gen_tagged(g) - } -} - -fn gen_array(level: u16, g: &mut G) -> Vec { - let len = g.gen_range(0, 64); - let mut vec = Vec::with_capacity(len); - for _ in 0 .. len { - vec.push(gen_value(level, g)) - } - vec -} - -fn gen_map(level: u16, g: &mut G) -> BTreeMap { - let len = g.gen_range(0, 64); - let mut map = BTreeMap::new(); - for _ in 0 .. len { - map.insert(gen_key(g), gen_value(level, g)); - } - map -} - -fn gen_key(g: &mut G) -> Key { - match g.gen_range(0, 4) { - 0 => Key::Int(gen_int(g)), - 1 => Key::Text(gen_text(g)), - 2 => Key::Bytes(gen_bytes(g)), - _ => Key::Bool(g.gen()), - } -} - -fn gen_int(g: &mut G) -> Int { - if g.gen() { - Int::Pos(g.gen()) - } else { - Int::Neg(g.gen()) - } -} - -fn gen_tag(g: &mut G) -> Tag { - match g.gen_range(0, 20) { - 0 => Tag::DateTime, - 1 => Tag::Timestamp, - 2 => Tag::Bignum, - 3 => Tag::NegativeBignum, - 4 => Tag::Decimal, - 5 => Tag::Bigfloat, - 6 => Tag::ToBase64Url, - 7 => Tag::ToBase64, - 8 => Tag::ToBase16, - 9 => Tag::Cbor, - 10 => Tag::Uri, - 11 => Tag::Base64Url, - 12 => Tag::Base64, - 13 => Tag::Regex, - 14 => Tag::Mime, - 15 => Tag::CborSelf, - tg => Tag::Unassigned(tg) - } -} - -fn gen_text(g: &mut G) -> Text { - match g.gen() { - true => Text::Text(Arbitrary::arbitrary(g)), - false => Text::Chunks(gen_chunks(g)) - } -} - -fn gen_bytes(g: &mut G) -> Bytes { - match g.gen() { - true => Bytes::Bytes(Arbitrary::arbitrary(g)), - false => Bytes::Chunks(gen_chunks(g)) - } -} - -fn gen_chunks(g: &mut G) -> LinkedList { - let mut xs = LinkedList::new(); - for _ in 0 .. g.gen_range(0, 64) { - xs.push_back(Arbitrary::arbitrary(g)) - } - xs -} - -fn gen_simple(g: &mut G) -> Simple { - match g.gen() { - true => match g.gen() { - n @ 0u8...19 | n @ 28...30 => Simple::Unassigned(n), - n @ 32...255 => Simple::Unassigned(n), - _ => Simple::Unassigned(0) - }, - false => match g.gen() { - n @ 0u8...31 => Simple::Reserved(n), - _ => Simple::Reserved(0) - } - } -} - -fn gen_tagged(g: &mut G) -> Value { - match gen_tag(g) { - t@Tag::DateTime => Value::Tagged(t, Box::new(Value::Text(gen_text(g)))), - t@Tag::Timestamp => match g.gen_range(0, 10) { - 0 => Value::Tagged(t, Box::new(Value::U8(g.gen()))), - 1 => Value::Tagged(t, Box::new(Value::U16(g.gen()))), - 2 => Value::Tagged(t, Box::new(Value::U32(g.gen()))), - 3 => Value::Tagged(t, Box::new(Value::U64(g.gen()))), - 4 => Value::Tagged(t, Box::new(Value::I8(g.gen()))), - 5 => Value::Tagged(t, Box::new(Value::I16(g.gen()))), - 6 => Value::Tagged(t, Box::new(Value::I32(g.gen()))), - 7 => Value::Tagged(t, Box::new(Value::I64(g.gen()))), - 8 => Value::Tagged(t, Box::new(Value::F32(g.gen()))), - _ => Value::Tagged(t, Box::new(Value::F64(g.gen()))) - }, - t@Tag::Bignum => Value::Tagged(t, Box::new(Value::Bytes(gen_bytes(g)))), - t@Tag::NegativeBignum => Value::Tagged(t, Box::new(Value::Bytes(gen_bytes(g)))), - t@Tag::Uri => Value::Tagged(t, Box::new(Value::Text(gen_text(g)))), - t@Tag::Base64 => Value::Tagged(t, Box::new(Value::Text(gen_text(g)))), - t@Tag::ToBase64Url => Value::Tagged(t, Box::new(Value::Text(gen_text(g)))), - t@Tag::Regex => Value::Tagged(t, Box::new(Value::Text(gen_text(g)))), - t@Tag::Decimal => Value::Tagged(t, Box::new(Value::Array(vec![Value::U64(g.gen()), Value::U64(g.gen())]))), - t@Tag::Bigfloat => Value::Tagged(t, Box::new(Value::Array(vec![Value::U64(g.gen()), Value::U64(g.gen())]))), - _ => Value::Tagged(Tag::Mime, Box::new(Value::Text(gen_text(g)))) - } -} - diff --git a/crates/cbor-codec/src/skip.rs b/crates/cbor-codec/src/skip.rs index 1b21da3..b42a93b 100644 --- a/crates/cbor-codec/src/skip.rs +++ b/crates/cbor-codec/src/skip.rs @@ -5,8 +5,7 @@ //! `Skip` trait to allow efficient skipping of consecutive bytes. -use std::i64; -use std::io::{Result, Error, ErrorKind, Seek, SeekFrom}; +use std::io::{Error, ErrorKind, Result, Seek, SeekFrom}; /// Type which supports skipping a number of bytes. /// @@ -21,7 +20,7 @@ impl Skip for A { /// `n` must be in range `[0, i64::MAX]`. fn skip(&mut self, n: u64) -> Result<()> { if n > i64::MAX as u64 { - return Err(Error::new(ErrorKind::Other, "n too large")) + return Err(Error::new(ErrorKind::Other, "n too large")); } self.seek(SeekFrom::Current(n as i64)).and(Ok(())) } diff --git a/crates/cbor-codec/src/value.rs b/crates/cbor-codec/src/value.rs index e6244de..5900d54 100644 --- a/crates/cbor-codec/src/value.rs +++ b/crates/cbor-codec/src/value.rs @@ -10,7 +10,6 @@ use crate::types::Tag; use std::collections::{BTreeMap, LinkedList}; -use std::i64; /// The generic CBOR representation. #[derive(Clone, Debug, PartialEq, PartialOrd)] diff --git a/crates/cbor-codec/tests/unit.rs b/crates/cbor-codec/tests/unit.rs index ec435f0..30f4022 100644 --- a/crates/cbor-codec/tests/unit.rs +++ b/crates/cbor-codec/tests/unit.rs @@ -105,8 +105,8 @@ fn eq(a: &Json, b: &Value) -> bool { match (a, b) { (&Json::Null, &Value::Null) => true, (&Json::Bool(x), &Value::Bool(y)) => x == y, - (&Json::String(ref x), &Value::Text(Text::Text(ref y))) => x == y, - (&Json::String(ref x), &Value::Text(Text::Chunks(ref y))) => { + (Json::String(x), &Value::Text(Text::Text(ref y))) => x == y, + (Json::String(x), &Value::Text(Text::Chunks(ref y))) => { let mut s = String::new(); for c in y { s.push_str(c) @@ -116,10 +116,8 @@ fn eq(a: &Json, b: &Value) -> bool { (&Json::Number(x), y) => util::as_f64(y) .map(|i| (x - i).abs() < f64::EPSILON) .unwrap_or(false), - (&Json::Array(ref x), &Value::Array(ref y)) => { - x.iter().zip(y.iter()).all(|(xi, yi)| eq(xi, yi)) - } - (&Json::Object(ref x), &Value::Map(ref y)) => { + (Json::Array(x), Value::Array(y)) => x.iter().zip(y.iter()).all(|(xi, yi)| eq(xi, yi)), + (Json::Object(x), Value::Map(y)) => { for (k, v) in x { if let Some(w) = y.get(&Key::Text(Text::Text(k.clone()))) { if !eq(v, w) { diff --git a/src/identity.rs b/src/identity.rs index 903d81c..3ea8ecb 100644 --- a/src/identity.rs +++ b/src/identity.rs @@ -30,8 +30,8 @@ pub enum IdentityMode { #[derive(Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Identity<'r> { - Sec(Cow<'r, IdentityKeyPair>), - Pub(Cow<'r, IdentityKey>), + Sec(Cow<'r, Box>), + Pub(Cow<'r, Box>), } impl<'r> Identity<'r> { @@ -73,8 +73,9 @@ impl<'r> Identity<'r> { if keypair.is_some() { return Err(DecodeError::DuplicateField("identity keypair")); } else { - keypair = - Some(Identity::Sec(Cow::Owned(IdentityKeyPair::decode(d)?))) + keypair = Some(Identity::Sec(Cow::Owned(Box::new( + IdentityKeyPair::decode(d)?, + )))) } } _ => d.skip()?, @@ -91,7 +92,9 @@ impl<'r> Identity<'r> { if key.is_some() { return Err(DecodeError::DuplicateField("identity key")); } else { - key = Some(Identity::Pub(Cow::Owned(IdentityKey::decode(d)?))) + key = Some(Identity::Pub(Cow::Owned(Box::new( + IdentityKey::decode(d)?, + )))) } } _ => d.skip()?, @@ -114,7 +117,7 @@ mod tests { #[wasm_bindgen_test] fn enc_dec_identity_sec() { let k = IdentityKeyPair::new(); - let identity = Identity::Sec(std::borrow::Cow::Owned(k)); + let identity = Identity::Sec(std::borrow::Cow::Owned(Box::new(k))); let r = roundtrip( |mut e| identity.encode(&mut e), |mut d| Identity::decode(&mut d), @@ -126,7 +129,7 @@ mod tests { #[wasm_bindgen_test] fn enc_dec_identity_pub() { let k = IdentityKeyPair::new(); - let identity = Identity::Pub(std::borrow::Cow::Owned(k.public_key)); + let identity = Identity::Pub(std::borrow::Cow::Owned(Box::new(k.public_key))); let r = roundtrip( |mut e| identity.encode(&mut e), |mut d| Identity::decode(&mut d), diff --git a/src/internal/keys.rs b/src/internal/keys.rs index 5d9c432..55b9ad0 100644 --- a/src/internal/keys.rs +++ b/src/internal/keys.rs @@ -151,8 +151,7 @@ impl IdentityKeyPair { } #[cfg(feature = "hazmat")] - #[must_use] - pub unsafe fn from_raw_key_pair(sk: [u8; 64], pk: [u8; 32]) -> ProteusResult { + pub fn from_raw_key_pair(sk: [u8; 64], pk: [u8; 32]) -> ProteusResult { Ok(Self::from_keypair(KeyPair::from_raw(sk, pk)?)) } } @@ -449,8 +448,7 @@ impl KeyPair { } #[cfg(feature = "hazmat")] - #[must_use] - pub unsafe fn from_raw(sk: [u8; 64], pk: [u8; 32]) -> ProteusResult { + pub fn from_raw(sk: [u8; 64], pk: [u8; 32]) -> ProteusResult { let sk = ed25519_dalek::SigningKey::from_keypair_bytes(&sk)?; let pk = ed25519_dalek::VerifyingKey::from_bytes(&pk)?; let secret_key = SecretKey(sk); @@ -627,7 +625,7 @@ impl PublicKey { ) -> bool { let messages: Vec<&[u8]> = verifying_contents.values().map(|m| m.as_slice()).collect(); let signatures: Vec<_> = verifying_contents.keys().map(|s| s.0).collect(); - let verifying_keys: Vec<_> = (0..signatures.len()).map(|_| self.0.clone()).collect(); + let verifying_keys: Vec<_> = (0..signatures.len()).map(|_| self.0).collect(); ed25519_dalek::verify_batch(&messages, &signatures, &verifying_keys).is_ok() } @@ -684,7 +682,7 @@ impl PublicKey { } } let pub_edward = pub_edward.ok_or(DecodeError::MissingField("PublicKey::pub_edward"))?; - Ok(Self(ed25519_dalek::VerifyingKey::from_bytes(&*pub_edward)?)) + Ok(Self(ed25519_dalek::VerifyingKey::from_bytes(&pub_edward)?)) } } diff --git a/src/internal/session.rs b/src/internal/session.rs index 39f0b6f..1cf78f8 100644 --- a/src/internal/session.rs +++ b/src/internal/session.rs @@ -215,7 +215,7 @@ impl RecvChain { ) -> SessionResult, E> { let too_old = self .message_keys - .get(0) + .front() .map_or(false, |k| k.counter > mesg.counter); if too_old { @@ -225,10 +225,11 @@ impl RecvChain { let Some(i) = self .message_keys .iter() - .position(|mk| mk.counter == mesg.counter) else { - // ? Handles error case 209 - return Err(SessionError::DuplicateMessage); - }; + .position(|mk| mk.counter == mesg.counter) + else { + // ? Handles error case 209 + return Err(SessionError::DuplicateMessage); + }; // SAFETY: Indexing directly is safe as the `position` check above ensure we have a MessageKeys present at the index if !env.verify(&self.message_keys[i].mac_key) { @@ -727,7 +728,7 @@ impl> Session { 2 => { let li = IdentityKey::decode(d)?; if ident.borrow().public_key != li { - return Err(DecodeError::LocalIdentityChanged(li)); + return Err(DecodeError::LocalIdentityChanged(Box::new(li))); } } 3 if remote_identity.is_none() => remote_identity = Some(IdentityKey::decode(d)?), @@ -1085,7 +1086,6 @@ mod tests { use std::borrow::Borrow; use std::collections::BTreeMap; use std::fmt; - use std::usize; use std::vec::Vec; use wasm_bindgen_test::wasm_bindgen_test; diff --git a/src/internal/types.rs b/src/internal/types.rs index 8fd1d5c..e282464 100644 --- a/src/internal/types.rs +++ b/src/internal/types.rs @@ -95,7 +95,7 @@ pub enum DecodeError { #[error("CBOR array length mismatch: expected {expected}, got {got}")] InvalidArrayLen { expected: usize, got: usize }, #[error("Local identity changed")] - LocalIdentityChanged(IdentityKey), + LocalIdentityChanged(Box), #[error(transparent)] Ed25519Error(#[from] ed25519_dalek::SignatureError), #[error("Unknown message type {0}: {1}")] diff --git a/tests/common.rs b/tests/common.rs index 4fb0e7c..12a5795 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -107,6 +107,12 @@ macro_rules! impl_harness_for_crate { >, } + impl Default for $client { + fn default() -> Self { + Self::new() + } + } + impl $client { #[must_use] pub fn new() -> Self { @@ -363,9 +369,7 @@ impl LegacyClient { impl Client { pub fn from_raw(sk: [u8; 64], pk: [u8; 32]) -> Self { Client { - identity: unsafe { - proteus_wasm::keys::IdentityKeyPair::from_raw_key_pair(sk, pk).unwrap() - }, + identity: proteus_wasm::keys::IdentityKeyPair::from_raw_key_pair(sk, pk).unwrap(), prekeys: Default::default(), sessions: Default::default(), } diff --git a/tests/interop.rs b/tests/interop.rs index 6c387b6..de69e80 100644 --- a/tests/interop.rs +++ b/tests/interop.rs @@ -75,8 +75,9 @@ mod serialization { let (alice, alice_legacy) = get_client_pair(); let identity_legacy = cryptobox::Identity::Sec(std::borrow::Cow::Owned(alice_legacy.identity.clone())); - let identity = - proteus_wasm::identity::Identity::Sec(std::borrow::Cow::Owned(alice.identity.clone())); + let identity = proteus_wasm::identity::Identity::Sec(std::borrow::Cow::Owned(Box::new( + alice.identity.clone(), + ))); let identity_legacy_ser = identity_legacy.serialise().unwrap(); let identity_ser = identity.serialise().unwrap(); @@ -84,11 +85,13 @@ mod serialization { assert_eq!(identity_legacy_ser, identity_ser); let cryptobox::Identity::Sec(identity_new_into_legacy) = - cryptobox::Identity::deserialise(&identity_ser).unwrap() else { + cryptobox::Identity::deserialise(&identity_ser).unwrap() + else { panic!("Wrong identity type: 2.0 -> 1.0"); }; let proteus_wasm::identity::Identity::Sec(identity_legacy_into_new) = - proteus_wasm::identity::Identity::deserialise(&identity_legacy_ser).unwrap() else { + proteus_wasm::identity::Identity::deserialise(&identity_legacy_ser).unwrap() + else { panic!("Wrong identity type: 1.0 -> 2.0") }; @@ -238,7 +241,7 @@ mod communication { assert_eq!(hello_bob, MSG); let hello_alice_from_bob = &bob.encrypt("ba", MSG); - let decrypted = alice.decrypt("ab", &hello_alice_from_bob); + let decrypted = alice.decrypt("ab", hello_alice_from_bob); assert_eq!(decrypted, MSG); }