commit 4f14fe0d59703c3cf85a31c01582c508190bfc2f Author: suhan1996 Date: Fri Mar 3 12:03:14 2023 -0500 remove fcm official diff --git a/.env b/.env new file mode 100644 index 0000000..7e6d674 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +DATABASE_URL=sqlite:./data/db/db.sqlite diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60165f0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,193 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + branches-ignore: + - "main" +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - build: linux + os: ubuntu-latest + rust: stable + target: x86_64-unknown-linux-musl + pre_install: sudo apt-get install -y rsync + - build: macos + os: macos-latest + rust: stable + target: x86_64-apple-darwin + pre_install: brew install rsync + # - build: macos-arm + # os: macos-latest + # rust: stable + # target: aarch64-apple-darwin + # cross: true + # pre_install: brew install rsync + - build: arm-v7 + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabihf + cross: true + pre_install: sudo apt-get install -y rsync + - build: aarch64 + os: ubuntu-latest + rust: stable + target: aarch64-unknown-linux-musl + cross: true + pre_install: sudo apt-get install -y rsync + steps: + - name: Install SSH Key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.NEW_GEN_ACTIONS_PRIVATE_KEY }} + known_hosts: ${{ secrets.VOCECHAT_COM_HOST }} + - name: Adding Known Hosts + run: ssh-keyscan -H "${{ secrets.VOCECHAT_COM_HOST }}" >> ~/.ssh/known_hosts + - name: Install rsync + run: ${{ matrix.pre_install }} + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: actions/checkout@v3 + - uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --release --target ${{ matrix.target }} + - run: | + cp target/${{ matrix.target }}/release/vocechat-server ./vocechat-server + zip -r ./vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip ./vocechat-server config + - name: Set AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - if: matrix.target == 'x86_64-unknown-linux-musl' + run: | + docker -v + cp -rf target/${{ matrix.target }}/release/vocechat-server build/docker/ + cd build/docker + cp -rf ../../config ./ + docker login -u privoce -p ${{ secrets.DOCKER_PASSWORD }} + + # build latest + docker build -t vocechat-server:latest . + docker tag vocechat-server:latest privoce/vocechat-server:latest + docker push privoce/vocechat-server:latest + + # build version + docker build -t vocechat-server:${{ github.ref_name}} . + docker tag vocechat-server:${{ github.ref_name}} privoce/vocechat-server:${{ github.ref_name}} + docker push privoce/vocechat-server:${{ github.ref_name}} + + aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 384878476649.dkr.ecr.us-east-1.amazonaws.com + docker build --platform linux/amd64 -t 384878476649.dkr.ecr.us-east-1.amazonaws.com/vocechat-server:latest . + docker push 384878476649.dkr.ecr.us-east-1.amazonaws.com/vocechat-server:latest + + docker build --platform linux/amd64 -t 384878476649.dkr.ecr.us-east-1.amazonaws.com/vocechat-server:${{ github.ref_name}} . + docker push 384878476649.dkr.ecr.us-east-1.amazonaws.com/vocechat-server:${{ github.ref_name}} + - if: matrix.target == 'aarch64-unknown-linux-musl' + run: | + docker -v + cp -rf target/${{ matrix.target }}/release/vocechat-server build/docker/ + cd build/docker + cp -rf ../../config ./ + docker login -u privoce -p ${{ secrets.DOCKER_PASSWORD }} + + # build latest + sudo apt install -y qemu-user-static binfmt-support + sed -i "s/alpine/arm64v8\/alpine/ig" Dockerfile + sed -i "s/busybox/arm64v8\/busybox/ig" Dockerfile + docker buildx build -t vocechat-server:latest-arm64 --platform linux/arm64 . + docker tag vocechat-server:latest-arm64 privoce/vocechat-server:latest-arm64 + docker push privoce/vocechat-server:latest-arm64 + + # build version + docker buildx build -t vocechat-server:${{ github.ref_name}}-arm64 --platform linux/arm64 . + docker tag vocechat-server:${{ github.ref_name}}-arm64 privoce/vocechat-server:${{ github.ref_name}}-arm64 + docker push privoce/vocechat-server:${{ github.ref_name}}-arm64 + - name: rsync to sh.voce.chat + run: | + rsync -av vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip root@${{ secrets.VOCECHAT_COM_HOST }}:/home/wwwroot/sh.voce.chat/vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: vocechat-server-${{ github.ref_name}}-${{ matrix.target }} + path: vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip + release: + runs-on: ubuntu-latest + needs: build + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + # - uses: dev-drprasad/delete-tag-and-release@v0.2.0 + # with: + # delete_release: true + # tag_name: ${{ github.ref_name }} + # env: + # GITHUB_TOKEN: ${{ secrets.THE_GITHUB_TOKEN }} + - uses: actions/checkout@v3 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.THE_GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref_name }} + release_name: Release ${{ github.ref_name }} + draft: false + prerelease: false + add: + runs-on: ubuntu-latest + needs: [build, release] + strategy: + matrix: + include: + - build: linux + os: ubuntu-latest + rust: stable + target: x86_64-unknown-linux-musl + - build: macos + os: macos-latest + rust: stable + target: x86_64-apple-darwin + # - build: macos-arm + # os: macos-latest + # rust: stable + # target: aarch64-apple-darwin + # cross: true + # pre_install: brew install rsync + - build: arm-v7 + os: ubuntu-latest + rust: stable + target: armv7-unknown-linux-musleabihf + cross: true + - build: aarch64 + os: ubuntu-latest + rust: stable + target: aarch64-unknown-linux-musl + cross: true + steps: + - uses: actions/checkout@v2 + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: vocechat-server-${{ github.ref_name}}-${{ matrix.target }} + - name: Upload Artifact to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.THE_GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip + asset_name: vocechat-server-${{ github.ref_name}}-${{ matrix.target }}.zip + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5dbe65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +target +/data +.idea +build/docker/config +build/docker/wwwroot +build/docker/*.zip +build/docker/vocechat-server +wwwroot \ No newline at end of file diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..ce8ff6c --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,12 @@ +edition = "2021" +newline_style = "unix" +# comments +normalize_comments = true +wrap_comments = true +format_code_in_doc_comments = true +# imports +imports_granularity = "Crate" +group_imports = "StdExternalCrate" +# report +#report_fixme = "Unnumbered" +#report_todo = "Unnumbered" diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d76e1eb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,5133 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aead" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" +dependencies = [ + "crypto-common", + "generic-array 0.14.6", +] + +[[package]] +name = "aes" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "agora-token" +version = "0.1.0" +dependencies = [ + "base64 0.13.1", + "checksum", + "fastrand", + "hmac 0.11.0", + "sha2 0.9.9", + "thiserror", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.8", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" + +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "asn1-rs" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "async-recursion" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "async-stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +dependencies = [ + "async-stream-impl", + "futures-core", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "async-trait" +version = "0.1.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "atoi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit_field" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "0.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array 0.14.6", +] + +[[package]] +name = "block-buffer" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "boxfnonce" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426" + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + +[[package]] +name = "bytes" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "checksum" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5c24f6a463e9973db3df3c2cc276f689f5baf289c87a693dc859e004d3eb45f" + +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-integer", + "num-traits", + "serde", + "time 0.1.45", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "cipher" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags", + "textwrap 0.11.0", + "unicode-width", +] + +[[package]] +name = "clap" +version = "3.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +dependencies = [ + "atty", + "bitflags", + "clap_derive", + "clap_lex", + "indexmap", + "once_cell", + "strsim", + "termcolor", + "textwrap 0.16.0", +] + +[[package]] +name = "clap_derive" +version = "3.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "const-oid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" +dependencies = [ + "aes-gcm", + "base64 0.13.1", + "hkdf", + "hmac 0.12.1", + "percent-encoding 2.2.0", + "rand 0.8.5", + "sha2 0.10.6", + "subtle", + "time 0.3.17", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "cpufeatures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +dependencies = [ + "atty", + "cast", + "clap 2.34.0", + "criterion-plot", + "csv", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +dependencies = [ + "autocfg 1.1.0", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.6", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array 0.14.6", + "subtle", +] + +[[package]] +name = "csv" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +dependencies = [ + "bstr", + "csv-core", + "itoa 0.4.8", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "cxx" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2 1.0.47", + "quote 1.0.21", + "scratch", + "syn 1.0.104", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "daemonize" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70c24513e34f53b640819f0ac9f705b673fcf4006d7aab8778bee72ebfc89815" +dependencies = [ + "boxfnonce", + "libc", +] + +[[package]] +name = "darling" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2 1.0.47", + "quote 1.0.21", + "strsim", + "syn 1.0.104", +] + +[[package]] +name = "darling_macro" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +dependencies = [ + "darling_core", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + +[[package]] +name = "der" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +dependencies = [ + "const-oid", + "crypto-bigint", + "pem-rfc7468", +] + +[[package]] +name = "der-oid-macro" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c73af209b6a5dc8ca7cbaba720732304792cddc933cfea3d74509c2b1ef2f436" +dependencies = [ + "num-bigint", + "num-traits", + "syn 1.0.104", +] + +[[package]] +name = "der-parser" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cddf120f700b411b2b02ebeb7f04dc0b7c8835909a6c2f52bf72ed0dd3433b2" +dependencies = [ + "der-oid-macro", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der-parser" +version = "8.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2 1.0.47", + "quote 1.0.21", + "rustc_version", + "syn 1.0.104", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.3", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "email-encoding" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34dd14c63662e0206599796cd5e1ad0268ab2b9d19b868d6050d688eba2bbf98" +dependencies = [ + "base64 0.13.1", + "memchr", +] + +[[package]] +name = "email_address" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2153bd83ebc09db15bcbdc3e2194d901804952e3dc96967e1cd3b0c5c32d112" +dependencies = [ + "serde", +] + +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "envy" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +dependencies = [ + "serde", +] + +[[package]] +name = "ethabi" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c98847055d934070b90e806e12d3936b787d0a115068981c1d8dfd5dfef5a5" +dependencies = [ + "ethereum-types", + "hex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb684ac8fa8f6c5759f788862bb22ec6fe3cb392f6bfd08e3c64b603661e3f8" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05136f7057fe789f06e6d41d07b34e6f70d8c86e5693b60f97aaa6553553bdaf" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "exr" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eb5f255b5980bb0c8cf676b675d1a99be40f316881444f44e0462eaf5df5ded" +dependencies = [ + "bit_field", + "flume", + "half 2.1.0", + "lebe", + "miniz_oxide", + "smallvec", + "threadpool", +] + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "flate2" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fluent" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f69378194459db76abd2ce3952b790db103ceb003008d3d50d97c41ff847a7" +dependencies = [ + "fluent-bundle", + "unic-langid", +] + +[[package]] +name = "fluent-bundle" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e242c601dec9711505f6d5bbff5bedd4b61b2469f2e8bb8e57ee7c9747a87ffd" +dependencies = [ + "fluent-langneg", + "fluent-syntax", + "intl-memoizer", + "intl_pluralrules", + "rustc-hash", + "self_cell", + "smallvec", + "unic-langid", +] + +[[package]] +name = "fluent-langneg" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ad0989667548f06ccd0e306ed56b61bd4d35458d54df5ec7587c0e8ed5e94" +dependencies = [ + "unic-langid", +] + +[[package]] +name = "fluent-syntax" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0abed97648395c902868fee9026de96483933faa54ea3b40d652f7dfe61ca78" +dependencies = [ + "thiserror", +] + +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project 1.0.12", + "spin 0.9.4", +] + +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding 2.2.0", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" + +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.11.2", +] + +[[package]] +name = "futures-io" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" + +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "futures-sink" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" + +[[package]] +name = "futures-task" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + +[[package]] +name = "futures-util" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "futures_codec" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" +dependencies = [ + "bytes 0.5.6", + "futures", + "memchr", + "pin-project 0.4.30", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gif" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes 1.3.0", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + +[[package]] +name = "half" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashlink" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +dependencies = [ + "hashbrown 0.11.2", +] + +[[package]] +name = "headers" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" +dependencies = [ + "base64 0.13.1", + "bitflags", + "bytes 1.3.0", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "html5ever" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c213fa6a618dc1da552f54f85cba74b05d8e883c92ec4e89067736938084c26e" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", +] + +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes 1.3.0", + "fnv", + "itoa 1.0.4", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.3.0", + "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +dependencies = [ + "bytes 1.3.0", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.4", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +dependencies = [ + "http", + "hyper", + "log", + "rustls 0.20.7", + "rustls-native-certs", + "tokio", + "tokio-rustls 0.23.4", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "image" +version = "0.24.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945" +dependencies = [ + "bytemuck", + "byteorder", + "color_quant", + "exr", + "gif", + "jpeg-decoder", + "num-rational", + "num-traits", + "png", + "scoped_threadpool", + "tiff", +] + +[[package]] +name = "impl-codec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg 1.1.0", + "hashbrown 0.12.3", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "intl-memoizer" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c310433e4a310918d6ed9243542a6b83ec1183df95dff8f23f87bb88a264a66f" +dependencies = [ + "type-map", + "unic-langid", +] + +[[package]] +name = "intl_pluralrules" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972" +dependencies = [ + "unic-langid", +] + +[[package]] +name = "ipnet" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" + +[[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 = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "itoa" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" + +[[package]] +name = "jpeg-decoder" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" +dependencies = [ + "rayon", +] + +[[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpc-core" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" +dependencies = [ + "futures", + "futures-executor", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "jsonwebtoken" +version = "8.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa4b4af834c6cfd35d8763d359661b90f2e45d8f750a0849156c7f4671af09c" +dependencies = [ + "base64 0.13.1", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "jwt" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98328bb4f360e6b2ceb1f95645602c7014000ef0c3809963df8ad3a3a09f8d99" +dependencies = [ + "base64 0.13.1", + "crypto-mac", + "digest 0.9.0", + "hmac 0.11.0", + "serde", + "serde_json", + "sha2 0.9.9", +] + +[[package]] +name = "keccak" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kstring" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b310ccceade8121d7d77fee406160e457c2f4e7c7982d589da3499bc7ea4526" +dependencies = [ + "serde", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] + +[[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + +[[package]] +name = "lettre" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eabca5e0b4d0e98e7f2243fb5b7520b6af2b65d8f87bcc86f2c75185a6ff243" +dependencies = [ + "async-trait", + "base64 0.13.1", + "email-encoding", + "email_address", + "fastrand", + "futures-io", + "futures-util", + "hostname", + "httpdate", + "idna 0.2.3", + "mime", + "nom", + "once_cell", + "quoted_printable", + "rustls 0.20.7", + "rustls-pemfile 1.0.1", + "socket2", + "tokio", + "tokio-rustls 0.23.4", + "webpki-roots 0.22.5", +] + +[[package]] +name = "libc" +version = "0.2.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" + +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + +[[package]] +name = "libsqlite3-sys" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + +[[package]] +name = "liquid" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26e930310cf4334c4936ae18737500a57739c69442b5c42bae114d619af54b82" +dependencies = [ + "doc-comment", + "kstring", + "liquid-core", + "liquid-derive", + "liquid-lib", + "serde", +] + +[[package]] +name = "liquid-core" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eae470f061bfc53607283906de925ab67ed57a341e827146e3b241699a1dcde" +dependencies = [ + "anymap2", + "chrono", + "itertools", + "kstring", + "liquid-derive", + "num-traits", + "pest", + "pest_derive", + "serde", +] + +[[package]] +name = "liquid-derive" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6510e456700da1afe07603913b0da5a2595f2482656ade07abf719aae7501f0a" +dependencies = [ + "proc-macro2 1.0.47", + "proc-quote", + "syn 1.0.104", +] + +[[package]] +name = "liquid-lib" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6341259f779ff663bdf1fc478bddb2ca51fda25414006dc69395eddfac07e0a4" +dependencies = [ + "chrono", + "itertools", + "kstring", + "liquid-core", + "once_cell", + "percent-encoding 2.2.0", + "regex", + "unicode-segmentation", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg 1.1.0", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897636f9850c3eef4905a5540683ed53dc9393860f0846cab2c2ddf9939862ff" +dependencies = [ + "phf", + "phf_codegen", + "serde", + "serde_derive", + "serde_json", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + +[[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.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.42.0", +] + +[[package]] +name = "multer" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" +dependencies = [ + "bytes 1.3.0", + "encoding_rs", + "futures-util", + "http", + "httparse", + "log", + "memchr", + "mime", + "spin 0.9.4", + "tokio", + "version_check", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2399c9463abc5f909349d8aa9ba080e0b88b3ce2885389b60b993f39b1a56905" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.5", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg 1.1.0", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg 1.1.0", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "oauth2" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaf26a72311c087f8c5ba617c96fac67a5c04f430e716ac8d8ab2de62e23368" +dependencies = [ + "base64 0.13.1", + "chrono", + "getrandom 0.2.8", + "http", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "sha2 0.10.6", + "thiserror", + "url 2.3.1", +] + +[[package]] +name = "oid-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe554cb2393bc784fd678c82c84cc0599c31ceadc7f03a594911f822cb8d1815" +dependencies = [ + "der-parser 6.0.1", +] + +[[package]] +name = "oid-registry" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "open-graph" +version = "0.1.0" +dependencies = [ + "async-recursion", + "flate2", + "html5ever", + "http", + "poem-openapi", + "regex", + "reqwest", + "serde", + "serde_derive", + "serde_json", + "tokio", + "url 2.3.1", +] + +[[package]] +name = "openidconnect" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87af7097640fedbe64718ac1c9b0549d72da747a3f527cd089215f96c6f691d5" +dependencies = [ + "base64 0.13.1", + "chrono", + "http", + "itertools", + "log", + "num-bigint", + "oauth2", + "rand 0.8.5", + "ring", + "serde", + "serde-value", + "serde_derive", + "serde_json", + "serde_path_to_error", + "thiserror", + "url 2.3.1", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "ordered-float" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +dependencies = [ + "num-traits", +] + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parity-scale-codec" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.4", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.42.0", +] + +[[package]] +name = "paste" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" + +[[package]] +name = "pem" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "pem-rfc7468" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "pest" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a" +dependencies = [ + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "423c2ba011d6e27b02b482a3707c773d19aec65cc024637aec44e19652e66f63" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e64e6c2c85031c02fdbd9e5c72845445ca0a724d419aa0bc068ac620c9935c1" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "pest_meta" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57959b91f0a133f89a68be874a5c88ed689c19cd729ecdb5d762ebf16c64d662" +dependencies = [ + "once_cell", + "pest", + "sha1", +] + +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" +dependencies = [ + "phf_shared", + "rand 0.6.5", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" +dependencies = [ + "pin-project-internal 0.4.30", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal 1.0.12", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" +dependencies = [ + "der", + "pkcs8", + "zeroize", +] + +[[package]] +name = "pkcs8" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +dependencies = [ + "der", + "spki", + "zeroize", +] + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "plotters" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" + +[[package]] +name = "plotters-svg" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "png" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" +dependencies = [ + "bitflags", + "crc32fast", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "poem" +version = "1.3.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b43fad06b128ce16d2eab9ff430b7d16c4a68c714eee59fd1c720fefdd71b42b" +dependencies = [ + "anyhow", + "async-trait", + "base64 0.13.1", + "bytes 1.3.0", + "chrono", + "cookie", + "fluent", + "fluent-langneg", + "fluent-syntax", + "futures-util", + "headers", + "http", + "httpdate", + "hyper", + "hyper-rustls", + "intl-memoizer", + "mime", + "mime_guess", + "multer", + "parking_lot 0.12.1", + "percent-encoding 2.2.0", + "pin-project-lite", + "poem-derive", + "quick-xml", + "rcgen 0.10.0", + "regex", + "rfc7239", + "ring", + "rustls-pemfile 1.0.1", + "serde", + "serde_json", + "serde_urlencoded", + "serde_yaml", + "smallvec", + "sse-codec", + "tempfile", + "thiserror", + "time 0.3.17", + "tokio", + "tokio-metrics", + "tokio-rustls 0.23.4", + "tokio-stream", + "tokio-util", + "tracing", + "unic-langid", + "x509-parser 0.14.0", +] + +[[package]] +name = "poem-derive" +version = "1.3.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb409283c448f2e27563e897bf416d89d646d10215b0132312395a32c9bf1c16" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "poem-openapi" +version = "2.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23985d68235c36580d0a5bfa8a00d244fd39cfaa9d0cf09c67c46080aa40e6e" +dependencies = [ + "base64 0.13.1", + "bytes 1.3.0", + "chrono", + "derive_more", + "email_address", + "futures-util", + "mime", + "num-traits", + "poem", + "poem-openapi-derive", + "quick-xml", + "regex", + "serde", + "serde_json", + "serde_urlencoded", + "serde_yaml", + "thiserror", + "tokio", +] + +[[package]] +name = "poem-openapi-derive" +version = "2.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6b126bef41ddde5e6217fd7f8f5af95480fb5faf0625322321706aa5b53949" +dependencies = [ + "darling", + "http", + "indexmap", + "mime", + "proc-macro-crate", + "proc-macro2 1.0.47", + "quote 1.0.21", + "regex", + "syn 1.0.104", + "thiserror", +] + +[[package]] +name = "polyval" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +dependencies = [ + "once_cell", + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-quote" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e84ab161de78c915302ca325a19bee6df272800e2ae1a43fe3ef430bab2a100" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.47", + "proc-quote-impl", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "proc-quote-impl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb3ec628b063cdbcf316e06a8b8c1a541d28fa6c0a8eacd2bfb2b7f49e88aa0" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.47", + "quote 1.0.21", +] + +[[package]] +name = "quick-xml" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +dependencies = [ + "proc-macro2 1.0.47", +] + +[[package]] +name = "quoted_printable" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fee2dce59f7a43418e3382c766554c614e06a552d53a8f07ef499ea4b332c0f" + +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.8", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc 0.1.0", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.3.1", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[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.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rayon" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +dependencies = [ + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "rc-fcm" +version = "0.1.0" +dependencies = [ + "anyhow", + "base64 0.13.1", + "chrono", + "reqwest", + "rustls 0.20.7", + "rustls-pemfile 0.3.0", + "serde", + "serde_json", + "thiserror", + "tokio", +] + +[[package]] +name = "rc-magic-link" +version = "0.1.0" +dependencies = [ + "bincode", + "chrono", + "fastrand", + "hex", + "hmac 0.11.0", + "serde", + "sha2 0.9.9", +] + +[[package]] +name = "rc-msgdb" +version = "0.1.0" +dependencies = [ + "criterion", + "parking_lot 0.12.1", + "sled", + "tempfile", + "thiserror", +] + +[[package]] +name = "rc-token" +version = "0.1.0" +dependencies = [ + "chrono", + "hmac 0.11.0", + "jwt", + "serde", + "sha2 0.9.9", + "textnonce", + "thiserror", +] + +[[package]] +name = "rcgen" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5911d1403f4143c9d56a702069d593e8d0f3fab880a85e103604d0893ea31ba7" +dependencies = [ + "chrono", + "pem", + "ring", + "x509-parser 0.12.0", + "yasna 0.4.0", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time 0.3.17", + "yasna 0.5.0", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "reqwest" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +dependencies = [ + "base64 0.13.1", + "bytes 1.3.0", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding 2.2.0", + "pin-project-lite", + "rustls 0.20.7", + "rustls-pemfile 1.0.1", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls 0.23.4", + "tower-service", + "url 2.3.1", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.22.5", + "winreg", +] + +[[package]] +name = "rfc7239" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "087317b3cf7eb481f13bd9025d729324b7cd068d6f470e2d76d049e191f5ba47" +dependencies = [ + "uncased", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes 1.3.0", + "rustc-hex", +] + +[[package]] +name = "rsa" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" +dependencies = [ + "byteorder", + "digest 0.10.6", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "smallvec", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", +] + +[[package]] +name = "rustls" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +dependencies = [ + "log", + "ring", + "sct 0.7.0", + "webpki 0.22.0", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile 1.0.1", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "ryu" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" + +[[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.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys 0.36.1", +] + +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "secp256k1" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c42e6f1735c5f00f51e43e28d6634141f2bcad10931b2609ddd74a86d751260" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +dependencies = [ + "cc", +] + +[[package]] +name = "security-framework" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "self_cell" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" + +[[package]] +name = "semver" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" + +[[package]] +name = "serde" +version = "1.0.148" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half 1.8.2", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.148" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "serde_json" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +dependencies = [ + "itoa 1.0.4", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184c643044780f7ceb59104cef98a5a6f12cb2288a7bc701ab93a362b49fd47d" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa 1.0.4", + "ryu", + "serde", +] + +[[package]] +name = "serde_yaml" +version = "0.9.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da" +dependencies = [ + "indexmap", + "itoa 1.0.4", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[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 0.3.17", +] + +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" + +[[package]] +name = "slab" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "sled" +version = "0.34.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +dependencies = [ + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot 0.11.2", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b" +dependencies = [ + "sqlx-core", + "sqlx-macros", +] + +[[package]] +name = "sqlx-core" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" +dependencies = [ + "ahash", + "atoi", + "bitflags", + "byteorder", + "bytes 1.3.0", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "hashlink", + "hex", + "indexmap", + "itoa 1.0.4", + "libc", + "libsqlite3-sys", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding 2.2.0", + "rustls 0.19.1", + "serde", + "serde_json", + "sha2 0.10.6", + "smallvec", + "sqlformat", + "sqlx-rt", + "stringprep", + "thiserror", + "tokio-stream", + "url 2.3.1", + "webpki 0.21.4", + "webpki-roots 0.21.1", +] + +[[package]] +name = "sqlx-macros" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1" +dependencies = [ + "dotenv", + "either", + "heck", + "once_cell", + "proc-macro2 1.0.47", + "quote 1.0.21", + "serde_json", + "sha2 0.10.6", + "sqlx-core", + "sqlx-rt", + "syn 1.0.104", + "url 2.3.1", +] + +[[package]] +name = "sqlx-rt" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae" +dependencies = [ + "once_cell", + "tokio", + "tokio-rustls 0.22.0", +] + +[[package]] +name = "sse-codec" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a59f811350c44b4a037aabeb72dc6a9591fc22aa95a036db9a96297c58085a" +dependencies = [ + "bytes 0.5.6", + "futures-io", + "futures_codec", + "memchr", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89c058a82f9fd69b1becf8c274f412281038877c553182f1d02eb027045a2d67" +dependencies = [ + "lazy_static", + "new_debug_unreachable", + "phf_shared", + "precomputed-hash", + "serde", + "string_cache_codegen", + "string_cache_shared", +] + +[[package]] +name = "string_cache_codegen" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2 1.0.47", + "quote 1.0.21", + "string_cache_shared", +] + +[[package]] +name = "string_cache_shared" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" + +[[package]] +name = "stringprep" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + +[[package]] +name = "syn" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", + "unicode-xid 0.2.4", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textnonce" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f8d70cd784ed1dc33106a18998d77758d281dc40dc3e6d050cf0f5286683" +dependencies = [ + "base64 0.12.3", + "rand 0.7.3", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + +[[package]] +name = "thiserror" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "tiff" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17def29300a156c19ae30814710d9c63cd50288a49c6fd3a10ccfbe4cf886fd" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "time" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +dependencies = [ + "itoa 1.0.4", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinystr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aeafdfd935e4a7fe16a91ab711fa52d54df84f9c8f7ca5837a9d1d902ef4c2" +dependencies = [ + "displaydoc", +] + +[[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 = "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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +dependencies = [ + "autocfg 1.1.0", + "bytes 1.3.0", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "tokio-metrics" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcb585a0069b53171684e22d5255984ec30d1c7304fd0a4a9a603ffd8c765cdd" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls 0.19.1", + "tokio", + "webpki 0.21.4", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls 0.20.7", + "tokio", + "webpki 0.22.0", +] + +[[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes 1.3.0", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +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.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "type-map" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d3364c5e96cb2ad1603037ab253ddd34d7fb72a58bdddf4b7350760fc69a46" +dependencies = [ + "rustc-hash", +] + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "ucd-trie" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" + +[[package]] +name = "uint" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "uncased" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622" +dependencies = [ + "version_check", +] + +[[package]] +name = "unic-langid" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "398f9ad7239db44fd0f80fe068d12ff22d78354080332a5077dc6f52f14dcf2f" +dependencies = [ + "unic-langid-impl", + "unic-langid-macros", +] + +[[package]] +name = "unic-langid-impl" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35bfd2f2b8796545b55d7d3fd3e89a0613f68a0d1c8bc28cb7ff96b411a35ff" +dependencies = [ + "tinystr", +] + +[[package]] +name = "unic-langid-macros" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055e618bf694161ffff0466d95cef3e1a5edc59f6ba1888e97801f2b4ebdc4fe" +dependencies = [ + "proc-macro-hack", + "tinystr", + "unic-langid-impl", + "unic-langid-macros-impl", +] + +[[package]] +name = "unic-langid-macros-impl" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f5cdec05b907f4e2f6843f4354f4ce6a5bebe1a56df320a49134944477ce4d8" +dependencies = [ + "proc-macro-hack", + "quote 1.0.21", + "syn 1.0.104", + "unic-langid-impl", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "universal-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "unsafe-libyaml" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna 0.3.0", + "percent-encoding 2.2.0", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "uuid" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +dependencies = [ + "getrandom 0.2.8", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vc-license" +version = "0.1.0" +dependencies = [ + "anyhow", + "bs58", + "chrono", + "digest 0.8.1", + "hex", + "pkcs1", + "rand 0.8.5", + "rsa", + "sha2 0.9.9", + "uuid 1.2.2", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "vocechat-server" +version = "0.3.3" +dependencies = [ + "agora-token", + "anyhow", + "async-stream", + "base64 0.13.1", + "bytes 1.3.0", + "chrono", + "clap 3.2.23", + "daemonize", + "envy", + "fastrand", + "fnv", + "fs2", + "futures-util", + "hex", + "hmac 0.11.0", + "image", + "itertools", + "jsonwebtoken", + "lettre", + "liquid", + "mime_guess", + "num_enum", + "once_cell", + "open-graph", + "openidconnect", + "parking_lot 0.11.2", + "poem", + "poem-openapi", + "rc-fcm", + "rc-magic-link", + "rc-msgdb", + "rc-token", + "rcgen 0.8.14", + "regex", + "reqwest", + "serde", + "serde_json", + "serde_urlencoded", + "sha2 0.9.9", + "sqlx", + "substring", + "tempfile", + "textnonce", + "tokio", + "tokio-stream", + "toml", + "tracing", + "tracing-subscriber", + "unic-langid", + "url 1.7.2", + "uuid 0.8.2", + "vc-license", + "walkdir", + "web3", + "zip", +] + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[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.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote 1.0.21", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.104", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web3" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f258e254752d210b84fe117b31f1e3cc9cbf04c0d747eb7f8cf7cf5e370f6d" +dependencies = [ + "arrayvec", + "derive_more", + "ethabi", + "ethereum-types", + "futures", + "futures-timer", + "hex", + "idna 0.2.3", + "jsonrpc-core", + "log", + "once_cell", + "parking_lot 0.12.1", + "pin-project 1.0.12", + "rlp", + "secp256k1", + "serde", + "serde_json", + "tiny-keccak", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki 0.21.4", +] + +[[package]] +name = "webpki-roots" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +dependencies = [ + "webpki 0.22.0", +] + +[[package]] +name = "weezl" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[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.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "x509-parser" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc90836a84cb72e6934137b1504d0cae304ef5d83904beb0c8d773bbfe256ed" +dependencies = [ + "base64 0.13.1", + "chrono", + "data-encoding", + "der-parser 6.0.1", + "lazy_static", + "nom", + "oid-registry 0.2.0", + "ring", + "rusticata-macros", + "thiserror", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64 0.13.1", + "data-encoding", + "der-parser 8.1.0", + "lazy_static", + "nom", + "oid-registry 0.6.0", + "rusticata-macros", + "thiserror", + "time 0.3.17", +] + +[[package]] +name = "yasna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e262a29d0e61ccf2b6190d7050d4b237535fc76ce4c1210d9caa316f71dffa75" +dependencies = [ + "chrono", +] + +[[package]] +name = "yasna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" +dependencies = [ + "time 0.3.17", +] + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" + +[[package]] +name = "zip" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..33f5c13 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,116 @@ +[package] +name = "vocechat-server" +version = "0.3.3" +edition = "2021" +license = "MIT" + +[dependencies] +rc-msgdb = { path = "./crates/msgdb" } +rc-token = { path = "./crates/token" } +rc-fcm = { path = "./crates/fcm" } +rc-magic-link = { path = "./crates/magic-link" } +vc-license = { path = "./crates/vc-license" } +agora-token = { path = "./crates/agora-token" } +open-graph = { path = "./crates/open-graph", features = ["poem_openapi"] } + +poem = { version = "1.3.51", features = [ + "rustls", + "sse", + "static-files", + "test", + "i18n", + "anyhow", + "acme", + 'tokio-metrics', +] } +poem-openapi = { version = "2.0.23", features = [ + "rapidoc", + "swagger-ui", + "redoc", + "chrono", + "email", + "static-files", +] } +serde = { version = "1.0.132", features = ["derive"] } +tokio = { version = "1.17.0", features = [ + "macros", + "rt-multi-thread", + "sync", + "fs", + "time", +] } +toml = "0.5.8" +tracing = "0.1.29" +tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } +serde_json = "1.0.73" +parking_lot = "0.11.2" +sqlx = { version = "0.5.9", features = [ + "sqlite", + "runtime-tokio-rustls", + "chrono", + "json", +] } +itertools = "0.10.3" +futures-util = "0.3.19" +async-stream = "0.3.2" +image = "0.24.2" +uuid = { version = "0.8.2", features = ["v4"] } +rcgen = { version = "0.8.14", features = ["x509-parser"] } +tokio-stream = "0.1.8" +num_enum = "0.5.5" +unic-langid = "0.9.0" +reqwest = { version = "0.11.8", default-features = false, features = [ + "rustls-tls", + "json", +] } +lettre = { version = "0.10.0-rc.4", default-features = false, features = [ + "smtp-transport", + "hostname", + "builder", + "tokio1", + "tokio1-rustls-tls", +] } +serde_urlencoded = "0.7.1" +liquid = "0.23.1" +fastrand = "1.7.0" +fs2 = "0.4.3" +hmac = "0.11.0" +sha2 = "0.9.0" +substring = "1.4.5" +regex = "1.5.4" +jsonwebtoken = "8.0.1" +openidconnect = "2.4.0" +#openidconnect = { git = "https://github.com/sunli829/openidconnect-rs", rev = "efd006c" } +bytes = "1.1.0" +textnonce = "1.0.0" +web3 = { version = "0.18.0", default-features = false, features = ["signing"] } +clap = { version = "3.1.6", features = ["derive"] } +walkdir = "2.3.2" +base64 = "0.13.0" +zip = { version = "0.6.0", default-features = false, features = ["deflate"] } +mime_guess = "2.0.4" +url = "1.7.2" +once_cell = "1.13.0" +chrono = { version = "0.4.19", features = ["serde"] } +anyhow = "1.0.51" +hex = "0.4.3" +envy = "0.4.2" + +[target.'cfg(not(windows))'.dependencies] +daemonize = "0.4.1" + +[workspace] +members = [ + "crates/msgdb", + "crates/token", + "crates/fcm", + "crates/open-graph", + "crates/vc-license", +] + +[dev-dependencies] +reqwest = { version = "0.11.8", default-features = false, features = [ + "rustls-tls", +] } +tempfile = "3.2.0" +fnv = "1.0.7" diff --git a/README.md b/README.md new file mode 100644 index 0000000..64a9983 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ + +# Re-decentralized the Internet through personal cloud computing. +## VoceChat is the `lightest` chat server prioritizes private hosting! Easy integratation to your app with our open API! +### Quick run + +```bash +docker run -d --restart=always \ + -p 3009:3000 \ + --name vocechat-server \ + Privoce/vocechat-server:latest +``` + +On browser visit: http://localhost:3009/ + + +### Contact us + +Doc: [https://doc.voce.chat](https://doc.voce.chat) +Chat with us: [https://voce.chat](https://voce.chat) +Email: [han@privoce.com](han@privoce.com) +### Welcome your help of any form--code, issues, blog articles, social media shares. + +# Goal + +The goal of Voce is to provide a space owned by "you" on the Internet, just as the name "voce" means in portguese. As cloud computing getting matured, there will be a time in the foreseeable future that netizens like you and me can enjoy the benefit of having a personal cloud space on the Internet--like iCloud, while not only will you have storage, but also a personalized computing layer. + +Why do we need a private cloud space? The short answer is that information will become our private property and means of communication will be under the control of every netizen. + +Digital technologies including Internet and the Web make information duplicable and transferable, yet platforms are controlling the ownership and means of production and transmission of most information (content) on the Internet. We are building Voce as an open-sourced tool (not a platform) to empower smaller groups and individuals to become a platform themselves. When various servers get connected to each other, all the information shared among the servers will be duplicated and become the server owner's private data under private storages. + +# Personal cloud + +We need a "home" as our private property on the Internet, and this home should have features more than just storage. No matter you choose NAS, AWS, Raspberry Pi or your local PC to run VoceChat, it is your own private property--yes, public cloud services like AWS purchased by you is commercially your own property and the data in your cloud is protected from accessing by the public cloud service providers. Features including but not limited to instant messaging, activity posts, private video calls, notes, whiteboard are all desiring and useful on your personal cloud server. Personal cloud is the new PC, and there will be a new software layer with some shared traits--distributed by URL(web app), good API, interoperable profiles. Privoce is currently working on this software layer of personal cloud. + +# Why Rust + +Personal cloud needs efficent solutions. This Rust written server is less than 20MB and runs with great efficiency. Hosting a 20MB private social media server is much more accessible than a 300MB one. Just like cars v. bus, or single family home v. hotels, if Facebook is a grand hotel, VoceChat is like a house. If Matrix and Mastodon are buses, VoceChat is like a car. The next paradigm of the internet is serverless functions + personal storage. Making VoceChat serverless is also a next step. + +# Webhook, bot, and ways to get interconnected (work in progress) + +Social media cannot always stay private if people want new information to be transferred among different servers. The word "social" in social media means multiple nodes communicate with multiple nodes in a synced space (mass to mass). A channel (private or public) should serve the end of this mass to mass data sharing and syncing space. Channel should function as a shared good where members who joined should have the right to store the same chat data (use their server)--this may one day functions like Bitcoin, yet currently, efficiency should be more prioritiezed and admin of the channel could have the right to assign different "power" to members. We have implemented both inbound and outbound webhooks so that it's possible to sync messages from a VoceChat channel to another channel (slack, discord, or VoceChat) though you will need to write your own server side code to personalize this process (this could be troublesome, and again, serverless could be a good solution). + +We also found bot super interesting and personal bot services may replace platforms--e.g., we are training some bots based on GPT api that can be added to VoceChat. + +If you have a proposal on how multiple servers could get interconnected, e.g., should we support Matrix protocal, or other protocal, feel free to share your thougts in the discussions, or directly discuss it with at our chat at https://voce.chat. + +# Free for personal use, require license for non-personal use. + +`VoceChat` is an open-source commercial software. The VoceChat server is the smallest, stablest and most efficient independent chat server on today's market, which is good for integration to your own app. VoceChat official image is free for personal use, which we define as equal or less than 20 registered users, if you want to integrate VoceChat to your own app/site for a larger user base, you have to purchase a license. The license is 49$/version. + +Our team also provide customization service. We also provide resale license for NAS and cloud providers who want to collaborate with us. + +### Project composition: + +| Name | Tech | Project | License | Comment | +| ---------- | ----------------------------------- | --------------------------------------------------------- | ------- | --------------------------------------------------- | +| Server | Rust | [vocechat-server](https://github.com/privoce/vocechat-server-rust) | Big Time Public License | Server supports Linux, Windows, ARM32/64 | +| Server image | Docker, Shell | [vocechat-docker](https://hub.docker.com/r/privoce/vocechat-server/tags) | Creative Commons Attribution-NonCommercial 4.0 International | Official image supports Linux, ARM64 | +| APP Client | Flutter | [vocechat-client](https://github.com/privoce/vocechat-client) | GPLv3 | Client supports Android and IOS platforms | +| Web Client | React | [vocechat-web](https://github.com/privoce/vocechat-web) | GPLv3 | Web App, integrated management | +| Documentation | [docusaurus](https://docusaurus.io) | [vocechat-doc](https://github.com/privoce/vocechat-doc) | GPLv3 | Vocechat document website | + +### Feature list & roadmap + +- [x] DM & Group Chating / 2021-Q4 +- [x] Reply, @ to mention a person / 2021-Q4 +- [x] Images and large files transmission / 2021-Q4 +- [x] Pin / 2022-Q1 +- [x] Forward / 2022-Q1 +- [x] Favorate / 2022-Q1 +- [x] Auto-delete my messages / 2022-Q2 +- [x] Voice (now support agora) / 2022-Q4 +- [x] Video (now support agora)/ 2022-Q4 +- [x] Bot and Webhook (inbound and outbound)/ 2022-Q4 +- [ ] Role based permission control/ Undecided +- [ ] Post, based on ActivityPub/ Undecided +- [ ] Matrix Bridge/ Undecided + + +Chat with us: https://voce.chat +Email: han@privoce.com diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile new file mode 100644 index 0000000..2783ffe --- /dev/null +++ b/build/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine as certs +RUN apk update && apk add ca-certificates + +FROM busybox +COPY --from=certs /etc/ssl/certs /etc/ssl/certs +COPY vocechat-server /home/vocechat-server/vocechat-server +COPY config /home/vocechat-server/config +COPY docker-entrypoint.sh / +RUN chmod +x /docker-entrypoint.sh +ENV VOCECHAT_FCM_PROJECT_ID=""\ + VOCECHAT_FCM_PRIVATE_KEY=""\ + VOCECHAT_FCM_CLIENT_EMAIL=""\ + VOCECHAT_FCM_TOKEN_URI="https://oauth2.googleapis.com/token" +EXPOSE 3000 +WORKDIR /home/vocechat-server +ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/build/docker/build.sh b/build/docker/build.sh new file mode 100755 index 0000000..948b1eb --- /dev/null +++ b/build/docker/build.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd ../../ + +#alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder' +#rust-musl-builder cargo build --release +docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder cargo build --release + +if [ -f ./target/x86_64-unknown-linux-musl/release/vocechat-server ]; then + + cp -rf ./target/x86_64-unknown-linux-musl/release/vocechat-server build/docker/vocechat-server + cp -rf config build/docker/ + + cd build/docker + + # sudo docker login -u vocechat -p xxxxxx + # build arm64 + sudo docker build --platform=linux/amd64 -t vocechat-server:latest . + docker tag vocechat-server:latest Privoce/vocechat-server:latest + docker push Privoce/vocechat-server:latest + + # build arrch64 + cp -rf ./target/aarch64-unknown-linux-musl/release/vocechat-server build/docker/vocechat-server + sudo docker build --platform=linux/arm64 -t vocechat-server:latest-arm64 . + docker tag vocechat-server:latest-arm64 Privoce/vocechat-server:latest-arm64 + docker push Privoce/vocechat-server:latest-arm64 + #rm -rf ./config + +fi \ No newline at end of file diff --git a/build/docker/deploy.sh b/build/docker/deploy.sh new file mode 100644 index 0000000..0cc6cc3 --- /dev/null +++ b/build/docker/deploy.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +mkdir -p ~/.vocechat-server/data/cert +docker stop vocechat-server +docker rm vocechat-server +docker pull Privoce/vocechat-server:latest +docker run -d --restart=always \ + -p 443:443 \ + --name vocechat-server \ + -v ~/.vocechat-server/data:/home/vocechat-server/data \ + Privoce/vocechat-server:latest \ + --network.bind "0.0.0.0:443" \ + --network.domain "chat.domain.com" \ + --network.tls.type "acme_tls_alpn_01" \ + --network.tls.acme.directory_url "https://acme-v02.api.letsencrypt.org/directory" \ + --network.tls.acme.cache_path "/home/vocechat-server/data/cert" +docker logs -f vocechat-server \ No newline at end of file diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml new file mode 100644 index 0000000..bf5fb9e --- /dev/null +++ b/build/docker/docker-compose.yaml @@ -0,0 +1,27 @@ +version: '3' +services: + vocechat: + image: vocechat-server:latest + container_name: vocechat-server + build: + context: . + dockerfile: Dockerfile + command: + "/docker-entrypoint.sh" + - "--network.bind" + - "0.0.0.0:3000" + - "--network.domain" + - "localhost" +# environment: +# - UID=1000 +# - GID=1000 +# - ADMIN_USER=admin +# - ADMIN_PASSWORD=123456 +# - DOMAIN=localhost + volumes: + - /share/data/docker/vocechat-server/data:/home/vocechat-server/data + expose: + - 3000 + ports: + - 3000:3000/tcp + restart: always \ No newline at end of file diff --git a/build/docker/docker-entrypoint.sh b/build/docker/docker-entrypoint.sh new file mode 100644 index 0000000..8258aa9 --- /dev/null +++ b/build/docker/docker-entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +#uid=${UID:=$(id -u)} +#gid=${GID:=$(id -g)} +#admin_user=${ADMIN_USER:="admin"} +#admin_password=${ADMIN_PASSWORD:="123456"} +#domain=${DOMAIN:=""} +# +#if test ! -z $domain; then +# sed -i "s/# domain = .*\$/domain = \"$domain\"/ig" /home/vocechat-server/config/config.toml +#fi +# +#if grep -q "name = \"$admin_user\"" /home/vocechat-server/config/config.toml; then +#cat <> /home/vocechat-server/config/config.toml +#[[user]] +#name = "$admin_user" +#password = "$admin_password" +#email = "$admin_user@$domain" +#is_admin = true +#EOT +#fi + +cd /home/vocechat-server/ +cmd="./vocechat-server" +if test $# -gt 0; then + case "$1" in + *.toml) + cmd="./vocechat-server $@" + break + ;; + --*) + cmd="./vocechat-server $@" + break + ;; + *) cmd="$@";; + esac +fi +echo $cmd +$cmd +# exec "$cmd" diff --git a/build/shell/install.sh b/build/shell/install.sh new file mode 100755 index 0000000..526678c --- /dev/null +++ b/build/shell/install.sh @@ -0,0 +1,238 @@ +#!/bin/sh +# auto-check version requires repo to be public +# VOCECHAT_SERVER_VERION=`curl -s https://github.com/Privoce/vocechat-server/releases/latest | sed "s/.*tag\/\(.*\)\".*/\1/ig"` +VOCECHAT_SERVER_VERION="v0.3.1" +ARCH=`uname -m` +OS=`uname` +PLATFORM="x86_64-unknown-linux-musl" +WORK_DIR="" +BIND_PORT=3000 +DOMAIN="" +HTTPS_ON="" +#PWD=`pwd` + +echo " ┌────────────────────────────────────────────────────────────────┠" +echo " │ vocechat-server $VOCECHAT_SERVER_VERION installation guide │ " +echo " └────────────────────────────────────────────────────────────────┘ " + +x_read() { + read -r $1 < /dev/tty +} + + + +have_command() { + if command -v $1 >/dev/null 2>&1; then + return 0 + else + return 1 + fi +} + +check_env() { + if test "$OS" != "Darwin"; then + if have_command apt; then + apt install -y unzip + fi + fi + echo "" +} + +error_exit() { + echo -e "\033[31m$1\033[0m" + exit +} + +sed_replace() { + if test "$OS" = "Darwin" ; then + sed -i "" $* + else + sed -i $* + fi +} +random_64() { + for i in {1..64} + do + echo $(( RANDOM % 10 )) | xargs echo -n + done +} +is_writable() +{ + if test ! -d $1; then + mkdir -p $1; + fi + if test -w $1; then + return 0 + fi + return 1 +} +port_in_use() +{ + n=`netstat -nlpt|grep ":$1 "|wc -l` + if test $n -gt 0; then + return 0 + else + return 1 + fi +} + +input_writable_dir() +{ + WORK_DIR="" + for workdir in /share/Download ~ `pwd`; do + if test -d $workdir; then + workdir2="$workdir/.vocechat-server" + if is_writable $workdir2; then + WORK_DIR=$workdir2; + break; + fi + fi + done + echo -e "Installation path (Default: \033[31m$WORK_DIR\033[0m):" + while true; do + x_read workdir + if test "$workdir" != ""; then + WORK_DIR=$workdir + fi + if test ! -w $WORK_DIR; then + echo "$WORK_DIR is unwritable! " + else + break + fi + done +} + +input_domain() +{ + echo "Please input domain (Default empty):" + x_read DOMAIN + if test "$DOMAIN" != ""; then + input_https_on + fi +} + +input_https_on() +{ + echo "Enable HTTPS: [y,n] (Default n)" + x_read HTTPS_ON + HTTPS_ON=$(echo $HTTPS_ON|tr [A-Z] [a-z]) + if test "$HTTPS_ON" = "y"; then + if port_in_use 443; then + error_exit "Port 443 is in use! Enable SSL requires opening port 443." + fi + fi +} + +install_as_service() +{ + echo "Start with system launched: [y,n] (Default: n)" + x_read AS_SERVICE + if test "$AS_SERVICE" = "y"; then + if test "$OS" = "Darwin"; then + cat >> ~/Library/LaunchAgents/com.vocechat.server.plist << EOF + + + + + Label + com.vocechat.server.plist + ProgramArguments + + bin/vocechat-server + config/config.toml + + RunAtLoad + + + +EOF + fi + fi +} + +check_env + +input_writable_dir + +cd $WORK_DIR +if test -d $WORK_DIR/data/db; then + rm -rf $WORK_DIR/data +fi + +input_domain + + +case $ARCH in + arm64) + if test `uname` = "Darwin"; then + PLATFORM="aarch64-apple-darwin" + else + PLATFORM="aarch64-unknown-linux-musl" + fi + ;; + aarch64) + PLATFORM="aarch64-unknown-linux-musl" + ;; + armv7l | arm) + PLATFORM="armv7-unknown-linux-musleabihf" + ;; + x86_64) + if test `uname` = "Darwin"; then + PLATFORM="x86_64-apple-darwin" + else + PLATFORM="x86_64-unknown-linux-musl" + fi + ;; + *) + echo -n "error: not supportted arch $(ARCH)!" + exit + ;; +esac + +echo -e "Detected platform: \033[31m$PLATFORM\033[0m." + +BIN_NAME="vocechat-server-$VOCECHAT_SERVER_VERION-$PLATFORM.zip" +BIN_URL="https://s.voce.chat/$BIN_NAME" +echo "Downloading URL: $BIN_URL" + +# clear old data: +kill `pidof vocechat-server` 2>/dev/null +if test ! -f vocechat-server.zip; then + curl --progress-bar -f $BIN_URL -o vocechat-server.zip || exit +fi +unzip -oq vocechat-server.zip || exit +chmod a+x vocechat-server + + +curl -f "https://s.voce.chat/vocechat-server.sh" -o vocechat-server.sh || exit +if test "$DOMAIN" != ""; then + sed -i "s/# domain = .*\$/domain = \"$DOMAIN\"/ig" config/config.toml + echo $HTTPS_ON + if test "$HTTPS_ON" = "y"; then + BIND_PORT=443 + sed -i "s/bind = .*\$/bind = \"0.0.0.0:$BIND_PORT\"/ig" config/config.toml + sed -i ':a;N;$!ba;s/# \[network\.tls\]/[network.tls]/4' config/config.toml + sed -i ':a;N;$!ba;s/# type = \"acme_tls_alpn_01\"/type = "acme_tls_alpn_01"/1' config/config.toml + sed -i ':a;N;$!ba;s/# cache_path/cache_path/2' config/config.toml + mkdir -p $WORK_DIR/data/cert + # tr '\n' '^' < config/config.toml | sed 's/# \[network\.tls\]/[network.tls]/4' | tr '^' '\n' > config/config2.toml + fi +fi + +sed_replace "s#WORKDIR=.*\$#WORKDIR=\"$WORK_DIR\"#ig" vocechat-server.sh + +chmod a+x vocechat-server.sh + +if test -d /etc/init.d/; then + cp -rf vocechat-server.sh /etc/init.d/ + echo "install done! " + echo "run: /etc/init.d/vocechat-server.sh start|stop|restart" +else + echo "/etc/init.d/ does not exists, refused! please try Ubuntu or CentOS, you can contact han@privoce.com." + exit + # echo "run: /etc/init.d/vocechat-server.sh start|stop|restart" +fi + +export PATH=$PATH:$WORK_DIR +echo "export PATH=\$PATH:$WORK_DIR" >> /etc/profile +#cd $PWD diff --git a/build/shell/vocechat-server.sh b/build/shell/vocechat-server.sh new file mode 100644 index 0000000..e29c5fd --- /dev/null +++ b/build/shell/vocechat-server.sh @@ -0,0 +1,37 @@ +#!/bin/sh +START=90 +STOP=10 +RETVAL=0 + +PWD=`pwd` +WORKDIR="" + +cd $WORKDIR +mkdir data/wwwroot +case "$1" in + start) + echo -n "Starting vocechat-server:" + ./vocechat-server config/config.toml --daemon --stdout=data/vocechat-server.log 2>&1 + echo -e "\033[32m [OK] \033[0m" + ;; + stop) + echo -n "Shutting down vocechat-server:" + kill `pidof vocechat-server` 2>&1 + echo -e "\033[32m [OK] \033[0m" + RETVAL=$? + ;; + restart) + $0 stop + $0 start + RETVAL=$? + ;; + log) + tail -f $WORKDIR/data/vocechat-server.log + ;; + *) + echo "Usage $0 {start|stop|restart}" + cd $PWD + exit 1 +esac + +cd $PWD \ No newline at end of file diff --git a/cert/ca.crt b/cert/ca.crt new file mode 100644 index 0000000..224d792 --- /dev/null +++ b/cert/ca.crt @@ -0,0 +1,32 @@ +-----BEGIN CERTIFICATE----- +MIIFhjCCA24CCQCCJqbypeaQ3zANBgkqhkiG9w0BAQsFADCBhDELMAkGA1UEBhMC +Q04xEDAOBgNVBAgMB0JlaWppbmcxEDAOBgNVBAcMB0JlaWppbmcxETAPBgNVBAoM +CFJ1c3RjaGF0MRswGQYDVQQDDBJSdXN0Y2hhdCBTZXJ2ZXIgQ0ExITAfBgkqhkiG +9w0BCQEWEmFkbWluQHJ1c3RjaGF0LmNvbTAeFw0yMTEyMjkwNTE2NDhaFw0zMTEy +MjcwNTE2NDhaMIGEMQswCQYDVQQGEwJDTjEQMA4GA1UECAwHQmVpamluZzEQMA4G +A1UEBwwHQmVpamluZzERMA8GA1UECgwIUnVzdGNoYXQxGzAZBgNVBAMMElJ1c3Rj +aGF0IFNlcnZlciBDQTEhMB8GCSqGSIb3DQEJARYSYWRtaW5AcnVzdGNoYXQuY29t +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4mGgT49d1jwhZIp/ezop +1o+kJChww+roIYVBL1J71cqWd6E+w9KeSE9UT3HYsXvM9q2XwcFjyZCT0eko3evW +E8Tt/C8jlO/gjhAiNQu20RtPMELwLnexq3+3zpg8lAVywtAwTJk29/uP3/13jraR +PsbRqlydFyikQwlswV6nCTwUXTN3IjJdf/Ej58G+D4+CDzBpsA1hlzt5q0dGOVRK +1zUvwJ0Urz48unDGVHSl6rgsww6v7H2GCiCspRSdXBvrqJKM+bJoU0R+ITRD90Po +z725NBcdxYtOP1NBbNnihqjvjagvn1ODy1bGtkGBUjRuBEjSn2A8UxHO5999lZQ4 +vLWPa5YI9Kt6GQ23lx9NE11DsAnzvfVtJ3Sr5J1F7LgX8+XNYUH5LrM27/eFgOSX +HMbv3FNJ8kbaHuAlXxhEQFTub7qIwF++U+kyKwZUMWHa392Dq1ejI33cOkfx5HdS +fPGcvmskE0R+dE+fI/g/t05i5ayp3csaLJlcgu0IFdO4coKhPte1+Zq1OEd/Kh+w +/DqETlyR0Ga+kmzE+Y02yQTXvIlzJZ/CYdbz8dC27KAXMCI9A1ra6oHs+VhvMmrn +MIk96uWEbir0RdJcDrZgnAJmh1/wkPPbS+R2Qwbj70qOpFCDg0B9r7ydhybbP0op +REvvOBKaDdDMtw5bEN1/wZUCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAkSdY7ttI +4Fj6tUKV8447fX2XRBO5GZo2ZtuB+udE3ioRkO/KOrvaSm0GwqceFKnmebk5OR2P +yZNC3caZ9/Z+M0ebkA1XlK6tsdVCY8jhpct2gg9yRlMdOMIkvhkLaXCBejy8+FDO +ito5Aq67WB8jUfpWl2vw51oDVGdJjjt08AIxXzcYzngGPGxvonh9aD5oMoaqz5ak +2WR7FwUkYCMT9KMAd4orSYykBdJMfu/AfTooTOMrztdUkznC46L3Wlr6+sJgWW+Q +nnxn8drqeHDLRk/aFvRjJa3nOquqBwLSGgNJfiUfiMKfzswPvujhGSeQushe7Gbu +9c8Jho5ELgAqqfx0EAKqsgx3/Pq4o1vgmaHHE/eOpMdrpRaCHg403Z0kAr1cAsgQ +4puOEdt2mWVA0Lle5NRwkL/j5zceBQr7PLtEN9RuxpaQQI7xo3Lf+lD61PdL385F +zQlDygoXtnrlBCSHEat49erGov15uqf1S8yF4rR375jwW59JJGHdaL8SLoI/msIg +aD0nWUzS2TPD/FrniI58uHo+zuxC2spAigFeI6vkqRQCKVrWF7002Q6e+eukIySN +eVY8Ilq8+4+wF1lTf2qSkbRkHZDt6SMyP8w7bOUgZ0pIJEfYcQWtC6WreCQ4GyjI +CxSyHWv+MGOb/MlIx7XDW/GtErMHLpGgPvE= +-----END CERTIFICATE----- diff --git a/cert/ca.key b/cert/ca.key new file mode 100644 index 0000000..4cfc3af --- /dev/null +++ b/cert/ca.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDiYaBPj13WPCFk +in97OinWj6QkKHDD6ughhUEvUnvVypZ3oT7D0p5IT1RPcdixe8z2rZfBwWPJkJPR +6Sjd69YTxO38LyOU7+COECI1C7bRG08wQvAud7Grf7fOmDyUBXLC0DBMmTb3+4/f +/XeOtpE+xtGqXJ0XKKRDCWzBXqcJPBRdM3ciMl1/8SPnwb4Pj4IPMGmwDWGXO3mr +R0Y5VErXNS/AnRSvPjy6cMZUdKXquCzDDq/sfYYKIKylFJ1cG+uokoz5smhTRH4h +NEP3Q+jPvbk0Fx3Fi04/U0Fs2eKGqO+NqC+fU4PLVsa2QYFSNG4ESNKfYDxTEc7n +332VlDi8tY9rlgj0q3oZDbeXH00TXUOwCfO99W0ndKvknUXsuBfz5c1hQfkuszbv +94WA5Jccxu/cU0nyRtoe4CVfGERAVO5vuojAX75T6TIrBlQxYdrf3YOrV6Mjfdw6 +R/Hkd1J88Zy+ayQTRH50T58j+D+3TmLlrKndyxosmVyC7QgV07hygqE+17X5mrU4 +R38qH7D8OoROXJHQZr6SbMT5jTbJBNe8iXMln8Jh1vPx0LbsoBcwIj0DWtrqgez5 +WG8yaucwiT3q5YRuKvRF0lwOtmCcAmaHX/CQ89tL5HZDBuPvSo6kUIODQH2vvJ2H +Jts/SilES+84EpoN0My3DlsQ3X/BlQIDAQABAoICAQCzg5j9HgHaPap5ML5weCnv +I86UgaESKvfShPmwzea3HMP+r1W3MRAk5QtFSFD+RN6+id96XKGFl+kwHoUyna4P +1SymurarhyB5Zt/JUrWw0cgUzC/rmSzBgzC9WclH054yT6bNRv3o3Yo0o6kn+Svq +LPzb7D8Bu0+ufQ3JtQYd849ubL4+1tN//jdrsx3E9xa6driIS8QkiZwsrwNHuMj0 +KQ/p3GYnpOHBMmaDWFCtdUjBkKb+kHc3Frvw2A0EmntgHH5ADzJdPUYLjIeMz0QR +YDA5107bdGEjJCEQcSMJh3MW0NSasj4jg3dl1UH4bu0C5sBmc4jCkq+Q/Y93iqcF +t57rBz9pcj/i6STaGRjl8ptC03O2dF6VBConCHCPcBMs8LDxJ7qbPWusRKXwbvWI +kGQba/5PxPjDzVrf+ubXEtRhMDdCgnfLb8N313e9X9mBhTIkUX1hH5SFxZwJSuYt +3TjobNVSfacjYAyjYHH/VjJB61j21BcEOuqpOqxh6Tf0bAEh014g7qCuIFCQwzxm +FkpZNQPOTFk+bty4l9/brllvXoarJ2O9/L7mWtLq9d2AjRzU5XVCRZtPtovGyG6J +qZFfP4kieU7E/gnVfCKuL4jMgkhlUtgAlfDVucEFCSFp3zVi/w8JUSmmCDIPEqmw +BQ5aNBDtQmH7dVgQGPL6gQKCAQEA+ecsuhMMpdo11DCW+8T5XPFO0XEnDW/9j0Yf +VAcOmw+GLtlJYTZzhqcD1ohVyQML8K0bn071pgt9tg1nwHk/oMDqE1nUOYq1+B9n +ZNIUyKCSN+qc5Jg3O5J14CtPdGrkQH5CYw3Kp/lFBSIzvyaswblRgqO4X/Yc7sSF +qwdleFgt8AyCcAqYi1g68gZ4P6VaN9ETvaG7rSbA6XaMMgiJ1yMWJ29OjXbCOWqi +I+XK3jHWHKjmDYXW1hxo8mOTNNRBk4G4VzAWHVOZ71DoI2gL2aQP05bZMIwaWPq6 +aafVtHdLjXVX6ZO4bcerjN2pegbyaeWq++1OpjFxoU8tCuNb9QKCAQEA5+eKp6x3 +Rak9xkjQOAJUnQgzpEnkOrxk/+iUeKkT+Kf97yjuMhcfry+L5Iapsmm/rSPXynB+ +PXJi2YpEi2YWq6iUKECjQ+iu00f/IzAHw3bHNSN+ndTd4U55iMQjpjlttd5u63kb +k/Il5CZpLQwElUZsJu+b2Xbx2Xwm06lyQbPLjOxXTQ3usunqCKWZmIig/MqrYCGO +aVm8p9jFoyM8ApUwWdFjtDWExCWjRVg72L2P61DscIShBNMsW15J5YWvOMDeRbfY +LnzkbvzO+FPqGix9RtwSakjqadsC48WIJmG8BJ6LeTBgaxJLS3MjZdtDgBEhiCyn +bSupzT52kEvrIQKCAQEA1SnJzxa8rSQK0mp3/14vToZPMvwP0bh7UqD/zA8Q+Fcv +n/qcSx3FQVBpR6+XbRT6NFuUujkB9JbMrmOU4msKSTcE82imTEbznSg8a5V/QPsm +fifTmHH2ewwdHBAVgDpFZHXObuuut8U6iHx6I0z8A2ruCj9Y4BHw8AIV+qMefJ7K +4H3rLWL8Z6/k59l47OFAqWfgLNsuWS47U2lZgLwjx60YEp8xJB3u4kcA8xnqB8n+ +1weC5HoLnSsyob8qK9/557a45TYRRwauwaIDwV/Y69az4UpFDNIVD10fcUxGT9+K +RKmZSZZFtO6ieFADZiFS2d2cEbSEZ+K5CF2fEDCLmQKCAQAzW7H3ZFid0tddfG6w +mMOIa3KUZdDnuSVdD3MiLb/Ah+PS/WuTKE/aClue5rvaSVUr0Q5PRQ6QKS7/IoH/ +pUJMDe+R4o7F0Vg2bnFwp4hwn3OKryuxZJ0m8qwzv8xtWbaUWoiSGaYj47LEjkUo +tsqlDI2TKemIBbGWCsrGgXZOWrUvpn/HDtjYQrmT5KjZgRi2I2REy+mwJzGCsp1C +feEiaUvl+FtuY5PdpMA98UZ/v6uJ38gdOyI14VanfYA8FpkxpnUTV53G3d3xPofP +szXbShMMiFyDsVZIzzoam3qFlYuAMmSNGEuiKtEGCp/CRQbz69dTQyBpKwxV6glz +93xBAoIBABr04VG9jN+Sk2G9v9ZCKr/t2K6Cku/4mjbkgTcHGauOF/urSWksoadj +rhyQbik3XgG+8u+CI9hH/FxBK9f6aypn2/vtgzM+r8DuBn9AX7qK2hVvnUaI78/Y +Hb0Ef7P8nwVbGYLv4Sw96yXJLa4FT0L2H/hRmNq11uMIKrQ+88+RK9JcZstn9oWV +0AVYYXm83so+BtW6wwLflPEWicdpyMwd4qrJq6MHNhWwtGzTq2gqRpfuZvlYzp9D +OQDWsStE54+m79Ymwi7HJV3frJeymXjTzWt/dXTfLtxkxVQOieSm/KDpvmiQzxGD +TgdMxd0hKCEjjYqMbTgv5yjurUi9dD4= +-----END PRIVATE KEY----- diff --git a/cert/create.sh b/cert/create.sh new file mode 100644 index 0000000..ba6fa7e --- /dev/null +++ b/cert/create.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Create private key file +openssl genpkey -algorithm RSA \ + -pkeyopt rsa_keygen_bits:4096 \ + -pkeyopt rsa_keygen_pubexp:65537 | \ + openssl pkcs8 -topk8 -nocrypt -outform pem > voce.chat.key + +# generate CSR file +openssl req -subj "/C=US/ST=Arizona/L=Scottsdale/O=Vocechat,Inc./CN=voce.chat/emailAddress=api.privoce@gmail.com" \ + -new -days 3650 -key voce.chat.key -out voce.chat.csr + +# generate self-sign file +openssl x509 -signkey voce.chat.key -in voce.chat.csr -req -days 365 -out voce.chat.crt + +# view certificate +openssl req -text -noout -verify -in voce.chat.csr \ No newline at end of file diff --git a/config/config-tls.toml b/config/config-tls.toml new file mode 100644 index 0000000..1e08546 --- /dev/null +++ b/config/config-tls.toml @@ -0,0 +1,7 @@ +[system] +server_key = "a secret key" +data_dir = "./data" + +[network] +bind = "0.0.0.0:3000" +tls = true diff --git a/config/config.toml b/config/config.toml new file mode 100644 index 0000000..09b2949 --- /dev/null +++ b/config/config.toml @@ -0,0 +1,46 @@ +# webclient_url = "https://github.com/Privoce/vocechat-web/releases/latest/download" +webclient_url = "https://s.voce.chat/web_client/v0.3.x" + +[system] +data_dir = "./data" +token_expiry_seconds = 300 +refresh_token_expiry_seconds = 604800 +# magic_token_expiry_seconds = 600 + +[network] +bind = "0.0.0.0:3000" +# domain = "chat.privoce.com" +frontend_url = "http://1.2.3.4:4000" + +# [network.tls] +# type = "self_signed" + +# [network.tls] +# type = "certificate" +# cert = "...." +# key = "...." +# path = "./cert/" + +# [network.tls] +# type = "acme_http_01" +# directory_url = "https://acme-v02.api.letsencrypt.org/directory" +# http_bind = "0.0.0.0:80" +# cache_path = "./data/cert" + +# [network.tls] +# type = "acme_tls_alpn_01" +# directory_url = "https://acme-v02.api.letsencrypt.org/directory" +# cache_path = "./data/cert" + +[template.register_by_email] +subject = "Register code" +file = "templates/register_by_email.html" + +[template.login_by_email] +subject = "Your sign-in link for Vocechat" +file = "templates/login_by_email.html" + +#[[user]] +#name = "Guest" +#password = "123456" +#email = "guest@voce.chat" diff --git a/config/templates/login_by_email.html b/config/templates/login_by_email.html new file mode 100644 index 0000000..64dbf94 --- /dev/null +++ b/config/templates/login_by_email.html @@ -0,0 +1,223 @@ + + + + + + + VoceChat Link + + + + +
+ +
+
+ Click the button below to log in to Vocechat. +
+
+ This button will expire in 3 minutes. +
+
+ Login to + Vocechat +
+
Button not showing? Click + here +
+
Confirming this request will securely log you in using + {{ email }} + .
+
+
+ + + \ No newline at end of file diff --git a/config/templates/register_by_email.html b/config/templates/register_by_email.html new file mode 100644 index 0000000..7cf5e4a --- /dev/null +++ b/config/templates/register_by_email.html @@ -0,0 +1,224 @@ + + + + + + + VoceChat Link + + + + +
+ +
+
+ Click the button below to log in to Vocechat. +
+
+ This button will expire in 3 minutes. +
+
+ Login to + Vocechat +
+
Button not showing? Click here +
+
Confirming this request will securely log you in using + {{ email }} + .
+
+
+ + + \ No newline at end of file diff --git a/crates/agora-token/Cargo.toml b/crates/agora-token/Cargo.toml new file mode 100644 index 0000000..1ec29c4 --- /dev/null +++ b/crates/agora-token/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "agora-token" +version = "0.1.0" +edition = "2021" + +[dependencies] +base64 = "0.13.0" +checksum = "0.2.1" +fastrand = "1.6.0" +hmac = "0.11.0" +sha2 = "0.9" +thiserror = "1.0.30" diff --git a/crates/agora-token/src/lib.rs b/crates/agora-token/src/lib.rs new file mode 100644 index 0000000..3284d1e --- /dev/null +++ b/crates/agora-token/src/lib.rs @@ -0,0 +1,98 @@ +use std::time::{SystemTime, UNIX_EPOCH}; + +use hmac::{Mac, NewMac}; +use sha2::Sha256; + +const VERSION: &str = "006"; + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)] +enum Privileges { + JoinChannel = 1, + PublishAudioStream = 2, + PublishVideoStream = 3, + PublishDataStream = 4, +} + +fn create_access_token( + app_id: &str, + app_certificate: &str, + channel_name: &str, + uid: &str, + privileges: &[Privileges], +) -> String { + let ts = (SystemTime::now().duration_since(UNIX_EPOCH)) + .unwrap() + .as_secs() as u32 + + 24 * 3600; + let salt = fastrand::u32(1..99999999); + let mut buf_m = Vec::new(); + + buf_m.extend_from_slice(&salt.to_le_bytes()); + buf_m.extend_from_slice(&ts.to_le_bytes()); + + buf_m.extend_from_slice(&(privileges.len() as u16).to_le_bytes()); + let mut privileges = privileges.to_vec(); + privileges.sort(); + + for k in privileges { + buf_m.extend_from_slice(&(k as u16).to_le_bytes()); + buf_m.extend_from_slice(&ts.to_le_bytes()); + } + + let mut buf_val = Vec::new(); + buf_val.extend(format!("{}{}{}", app_id, channel_name, uid).as_bytes()); + buf_val.extend(&buf_m); + + let buf_sig = { + let mut mac = hmac::Hmac::::new_from_slice(app_certificate.as_bytes()) + .expect("valid app certificate"); + mac.update(&buf_val); + mac.finalize().into_bytes() + }; + + let crc_channel_name = crc32(channel_name.as_bytes()); + let crc_uid = crc32(uid.as_bytes()); + + let mut buf_content = Vec::new(); + pack_bytes(&mut buf_content, &buf_sig); + buf_content.extend_from_slice(&crc_channel_name.to_le_bytes()); + buf_content.extend_from_slice(&crc_uid.to_le_bytes()); + pack_bytes(&mut buf_content, &buf_m); + + format!("{}{}{}", VERSION, app_id, base64::encode(buf_content)) +} + +fn crc32(data: &[u8]) -> u32 { + let mut hasher = checksum::crc32::Crc32::new(); + hasher.checksum(data) +} + +fn pack_bytes(data: &mut Vec, s: &[u8]) { + data.extend_from_slice(&(s.len() as u16).to_le_bytes()); + data.extend_from_slice(s); +} + +pub fn create_rtc_token( + app_id: &str, + app_certificate: &str, + channel_name: &str, + uid: u32, +) -> String { + let uid = if uid == 0 { + String::new() + } else { + uid.to_string() + }; + create_access_token( + app_id, + app_certificate, + channel_name, + &uid, + &[ + Privileges::JoinChannel, + Privileges::PublishAudioStream, + Privileges::PublishVideoStream, + Privileges::PublishDataStream, + ], + ) +} diff --git a/crates/fcm/Cargo.toml b/crates/fcm/Cargo.toml new file mode 100644 index 0000000..50525b0 --- /dev/null +++ b/crates/fcm/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "rc-fcm" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.52" +base64 = "0.13.0" +chrono = "0.4.19" +reqwest = { version = "0.11.8", default-features = false, features = ["rustls-tls", "json"] } +rustls = "0.20.2" +rustls-pemfile = "0.3.0" +serde = { version = "1.0.132", features = ["derive"] } +serde_json = "1.0.73" +thiserror = "1.0.30" +tokio = { version = "1.15.0", features = ["sync"] } + +[dev-dependencies] +tokio = { version = "1.15.0", features = ["macros", "rt-multi-thread"] } diff --git a/crates/fcm/src/client.rs b/crates/fcm/src/client.rs new file mode 100644 index 0000000..3fb43c3 --- /dev/null +++ b/crates/fcm/src/client.rs @@ -0,0 +1,153 @@ +use anyhow::Result; +use chrono::{DateTime, Duration, Utc}; +use reqwest::Client; +use serde::{Deserialize, Deserializer, Serialize}; +use tokio::sync::Mutex; + +use crate::{ + jwt::{Claims, JwtSigner}, + ApplicationCredentials, +}; + +const GRANT_TYPE: &str = "urn:ietf:params:oauth:grant-type:jwt-bearer"; +const SCOPES: &[&str] = &["https://www.googleapis.com/auth/firebase.messaging"]; + +#[derive(Deserialize, Debug)] +struct Token { + access_token: String, + #[serde( + deserialize_with = "deserialize_expires_in", + rename(deserialize = "expires_in") + )] + expires_at: Option>, +} + +impl Token { + fn has_expired(&self) -> bool { + self.expires_at + .map(|expiration_time| expiration_time - Duration::seconds(30) <= Utc::now()) + .unwrap_or(false) + } + + fn as_str(&self) -> &str { + &self.access_token + } +} + +fn deserialize_expires_in<'de, D>(deserializer: D) -> Result>, D::Error> +where + D: Deserializer<'de>, +{ + let s: Option = Deserialize::deserialize(deserializer)?; + Ok(s.map(|seconds_from_now| Utc::now() + Duration::seconds(seconds_from_now))) +} + +pub struct FcmClient { + client: Client, + credentials: ApplicationCredentials, + token: Mutex>, +} + +impl FcmClient { + pub fn new(credentials: ApplicationCredentials) -> Self { + Self { + client: Client::new(), + credentials, + token: Default::default(), + } + } + + pub fn credentials(&self) -> &ApplicationCredentials { + &self.credentials + } + + async fn refresh_token(&self) -> Result { + let signer = JwtSigner::new(&self.credentials.private_key)?; + let claims = Claims::new(&self.credentials, SCOPES, None); + let signed = signer.sign_claims(&claims)?; + let token = self + .client + .post(&self.credentials.token_uri) + .form(&[("grant_type", GRANT_TYPE), ("assertion", signed.as_str())]) + .send() + .await? + .error_for_status()? + .json::() + .await?; + Ok(token) + } + + pub async fn send( + &self, + device_token: &str, + title: &str, + message: &str, + data: &impl Serialize, + ) -> Result<()> { + let token = loop { + let mut token = self.token.lock().await; + match &*token { + Some(token) if !token.has_expired() => break token.as_str().to_string(), + _ => *token = Some(self.refresh_token().await?), + } + }; + + let url = format!( + "https://fcm.googleapis.com/v1/projects/{}/messages:send", + self.credentials.project_id + ); + + let _ = reqwest::Client::new() + .post(url) + .bearer_auth(token) + .json(&serde_json::json!({ + "message": { + "notification": { + "title": title, + "body": message, + "sound": "default", + }, + "data": data, + "token": device_token, + } + })) + .send() + .await? + .error_for_status()?; + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use serde_json::json; + + use super::*; + + #[tokio::test] + async fn test_send() { + let credentials = ApplicationCredentials { + project_id: "Your project".to_string(), + private_key: "Your key".to_string(), + client_email: "Your client email" + .to_string(), + token_uri: "https://oauth2.googleapis.com/token".to_string(), + }; + + let client = FcmClient::new(credentials); + let device_token = "Your client token"; + client + .send( + device_token, + "title", + "hello!", + &json!({ + "vocechat_server_id": "your server id", + "vocechat_from_uid": "123", + "vocechat_to_uid": "123123", + }), + ) + .await + .unwrap(); + } +} diff --git a/crates/fcm/src/credentials.rs b/crates/fcm/src/credentials.rs new file mode 100644 index 0000000..e4cfeb0 --- /dev/null +++ b/crates/fcm/src/credentials.rs @@ -0,0 +1,9 @@ +use serde::Deserialize; + +#[derive(Debug, Clone, Default, Deserialize)] +pub struct ApplicationCredentials { + pub project_id: String, + pub private_key: String, + pub client_email: String, + pub token_uri: String, +} diff --git a/crates/fcm/src/jwt.rs b/crates/fcm/src/jwt.rs new file mode 100644 index 0000000..3f9c78d --- /dev/null +++ b/crates/fcm/src/jwt.rs @@ -0,0 +1,94 @@ +use anyhow::Result; +use chrono::Utc; +use rustls::{sign, sign::SigningKey, PrivateKey}; +use serde::Serialize; + +use crate::ApplicationCredentials; + +const GOOGLE_RS256_HEAD: &str = r#"{"alg":"RS256","typ":"JWT"}"#; + +/// Encodes s as Base64 +fn append_base64 + ?Sized>(s: &T, out: &mut String) { + base64::encode_config_buf(s, base64::URL_SAFE, out) +} + +/// Decode a PKCS8 formatted RSA key. +fn decode_rsa_key(pem_pkcs8: &str) -> Result { + let mut private_keys = rustls_pemfile::pkcs8_private_keys(&mut pem_pkcs8.as_bytes())?; + anyhow::ensure!(!private_keys.is_empty(), "Not enough private keys in PEM"); + Ok(PrivateKey(private_keys.remove(0))) +} + +/// Permissions requested for a JWT. +/// See https://developers.google.com/identity/protocols/OAuth2ServiceAccount#authorizingrequests. +#[derive(Serialize, Debug)] +pub(crate) struct Claims<'a> { + iss: &'a str, + aud: &'a str, + exp: i64, + iat: i64, + subject: Option<&'a str>, + scope: String, +} + +impl<'a> Claims<'a> { + pub(crate) fn new( + key: &'a ApplicationCredentials, + scopes: &[T], + subject: Option<&'a str>, + ) -> Self + where + T: std::string::ToString, + { + let iat = Utc::now().timestamp(); + let expiry = iat + 3600 - 5; // Max validity is 1h. + + let scope: String = scopes + .iter() + .map(|x| x.to_string()) + .collect::>() + .join(" "); + Claims { + iss: &key.client_email, + aud: &key.token_uri, + exp: expiry, + iat, + subject, + scope, + } + } +} + +/// A JSON Web Token ready for signing. +pub(crate) struct JwtSigner { + signer: Box, +} + +impl JwtSigner { + pub(crate) fn new(private_key: &str) -> Result { + let key = decode_rsa_key(private_key)?; + let signing_key = sign::RsaSigningKey::new(&key)?; + let signer = signing_key + .choose_scheme(&[rustls::SignatureScheme::RSA_PKCS1_SHA256]) + .ok_or_else(|| anyhow::anyhow!("Couldn't choose signing scheme"))?; + Ok(JwtSigner { signer }) + } + + pub(crate) fn sign_claims(&self, claims: &Claims) -> Result { + let mut jwt_head = Self::encode_claims(claims); + let signature = self.signer.sign(jwt_head.as_bytes())?; + jwt_head.push('.'); + append_base64(&signature, &mut jwt_head); + Ok(jwt_head) + } + + /// Encodes the first two parts (header and claims) to base64 and assembles + /// them into a form ready to be signed. + fn encode_claims(claims: &Claims) -> String { + let mut head = String::new(); + append_base64(GOOGLE_RS256_HEAD, &mut head); + head.push('.'); + append_base64(&serde_json::to_string(&claims).unwrap(), &mut head); + head + } +} diff --git a/crates/fcm/src/lib.rs b/crates/fcm/src/lib.rs new file mode 100644 index 0000000..76e79b3 --- /dev/null +++ b/crates/fcm/src/lib.rs @@ -0,0 +1,6 @@ +mod client; +mod credentials; +mod jwt; + +pub use client::FcmClient; +pub use credentials::ApplicationCredentials; diff --git a/crates/github-oauth/Cargo.toml b/crates/github-oauth/Cargo.toml new file mode 100644 index 0000000..ecc67d7 --- /dev/null +++ b/crates/github-oauth/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "github-oauth" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/github-oauth/src/main.rs b/crates/github-oauth/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/crates/github-oauth/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/crates/magic-link/Cargo.toml b/crates/magic-link/Cargo.toml new file mode 100644 index 0000000..3b5c8de --- /dev/null +++ b/crates/magic-link/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "rc-magic-link" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1.0.132", features = ["derive"] } +chrono = { version = "0.4.19", features = ["serde"] } +hmac = "0.11.0" +sha2 = "0.9.0" +bincode = "1.3.3" +fastrand = "1.6.0" +hex = "0.4.3" diff --git a/crates/magic-link/src/lib.rs b/crates/magic-link/src/lib.rs new file mode 100644 index 0000000..cad2a0d --- /dev/null +++ b/crates/magic-link/src/lib.rs @@ -0,0 +1,149 @@ +extern crate core; + +use chrono::{DateTime, Utc}; +use hmac::{Mac, NewMac}; +use serde::{Deserialize, Serialize}; +use sha2::Sha256; + +#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] +#[non_exhaustive] +pub enum MagicLinkToken { + Register { + is_confirmed: bool, + // in_confirmed -> is_email_confirmed + gid: Option, + code: String, + expired_at: i64, + extra_email: Option, + extra_password: Option, + }, + Login { + email: String, + uid: Option, + code: String, + expired_at: i64, + }, +} + +impl MagicLinkToken { + pub fn gen_reg_magic_token( + code: &str, + server_key: &str, + expired_at: DateTime, + is_confirmed: bool, + gid: Option, + extra_email: Option, + extra_password: Option, + ) -> String { + encode( + server_key, + &MagicLinkToken::Register { + is_confirmed, + gid, + code: code.to_string(), + expired_at: expired_at.timestamp(), /* : (Utc::now() + Duration::seconds(expired_in)).timestamp() */ + extra_email, + extra_password, + }, + ) + } + + pub fn gen_login_magic_token( + code: &str, + server_key: &str, + expired_at: DateTime, + email: &str, + uid: Option, + ) -> String { + encode( + server_key, + &MagicLinkToken::Login { + email: email.to_string(), + uid, + code: code.to_string(), + expired_at: expired_at.timestamp(), + }, + ) + } + + pub fn parse(server_key: &str, s: impl AsRef) -> Option { + if s.as_ref().is_empty() { + return None; + } + // ya29.a0ARrdaM-5RaNLVVbJQSCYlekpYmPqhUXpG4THaOOYA0kUJ8jUd_rLFEgRappLi9fdmFpvdD7keGos2jzcnl0Vivh4C3HDNbOJpqCtwEQvH8vIYGUayAeMNMKGowkAhH0zCCprUGNBdQaZ65EW8Gf3kKcPc2GH + let data = hex::decode(s.as_ref()).ok()?; + assert!(data.len() >= 32); + let mut mac = hmac::Hmac::::new_from_slice(server_key.as_bytes()).unwrap(); + mac.update(&data[32..]); + mac.verify(&data[..32]).ok()?; + let magic_token = bincode::deserialize::(&data[32..]).ok()?; + if magic_token.get_expired_at() < Utc::now().timestamp() { + return None; + } + Some(magic_token) + } + + pub fn get_expired_at(&self) -> i64 { + match &self { + MagicLinkToken::Register { expired_at, .. } => *expired_at, + MagicLinkToken::Login { expired_at, .. } => *expired_at, + } + } + + pub fn get_code(&self) -> &str { + match &self { + MagicLinkToken::Register { code, .. } => code.as_str(), + MagicLinkToken::Login { code, .. } => code.as_str(), + } + } +} + +pub fn gen_code() -> String { + (0..6) + .map(|_| fastrand::char('0'..='9')) + .collect::() +} + +fn encode(server_key: &str, magictoken: &MagicLinkToken) -> String { + let content = bincode::serialize(&magictoken).unwrap(); + let mut buf_sig = { + let mut mac = hmac::Hmac::::new_from_slice(server_key.as_bytes()).unwrap(); + mac.update(&content); + mac.finalize().into_bytes().to_vec() + }; + buf_sig.extend_from_slice(&content); + hex::encode(&buf_sig) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_encode_invite_to_server() { + let server_key = "123456"; + let code = gen_code(); + let expired_at = chrono::Utc::now() + chrono::Duration::seconds(10); + let token = MagicLinkToken::gen_reg_magic_token( + &code, server_key, expired_at, true, None, None, None, + ); + if let MagicLinkToken::Register { + is_confirmed, + gid, + code, + expired_at, + extra_email, + extra_password, + } = MagicLinkToken::parse(server_key, token).unwrap() + { + assert!(is_confirmed); + assert_eq!(gid, None); + assert_eq!(code.len(), 6); + assert!(expired_at > 0); + assert_eq!(extra_email, None); + assert_eq!(extra_password, None); + } else { + panic!("test failed!"); + } + } +} diff --git a/crates/msgdb/Cargo.lock b/crates/msgdb/Cargo.lock new file mode 100644 index 0000000..25cccde --- /dev/null +++ b/crates/msgdb/Cargo.lock @@ -0,0 +1,768 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cast" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "bitflags", + "textwrap", + "unicode-width", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10" +dependencies = [ + "atty", + "cast", + "clap", + "criterion-plot", + "csv", + "itertools", + "lazy_static", + "num-traits", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_cbor", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6" +dependencies = [ + "cfg-if", + "lazy_static", +] + +[[package]] +name = "csv" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +dependencies = [ + "bstr", + "csv-core", + "itoa 0.4.8", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[package]] +name = "js-sys" +version = "0.3.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" + +[[package]] +name = "lock_api" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "plotters" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c" + +[[package]] +name = "plotters-svg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "proc-macro2" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "rc-msgdb" +version = "0.1.0" +dependencies = [ + "criterion", + "sled", + "tempfile", + "thiserror", +] + +[[package]] +name = "redox_syscall" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" + +[[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 = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" + +[[package]] +name = "serde" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +dependencies = [ + "itoa 1.0.1", + "ryu", + "serde", +] + +[[package]] +name = "sled" +version = "0.34.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935" +dependencies = [ + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot", +] + +[[package]] +name = "smallvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" + +[[package]] +name = "syn" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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 = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" + +[[package]] +name = "web-sys" +version = "0.3.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/crates/msgdb/Cargo.toml b/crates/msgdb/Cargo.toml new file mode 100644 index 0000000..d867b95 --- /dev/null +++ b/crates/msgdb/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "rc-msgdb" +version = "0.1.0" +edition = "2021" + +[dependencies] +parking_lot = "0.12.0" +sled = "0.34.7" +thiserror = "1.0.30" + +[dev-dependencies] +criterion = { version = "0.3.5", features = ["html_reports"] } +tempfile = "3.2.0" + +[[bench]] +name = "db" +harness = false diff --git a/crates/msgdb/benches/db.rs b/crates/msgdb/benches/db.rs new file mode 100644 index 0000000..d763160 --- /dev/null +++ b/crates/msgdb/benches/db.rs @@ -0,0 +1,43 @@ +use criterion::{criterion_group, criterion_main, Criterion}; +use rc_msgdb::MsgDb; +use tempfile::tempdir; + +fn send_benchmark(c: &mut Criterion) { + let dir = tempdir().unwrap(); + let db = MsgDb::open(dir.path()).unwrap(); + let to = (0..50000i64).collect::>(); + let msg = b"hello!"; + c.bench_function("send", |b| { + b.iter(|| { + db.messages() + .send_to_group(1, to.iter().copied(), msg) + .unwrap(); + }) + }); +} + +fn fetch_benchmark(c: &mut Criterion) { + let dir = tempdir().unwrap(); + let db = MsgDb::open(dir.path()).unwrap(); + let to = vec![1]; + let msg = b"hello!"; + for _ in 0..1000 { + db.messages() + .send_to_group(1, to.iter().copied(), msg) + .unwrap(); + } + c.bench_function("fetch", |b| { + b.iter(|| { + assert_eq!( + db.messages() + .fetch_user_messages_after(1, None, 10000) + .unwrap() + .len(), + 1000 + ); + }) + }); +} + +criterion_group!(benches, send_benchmark, fetch_benchmark); +criterion_main!(benches); diff --git a/crates/msgdb/src/db.rs b/crates/msgdb/src/db.rs new file mode 100644 index 0000000..486add2 --- /dev/null +++ b/crates/msgdb/src/db.rs @@ -0,0 +1,36 @@ +use std::path::Path; + +use parking_lot::Mutex; +use sled::Db; + +use crate::{sequence::Sequence, Messages, Result}; + +const MSG_SEQUENCE: u8 = 1; + +pub struct MsgDb { + pub(crate) db: Db, + msg_sequence: Mutex, +} + +impl Drop for MsgDb { + fn drop(&mut self) { + self.msg_sequence.lock().release(&self.db); + } +} + +impl MsgDb { + pub fn open(path: impl AsRef) -> Result { + let db = sled::open(path)?; + let msg_sequence = Mutex::new(Sequence::new(&db, MSG_SEQUENCE)?); + Ok(Self { db, msg_sequence }) + } + + #[inline] + pub fn messages(&self) -> Messages { + Messages { db: self } + } + + pub(crate) fn generate_msg_id(&self) -> Result { + self.msg_sequence.lock().generate_id(&self.db) + } +} diff --git a/crates/msgdb/src/error.rs b/crates/msgdb/src/error.rs new file mode 100644 index 0000000..45941ac --- /dev/null +++ b/crates/msgdb/src/error.rs @@ -0,0 +1,10 @@ +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error(transparent)] + Db(#[from] sled::Error), + + #[error("invalid data")] + InvalidData, +} + +pub type Result = ::std::result::Result; diff --git a/crates/msgdb/src/lib.rs b/crates/msgdb/src/lib.rs new file mode 100644 index 0000000..f8b7b53 --- /dev/null +++ b/crates/msgdb/src/lib.rs @@ -0,0 +1,8 @@ +mod db; +mod error; +mod messages; +mod sequence; + +pub use db::MsgDb; +pub use error::{Error, Result}; +pub use messages::Messages; diff --git a/crates/msgdb/src/messages.rs b/crates/msgdb/src/messages.rs new file mode 100644 index 0000000..52911a9 --- /dev/null +++ b/crates/msgdb/src/messages.rs @@ -0,0 +1,238 @@ +use sled::Batch; + +use crate::{MsgDb, Result}; + +pub struct Messages<'a> { + pub(crate) db: &'a MsgDb, +} + +impl<'a> Messages<'a> { + pub fn get(&self, mid: i64) -> Result>> { + Ok(self.db.db.get(key_msg(mid))?.map(|data| data.to_vec())) + } + + pub fn send_to_group( + &self, + gid: i64, + to: impl IntoIterator, + msg: &[u8], + ) -> Result { + let id = self.db.generate_msg_id()?; + let mut batch = Batch::default(); + batch.insert(&key_msg(id), msg); + for target_uid in to { + batch.insert(&key_user_msg(target_uid, id), msg); + } + batch.insert(&key_group_msg(gid, id), msg); + self.db.db.apply_batch(batch)?; + Ok(id) + } + + pub fn send_to_dm(&self, from_uid: i64, to_uid: i64, msg: &[u8]) -> Result { + let id = self.db.generate_msg_id()?; + let mut batch = Batch::default(); + batch.insert(&key_msg(id), msg); + for target_uid in [from_uid, to_uid] { + batch.insert(&key_user_msg(target_uid, id), msg); + } + batch.insert(&key_dm_msg(from_uid, to_uid, id), msg); + self.db.db.apply_batch(batch)?; + Ok(id) + } + + pub fn fetch_user_messages_after( + &self, + uid: i64, + after: Option, + limit: usize, + ) -> Result)>> { + let after_id = after.map(|id| id + 1).unwrap_or_default(); + let iter = self + .db + .db + .range(key_user_msg(uid, after_id)..key_user_msg(uid, i64::MAX)) + .rev(); + let mut msgs = Vec::new(); + + for item in iter.take(limit) { + let (key, value) = item?; + let (current_uid, msg_id) = match decode_key_user_msg(&key) { + Some(res) => res, + None => break, + }; + + if current_uid != uid { + break; + } + + msgs.push((msg_id, value.to_vec())); + } + + msgs.reverse(); + Ok(msgs) + } + + pub fn fetch_dm_messages_before( + &self, + from_uid: i64, + to_uid: i64, + before: Option, + limit: usize, + ) -> Result)>> { + let before_id = before.unwrap_or(i64::MAX); + let iter = self + .db + .db + .range(key_dm_msg(from_uid, to_uid, 0)..key_dm_msg(from_uid, to_uid, before_id)) + .rev() + .take(limit); + let mut msgs = Vec::new(); + + for item in iter { + let (key, value) = item?; + let (a, b, msg_id) = match decode_key_dm_msg(&key) { + Some(res) => res, + None => break, + }; + + if !(from_uid == a && to_uid == b || from_uid == b && to_uid == a) { + break; + } + + msgs.push((msg_id, value.to_vec())); + } + + msgs.reverse(); + Ok(msgs) + } + + pub fn fetch_group_messages_before( + &self, + gid: i64, + before: Option, + limit: usize, + ) -> Result)>> { + let before_id = before.unwrap_or(i64::MAX); + let iter = self + .db + .db + .range(key_group_msg(gid, 0)..key_group_msg(gid, before_id)) + .rev() + .take(limit); + let mut msgs = Vec::new(); + + for item in iter { + let (key, value) = item?; + let (current_gid, msg_id) = match decode_key_group_msg(&key) { + Some(res) => res, + None => break, + }; + + if current_gid != gid { + break; + } + + msgs.push((msg_id, value.to_vec())); + } + + msgs.reverse(); + Ok(msgs) + } + + pub fn insert_merged_msg(&self, mid: i64, msg: &[u8]) -> Result<()> { + self.db.db.insert(key_merged_msg(mid), msg)?; + Ok(()) + } + + pub fn update_merged_msg(&self, mid: i64, mut f: impl FnMut(&[u8]) -> Vec) -> Result<()> { + self.db + .db + .update_and_fetch(key_merged_msg(mid), |data| data.map(&mut f))?; + Ok(()) + } + + pub fn remove_merged_msg(&self, mid: i64) -> Result<()> { + self.db.db.remove(key_merged_msg(mid))?; + Ok(()) + } + + pub fn get_merged_msg(&self, mid: i64) -> Result>> { + Ok(self + .db + .db + .get(key_merged_msg(mid))? + .map(|data| data.to_vec())) + } +} + +fn key_msg(msg_id: i64) -> [u8; 12] { + let mut data = [0; 12]; + data[0..4].copy_from_slice(b"MSG/"); + data[4..12].copy_from_slice(&msg_id.to_be_bytes()); + data +} + +fn key_merged_msg(msg_id: i64) -> [u8; 13] { + let mut data = [0; 13]; + data[0..5].copy_from_slice(b"FMSG/"); + data[5..13].copy_from_slice(&msg_id.to_be_bytes()); + data +} + +fn key_user_msg(uid: i64, msg_id: i64) -> [u8; 21] { + let mut data = [0; 21]; + data[0..5].copy_from_slice(b"UMSG/"); + data[5..13].copy_from_slice(&uid.to_be_bytes()); + data[13..21].copy_from_slice(&msg_id.to_be_bytes()); + data +} + +fn decode_key_user_msg(data: &[u8]) -> Option<(i64, i64)> { + let data = data.strip_prefix(b"UMSG/")?; + if data.len() != 16 { + return None; + } + let uid = i64::from_be_bytes(data[0..8].try_into().unwrap()); + let msg_id = i64::from_be_bytes(data[8..16].try_into().unwrap()); + Some((uid, msg_id)) +} + +fn key_group_msg(gid: i64, msg_id: i64) -> [u8; 21] { + let mut data = [0; 21]; + data[0..5].copy_from_slice(b"GMSG/"); + data[5..13].copy_from_slice(&gid.to_be_bytes()); + data[13..21].copy_from_slice(&msg_id.to_be_bytes()); + data +} + +fn decode_key_group_msg(data: &[u8]) -> Option<(i64, i64)> { + let data = data.strip_prefix(b"GMSG/")?; + if data.len() != 16 { + return None; + } + let gid = i64::from_be_bytes(data[0..8].try_into().unwrap()); + let msg_id = i64::from_be_bytes(data[8..16].try_into().unwrap()); + Some((gid, msg_id)) +} + +fn key_dm_msg(from_uid: i64, to_uid: i64, msg_id: i64) -> [u8; 27] { + let mut data = [0; 27]; + let a = from_uid.min(to_uid); + let b = from_uid.max(to_uid); + data[0..3].copy_from_slice(b"DM/"); + data[3..11].copy_from_slice(&a.to_be_bytes()); + data[11..19].copy_from_slice(&b.to_be_bytes()); + data[19..27].copy_from_slice(&msg_id.to_be_bytes()); + data +} + +fn decode_key_dm_msg(data: &[u8]) -> Option<(i64, i64, i64)> { + let data = data.strip_prefix(b"DM/")?; + if data.len() != 24 { + return None; + } + let from_uid = i64::from_be_bytes(data[0..8].try_into().unwrap()); + let to_uid = i64::from_be_bytes(data[8..16].try_into().unwrap()); + let msg_id = i64::from_be_bytes(data[16..24].try_into().unwrap()); + Some((from_uid, to_uid, msg_id)) +} diff --git a/crates/msgdb/src/sequence.rs b/crates/msgdb/src/sequence.rs new file mode 100644 index 0000000..cd96332 --- /dev/null +++ b/crates/msgdb/src/sequence.rs @@ -0,0 +1,53 @@ +use sled::Db; + +use crate::{Error, Result}; + +const SEQUENCE_BANDWIDTH: i64 = 32; + +pub(crate) struct Sequence { + ty: u8, + next: i64, + leased: i64, +} + +impl Sequence { + pub(crate) fn new(db: &Db, ty: u8) -> Result { + let (next, leased) = Self::update_sequence_lease(ty, db)?; + Ok(Sequence { ty, next, leased }) + } + + pub(crate) fn release(&self, db: &Db) { + let _ = db.insert(key_sequence(self.ty), &self.next.to_be_bytes()); + } + + fn update_sequence_lease(ty: u8, db: &Db) -> Result<(i64, i64)> { + let key = key_sequence(ty); + let next = match db.get(key)? { + Some(value) => { + i64::from_be_bytes(value.as_ref().try_into().map_err(|_| Error::InvalidData)?) + } + None => 1, + }; + let leased = next + SEQUENCE_BANDWIDTH; + db.insert(key, &leased.to_be_bytes())?; + Ok((next, leased)) + } + + pub(crate) fn generate_id(&mut self, db: &Db) -> Result { + if self.next >= self.leased { + let (next, lease) = Self::update_sequence_lease(self.ty, db)?; + self.next = next; + self.leased = lease; + } + let val = self.next; + self.next += 1; + Ok(val) + } +} + +fn key_sequence(ty: u8) -> [u8; 10] { + let mut data = [0; 10]; + data[0..9].copy_from_slice(b"SEQUENCE/"); + data[9] = ty; + data +} diff --git a/crates/open-graph/Cargo.toml b/crates/open-graph/Cargo.toml new file mode 100644 index 0000000..24b40c2 --- /dev/null +++ b/crates/open-graph/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "open-graph" +version = "0.1.0" +edition = "2021" +include = ["**/*.rs", "Cargo.toml"] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "*", features = ["macros"] } +html5ever = "0.22.5" +reqwest = { version = "0.11.10", features = [ + "tokio-rustls", +], default-features = false } +serde = "1.0.136" +serde_derive = "1.0.136" +serde_json = "1.0.79" +poem-openapi = { version = "2.0.23", optional = true } +http = "0.2.6" +url = "2.2.2" +flate2 = "1.0" +regex = "1.5.4" +async-recursion = "1.0.0" + +[features] +default = [] +poem_openapi = ["poem-openapi"] diff --git a/crates/open-graph/README.md b/crates/open-graph/README.md new file mode 100644 index 0000000..4a67938 --- /dev/null +++ b/crates/open-graph/README.md @@ -0,0 +1,40 @@ +# Open Graph Protocal Parser + +`pvc-opengraph` is based on `opengraph-0.2.4`, added some extra information: `Title`, `Description`, `Favicon`, and solved some problem: + +1. Support three-level attribute name. +```html + +``` + +2. Support extracting `favicon`. +```html + +``` + +3. Support extracting `Title`. +```html +First Title + +``` + +4. Relative path is automatically converted to absolute path: +if request `https://domain.com/path1/path2` get the following: +```html + +``` +The absolute path is obtained after parsing: +``` +https://domain.com/path1/rock.jpg +``` + +5. `reqwest` updated to the latest version. The `edition` adopts 2021, and `rustls` is enabled by default, which supports better cross platform compilation. + + +6. add feature `poem-openapi`. + + +7. `unzip` decoding of non-standard servers is supported. few servers ignore the client `Accept-Encoding` and always return `gz` format data. + + +9. The code passed the `cargo test` and `cargo clip`. \ No newline at end of file diff --git a/crates/open-graph/src/audio.rs b/crates/open-graph/src/audio.rs new file mode 100644 index 0000000..db91ad5 --- /dev/null +++ b/crates/open-graph/src/audio.rs @@ -0,0 +1,17 @@ +#[derive(Serialize, Deserialize, Debug, Default, Clone)] +#[cfg(feature = "poem_openapi")] +#[derive(poem_openapi::Object)] +pub struct Audio { + pub r#type: Option, + pub url: String, + pub secure_url: Option, +} + +impl Audio { + pub fn new(url: String) -> Audio { + Audio { + url, + ..Default::default() + } + } +} diff --git a/crates/open-graph/src/error.rs b/crates/open-graph/src/error.rs new file mode 100644 index 0000000..601625c --- /dev/null +++ b/crates/open-graph/src/error.rs @@ -0,0 +1,52 @@ +use std::{ + error, + fmt::{Display, Formatter, Result as FmtResult}, +}; + +use reqwest; +use url; + +#[derive(Debug)] +pub enum Error { + NetworkError(reqwest::Error), + UrlParseError(url::ParseError), + IoError(std::io::Error), + Other(String), + Unexpected, +} + +impl Display for Error { + fn fmt(&self, f: &mut Formatter) -> FmtResult { + match self { + Error::NetworkError(ref e) => write!(f, "NetworkError: {}", e), + Error::UrlParseError(ref e) => write!(f, "UrlParseError: {}", e), + Error::IoError(ref e) => write!(f, "IoError: {}", e), + Error::Other(s) => write!(f, "Other Error: {}", s.as_str()), + Error::Unexpected => write!(f, "UnexpectedError"), + } + } +} + +impl From for Error { + fn from(err: reqwest::Error) -> Error { + Error::NetworkError(err) + } +} + +impl From for Error { + fn from(err: url::ParseError) -> Error { + Error::UrlParseError(err) + } +} + +impl From for Error { + fn from(err: std::io::Error) -> Error { + Error::IoError(err) + } +} + +impl error::Error for Error { + fn description(&self) -> &str { + "" + } +} diff --git a/crates/open-graph/src/fetcher.rs b/crates/open-graph/src/fetcher.rs new file mode 100644 index 0000000..27ac7d2 --- /dev/null +++ b/crates/open-graph/src/fetcher.rs @@ -0,0 +1,341 @@ +use std::borrow::Borrow; + +use html5ever::{ + parse_document, + rcdom::{ + Handle, + NodeData::{Comment, Doctype, Document, Element, ProcessingInstruction, Text}, + RcDom, + }, + tendril::{fmt::Slice, TendrilSink}, + Attribute, +}; +use http::HeaderMap; +use reqwest; + +// use std::io::Read; +use crate::{error::Error, Audio, Image, Object, Video}; + +fn gz_decode(data: &[u8]) -> Result { + use std::io::prelude::*; + + use flate2::read::GzDecoder; + let mut d = GzDecoder::new(data); + let mut s = String::new(); + d.read_to_string(&mut s)?; + Ok(s) +} + +use regex::Regex; +fn fetch_url_from_meta(text: &str) -> Option { + let re = Regex::new(r#""#; + let a = fetch_url_from_meta(text); + assert_eq!(Some("http://www.baidu.com/".to_string()), a); +} + +use async_recursion::async_recursion; +#[async_recursion] +pub async fn fetch(url: &str, header_map: Option, deep: u8) -> Result { + // let body = reqwest::get(url).await?.text().await?; + let mut client = reqwest::Client::new().get(url); + if let Some(header_map2) = header_map.clone() { + client = client.headers(header_map2); + client = client.header(http::header::ACCEPT_ENCODING, "none"); + } + let body = client.send().await?.bytes().await?; + // gz magic number: 1f 8b + if body.len() < 2 { + return Err(Error::Unexpected); + } + let body = if body[0] == 0x1f && body[1] == 0x8b { + gz_decode(body.as_bytes()) + .unwrap_or_default() + .to_lowercase() + } else { + String::from_utf8(body.to_vec()).unwrap_or_default() + }; + + if body.contains(" 10 { + return Err(Error::Other("too many redirect!".into())); + } + return fetch(&url, header_map, deep + 1).await; + } + } + // let body = client.send().await?.text().await?; + let dom = parse_document(RcDom::default(), Default::default()) + .from_utf8() + .read_from(&mut body.as_bytes()) + .unwrap(); + walk(dom.document, url) +} + +fn attr_value(attr_name: &str, attrs: &[Attribute]) -> Option { + for attr in attrs.iter() { + if attr.name.local.as_ref() == attr_name { + return Some(attr.value.to_string()); + } + } + None +} + +fn inner_text(handle: Handle) -> Option { + if handle.children.borrow().len() > 0 { + let text1 = handle.children.borrow(); + let inner = text1.get(0); + if let Some(handle) = inner { + if let Text { contents } = handle.data.borrow() { + return Some(contents.borrow().to_string()); + } + } + } + None +} + +// use std::any::Any; +fn walk(handle: Handle, url: &str) -> Result { + let mut key_key_values = vec![]; + do_walk(handle, &mut key_key_values, url)?; + let mut obj = Object::default(); + for (key0, key1, value) in key_key_values { + match key0.as_ref() { + "title" => { + if !value.is_empty() { + obj.title = value; + } + } + "type" => { + obj.r#type = value; + } + "url" => { + obj.url = value; + } + "favicon_url" => { + obj.favicon_url = Some(value); + } + "description" => { + if !value.is_empty() { + obj.description = Some(value); + } + } + "locale" => { + obj.locale = Some(value); + } + "locale_alternate" => { + // obj.locale_alternate.as_mut().map(|v|v.push(value)); // cargo clippy warning! + if let Some(v) = obj.locale_alternate.as_mut() { + v.push(value); + } + } + "site_name" => { + obj.site_name = Some(value); + } + "image" => { + if key1.is_empty() { + obj.images.push(Image::new(value)); + } else { + if obj.images.is_empty() { + obj.images.push(Image::new(value.clone())); + } + let mut v = obj.images.last_mut().unwrap(); + match key1.as_ref() { + "width" => v.width = value.parse::().ok(), + "height" => v.height = value.parse::().ok(), + "secure_url" => v.secure_url = Some(value), + "alt" => v.alt = Some(value), + "type" => v.r#type = Some(value), + _ => {} + } + } + } + "audio" => { + if key1.is_empty() { + obj.audios.push(Audio::new(value)); + } else { + if obj.audios.is_empty() { + obj.audios.push(Audio::new(value.clone())); + } + let mut v = obj.audios.last_mut().unwrap(); + match key1.as_ref() { + "secure_url" => v.secure_url = Some(value), + "type" => v.r#type = Some(value), + _ => {} + } + } + } + "video" => { + if key1.is_empty() { + obj.videos.push(Video::new(value)); + } else { + if obj.videos.is_empty() { + obj.videos.push(Video::new(value.clone())); + } + let mut v = obj.videos.last_mut().unwrap(); + match key1.as_ref() { + "height" => v.height = value.parse::().ok(), + "width" => v.width = value.parse::().ok(), + "secure_url" => v.secure_url = Some(value), + "type" => v.r#type = Some(value), + _ => {} + } + } + } + _ => {} + }; + } + Ok(obj) +} +fn do_walk( + handle: Handle, + key_key_values: &mut Vec<(String, String, String)>, + url: &str, +) -> Result<(), Error> { + let abs_path = url::Url::parse(url)?; + match handle.data { + Document => (), + Doctype { .. } => (), + Text { .. } => (), + Comment { .. } => (), + Element { + ref name, + ref attrs, + .. + } => { + let tag_name = name.local.as_ref(); + match tag_name { + "meta" => { + if let Some(v) = attr_value("name", &attrs.borrow()) { + if v == "description" { + if let Some(vv) = attr_value("content", &attrs.borrow()) { + key_key_values.push(( + "description".to_string(), + "".to_string(), + vv, + )); + } + } + } + if let Some(v) = attr_value("property", &attrs.borrow()) { + if v.starts_with("og:") { + let end = v.chars().count(); + let key = unsafe { v.get_unchecked(3..end) }.to_string(); + let mut keys: Vec<_> = key.split(':').collect(); + let key0 = keys.remove(0).to_string(); + let key1 = if keys.is_empty() { + String::new() + } else { + keys.remove(0).to_string() + }; + if let Some(mut vv) = attr_value("content", &attrs.borrow()) { + if (key0 == "image" || key0 == "video" || key0 == "audio") + && key1.is_empty() + && !vv.starts_with("http") + { + vv = abs_path.join(vv.as_str())?.to_string(); + } + key_key_values.push((key0, key1, vv)); + } + } + } + } + "title" => { + let title = inner_text(handle.clone()).unwrap_or_default(); + key_key_values.push(("title".to_string(), "".to_string(), title)) + } + // + // + // + // + "link" => { + if let Some(v) = attr_value("rel", &attrs.borrow()) { + if v.ends_with("icon") { + if let Some(vv) = attr_value("href", &attrs.borrow()) { + let vv = url::Url::parse(url)?.join(&vv)?; + key_key_values.push(( + "favicon_url".to_string(), + "".to_string(), + vv.to_string(), + )); + } + } + } + } + _ => (), + } + } + ProcessingInstruction { .. } => unreachable!(), + } + for child in handle.children.borrow().iter() { + do_walk(child.clone(), key_key_values, url)?; + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn extract_open_graph_object() { + let x = r#" + + + The Rock 123 + + + + + + + + + + + + + + +

hello

+

hello

+ + + "#; + let x = x.to_string(); + let dom = parse_document(RcDom::default(), Default::default()) + .from_utf8() + .read_from(&mut x.as_bytes()) + .unwrap(); + let obj = walk(dom.document, "").unwrap(); + assert_eq!(obj.title, "The Rock".to_string()); + assert_eq!(obj.description, Some("Some Description".to_string())); + assert_eq!(obj.r#type, "video.movie".to_string()); + assert_eq!(obj.url, "http://www.imdb.com/title/tt0117500/".to_string()); + assert_eq!(obj.images.len(), 4); + assert_eq!( + obj.images[1].url, + "https://example.com/rock.jpg".to_string() + ); + assert_eq!(obj.images[1].width, Some(400)); + assert_eq!(obj.images[1].height, Some(300)); + assert_eq!(obj.images[3].height, Some(1000)); + } + + #[tokio::test] + async fn test_fetch() { + // curl -H "accept-encoding: none" https://www.bilibili.com/video/BV1s3411J7Aj + // let obj = fetch("https://www.bilibili.com/video/BV1s3411J7Aj", None).await.unwrap(); + // let obj = fetch("https://www.youtube.com/watch?v=BlI9PVQA8ZA", None).await.unwrap(); + // let obj = fetch("https://dapr.io/", None).await.unwrap(); + // dbg!(obj); + } +} diff --git a/crates/open-graph/src/image.rs b/crates/open-graph/src/image.rs new file mode 100644 index 0000000..dabbe3c --- /dev/null +++ b/crates/open-graph/src/image.rs @@ -0,0 +1,21 @@ +/// more media types: https://en.wikipedia.org/wiki/Media_type +#[derive(Serialize, Deserialize, Debug, Default, Clone)] +#[cfg(feature = "poem_openapi")] +#[derive(poem_openapi::Object)] +pub struct Image { + pub r#type: Option, + pub url: String, + pub secure_url: Option, + pub width: Option, + pub height: Option, + pub alt: Option, +} + +impl Image { + pub fn new(url: String) -> Self { + Image { + url, + ..Default::default() + } + } +} diff --git a/crates/open-graph/src/lib.rs b/crates/open-graph/src/lib.rs new file mode 100644 index 0000000..48b0a55 --- /dev/null +++ b/crates/open-graph/src/lib.rs @@ -0,0 +1,22 @@ +// https://ogp.me/ +#[macro_use] +extern crate serde_derive; +extern crate html5ever; +extern crate reqwest; +extern crate serde; +extern crate serde_json; + +mod audio; +mod image; +mod object; +mod video; + +pub mod error; +pub mod fetcher; + +pub use audio::Audio; +pub use error::Error; +pub use fetcher::fetch; +pub use image::Image; +pub use object::Object; +pub use video::Video; diff --git a/crates/open-graph/src/object.rs b/crates/open-graph/src/object.rs new file mode 100644 index 0000000..4d426e3 --- /dev/null +++ b/crates/open-graph/src/object.rs @@ -0,0 +1,20 @@ +use crate::{Audio, Image, Video}; + +#[derive(Serialize, Deserialize, Debug, Default, Clone)] +#[cfg(feature = "poem_openapi")] +#[derive(poem_openapi::Object)] +pub struct Object { + pub r#type: String, + pub title: String, + pub url: String, + + pub images: Vec, + pub audios: Vec