diff --git a/.github/actions/build-napi/action.yml b/.github/actions/build-napi/action.yml deleted file mode 100644 index f11358ea73..0000000000 --- a/.github/actions/build-napi/action.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: 'build-napi-artifact' -description: | - Builds napi artifact using specified settings' - -inputs: - docker: - required: true - target: - required: true - build: - required: true - node-version: - default: 18 - rust-version: - required: true - -runs: - using: "composite" - steps: - - name: Setup node - uses: actions/setup-node@v3 - if: ${{ !inputs.docker }} - with: - node-version: ${{ inputs.node-version }} - cache: npm - cache-dependency-path: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs/package-lock.json - - name: Install - uses: actions-rs/toolchain@v1 - if: ${{ !inputs.docker }} - with: - toolchain: ${{ inputs.rust-version }} - target: ${{ inputs.target }} - default: true - - name: Cache cargo - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - .cargo-cache - target/ - key: ${{ inputs.target }}-cargo-registry - - name: Install dependencies - run: npm install - working-directory: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs - shell: bash - - name: Build docker image - if: ${{ inputs.docker }} - shell: bash - run: | - docker build -f aries/wrappers/vcx-napi-rs/${{ inputs.docker }}.Dockerfile -t ghcr.io/hyperledger/aries-vcx/napi-rs-${{ inputs.docker }}:latest . - - name: Build in docker - uses: addnab/docker-run-action@v3 - if: ${{ inputs.docker }} - with: - image: ghcr.io/hyperledger/aries-vcx/napi-rs-${{ inputs.docker }} - options: -v /home/runner/.cargo/git/db:/root/.cargo/git/db -v /home/runner/.cargo/registry/cache:/root/.cargo/registry/cache -v /home/runner/.cargo/registry/index:/root/.cargo/registry/index -v ${{ github.workspace }}:/build -w /build - run: ${{ inputs.build }} - - name: Build - run: ${{ inputs.build }} - if: ${{ !inputs.docker }} - working-directory: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs - shell: bash - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: bindings-${{ inputs.target }} - path: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs/*.node - if-no-files-found: error diff --git a/.github/actions/publish-napi/action.yml b/.github/actions/publish-napi/action.yml deleted file mode 100644 index d4cb99e472..0000000000 --- a/.github/actions/publish-napi/action.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: 'publish-napi' -description: | - Publishes vcx-napi-rs node packages - -inputs: - publish-version: - required: true - npmjs-token: - required: true - node-version: - default: 18 - -runs: - using: "composite" - steps: - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.node-version }} - cache: npm - cache-dependency-path: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs/package-lock.json - - name: Install dependencies - run: npm install - working-directory: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs - shell: bash - - name: Download napi artifacts - uses: actions/download-artifact@v3 - with: - path: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs/artifacts - - name: Move artifacts - run: | - find . -type d -not -path \*\*/artifacts/bindings-\* -path \*\*/artifacts/\*\* -mindepth 2 -maxdepth 2 -exec rm -rf {} \+ - ls -R artifacts - npm run artifacts - working-directory: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs - shell: bash - - name: Publish - run: | - if [[ "$PUBLISH_VERSION" ]] - then - npm set "//registry.npmjs.org/:_authToken" $NPMJS_TOKEN - npm version $PUBLISH_VERSION - npm run prepublish - npm publish - else - echo "New version was not defined, skipping release." - fi - working-directory: ${{ github.workspace }}/aries/wrappers/vcx-napi-rs - shell: bash - env: - NPMJS_TOKEN: ${{ inputs.npmjs-token }} - PUBLISH_VERSION: ${{ inputs.publish-version }} diff --git a/.github/actions/setup-codecov-rust/action.yml b/.github/actions/setup-codecov-rust/action.yml index b6c4c27587..a4c4620230 100644 --- a/.github/actions/setup-codecov-rust/action.yml +++ b/.github/actions/setup-codecov-rust/action.yml @@ -29,4 +29,3 @@ runs: docker run --rm -d --name mysql --network host -e MYSQL_ROOT_PASSWORD=mysecretpassword mysql:5.7.35 docker run --rm -d --name indypool --network host ${{ env.DOCKER_IMAGE_POOL }} sleep 5 - docker-compose -f ./.github/ci/agency/docker-compose.yml up -d \ No newline at end of file diff --git a/.github/actions/setup-testing-nodejs/action.yml b/.github/actions/setup-testing-nodejs/action.yml deleted file mode 100644 index 9dc065f2b5..0000000000 --- a/.github/actions/setup-testing-nodejs/action.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: "setup-testing-nodejs" -description: 'Install library deps, build libvcx' - -inputs: - rust-toolchain-version: - description: 'The Rust toolchain version to use' - required: true - skip-docker-setup: - description: 'If true, skip spinning up docker containers' - required: false - default: false - node-version: - description: 'Version of nodejs' - required: true - -runs: - using: "composite" - steps: - - name: "Use Node.js ${{ inputs.node-version }}" - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.node-version }} - - name: "Install npm 8.19.3" - shell: bash - run: | - npm install -g npm@8.19.3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ inputs.rust-toolchain-version }} - default: true - - uses: Swatinem/rust-cache@v2 - - name: "Install dependencies" - shell: bash - run: | - sudo apt-get update -y - sudo apt-get install -y libsodium-dev libssl-dev libzmq3-dev - - name: "Start indypool, mysql, agency" - if: ${{ inputs.skip-docker-setup != 'true' }} - shell: bash - run: | - docker run --rm -d --name mysql --network host -e MYSQL_ROOT_PASSWORD=mysecretpassword mysql:5.7.35 - docker run --rm -d --name indypool --network host ${{ env.DOCKER_IMAGE_POOL }} - sleep 5 - docker-compose -f ./.github/ci/agency/docker-compose.yml up -d - - name: "Build binding module" - shell: bash - run: (cd aries/wrappers/vcx-napi-rs && npm install && npm run build:napi:debug) - - name: "Transpile TS wrapper" - shell: bash - run: (cd aries/wrappers/node && npm install && npm run compile) - - name: "Check wrappers" - shell: bash - run: | - ls -lah aries/wrappers/vcx-napi-rs - ls -lah aries/wrappers/node diff --git a/.github/ci/agency/docker-compose.yml b/.github/ci/agency/docker-compose.yml deleted file mode 100644 index 6c3011a0a3..0000000000 --- a/.github/ci/agency/docker-compose.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: '3.5' - -services: - agency: - image: ${DOCKER_IMAGE_AGENCY} - container_name: agency - environment: - - LOG_JSON_TO_CONSOLE=false - - LOG_LEVEL=info - - SERVER_PORT=8080 - - SERVER_MAX_REQUEST_SIZE_KB=300 - - - PG_WALLET_MAX_CONNECTIONS=90 - - PG_WALLET_CONNECTION_TIMEOUT_MINS=30 - - - AGENCY_WALLET_NAME=vcxagency-node-ea - - AGENCY_DID=VsKV7grR1BUE29mG2Fm2kX - - AGENCY_SEED_SECRET=0000000000000000000000000Forward - - AGENCY_WALLET_KEY_SECRET=98765432109876543210 - - - AGENCY_TYPE=enterprise - - - MYSQL_HOST=localhost - - MYSQL_PORT=3306 - - MYSQL_ACCOUNT=root - - MYSQL_PASSWORD_SECRET=mysecretpassword - - MYSQL_DATABASE_APPLICATION=agency_application - - MYSQL_DATABASE_WALLET=agency_wallets - - MYSQL_DATABASE_WALLET_CONNECTION_LIMIT=50 - - - SERVER_ENABLE_TLS=false - network_mode: "host" - command: ["sh", "-c", "npm run dev:schema:migrate:all && npm run serve"] diff --git a/.github/ci/agency/localhost.env b/.github/ci/agency/localhost.env deleted file mode 100644 index bc02e7b98e..0000000000 --- a/.github/ci/agency/localhost.env +++ /dev/null @@ -1,22 +0,0 @@ -LOG_LEVEL=debug -LOG_ENABLE_INDYSDK=false -LOG_JSON_TO_CONSOLE=false -SERVER_PORT=8080 -SERVER_MAX_REQUEST_SIZE_KB=300 -SERVER_ENABLE_TLS=false -DEV_MODE=true - -AGENCY_WALLET_NAME=wallet_agency_ca -AGENCY_DID=VsKV7grR1BUE29mG2Fm2kX -AGENCY_SEED_SECRET=0000000000000000000000000Forward -AGENCY_WALLET_KEY_SECRET=01234567890123456789 - -AGENCY_TYPE=enterprise - -MYSQL_HOST=localhost -MYSQL_PORT=3306 -MYSQL_ACCOUNT=root -MYSQL_PASSWORD_SECRET=mysecretpassword -MYSQL_DATABASE_APPLICATION=agency_application -MYSQL_DATABASE_WALLET=agency_wallets -MYSQL_DATABASE_WALLET_CONNECTION_LIMIT=50 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a50480c3ed..eac96b933e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -393,25 +393,6 @@ jobs: with: name: "docker-services-${{ github.job }}" - test-integration-libvcx: - needs: workflow-setup - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} - runs-on: ubuntu-20.04 - strategy: - matrix: - wallet: ["vdrtools_wallet", "askar_wallet"] - steps: - - name: "Git checkout" - uses: actions/checkout@v3 - - name: "Setup rust testing environment" - uses: ./.github/actions/setup-testing-rust - with: - rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSION }} - - name: "Install just" - run: sudo snap install --edge --classic just - - name: "Run libvcx_core integration tests" - run: just test-integration-libvcx ${{ matrix.wallet }} - test-integration-did-crate: needs: workflow-setup if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} @@ -428,175 +409,6 @@ jobs: - name: "Run resolver tests" run: just test-integration-did-crate - test-integration-node-wrapper: - needs: workflow-setup - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} - runs-on: ubuntu-22.04 - strategy: - matrix: - node-version: [18.x] - steps: - - name: "Git checkout" - uses: actions/checkout@v3 - - name: "Setup NodeJS libvcx testing environment" - uses: ./.github/actions/setup-testing-nodejs - with: - rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSION }} - node-version: ${{ matrix.node-version }} - - name: "Run wrapper integration tests" - run: (cd aries/wrappers/node && npm run test:integration) - - name: "Install vcxagent-core dependencies" - run: (cd aries/agents/node/vcxagent-core && npm install) - - name: "Run demo" - run: (cd aries/agents/node/vcxagent-core && AGENCY_URL=http://localhost:8080 npm run demo) - - name: "Run demo with revocation" - run: (cd aries/agents/node/vcxagent-core && AGENCY_URL=http://localhost:8080 npm run demo:revocation) - - name: "Run integration tests" - run: (cd aries/agents/node/vcxagent-core && AGENCY_URL=http://localhost:8080 npm run test:integration) - - ########################################################################################## - ############################ NPMJS PUBLISHING ####################################### - - publish-node-wrapper: - runs-on: ubuntu-20.04 - needs: - - workflow-setup - - publish-napi - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} - env: - PUBLISH_VERSION: ${{needs.workflow-setup.outputs.PUBLISH_VERSION}} - steps: - - name: "Git checkout" - uses: actions/checkout@v3 - - name: "Use Node.js 18" - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - - name: "Publish package" - run: | - if [[ "$PUBLISH_VERSION" ]] - then - NPMJS_TOKEN=${{ secrets.NPMJS_TOKEN }} PUBLISH_VERSION=${{ env.PUBLISH_VERSION }} ./aries/wrappers/node/publish.sh - else - echo "New version was not defined, skipping release." - fi - - publish-agent-core: - runs-on: ubuntu-20.04 - needs: - - workflow-setup - - publish-node-wrapper - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} - env: - NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} - PUBLISH_VERSION: ${{needs.workflow-setup.outputs.PUBLISH_VERSION}} - steps: - - name: "Git checkout" - uses: actions/checkout@v3 - - name: "Use Node.js 18" - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - - name: "Release agent-core package" - run: | - if [[ "$PUBLISH_VERSION" ]] - then - NPMJS_TOKEN=${{ secrets.NPMJS_TOKEN }} PUBLISH_VERSION=${{ env.PUBLISH_VERSION }} ./aries/agents/node/vcxagent-core/publish.sh - else - echo "New version was not defined, skipping release." - fi - - build-napi: - needs: - - workflow-setup - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' }} - strategy: - fail-fast: false - matrix: - settings: - - host: ubuntu-20.04 - target: x86_64-unknown-linux-gnu - build: |- - set -e - sudo apt-get update -y - sudo apt-get install -y libssl-dev libzmq3-dev - npm run build:napi - strip *.node - - host: ubuntu-20.04 - target: x86_64-unknown-linux-musl - docker: alpine - build: |- - set -e - env - unset CC - unset CXX - cd aries/wrappers/vcx-napi-rs - npm run build:napi - strip *.node - - host: macos-latest - target: x86_64-apple-darwin - build: | - brew install openssl zmq pkg-config - npm run build:napi - strip -x *.node - - host: macos-latest - target: aarch64-apple-darwin - skip: ${{ needs.workflow-setup.outputs.SKIP_NAPI_M1 }} - build: | - wget https://github.com/macports/macports-base/releases/download/v2.9.1/MacPorts-2.9.1-12-Monterey.pkg - sudo installer -pkg ./MacPorts-2.9.1-12-Monterey.pkg -target / - export PATH=/opt/local/bin:/opt/local/sbin:$PATH - - sudo port install openssl +universal zmq +universal - export OPENSSL_DIR=/opt/local - export OPENSSL_INCLUDE_DIR=/opt/local/include/ - export OPENSSL_LIB_DIR=/opt/local/lib/ - - export SODIUM_LIB_DIR=/opt/local/lib/ - export SODIUM_INCLUDE_DIR=/opt/local/include - - export LIBZMQ_LIB_DIR=/opt/local/lib/ - export LIBZMQ_INCLUDE_DIR=/opt/local/include - - export PKG_CONFIG_ALLOW_CROSS=1 - export PKG_CONFIG_SYSROOT_DIR=/ - export RUST_BACKTRACE=1 - npm run build:napi -- --target aarch64-apple-darwin - strip -x *.node - name: ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.host }} - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/build-napi - if: ${{ matrix.settings.skip != 'true' }} - with: - docker: ${{ matrix.settings.docker }} - target: ${{ matrix.settings.target }} - build: ${{ matrix.settings.build }} - node-version: ${{ env.NODE_VERSION }} - rust-version: ${{ env.RUST_TOOLCHAIN_VERSION }} - - publish-napi: - runs-on: ubuntu-20.04 - needs: - - workflow-setup - - test-unit-workspace - - test-integration-libvcx - - test-integration-aries-vcx - - test-integration-aries-vcx-mysql - # - test-node-wrapper - - test-integration-node-wrapper - - workflow-setup - - build-napi - if: ${{ needs.workflow-setup.outputs.SKIP_CI != 'true' && needs.workflow-setup.outputs.IS_FORK == 'false' }} - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/publish-napi - with: - publish-version: ${{ needs.workflow-setup.outputs.PUBLISH_VERSION }} - npmjs-token: ${{ secrets.NPMJS_TOKEN }} - node-version: ${{ env.NODE_VERSION }} - ########################################################################################## ############################## RELEASE ######################################### @@ -605,11 +417,8 @@ jobs: needs: - workflow-setup - test-unit-workspace - - test-integration-libvcx - test-integration-aries-vcx - test-integration-aries-vcx-mysql - # - test-node-wrapper - - test-integration-node-wrapper if: ${{ needs.workflow-setup.outputs.RELEASE == 'true' || needs.workflow-setup.outputs.PRERELEASE == 'true' }} outputs: RELEASE_UPLOAD_URL: ${{ steps.create-release.outputs.upload_url }} diff --git a/.github/workflows/mediator.pr.yml b/.github/workflows/mediator.pr.yml index 0c3f5824f6..c7ebe11fb9 100644 --- a/.github/workflows/mediator.pr.yml +++ b/.github/workflows/mediator.pr.yml @@ -79,7 +79,7 @@ jobs: # uses: Swatinem/rust-cache@v2 run: cargo install sqlx-cli - name: Setup database - run: DATABASE_URL=${MYSQL_URL} sqlx migrate run --source aries/agents/rust/mediator/migrations + run: DATABASE_URL=${MYSQL_URL} sqlx migrate run --source aries/agents/mediator/migrations - name: "Run mediator integration tests" run: cargo run --bin mediator & sleep 5 && cargo test --verbose --package mediator -- --nocapture; - name: "Collect docker logs on failure" @@ -109,7 +109,7 @@ jobs: uses: ./.github/actions/build-image with: docker-img: ${{ env.DOCKER_IMAGE }} - dockerfile-path: "aries/agents/rust/mediator/Dockerfile" + dockerfile-path: "aries/agents/mediator/Dockerfile" branch-name: ${{ needs.setup-variables.outputs.BRANCH_NAME }} branch-main: ${{ env.MAIN_BRANCH }} docker-repo-local-name: mediator diff --git a/.github/workflows/push-napi-image.yml b/.github/workflows/push-napi-image.yml deleted file mode 100644 index 208c15a8ca..0000000000 --- a/.github/workflows/push-napi-image.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build and push napi image - -on: - workflow_dispatch: - inputs: - image-type: - description: 'Docker image type' - required: true - type: choice - options: - - alpine - - debian - -jobs: - build-and-push-image: - runs-on: ubuntu-20.04 - permissions: - packages: write - contents: read - steps: - - name: "Git checkout" - uses: actions/checkout@v3 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: "Build image" - run: | - docker build -f aries/wrappers/vcx-napi-rs/${{ inputs.image-type }}.Dockerfile -t ghcr.io/hyperledger/aries-vcx/napi-rs-${{ inputs.image-type }}:latest . - - name: "Push image to ghcr.io" - run: | - docker push ghcr.io/hyperledger/aries-vcx/napi-rs-${{ inputs.image-type }}:latest diff --git a/Cargo.lock b/Cargo.lock index 0af9495db0..d5e8dd16b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1342,15 +1342,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "cookie" version = "0.16.2" @@ -1526,16 +1517,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ctor" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" -dependencies = [ - "quote", - "syn 2.0.48", -] - [[package]] name = "ctr" version = "0.9.2" @@ -1794,7 +1775,7 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case 0.4.0", + "convert_case", "proc-macro2", "quote", "rustc_version", @@ -3230,16 +3211,6 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - [[package]] name = "libm" version = "0.2.8" @@ -3267,41 +3238,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "libvcx_core" -version = "0.62.0" -dependencies = [ - "agency_client", - "anoncreds_types", - "aries_vcx", - "aries_vcx_core", - "async-trait", - "cfg-if", - "chrono", - "did_parser", - "diddoc_legacy", - "env_logger 0.10.0", - "futures", - "lazy_static", - "libc", - "log", - "num-traits", - "once_cell", - "public_key", - "rand 0.8.5", - "serde", - "serde_derive", - "serde_json", - "shared", - "test_utils", - "thiserror", - "time 0.3.20", - "tokio", - "url", - "uuid 1.5.0", - "wallet_migrator", -] - [[package]] name = "libvcx_logger" version = "0.62.0" @@ -3594,64 +3530,6 @@ dependencies = [ "data-encoding-macro", ] -[[package]] -name = "napi" -version = "2.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd063c93b900149304e3ba96ce5bf210cd4f81ef5eb80ded0d100df3e85a3ac0" -dependencies = [ - "bitflags 2.4.0", - "ctor", - "napi-derive", - "napi-sys", - "once_cell", - "tokio", -] - -[[package]] -name = "napi-build" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882a73d9ef23e8dc2ebbffb6a6ae2ef467c0f18ac10711e4cc59c5485d41df0e" - -[[package]] -name = "napi-derive" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1c6a8fa84d549aa8708fcd062372bf8ec6e849de39016ab921067d21bde367" -dependencies = [ - "cfg-if", - "convert_case 0.6.0", - "napi-derive-backend", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "napi-derive-backend" -version = "1.0.52" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20bbc7c69168d06a848f925ec5f0e0997f98e8c8d4f2cc30157f0da51c009e17" -dependencies = [ - "convert_case 0.6.0", - "once_cell", - "proc-macro2", - "quote", - "regex", - "semver", - "syn 1.0.109", -] - -[[package]] -name = "napi-sys" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "166b5ef52a3ab5575047a9fe8d4a030cdd0f63c96f071cd6907674453b07bae3" -dependencies = [ - "libloading", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -5965,23 +5843,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "vcx-napi-rs" -version = "0.62.0" -dependencies = [ - "chrono", - "libvcx_core", - "libvcx_logger", - "log", - "napi", - "napi-build", - "napi-derive", - "serde", - "serde_json", - "uuid 1.5.0", - "wallet_migrator", -] - [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 21cdd840b6..6b1f922e23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,18 +3,16 @@ resolver = "2" members = [ "aries/aries_vcx", - "aries/misc/legacy/libvcx_core", "aries/misc/legacy/agency_client", "aries/misc/legacy/libvdrtools", "aries/messages_macros", "aries/messages", "aries/misc/shared", "aries/misc/legacy/diddoc_legacy", - "aries/agents/rust/mediator", - "aries/agents/rust/mediator/client-tui", - "aries/agents/rust/aries-vcx-agent", + "aries/agents/mediator", + "aries/agents/mediator/client-tui", + "aries/agents/aries-vcx-agent", "aries/wrappers/uniffi-aries-vcx/core", - "aries/wrappers/vcx-napi-rs", "aries/aries_vcx_core", "aries/misc/indy_ledger_response_parser", "aries/misc/wallet_migrator", diff --git a/aries/agents/rust/README.md b/aries/agents/README.md similarity index 100% rename from aries/agents/rust/README.md rename to aries/agents/README.md diff --git a/aries/agents/rust/aries-vcx-agent/.gitignore b/aries/agents/aries-vcx-agent/.gitignore similarity index 100% rename from aries/agents/rust/aries-vcx-agent/.gitignore rename to aries/agents/aries-vcx-agent/.gitignore diff --git a/aries/agents/aries-vcx-agent/Cargo.toml b/aries/agents/aries-vcx-agent/Cargo.toml new file mode 100644 index 0000000000..f2b37515ca --- /dev/null +++ b/aries/agents/aries-vcx-agent/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "aries-vcx-agent" +version.workspace = true +authors.workspace = true +license.workspace = true +edition.workspace = true + +[dependencies] +serde = "1.0.145" +aries_vcx = { path = "../../aries_vcx" } +aries_vcx_core = { path = "../../aries_vcx_core", features = [ + "credx", + "vdrtools_wallet", +] } +anoncreds_types = { path = "../../misc/anoncreds_types" } +shared = { path = "../../misc/shared" } +did_resolver_registry = { path = "../../../did_core/did_resolver_registry" } +did_resolver_sov = { path = "../../../did_core/did_methods/did_resolver_sov" } +did_peer = { path = "../../../did_core/did_methods/did_peer" } +did_key = { path = "../../../did_core/did_methods/did_key" } +public_key = { path = "../../../did_core/public_key" } +async-trait = "0.1.64" +derive_builder = "0.12.0" +serde_json = "1.0.85" +log = "0.4.17" +uuid = "1.2.1" +thiserror = "1.0.37" +url = { version = "2.3.1", features = ["serde"] } +display_as_json = { path = "../../../misc/display_as_json" } diff --git a/aries/agents/rust/aries-vcx-agent/src/agent/agent_config.rs b/aries/agents/aries-vcx-agent/src/agent/agent_config.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/agent/agent_config.rs rename to aries/agents/aries-vcx-agent/src/agent/agent_config.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/agent/agent_struct.rs b/aries/agents/aries-vcx-agent/src/agent/agent_struct.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/agent/agent_struct.rs rename to aries/agents/aries-vcx-agent/src/agent/agent_struct.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/agent/init.rs b/aries/agents/aries-vcx-agent/src/agent/init.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/agent/init.rs rename to aries/agents/aries-vcx-agent/src/agent/init.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/agent/mod.rs b/aries/agents/aries-vcx-agent/src/agent/mod.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/agent/mod.rs rename to aries/agents/aries-vcx-agent/src/agent/mod.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/error/convertors.rs b/aries/agents/aries-vcx-agent/src/error/convertors.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/error/convertors.rs rename to aries/agents/aries-vcx-agent/src/error/convertors.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/error/error_kind.rs b/aries/agents/aries-vcx-agent/src/error/error_kind.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/error/error_kind.rs rename to aries/agents/aries-vcx-agent/src/error/error_kind.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/error/error_struct.rs b/aries/agents/aries-vcx-agent/src/error/error_struct.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/error/error_struct.rs rename to aries/agents/aries-vcx-agent/src/error/error_struct.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/error/mod.rs b/aries/agents/aries-vcx-agent/src/error/mod.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/error/mod.rs rename to aries/agents/aries-vcx-agent/src/error/mod.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/error/result.rs b/aries/agents/aries-vcx-agent/src/error/result.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/error/result.rs rename to aries/agents/aries-vcx-agent/src/error/result.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/helper.rs b/aries/agents/aries-vcx-agent/src/helper.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/helper.rs rename to aries/agents/aries-vcx-agent/src/helper.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/http.rs b/aries/agents/aries-vcx-agent/src/http.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/http.rs rename to aries/agents/aries-vcx-agent/src/http.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/lib.rs b/aries/agents/aries-vcx-agent/src/lib.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/lib.rs rename to aries/agents/aries-vcx-agent/src/lib.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/connection.rs b/aries/agents/aries-vcx-agent/src/services/connection.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/connection.rs rename to aries/agents/aries-vcx-agent/src/services/connection.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/credential_definition.rs b/aries/agents/aries-vcx-agent/src/services/credential_definition.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/credential_definition.rs rename to aries/agents/aries-vcx-agent/src/services/credential_definition.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/did_exchange.rs b/aries/agents/aries-vcx-agent/src/services/did_exchange.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/did_exchange.rs rename to aries/agents/aries-vcx-agent/src/services/did_exchange.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/holder.rs b/aries/agents/aries-vcx-agent/src/services/holder.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/holder.rs rename to aries/agents/aries-vcx-agent/src/services/holder.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/issuer.rs b/aries/agents/aries-vcx-agent/src/services/issuer.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/issuer.rs rename to aries/agents/aries-vcx-agent/src/services/issuer.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/mod.rs b/aries/agents/aries-vcx-agent/src/services/mod.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/mod.rs rename to aries/agents/aries-vcx-agent/src/services/mod.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/out_of_band.rs b/aries/agents/aries-vcx-agent/src/services/out_of_band.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/out_of_band.rs rename to aries/agents/aries-vcx-agent/src/services/out_of_band.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/prover.rs b/aries/agents/aries-vcx-agent/src/services/prover.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/prover.rs rename to aries/agents/aries-vcx-agent/src/services/prover.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/revocation_registry.rs b/aries/agents/aries-vcx-agent/src/services/revocation_registry.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/revocation_registry.rs rename to aries/agents/aries-vcx-agent/src/services/revocation_registry.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/schema.rs b/aries/agents/aries-vcx-agent/src/services/schema.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/schema.rs rename to aries/agents/aries-vcx-agent/src/services/schema.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/services/verifier.rs b/aries/agents/aries-vcx-agent/src/services/verifier.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/services/verifier.rs rename to aries/agents/aries-vcx-agent/src/services/verifier.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/storage/mod.rs b/aries/agents/aries-vcx-agent/src/storage/mod.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/storage/mod.rs rename to aries/agents/aries-vcx-agent/src/storage/mod.rs diff --git a/aries/agents/rust/aries-vcx-agent/src/storage/object_cache.rs b/aries/agents/aries-vcx-agent/src/storage/object_cache.rs similarity index 100% rename from aries/agents/rust/aries-vcx-agent/src/storage/object_cache.rs rename to aries/agents/aries-vcx-agent/src/storage/object_cache.rs diff --git a/aries/agents/rust/mediator/.cargo/config.toml b/aries/agents/mediator/.cargo/config.toml similarity index 100% rename from aries/agents/rust/mediator/.cargo/config.toml rename to aries/agents/mediator/.cargo/config.toml diff --git a/aries/agents/rust/mediator/.env b/aries/agents/mediator/.env similarity index 100% rename from aries/agents/rust/mediator/.env rename to aries/agents/mediator/.env diff --git a/aries/agents/rust/mediator/.gitignore b/aries/agents/mediator/.gitignore similarity index 100% rename from aries/agents/rust/mediator/.gitignore rename to aries/agents/mediator/.gitignore diff --git a/aries/agents/rust/mediator/Cargo.toml b/aries/agents/mediator/Cargo.toml similarity index 76% rename from aries/agents/rust/mediator/Cargo.toml rename to aries/agents/mediator/Cargo.toml index 011d01ff4c..9bb0f7ee2d 100644 --- a/aries/agents/rust/mediator/Cargo.toml +++ b/aries/agents/mediator/Cargo.toml @@ -11,20 +11,20 @@ client = [] [dependencies] anyhow = "1.0.75" -aries_vcx = { path = "../../../aries_vcx" } -aries_vcx_core = { path = "../../../aries_vcx_core", features = [ +aries_vcx = { path = "../../aries_vcx" } +aries_vcx_core = { path = "../../aries_vcx_core", features = [ "vdrtools_wallet", ] } async-trait = "0.1.73" axum = "0.6" axum-macros = "0.3.8" -diddoc_legacy = { path = "../../../misc/legacy/diddoc_legacy" } +diddoc_legacy = { path = "../../misc/legacy/diddoc_legacy" } dotenvy = "0.15" env_logger = "0.10.0" fast_qr = { version = "0.10.2", features = ["svg"] } futures = "0.3.28" log = "0.4.20" -messages = { path = "../../../messages" } +messages = { path = "../../messages" } reqwest = { version = "0.11.20", features = ["json"] } serde = "1.0.188" serde_json = "1.0.106" @@ -34,7 +34,7 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros"] } tower-http = { version = "0.4.4", features = ["catch-panic"] } url = "2.4.1" uuid = "1.4.1" -test_utils = { path = "../../../misc/test_utils" } +test_utils = { path = "../../misc/test_utils" } base64-url = "2.0.0" [dev-dependencies] diff --git a/aries/agents/rust/mediator/Dockerfile b/aries/agents/mediator/Dockerfile similarity index 84% rename from aries/agents/rust/mediator/Dockerfile rename to aries/agents/mediator/Dockerfile index a4ffad07ab..66a4e17eab 100644 --- a/aries/agents/rust/mediator/Dockerfile +++ b/aries/agents/mediator/Dockerfile @@ -7,7 +7,7 @@ RUN ls -lahF RUN --mount=type=cache,target=./target \ --mount=type=cache,target=${CARGO_HOME}/git \ --mount=type=cache,target=${CARGO_HOME}/registry \ - cargo install --no-default-features --path=./aries/agents/rust/mediator/ --bin mediator + cargo install --no-default-features --path=./aries/agents/mediator/ --bin mediator FROM debian:bookworm-slim as mediator RUN apt update && apt install -y libsodium23 libzmq5 && rm -rf /var/lib/apt/lists/* diff --git a/aries/agents/rust/mediator/Dockerfile.dockerignore b/aries/agents/mediator/Dockerfile.dockerignore similarity index 100% rename from aries/agents/rust/mediator/Dockerfile.dockerignore rename to aries/agents/mediator/Dockerfile.dockerignore diff --git a/aries/agents/rust/mediator/README.md b/aries/agents/mediator/README.md similarity index 100% rename from aries/agents/rust/mediator/README.md rename to aries/agents/mediator/README.md diff --git a/aries/agents/rust/mediator/build.rs b/aries/agents/mediator/build.rs similarity index 100% rename from aries/agents/rust/mediator/build.rs rename to aries/agents/mediator/build.rs diff --git a/aries/agents/rust/mediator/client-tui/Cargo.toml b/aries/agents/mediator/client-tui/Cargo.toml similarity index 80% rename from aries/agents/rust/mediator/client-tui/Cargo.toml rename to aries/agents/mediator/client-tui/Cargo.toml index 5b68ec6d22..ed93a4868a 100644 --- a/aries/agents/rust/mediator/client-tui/Cargo.toml +++ b/aries/agents/mediator/client-tui/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -aries_vcx_core = { path = "../../../../aries_vcx_core", features = [ +aries_vcx_core = { path = "../../../aries_vcx_core", features = [ "vdrtools_wallet", ] } axum = "0.6.20" @@ -14,7 +14,7 @@ cursive = { version = "0.20.0", features = ["crossterm-backend"] } futures = "0.3.28" log = "0.4.20" mediator = { path = ".." } -messages = { path = "../../../../messages" } +messages = { path = "../../../messages" } reqwest = "0.11.22" serde_json = "1.0.107" diff --git a/aries/agents/rust/mediator/client-tui/src/lib.rs b/aries/agents/mediator/client-tui/src/lib.rs similarity index 100% rename from aries/agents/rust/mediator/client-tui/src/lib.rs rename to aries/agents/mediator/client-tui/src/lib.rs diff --git a/aries/agents/rust/mediator/client-tui/src/main.rs b/aries/agents/mediator/client-tui/src/main.rs similarity index 100% rename from aries/agents/rust/mediator/client-tui/src/main.rs rename to aries/agents/mediator/client-tui/src/main.rs diff --git a/aries/agents/rust/mediator/client-tui/src/tui.rs b/aries/agents/mediator/client-tui/src/tui.rs similarity index 100% rename from aries/agents/rust/mediator/client-tui/src/tui.rs rename to aries/agents/mediator/client-tui/src/tui.rs diff --git a/aries/agents/rust/mediator/compose.yaml b/aries/agents/mediator/compose.yaml similarity index 100% rename from aries/agents/rust/mediator/compose.yaml rename to aries/agents/mediator/compose.yaml diff --git a/aries/agents/rust/mediator/db-only.compose.yaml b/aries/agents/mediator/db-only.compose.yaml similarity index 100% rename from aries/agents/rust/mediator/db-only.compose.yaml rename to aries/agents/mediator/db-only.compose.yaml diff --git a/aries/agents/rust/mediator/migrations/20230810132416_3-part-data-(accounts,_recipients,_messages).sql b/aries/agents/mediator/migrations/20230810132416_3-part-data-(accounts,_recipients,_messages).sql similarity index 100% rename from aries/agents/rust/mediator/migrations/20230810132416_3-part-data-(accounts,_recipients,_messages).sql rename to aries/agents/mediator/migrations/20230810132416_3-part-data-(accounts,_recipients,_messages).sql diff --git a/aries/agents/rust/mediator/src/aries_agent/client/mod.rs b/aries/agents/mediator/src/aries_agent/client/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/aries_agent/client/mod.rs rename to aries/agents/mediator/src/aries_agent/client/mod.rs diff --git a/aries/agents/rust/mediator/src/aries_agent/client/transports.rs b/aries/agents/mediator/src/aries_agent/client/transports.rs similarity index 100% rename from aries/agents/rust/mediator/src/aries_agent/client/transports.rs rename to aries/agents/mediator/src/aries_agent/client/transports.rs diff --git a/aries/agents/rust/mediator/src/aries_agent/mod.rs b/aries/agents/mediator/src/aries_agent/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/aries_agent/mod.rs rename to aries/agents/mediator/src/aries_agent/mod.rs diff --git a/aries/agents/rust/mediator/src/aries_agent/utils.rs b/aries/agents/mediator/src/aries_agent/utils.rs similarity index 100% rename from aries/agents/rust/mediator/src/aries_agent/utils.rs rename to aries/agents/mediator/src/aries_agent/utils.rs diff --git a/aries/agents/rust/mediator/src/bin/mediator.rs b/aries/agents/mediator/src/bin/mediator.rs similarity index 100% rename from aries/agents/rust/mediator/src/bin/mediator.rs rename to aries/agents/mediator/src/bin/mediator.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/connection.rs b/aries/agents/mediator/src/didcomm_handlers/connection.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/connection.rs rename to aries/agents/mediator/src/didcomm_handlers/connection.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/forward.rs b/aries/agents/mediator/src/didcomm_handlers/forward.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/forward.rs rename to aries/agents/mediator/src/didcomm_handlers/forward.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/mediator_coord.rs b/aries/agents/mediator/src/didcomm_handlers/mediator_coord.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/mediator_coord.rs rename to aries/agents/mediator/src/didcomm_handlers/mediator_coord.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/mod.rs b/aries/agents/mediator/src/didcomm_handlers/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/mod.rs rename to aries/agents/mediator/src/didcomm_handlers/mod.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/pickup.rs b/aries/agents/mediator/src/didcomm_handlers/pickup.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/pickup.rs rename to aries/agents/mediator/src/didcomm_handlers/pickup.rs diff --git a/aries/agents/rust/mediator/src/didcomm_handlers/utils.rs b/aries/agents/mediator/src/didcomm_handlers/utils.rs similarity index 100% rename from aries/agents/rust/mediator/src/didcomm_handlers/utils.rs rename to aries/agents/mediator/src/didcomm_handlers/utils.rs diff --git a/aries/agents/rust/mediator/src/http_routes/mod.rs b/aries/agents/mediator/src/http_routes/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/http_routes/mod.rs rename to aries/agents/mediator/src/http_routes/mod.rs diff --git a/aries/agents/rust/mediator/src/lib.rs b/aries/agents/mediator/src/lib.rs similarity index 100% rename from aries/agents/rust/mediator/src/lib.rs rename to aries/agents/mediator/src/lib.rs diff --git a/aries/agents/rust/mediator/src/mediation/coordination.rs b/aries/agents/mediator/src/mediation/coordination.rs similarity index 100% rename from aries/agents/rust/mediator/src/mediation/coordination.rs rename to aries/agents/mediator/src/mediation/coordination.rs diff --git a/aries/agents/rust/mediator/src/mediation/forward.rs b/aries/agents/mediator/src/mediation/forward.rs similarity index 100% rename from aries/agents/rust/mediator/src/mediation/forward.rs rename to aries/agents/mediator/src/mediation/forward.rs diff --git a/aries/agents/rust/mediator/src/mediation/mod.rs b/aries/agents/mediator/src/mediation/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/mediation/mod.rs rename to aries/agents/mediator/src/mediation/mod.rs diff --git a/aries/agents/rust/mediator/src/mediation/pickup.rs b/aries/agents/mediator/src/mediation/pickup.rs similarity index 100% rename from aries/agents/rust/mediator/src/mediation/pickup.rs rename to aries/agents/mediator/src/mediation/pickup.rs diff --git a/aries/agents/rust/mediator/src/persistence/database/mod.rs b/aries/agents/mediator/src/persistence/database/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/persistence/database/mod.rs rename to aries/agents/mediator/src/persistence/database/mod.rs diff --git a/aries/agents/rust/mediator/src/persistence/database/mysql.rs b/aries/agents/mediator/src/persistence/database/mysql.rs similarity index 100% rename from aries/agents/rust/mediator/src/persistence/database/mysql.rs rename to aries/agents/mediator/src/persistence/database/mysql.rs diff --git a/aries/agents/rust/mediator/src/persistence/errors.rs b/aries/agents/mediator/src/persistence/errors.rs similarity index 100% rename from aries/agents/rust/mediator/src/persistence/errors.rs rename to aries/agents/mediator/src/persistence/errors.rs diff --git a/aries/agents/rust/mediator/src/persistence/mod.rs b/aries/agents/mediator/src/persistence/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/persistence/mod.rs rename to aries/agents/mediator/src/persistence/mod.rs diff --git a/aries/agents/rust/mediator/src/utils/binary_utils.rs b/aries/agents/mediator/src/utils/binary_utils.rs similarity index 100% rename from aries/agents/rust/mediator/src/utils/binary_utils.rs rename to aries/agents/mediator/src/utils/binary_utils.rs diff --git a/aries/agents/rust/mediator/src/utils/mod.rs b/aries/agents/mediator/src/utils/mod.rs similarity index 100% rename from aries/agents/rust/mediator/src/utils/mod.rs rename to aries/agents/mediator/src/utils/mod.rs diff --git a/aries/agents/rust/mediator/src/utils/prelude.rs b/aries/agents/mediator/src/utils/prelude.rs similarity index 100% rename from aries/agents/rust/mediator/src/utils/prelude.rs rename to aries/agents/mediator/src/utils/prelude.rs diff --git a/aries/agents/rust/mediator/src/utils/structs.rs b/aries/agents/mediator/src/utils/structs.rs similarity index 100% rename from aries/agents/rust/mediator/src/utils/structs.rs rename to aries/agents/mediator/src/utils/structs.rs diff --git a/aries/agents/rust/mediator/tests/common/agent_and_transport_utils.rs b/aries/agents/mediator/tests/common/agent_and_transport_utils.rs similarity index 100% rename from aries/agents/rust/mediator/tests/common/agent_and_transport_utils.rs rename to aries/agents/mediator/tests/common/agent_and_transport_utils.rs diff --git a/aries/agents/rust/mediator/tests/common/mod.rs b/aries/agents/mediator/tests/common/mod.rs similarity index 100% rename from aries/agents/rust/mediator/tests/common/mod.rs rename to aries/agents/mediator/tests/common/mod.rs diff --git a/aries/agents/rust/mediator/tests/mediator-aries-connection.rs b/aries/agents/mediator/tests/mediator-aries-connection.rs similarity index 100% rename from aries/agents/rust/mediator/tests/mediator-aries-connection.rs rename to aries/agents/mediator/tests/mediator-aries-connection.rs diff --git a/aries/agents/rust/mediator/tests/mediator-coord-protocol.rs b/aries/agents/mediator/tests/mediator-coord-protocol.rs similarity index 100% rename from aries/agents/rust/mediator/tests/mediator-coord-protocol.rs rename to aries/agents/mediator/tests/mediator-coord-protocol.rs diff --git a/aries/agents/rust/mediator/tests/mediator-oob-invitation.rs b/aries/agents/mediator/tests/mediator-oob-invitation.rs similarity index 100% rename from aries/agents/rust/mediator/tests/mediator-oob-invitation.rs rename to aries/agents/mediator/tests/mediator-oob-invitation.rs diff --git a/aries/agents/rust/mediator/tests/mediator-protocol-pickup.rs b/aries/agents/mediator/tests/mediator-protocol-pickup.rs similarity index 100% rename from aries/agents/rust/mediator/tests/mediator-protocol-pickup.rs rename to aries/agents/mediator/tests/mediator-protocol-pickup.rs diff --git a/aries/agents/rust/mediator/tests/mediator-routing-forward.rs b/aries/agents/mediator/tests/mediator-routing-forward.rs similarity index 100% rename from aries/agents/rust/mediator/tests/mediator-routing-forward.rs rename to aries/agents/mediator/tests/mediator-routing-forward.rs diff --git a/aries/agents/rust/mobile_demo/.gitignore b/aries/agents/mobile_demo/.gitignore similarity index 100% rename from aries/agents/rust/mobile_demo/.gitignore rename to aries/agents/mobile_demo/.gitignore diff --git a/aries/agents/rust/mobile_demo/app/.gitignore b/aries/agents/mobile_demo/app/.gitignore similarity index 100% rename from aries/agents/rust/mobile_demo/app/.gitignore rename to aries/agents/mobile_demo/app/.gitignore diff --git a/aries/agents/rust/mobile_demo/app/build.gradle b/aries/agents/mobile_demo/app/build.gradle similarity index 100% rename from aries/agents/rust/mobile_demo/app/build.gradle rename to aries/agents/mobile_demo/app/build.gradle diff --git a/aries/agents/rust/mobile_demo/app/proguard-rules.pro b/aries/agents/mobile_demo/app/proguard-rules.pro similarity index 100% rename from aries/agents/rust/mobile_demo/app/proguard-rules.pro rename to aries/agents/mobile_demo/app/proguard-rules.pro diff --git a/aries/agents/rust/mobile_demo/app/src/androidTest/java/org/hyperledger/ariesvcx/ExampleInstrumentedTest.kt b/aries/agents/mobile_demo/app/src/androidTest/java/org/hyperledger/ariesvcx/ExampleInstrumentedTest.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/androidTest/java/org/hyperledger/ariesvcx/ExampleInstrumentedTest.kt rename to aries/agents/mobile_demo/app/src/androidTest/java/org/hyperledger/ariesvcx/ExampleInstrumentedTest.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/AndroidManifest.xml b/aries/agents/mobile_demo/app/src/main/AndroidManifest.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/AndroidManifest.xml rename to aries/agents/mobile_demo/app/src/main/AndroidManifest.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/AppDemoController.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Constants.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/CredentialScreen.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/CredentialScreen.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/CredentialScreen.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/CredentialScreen.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Credentials.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Credentials.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Credentials.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/Credentials.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HolderScreen.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HolderScreen.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HolderScreen.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HolderScreen.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/HomeScreen.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/MainActivity.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/MainActivity.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/MainActivity.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/MainActivity.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/QrCodeAnalyzer.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/QrCodeAnalyzer.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/QrCodeAnalyzer.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/QrCodeAnalyzer.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ScanScreen.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Color.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Color.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Color.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Color.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Theme.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Theme.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Theme.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Theme.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Type.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Type.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Type.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/ui/theme/Type.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/OkHttpAwait.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/OkHttpAwait.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/OkHttpAwait.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/OkHttpAwait.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/PrepareGenesisFile.kt b/aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/PrepareGenesisFile.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/PrepareGenesisFile.kt rename to aries/agents/mobile_demo/app/src/main/java/org/hyperledger/ariesvcx/utils/PrepareGenesisFile.kt diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/aries/agents/mobile_demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to aries/agents/mobile_demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/drawable/ic_launcher_background.xml b/aries/agents/mobile_demo/app/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/drawable/ic_launcher_background.xml rename to aries/agents/mobile_demo/app/src/main/res/drawable/ic_launcher_background.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/aries/agents/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to aries/agents/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/aries/agents/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to aries/agents/mobile_demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/aries/agents/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp rename to aries/agents/mobile_demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/raw/bcovrin_transactions b/aries/agents/mobile_demo/app/src/main/res/raw/bcovrin_transactions similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/raw/bcovrin_transactions rename to aries/agents/mobile_demo/app/src/main/res/raw/bcovrin_transactions diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/values/colors.xml b/aries/agents/mobile_demo/app/src/main/res/values/colors.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/values/colors.xml rename to aries/agents/mobile_demo/app/src/main/res/values/colors.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/values/strings.xml b/aries/agents/mobile_demo/app/src/main/res/values/strings.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/values/strings.xml rename to aries/agents/mobile_demo/app/src/main/res/values/strings.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/values/themes.xml b/aries/agents/mobile_demo/app/src/main/res/values/themes.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/values/themes.xml rename to aries/agents/mobile_demo/app/src/main/res/values/themes.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/xml/backup_rules.xml b/aries/agents/mobile_demo/app/src/main/res/xml/backup_rules.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/xml/backup_rules.xml rename to aries/agents/mobile_demo/app/src/main/res/xml/backup_rules.xml diff --git a/aries/agents/rust/mobile_demo/app/src/main/res/xml/data_extraction_rules.xml b/aries/agents/mobile_demo/app/src/main/res/xml/data_extraction_rules.xml similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/main/res/xml/data_extraction_rules.xml rename to aries/agents/mobile_demo/app/src/main/res/xml/data_extraction_rules.xml diff --git a/aries/agents/rust/mobile_demo/app/src/test/java/org/hyperledger/ariesvcx/ExampleUnitTest.kt b/aries/agents/mobile_demo/app/src/test/java/org/hyperledger/ariesvcx/ExampleUnitTest.kt similarity index 100% rename from aries/agents/rust/mobile_demo/app/src/test/java/org/hyperledger/ariesvcx/ExampleUnitTest.kt rename to aries/agents/mobile_demo/app/src/test/java/org/hyperledger/ariesvcx/ExampleUnitTest.kt diff --git a/aries/agents/rust/mobile_demo/build.gradle b/aries/agents/mobile_demo/build.gradle similarity index 100% rename from aries/agents/rust/mobile_demo/build.gradle rename to aries/agents/mobile_demo/build.gradle diff --git a/aries/agents/rust/mobile_demo/gradle.properties b/aries/agents/mobile_demo/gradle.properties similarity index 100% rename from aries/agents/rust/mobile_demo/gradle.properties rename to aries/agents/mobile_demo/gradle.properties diff --git a/aries/agents/rust/mobile_demo/gradle/wrapper/gradle-wrapper.jar b/aries/agents/mobile_demo/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from aries/agents/rust/mobile_demo/gradle/wrapper/gradle-wrapper.jar rename to aries/agents/mobile_demo/gradle/wrapper/gradle-wrapper.jar diff --git a/aries/agents/rust/mobile_demo/gradle/wrapper/gradle-wrapper.properties b/aries/agents/mobile_demo/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from aries/agents/rust/mobile_demo/gradle/wrapper/gradle-wrapper.properties rename to aries/agents/mobile_demo/gradle/wrapper/gradle-wrapper.properties diff --git a/aries/agents/rust/mobile_demo/gradlew b/aries/agents/mobile_demo/gradlew similarity index 100% rename from aries/agents/rust/mobile_demo/gradlew rename to aries/agents/mobile_demo/gradlew diff --git a/aries/agents/rust/mobile_demo/gradlew.bat b/aries/agents/mobile_demo/gradlew.bat similarity index 100% rename from aries/agents/rust/mobile_demo/gradlew.bat rename to aries/agents/mobile_demo/gradlew.bat diff --git a/aries/agents/rust/mobile_demo/settings.gradle b/aries/agents/mobile_demo/settings.gradle similarity index 100% rename from aries/agents/rust/mobile_demo/settings.gradle rename to aries/agents/mobile_demo/settings.gradle diff --git a/aries/agents/node/.gitignore b/aries/agents/node/.gitignore deleted file mode 100644 index c7c0c162f2..0000000000 --- a/aries/agents/node/.gitignore +++ /dev/null @@ -1,75 +0,0 @@ -dist/ -lib/ -doc/ -package-lock.json -.npmrc - -# Created by https://www.gitignore.io/api/node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Typescript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - - -# End of https://www.gitignore.io/api/node - - -vcxagent-core/storage-proofs/ - -**/test/tmp diff --git a/aries/agents/node/vcxagent-cli/logger.js b/aries/agents/node/vcxagent-cli/logger.js deleted file mode 100644 index 3b1a3de7f4..0000000000 --- a/aries/agents/node/vcxagent-cli/logger.js +++ /dev/null @@ -1,22 +0,0 @@ -const { createLogger, format, transports } = require('winston') -const { label } = format - -const prettyFormatter = format.combine( - format.printf( - info => `${info.label} [${info.level}]: ${info.message}` - ) -) - -module.exports = loggerLabel => { - return createLogger({ - level: 'debug', - format: format.combine( - label({ label: loggerLabel }), - format.colorize({ all: true }), - prettyFormatter - ), - transports: [ - new transports.Console() - ] - }) -} diff --git a/aries/agents/node/vcxagent-cli/package.json b/aries/agents/node/vcxagent-cli/package.json deleted file mode 100644 index ea285be0cc..0000000000 --- a/aries/agents/node/vcxagent-cli/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "vcxagent-cli", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "interactive": "node vcxclient-cli.js", - "lint:fix": "standard --fix" - }, - "dependencies": { - "sovrin-networks": "git+https://github.com/AbsaOSS/sovrin-networks#0.1.0", - "@hyperledger/node-vcx-wrapper": "file:../../../../wrappers/node", - "@hyperledger/vcxagent-core": "file:../vcxagent-core", - "command-line-args": "^5.1.1", - "command-line-usage": "^5.0.5", - "readline-sync": "^1.4.10", - "uuid": "9.0.0", - "standard": "^16.0.4", - "winston": "^3.3.3" - }, - "author": "Absa Group Limited", - "license": "Apache-2.0" -} \ No newline at end of file diff --git a/aries/agents/node/vcxagent-cli/readme.md b/aries/agents/node/vcxagent-cli/readme.md deleted file mode 100644 index c8d6222494..0000000000 --- a/aries/agents/node/vcxagent-cli/readme.md +++ /dev/null @@ -1,17 +0,0 @@ -# VCX Agent CLI -CLI Utility - simple Aries agent with CLI interface. - -# What you need -As this tool is based on [vcxagent-core](../vcxagent-core), the prerequisites are the same. You -need to: -- have compiled `aries-vcx` library, -- have mediator agent running. - -# Run -``` -node vcxclient-cli.js --help -``` -Example: -``` -npm run interactive -- --agencyUrl 'https://localhost:8080' --rustLog aries-vcx=trace,vcx=info --name dev -``` diff --git a/aries/agents/node/vcxagent-cli/script-common.js b/aries/agents/node/vcxagent-cli/script-common.js deleted file mode 100644 index e1ff70a971..0000000000 --- a/aries/agents/node/vcxagent-cli/script-common.js +++ /dev/null @@ -1,27 +0,0 @@ -const commandLineArgs = require('command-line-args') -const commandLineUsage = require('command-line-usage') - -module.exports.runScript = async function runScript (optionDefinitions, usageDefinition, areOptionsValid, runFunction) { - const usage = commandLineUsage(usageDefinition) - - let options = {} - try { - options = commandLineArgs(optionDefinitions) - } catch (error) { - console.error('Error parsing arguments') - console.error(error) - console.log(usage) - return - } - if (options.help) { - console.error('Help requested.') - console.log(usage) - return - } - if (!areOptionsValid(options)) { - console.error('Invalid options.') - console.log(usage) - return - } - await runFunction(options) -} diff --git a/aries/agents/node/vcxagent-cli/vcxclient-cli.js b/aries/agents/node/vcxagent-cli/vcxclient-cli.js deleted file mode 100644 index e385865fa5..0000000000 --- a/aries/agents/node/vcxagent-cli/vcxclient-cli.js +++ /dev/null @@ -1,62 +0,0 @@ -const { runInteractive } = require('./vcxclient-interactive') -const { runScript } = require('./script-common') - -const optionDefinitions = [ - { - name: 'help', - alias: 'h', - type: Boolean, - description: 'Display this usage guide.' - }, - { - name: 'acceptTaa', - type: Boolean, - description: 'If specified accpets taa', - defaultValue: false - }, - { - name: 'seed', - type: String, - description: 'Provision seed', - defaultValue: '000000000000000000000000Trustee1' - }, - { - name: 'name', - type: String, - description: 'Agent name' - }, - { - name: 'rustLog', - type: String, - description: 'Rust log level', - defaultValue: 'warn,aries-vcx=trace' - }, - { - name: 'agencyUrl', - type: String, - description: 'Url of mediator agency', - defaultValue: 'http://localhost:8080' - }, - { - name: 'indyNetwork', - type: String, - description: 'Identifier for indy network', - defaultValue: '127.0.0.1' - } -] - -const usage = [ - { - header: 'Options', - optionList: optionDefinitions - }, - { - content: 'Project home: {underline https://github.com/AbsaOSS/libvcx}' - } -] - -function areOptionsValid (_options) { - return true -} - -runScript(optionDefinitions, usage, areOptionsValid, runInteractive) diff --git a/aries/agents/node/vcxagent-cli/vcxclient-interactive.js b/aries/agents/node/vcxagent-cli/vcxclient-interactive.js deleted file mode 100644 index 8c8cd41c00..0000000000 --- a/aries/agents/node/vcxagent-cli/vcxclient-interactive.js +++ /dev/null @@ -1,115 +0,0 @@ -const readlineSync = require('readline-sync') -const { initRustapi, createVcxAgent } = require('@hyperledger/vcxagent-core') -const logger = require('./logger')('VCX Client') -const { getGenesisFile } = require('sovrin-networks') -const uuid = require('uuid') - -async function createInteractiveClient (agentName, seed, acceptTaa, rustLogLevel, agencyUrl, indyNetwork) { - logger.info(`Creating interactive client ${agentName} seed=${seed}, rustLogLevel=${rustLogLevel}, indyNetwork: ${indyNetwork}`) - - await initRustapi(rustLogLevel) - const genesisPath = (indyNetwork) ? getGenesisFile(indyNetwork) : undefined - console.log(`Resolved genesis path: ${genesisPath}`) - const ariesAgent = await createVcxAgent({ - genesisPath, - agentName, - agencyUrl, - seed, - logger, - rustLogLevel - }) - await ariesAgent.agentInitVcx() - - if (acceptTaa) { - await ariesAgent.acceptTaa() - } - - const commands = { - 0: 'ACCEPT_TAA', - 1: 'CREATE_SCHEMA', - 2: 'CREATE_CRED_DEF', - 10: 'CONNECTION_INVITER_CREATE', - 11: 'CONNECTION_INVITEE_ACCEPT', - 12: 'CONNECTION_PROGRESS', - 13: 'CONNECTION_INFO', - 14: 'CONNECTIONS_INFO', - 20: 'GET_CREDENTIAL_OFFERS', - 21: 'ACCEPT_CREDENTIAL_OFFER', - 22: 'DISPLAY_CREDENTIAL', - 30: 'SEND_MESSAGE', - 31: 'GET_MESSAGE', - 32: 'GET_MESSAGE_V2' - } - - while (true) { - const cmd = readlineSync.question(`Select action: ${JSON.stringify(commands, null, 2)}\n`) - if (cmd) { - if (cmd === '0') { - logger.info('Going to accept taa.\n') - await ariesAgent.acceptTaa() - logger.info('Taa accepted.\n') - } else if (cmd === '10') { - const connectionId = readlineSync.question('Enter connection id:\n') - await ariesAgent.serviceConnections.inviterConnectionCreateAndAccept(connectionId, (invitationString) => { - logger.info(`Connection ${connectionId} created. Invitation: ${invitationString}`) - }) - } else if (cmd === '11') { - const connectionId = readlineSync.question('Enter connection id:\n') - let invitationString = readlineSync.question('Enter invitation:\n') - try { - const url = new URL(invitationString) - const base64Invitation = url.searchParams.get('c_i') || url.searchParams.get('oob') - if (base64Invitation) { - invitationString = Buffer.from(base64Invitation, 'base64').toString() - } - } catch (err) { - logger.debug("Invitation string is not URL, will assume it's an Aries message as JSON") - } - await ariesAgent.serviceConnections.inviteeConnectionAcceptFromInvitationAndProgress(connectionId, invitationString) - } else if (cmd === '12') { - const connectionId = readlineSync.question('Enter connection id:\n') - await ariesAgent.serviceConnections.connectionAutoupdate(connectionId) - } else if (cmd === '13') { - const connectionId = readlineSync.question('Enter connection id:\n') - await ariesAgent.serviceConnections.printInfo([connectionId]) - } else if (cmd === '14') { - const connectionIds = await ariesAgent.serviceConnections.listIds() - await ariesAgent.serviceConnections.printInfo(connectionIds) - } else if (cmd === '20') { - const connectionId = readlineSync.question('Enter connection id:\n') - await ariesAgent.serviceCredHolder.waitForCredentialOffer(connectionId, null, 1, 0) - } else if (cmd === '21') { - const connectionId = readlineSync.question('Enter connection id:\n') - const id = uuid.v4() - await ariesAgent.serviceCredHolder.waitForCredentialOfferAndAcceptAndProgress(connectionId, id, null, 20, 1000) - logger.info(`Received credential, assigned it local id ${id}`) - } else if (cmd === '22') { - const id = readlineSync.question('Enter credential id:\n') - const data = await ariesAgent.serviceCredHolder.getCredentialData(id) - logger.info(`Resolved credential object: ${JSON.stringify(data)}`) - } else if (cmd === '30') { - const connectionId = readlineSync.question('Enter connection id:\n') - const message = readlineSync.question('Enter message to send:\n') - await ariesAgent.serviceConnections.sendMessage(connectionId, message) - } else if (cmd === '31') { - const connectionId = readlineSync.question('Enter connection id:\n') - const messages = await ariesAgent.serviceConnections.getMessages(connectionId, [], []) - logger.info(`Found messages\n:${JSON.stringify(messages, null, 2)}`) - } else if (cmd === '32') { - const connectionId = readlineSync.question('Enter connection id:\n') - const messages = await ariesAgent.serviceConnections.getMessagesV2(connectionId, [], []) - logger.info(`Found messages\n:${JSON.stringify(messages, null, 2)}`) - } else { - logger.error(`Unknown command ${cmd}`) - } - } - } -} - -async function runInteractive (options) { - logger.debug(`Going to build interactive client using options ${JSON.stringify(options)}`) - const agentName = options.name || readlineSync.question('Enter agent\'s name:\n') - await createInteractiveClient(agentName, options.seed, options.acceptTaa, options.rustLog, options.agencyUrl, options.indyNetwork) -} - -module.exports.runInteractive = runInteractive diff --git a/aries/agents/node/vcxagent-core/.gitignore b/aries/agents/node/vcxagent-core/.gitignore deleted file mode 100644 index 54228bffd9..0000000000 --- a/aries/agents/node/vcxagent-core/.gitignore +++ /dev/null @@ -1 +0,0 @@ -storage-*/ diff --git a/aries/agents/node/vcxagent-core/demo/alice.js b/aries/agents/node/vcxagent-core/demo/alice.js deleted file mode 100644 index e7ec0aa58e..0000000000 --- a/aries/agents/node/vcxagent-core/demo/alice.js +++ /dev/null @@ -1,153 +0,0 @@ -const readlineSync = require('readline-sync') -const sleepPromise = require('sleep-promise') -const { createVcxAgent } = require('../src/index') -const { testTailsUrl } = require('../src/common') -const logger = require('./logger')('Alice') -const { runScript } = require('./script-common') -const uuid = require('uuid') -const axios = require('axios') -const isPortReachable = require('is-port-reachable') -const url = require('url') -const { extractProofRequestAttachement } = require('../src/utils/proofs') -const assert = require('assert') -const { getStorageInfoMysql } = require('./wallet-common') -const { initRustLogger } = require('../src') -const mkdirp = require('mkdirp') - -const tailsDir = '/tmp/tails' -const mapRevRegIdToTailsFile = (_revRegId) => tailsDir - -async function getInvitationString (fetchInviteUrl) { - mkdirp.sync(tailsDir) - let invitationString - if (fetchInviteUrl) { - const fetchInviteAttemptThreshold = 30 - const fetchInviteTimeout = 1000 - let fetchInviteAttemps = 0 - while (!invitationString) { - if (await isPortReachable(url.parse(fetchInviteUrl).port, {host: url.parse(fetchInviteUrl).hostname})) { // eslint-disable-line - ({ data: { invitationString } } = await axios.get(fetchInviteUrl)) - logger.info(`Invitation ${invitationString} was loaded from ${fetchInviteUrl}.`) - } else { - logger.info(`Invitation fetch url ${fetchInviteUrl} not yet available. ${fetchInviteAttemps}/${fetchInviteAttemptThreshold}`) - await sleepPromise(fetchInviteTimeout) - } - fetchInviteAttemps++ - if (fetchInviteAttemps > fetchInviteAttemptThreshold) { - throw Error(`Could not reach ${fetchInviteUrl} to fetch connection invitation.`) - } - } - } else { - invitationString = readlineSync.question('Enter connection invitation:\n') - } - return invitationString -} - -async function runAlice (options) { - logger.info('Starting alice.') - - initRustLogger(process.env.RUST_LOG || 'vcx=error') - const agentName = `alice-${uuid.v4()}` - const connectionId = 'alice-to-faber' - const holderCredentialId = 'alice-credential' - const disclosedProofId = 'alice-proof' - const walletExtraConfigs = (options.mysql) - ? getStorageInfoMysql() - : {} - - const vcxAgent = await createVcxAgent({ - agentName, - agencyUrl: process.env.AGENCY_URL || 'https://ariesvcx.agency.staging.absa.id', - seed: '000000000000000000000000Trustee1', - walletExtraConfigs, - logger - }) - await vcxAgent.agentInitVcx() - await vcxAgent.updateWebhookUrl(`http://localhost:7209/notifications/${agentName}`) - - const invitationString = await getInvitationString(options['autofetch-invitation-url']) - await vcxAgent.serviceConnections.inviteeConnectionAcceptFromInvitationAndProgress(connectionId, invitationString) - logger.info('Connection to alice was Accepted!') - - await vcxAgent.serviceCredHolder.waitForCredentialOfferAndAcceptAndProgress(connectionId, holderCredentialId) - const revRegId = await vcxAgent.serviceCredHolder.getRevRegId(holderCredentialId) - await _validateTestTailsLocation(holderCredentialId, revRegId, vcxAgent) - - const proofRequests = await vcxAgent.serviceProver.waitForProofRequests(connectionId) - if (proofRequests.length === 0) { - throw Error('No proof request found.') - } - const proofRequest = proofRequests[0] - - await vcxAgent.serviceProver.buildDisclosedProof(disclosedProofId, proofRequest) - const requestInfo = extractProofRequestAttachement(proofRequest) - logger.debug(`Proof request presentation attachment ${JSON.stringify(requestInfo, null, 2)}`) - - const { selectedCreds } = await vcxAgent.serviceProver.selectCredentials(disclosedProofId, mapRevRegIdToTailsFile) - const selfAttestedAttrs = { attr_nickname: 'Smith' } - await vcxAgent.serviceProver.generateProof(disclosedProofId, selectedCreds, selfAttestedAttrs) - await vcxAgent.serviceProver.sendDisclosedProofAndProgress(disclosedProofId, connectionId) - logger.info('Faber received the proof') - - const msgs = await vcxAgent.serviceConnections.getMessages(connectionId) - _validateMsgs(msgs) - - const msgs2 = await vcxAgent.serviceConnections.getMessagesV2(connectionId) - _validateMsgs(msgs2) - - await vcxAgent.agentShutdownVcx() - process.exit(0) -} - -function _validateMsgs (msgs) { - logger.debug(`Validating messages:\n${JSON.stringify(msgs, null, 2)}`) - assert(msgs.length === 4) - assert(msgs[0].uid) - assert(msgs[0].statusCode) - assert(msgs[0].decryptedMsg) - const payload = JSON.parse(msgs[0].decryptedMsg) - assert(payload['@id']) - assert(payload['@type']) -} - -async function _validateTestTailsLocation (holderCredentialId, revRegId, vcxAgent) { - logger.debug(`Going to check that holder's tails location is ${testTailsUrl}`) - const tailsLocation = await vcxAgent.serviceCredHolder.getTailsLocation(holderCredentialId) - assert.equal(tailsLocation, testTailsUrl) -} - -const optionDefinitions = [ - { - name: 'help', - alias: 'h', - type: Boolean, - description: 'Display this usage guide.' - }, - { - name: 'mysql', - type: Boolean, - description: 'If specified, mysql wallet will be used.', - defaultValue: false - }, - { - name: 'autofetch-invitation-url', - type: String, - description: 'If specified, the script will try to download invitation from specified url.' - } -] - -const usage = [ - { - header: 'Options', - optionList: optionDefinitions - }, - { - content: 'Project home: {underline https://github.com/AbsaOSS/libvcx}' - } -] - -function areOptionsValid (_options) { - return true -} - -runScript(optionDefinitions, usage, areOptionsValid, runAlice) diff --git a/aries/agents/node/vcxagent-core/demo/faber.js b/aries/agents/node/vcxagent-core/demo/faber.js deleted file mode 100644 index ae99c80d38..0000000000 --- a/aries/agents/node/vcxagent-core/demo/faber.js +++ /dev/null @@ -1,202 +0,0 @@ -const { VerifierStateType, ProofVerificationStatus, Proof } = require('@hyperledger/node-vcx-wrapper') -const sleepPromise = require('sleep-promise') -const { runScript } = require('./script-common') -const logger = require('./logger')('Faber') -const assert = require('assert') -const uuid = require('uuid') -const express = require('express') -const bodyParser = require('body-parser') -const { getFaberProofDataWithNonRevocation } = require('../test/utils/data') -const { createVcxAgent, getSampleSchemaData } = require('../src/index') -const { getAliceSchemaAttrs, getFaberCredDefName } = require('../test/utils/data') -require('@hyperledger/node-vcx-wrapper') -const { getStorageInfoMysql } = require('./wallet-common') -const sleep = require('sleep-promise') -const { testTailsUrl, initRustLogger } = require('../src') -const mkdirp = require('mkdirp') - -const tailsDir = '/tmp/tails' - -async function runFaber (options) { - logger.info(`Starting Faber. Revocation enabled=${options.revocation}`) - mkdirp.sync(tailsDir) - initRustLogger(process.env.RUST_LOG || 'vcx=error') - - let faberServer - let exitcode = 0 - let vcxAgent - const credDefId = getFaberCredDefName() - const proofId = 'proof-from-alice' - const connectionId = 'faber-to-alice' - const issuerCredId = 'cred-for-alice' - try { - const agentName = `faber-${uuid.v4()}` - const walletExtraConfigs = (options.mysql) - ? getStorageInfoMysql() - : {} - - vcxAgent = await createVcxAgent({ - agentName, - agencyUrl: process.env.AGENCY_URL || 'https://ariesvcx.agency.staging.absa.id', - seed: '000000000000000000000000Trustee1', - walletExtraConfigs, - logger - }) - await vcxAgent.agentInitVcx() - await vcxAgent.updateWebhookUrl(`http://localhost:7209/notifications/${agentName}`) - - if (process.env.ACCEPT_TAA) { - await vcxAgent.acceptTaa() - } - - const issuerDid = vcxAgent.getInstitutionDid() - const schemaId = await vcxAgent.serviceLedgerSchema.createSchema(getSampleSchemaData(), issuerDid) - await sleep(500) - const vcxCredDef = await vcxAgent.serviceLedgerCredDef.createCredentialDefinitionV2(issuerDid, schemaId, getFaberCredDefName(), true, 'tag1') - const { revReg, revRegId } = await vcxAgent.serviceLedgerRevReg.createRevocationRegistry(issuerDid, await vcxCredDef.getCredDefId(), 1, tailsDir, 5, testTailsUrl) - - await vcxAgent.serviceConnections.inviterConnectionCreateAndAccept(connectionId, (invitationString) => { - logger.info('\n\n**invite details**') - logger.info('**You\'ll ge queried to paste this data to alice side of the demo. This is invitation to connect.**') - logger.info('**It\'s assumed this is obtained by Alice from Faber by some existing secure channel.**') - logger.info('**Could be on website via HTTPS, QR code scanned at Faber institution, ...**') - logger.info('\n******************\n\n') - logger.info(invitationString) - logger.info('\n\n******************\n\n') - - if (options['expose-invitation-port']) { - const port = options['expose-invitation-port'] - try { - const appCallbacks = express() - appCallbacks.use(bodyParser.json()) - appCallbacks.get('/', - async function (req, res) { - res.status(200).send({ invitationString }) - } - ) - faberServer = appCallbacks.listen(port) - logger.info(`The invitation is also available on port ${port}`) - } catch (e) { - logger.error(`Error trying to expose connection invitation on port ${port}`) - } - } - }) - - logger.info('Faber is going to send credential offer') - const schemaAttrs = getAliceSchemaAttrs() - await vcxAgent.serviceCredIssuer.sendOfferAndCredential(issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) - if (options.revocation === true) { - logger.info('Faber is revoking issued credential') - await vcxAgent.serviceCredIssuer.revokeCredentialLocal(issuerCredId) - logger.info('Faber is publishing revocation') - await revReg.publishRevocations(issuerDid) - } - - logger.info('#19 Create a Proof object') - const vcxProof = await Proof.create(getFaberProofDataWithNonRevocation(vcxAgent.getInstitutionDid(), proofId)) - - const connectionToAlice = await vcxAgent.serviceConnections.getVcxConnection(connectionId) - logger.info('#20 Request proof of degree from alice') - await vcxProof.requestProof(connectionToAlice) - - logger.info('#21 Poll agency and wait for alice to provide proof') - let proofProtocolState = await vcxProof.updateStateV2(connectionToAlice) - logger.debug(`vcxProof = ${JSON.stringify(vcxProof)}`) - logger.debug(`proofVerificationStatus = ${proofProtocolState}`) - while (![VerifierStateType.Finished, VerifierStateType.Failed].includes(proofProtocolState)) { - await sleepPromise(2000) - proofProtocolState = await vcxProof.updateStateV2(connectionToAlice) - logger.info(`proofVerificationStatus=${proofProtocolState}`) - if (proofProtocolState === VerifierStateType.Failed) { - logger.error(`Faber proof protocol state is ${3} which an error has ocurred.`) - logger.error(`Serialized proof state = ${JSON.stringify(await vcxProof.serialize())}`) - process.exit(-1) - } - } - - logger.info('#27 Process the proof provided by alice.') - const presentation = vcxProof.getPresentationMsg() - const verificationStatus = vcxProof.getVerificationStatus() - logger.info(`#27 Proof: proofVerificationStatus=${verificationStatus}, proof=${presentation}`) - assert(verificationStatus) - assert(presentation) - logger.info(`Proof protocol state = ${JSON.stringify(proofProtocolState)}`) - logger.info(`Proof verification state =${verificationStatus}`) - logger.debug(`Proof presentation = ${JSON.stringify(presentation, null, 2)}`) - logger.debug(`Serialized Proof state machine ${JSON.stringify(await vcxProof.serialize())}`) - - if (verificationStatus === ProofVerificationStatus.Valid) { - if (options.revocation) { - throw Error('Proof was verified, but was expected to be invalid, because revocation was enabled.') - } else { - logger.info('Proof was verified.') - } - } else if (verificationStatus === ProofVerificationStatus.Invalid) { - if (options.revocation) { - logger.info('Proof was determined as invalid, which was expected because the used credential was revoked.') - } else { - throw Error('Proof was invalid, but was expected to be verified. Revocation was not enabled.') - } - await sleepPromise(1000) - } else { - logger.error(`Unexpected proof state '${verificationStatus}'.`) - process.exit(-1) - } - - const msgs = await vcxAgent.serviceConnections.getMessagesV2(connectionId) - logger.debug(`Faber received messages: ${JSON.stringify(msgs, null, 2)}`) - assert(msgs.length === 4) - } catch (err) { - exitcode = -1 - logger.error(`Faber encountered error ${err.message} ${err.stack}`) - } finally { - if (faberServer) { - await faberServer.close() - } - logger.info(`Exiting process with code ${exitcode}`) - await vcxAgent.agentShutdownVcx() - process.exit(exitcode) - } -} - -const optionDefinitions = [ - { - name: 'help', - alias: 'h', - type: Boolean, - description: 'Display this usage guide.' - }, - { - name: 'mysql', - type: Boolean, - description: 'If specified, mysql wallet will be used.', - defaultValue: false - }, - { - name: 'revocation', - type: Boolean, - description: 'If specified, the issued credential will be revoked', - defaultValue: false - }, - { - name: 'expose-invitation-port', - type: Number, - description: 'If specified, invitation will be exposed on this port via HTTP' - } -] - -const usage = [ - { - header: 'Options', - optionList: optionDefinitions - }, - { - content: 'Project home: {underline https://github.com/AbsaOSS/libvcx}' - } -] - -function areOptionsValid (_options) { - return true -} - -runScript(optionDefinitions, usage, areOptionsValid, runFaber) diff --git a/aries/agents/node/vcxagent-core/demo/integration-test.js b/aries/agents/node/vcxagent-core/demo/integration-test.js deleted file mode 100644 index 0a9ea76f6c..0000000000 --- a/aries/agents/node/vcxagent-core/demo/integration-test.js +++ /dev/null @@ -1,51 +0,0 @@ -const path = require('path') -const { spawn } = require('child_process') - -function run (spawnProcess) { - const spawnedProcess = spawnProcess() - spawnedProcess.on('error', function (err) { - console.error(`Encountered error: ${JSON.stringify(err)}`) - process.exit(-1) - }) - spawnedProcess.on('exit', function (code, signal) { - if (code !== 0) { - console.error('Process finished with nonzero exit code!') - process.exit(-1) - } - }) - spawnedProcess.stdout.on('data', (data) => { - console.log(data.toString()) - }) - - spawnedProcess.stderr.on('data', (data) => { - console.error(data.toString()) - }) -} - -const spawnFaber = () => { - if (process.env.REVOCATION === 'true') { - return spawn('node', - [path.resolve(__dirname, './faber.js'), - '--expose-invitation-port', 8181, - '--revocation' - ] - ) - } else { - return spawn('node', - [path.resolve(__dirname, './faber.js'), - '--expose-invitation-port', 8181 - ] - ) - } -} - -const spawnAlice = () => { - return spawn('node', - [path.resolve(__dirname, './alice.js'), - '--autofetch-invitation-url', 'http://localhost:8181' - ] - ) -} - -run(spawnFaber) -run(spawnAlice) diff --git a/aries/agents/node/vcxagent-core/demo/logger.js b/aries/agents/node/vcxagent-core/demo/logger.js deleted file mode 100644 index c4441099ec..0000000000 --- a/aries/agents/node/vcxagent-core/demo/logger.js +++ /dev/null @@ -1,27 +0,0 @@ -const { createLogger, format, transports } = require('winston') - -const prettyFormatter = format.combine( - (process.env.DISABLE_COLOR_LOGS !== 'true') ? format.colorize({ all: true }) : format.uncolorize({}), - format.printf( - msg => { - const extras = (global.expect) ? `${global.expect.getState().currentTestName}` : '' - return `[${msg.timestamp}] [${msg.filename}] [${msg.label}] [${msg.level}] ${extras}: ${msg.message}` - } - ) -) - -module.exports = loggerLabel => { - return createLogger({ - level: 'debug', - format: format.combine( - format.label({ label: loggerLabel }), - format.timestamp({ - format: 'YYYY-MM-DD HH:mm:ss.SSS' - }), - prettyFormatter - ), - transports: [ - new transports.Console() - ] - }) -} diff --git a/aries/agents/node/vcxagent-core/demo/notification-server.js b/aries/agents/node/vcxagent-core/demo/notification-server.js deleted file mode 100644 index c0fde74f33..0000000000 --- a/aries/agents/node/vcxagent-core/demo/notification-server.js +++ /dev/null @@ -1,55 +0,0 @@ -const express = require('express') -const bodyParser = require('body-parser') - -const PORT = 7209 - -const app = express() -app.use(bodyParser.json()) - -const FgRed = '\x1b[31m' -const FgGreen = '\x1b[32m' -const FgYellow = '\x1b[33m' -const FgBlue = '\x1b[34m' -const FgMagenta = '\x1b[35m' -const FgCyan = '\x1b[36m' -const FgWhite = '\x1b[37m' - -const colors = [FgRed, FgGreen, FgYellow, FgBlue, FgMagenta, FgCyan, FgWhite] -let colorIdx = 0 - -const agentColors = {} - -function getAgentColor (agentId) { - if (!agentColors[agentId]) { - agentColors[agentId] = colors[colorIdx] - colorIdx = (colorIdx + 1) % colors.length - } - return agentColors[agentId] -} - -async function run () { - const notifications = {} - - app.post('/notifications/:agentId', async function (req, res) { - const { agentId } = req.params - console.log(getAgentColor(agentId), `${new Date()}] ${agentId}: ${JSON.stringify(req.body, null, 2)}`) - if (!notifications[agentId]) { - notifications[agentId] = [] - } - notifications[agentId].push(req.body) - return res.status(200).send() - }) - - app.get('/notifications', async function (req, res) { - return res.status(200).send(JSON.stringify(notifications)) - }) - - app.use(function (req, res, next) { - console.error(`Request ${req.method} '${req.originalUrl}' was not matched with any handler.\nRequest header:${JSON.stringify(req.headers, null, 2)}\nRequest body: ${JSON.stringify(req.body, null, 2)}`) - res.status(404).send({ message: `Your request: '${req.originalUrl}' didn't reach any handler.` }) - }) - - app.listen(PORT, () => console.log(`Server listening on port ${PORT}!`)) -} - -run() diff --git a/aries/agents/node/vcxagent-core/demo/script-common.js b/aries/agents/node/vcxagent-core/demo/script-common.js deleted file mode 100644 index e1ff70a971..0000000000 --- a/aries/agents/node/vcxagent-core/demo/script-common.js +++ /dev/null @@ -1,27 +0,0 @@ -const commandLineArgs = require('command-line-args') -const commandLineUsage = require('command-line-usage') - -module.exports.runScript = async function runScript (optionDefinitions, usageDefinition, areOptionsValid, runFunction) { - const usage = commandLineUsage(usageDefinition) - - let options = {} - try { - options = commandLineArgs(optionDefinitions) - } catch (error) { - console.error('Error parsing arguments') - console.error(error) - console.log(usage) - return - } - if (options.help) { - console.error('Help requested.') - console.log(usage) - return - } - if (!areOptionsValid(options)) { - console.error('Invalid options.') - console.log(usage) - return - } - await runFunction(options) -} diff --git a/aries/agents/node/vcxagent-core/demo/wallet-common.js b/aries/agents/node/vcxagent-core/demo/wallet-common.js deleted file mode 100644 index 001820ae41..0000000000 --- a/aries/agents/node/vcxagent-core/demo/wallet-common.js +++ /dev/null @@ -1,42 +0,0 @@ -function indyBuildMysqlStorageCredentials (user, pass) { - return { - user, - pass - } -} - -function indyBuildMysqlStorageConfig (readHost, writeHost, port, dbName, defaultConnectionLimit) { - return { - read_host: readHost, - write_host: writeHost, - port, - db_name: dbName, - default_connection_limit: defaultConnectionLimit - } -} - -function getStorageInfoMysql () { - if (!process.env.MYSQL_DATABASE) { - throw Error('Env variable MYSQL_DATABASE must be specified') - } - const walletStorageConfig = indyBuildMysqlStorageConfig( - process.env.MYSQL_HOST || 'localhost', - process.env.MYSQL_HOST || 'localhost', - process.env.MYSQL_PORT || 3306, - process.env.MYSQL_DATABASE, - process.env.MYSQL_CONNECTION_LIMIT || 50 - ) - const walletStorageCredentials = indyBuildMysqlStorageCredentials( - process.env.MYSQL_USER || 'root', - process.env.MYSQL_PASSWORD_SECRET || 'mysecretpassword' - ) - return { - wallet_type: 'mysql', - storage_config: walletStorageConfig, - storage_credentials: walletStorageCredentials - } -} - -module.exports = { - getStorageInfoMysql -} diff --git a/aries/agents/node/vcxagent-core/package.json b/aries/agents/node/vcxagent-core/package.json deleted file mode 100644 index d16bac541e..0000000000 --- a/aries/agents/node/vcxagent-core/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@hyperledger/vcxagent-core", - "description": "Aries-framework-rs based Aries agent", - "license": "Apache-2.0", - "main": "src/index.js", - "directories": { - "test": "test", - "lib": "src" - }, - "contributors": [ - { - "name": "Hyperledger Indy Contributors", - "email": "indy@lists.hyperledger.org" - } - ], - "bugs": { - "url": "https://github.com/hyperledger/aries-vcx/issues" - }, - "repository": { - "url": "https://github.com/hyperledger/aries-vcx.git", - "type": "git" - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "lint:fix": "standard --fix", - "demo:notifyserver": "node demo/notification-server.js", - "demo": "node demo/integration-test.js", - "demo:revocation": "REVOCATION=true node demo/integration-test.js", - "demo:alice": "node demo/alice.js", - "demo:faber": "node demo/faber.js", - "demo:faber:rev": "node demo/faber.js --revocation", - "demo:alice:mysql": "node demo/alice.js --mysql", - "demo:faber:mysql": "node demo/faber.js --mysql", - "demo:alice:sign": "node demo/alice-signature.js", - "demo:faber:verify": "node demo/faber-verify-signature.js", - "test:integration": "npm run test:integration:issue-verify && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:public-invite && npm run test:integration:out-of-band && npm run test:integration:endpoint && npm run test:integration:connection", - "test:integration:issue-verify": "jest --forceExit --env=node --runInBand test/issue-verify.spec.js", - "test:integration:signing": "jest --forceExit --env=node --runInBand test/sign-verify.spec.js", - "test:integration:messaging": "jest --forceExit --env=node --runInBand test/messaging.spec.js", - "test:integration:tails": "jest --forceExit --env=node --runInBand test/distribute-tails.spec.js", - "test:integration:trustping": "jest --forceExit --env=node --runInBand test/trustping.spec.js", - "test:integration:public-invite": "jest --forceExit --env=node --runInBand test/public-invite.spec.js", - "test:integration:out-of-band": "jest --forceExit --env=node --runInBand test/out-of-band.spec.js", - "test:integration:endpoint": "jest --forceExit --env=node --runInBand test/endpoint.spec.js", - "test:integration:connection": "jest --forceExit --env=node --runInBand test/connection.spec.js" - }, - "dependencies": { - "@hyperledger/node-vcx-wrapper": "file:../../../wrappers/node", - "axios": "^1.6.0", - "ffi-napi": "^4.0.3", - "fs-extra": "^4.0.3", - "lodash": "^4.17.21", - "mkdirp": "^1.0.4", - "node-persist": "^3.1.0", - "sleep-promise": "^9.0.1", - "uuid": "^8.3.2" - }, - "devDependencies": { - "body-parser": "^1.19.0", - "command-line-args": "^5.2.0", - "command-line-usage": "^5.0.5", - "express": "^4.17.1", - "is-port-reachable": "^2.0.1", - "jest": "^29.7.0", - "readline-sync": "^1.4.10", - "standard": "^16.0.4", - "winston": "^3.3.3" - } -} diff --git a/aries/agents/node/vcxagent-core/publish.sh b/aries/agents/node/vcxagent-core/publish.sh deleted file mode 100755 index 512e60b7b0..0000000000 --- a/aries/agents/node/vcxagent-core/publish.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -errcho(){ >&2 echo ">> ERROR: $@"; } - -function exitWithErrMsg() { - errcho "$1" - exit 1 -} - -if [ -z "$NPMJS_TOKEN" ]; then - exitWithErrMsg "NPMJS_TOKEN environment variable not set." -fi -if [ -z "$PUBLISH_VERSION" ]; then - exitWithErrMsg "PUBLISH_VERSION environment variable not set." -fi - -cd "$(dirname "$0")" || exit -echo '//registry.npmjs.org/:_authToken=${NPMJS_TOKEN}' > .npmrc -npm install --save-exact @hyperledger/node-vcx-wrapper@${PUBLISH_VERSION} || exitWithErrMsg "Failed to install @hyperledger/node-vcx-wrapper@${PUBLISH_VERSION}" -npm install -npm version --no-git-tag-version $PUBLISH_VERSION -npm publish diff --git a/aries/agents/node/vcxagent-core/readme.md b/aries/agents/node/vcxagent-core/readme.md deleted file mode 100644 index 4279b33f30..0000000000 --- a/aries/agents/node/vcxagent-core/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# VCX Agent Core -VCX Agent Core is implementation of simple agent with persistent file storage. It's based on -[NodeJS Wrapper](../../../wrappers/node) for `aries-vcx` library. - -# Try it -1. First step is to compile and `aries-vcx` and make it available on your system. Follow [instructions](../../../libvcx). -2. You need to have mediator agent compatible with `aries-vcx`. See more [info](../../../README.md). -3. Run `npm run demo`. This will run sample scenario where Alice and Faber - - establish connection, - - Faber issues a credential to Alice - - Faber requests Alice to prove certain information about herself (using the credential). - -# Note -You can also have look at [vcxagent-cli](../vcxagent-cli) - CLI Aries agent based -on this project. diff --git a/aries/agents/node/vcxagent-core/resources/docker.txn b/aries/agents/node/vcxagent-core/resources/docker.txn deleted file mode 100644 index 66fb071b90..0000000000 --- a/aries/agents/node/vcxagent-core/resources/docker.txn +++ /dev/null @@ -1,4 +0,0 @@ -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"127.0.0.1","client_port":9702,"node_ip":"127.0.0.1","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"127.0.0.1","client_port":9704,"node_ip":"127.0.0.1","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node3","blskey":"3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5","blskey_pop":"QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh","client_ip":"127.0.0.1","client_port":9706,"node_ip":"127.0.0.1","node_port":9705,"services":["VALIDATOR"]},"dest":"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya"},"metadata":{"from":"4cU41vWW82ArfxJxHkzXPG"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"7e9f355dffa78ed24668f0e0e369fd8c224076571c51e2ea8be5f26479edebe4"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node4","blskey":"2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw","blskey_pop":"RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP","client_ip":"127.0.0.1","client_port":9708,"node_ip":"127.0.0.1","node_port":9707,"services":["VALIDATOR"]},"dest":"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA"},"metadata":{"from":"TWwCRQRZ2ZHMJFn9TzLp7W"},"type":"0"},"txnMetadata":{"seqNo":4,"txnId":"aa5e817d7cc626170eca175822029339a444eb0ee8f0bd20d3b0b76e566fb008"},"ver":"1"} \ No newline at end of file diff --git a/aries/agents/node/vcxagent-core/src/agent.js b/aries/agents/node/vcxagent-core/src/agent.js deleted file mode 100644 index b7dc1aa2ce..0000000000 --- a/aries/agents/node/vcxagent-core/src/agent.js +++ /dev/null @@ -1,172 +0,0 @@ -const { - getLedgerAuthorAgreement, - setActiveTxnAuthorAgreementMeta -} = require('@hyperledger/node-vcx-wrapper') -const { createServiceLedgerCredDef } = require('./services/service-ledger-creddef') -const { createServiceLedgerSchema } = require('./services/service-ledger-schema') -const { createServiceVerifier } = require('./services/service-verifier') -const { createServiceProver } = require('./services/service-prover') -const { createServiceCredHolder } = require('./services/service-cred-holder') -const { createServiceCredIssuer } = require('./services/service-cred-issuer') -const { createServiceConnections } = require('./services/service-connections') -const { createServiceNonmediatedConnections } = require('./services/service-mediated-connections') -const { createServiceOutOfBand } = require('./services/service-out-of-band') -const { createServiceLedgerRevocationRegistry } = require('./services/service-revocation-registry') -const { provisionAgentInAgency } = require('./utils/vcx-workflows') -const { - createAgencyClientForMainWallet, - openMainWallet, - openMainPool, - vcxUpdateWebhookUrl, - shutdownVcx -} = require('@hyperledger/node-vcx-wrapper') -const { createStorageService } = require('./storage/storage-service') -const { waitUntilAgencyIsReady, getAgencyConfig } = require('./common') -const path = require('path') - -async function createVcxAgent ({ agentName, genesisPath, agencyUrl, seed, walletExtraConfigs, endpointInfo, logger }) { - genesisPath = genesisPath || path.join(__dirname, '/../resources/docker.txn') - - await waitUntilAgencyIsReady(agencyUrl, logger) - const agencyConfig = await getAgencyConfig(agencyUrl, logger) - - const storageService = await createStorageService(agentName) - if (!await storageService.agentProvisionExists()) { - const agentProvision = await provisionAgentInAgency(agentName, agencyConfig, seed, walletExtraConfigs, logger) - await storageService.saveAgentProvision(agentProvision) - } - const agentProvision = await storageService.loadAgentProvision() - const issuerDid = agentProvision.issuerConfig.institution_did - - async function agentInitVcx () { - logger.info(`Initializing ${agentName} vcx session.`) - - logger.silly(`Using following agent provision to initialize VCX settings ${JSON.stringify(agentProvision, null, 2)}`) - logger.silly('Opening main wallet') - await openMainWallet(agentProvision.walletConfig) - logger.silly('Creating cloud agency config') - await createAgencyClientForMainWallet(agentProvision.agencyConfig) - logger.silly('Opening pool') - await openMainPool({ genesis_path: genesisPath }) - } - - async function agentShutdownVcx () { - logger.debug(`Shutting down ${agentName} vcx session.`) - shutdownVcx() - } - - async function updateWebhookUrl (webhookUrl) { - logger.info(`Updating webhook url to ${webhookUrl}`) - await vcxUpdateWebhookUrl({ webhookUrl }) - } - - async function acceptTaa () { - const taa = await getLedgerAuthorAgreement() - const taaJson = JSON.parse(taa) - const acceptanceMechanism = Object.keys(taaJson.aml)[0] - logger.info(`Accepting TAA using mechanism ${acceptanceMechanism}`) - await setActiveTxnAuthorAgreementMeta(taaJson.text, taaJson.version, acceptanceMechanism) - } - - function getInstitutionDid () { - return issuerDid - } - - const serviceConnections = createServiceConnections({ - logger, - saveConnection: storageService.saveConnection, - loadConnection: storageService.loadConnection, - listConnectionIds: storageService.listConnectionKeys - }) - - const serviceNonmediatedConnections = createServiceNonmediatedConnections({ - logger, - saveNonmediatedConnection: storageService.saveNonmediatedConnection, - loadNonmediatedConnection: storageService.loadNonmediatedConnection, - endpointInfo - }) - - const serviceLedgerSchema = createServiceLedgerSchema({ - logger, - saveSchema: storageService.saveSchema, - loadSchema: storageService.loadSchema, - listSchemaIds: storageService.listSchemaKeys - }) - const serviceLedgerCredDef = createServiceLedgerCredDef({ - logger, - saveCredDef: storageService.saveCredentialDefinition, - loadCredDef: storageService.loadCredentialDefinition, - listCredDefIds: storageService.listCredentialDefinitionKeys - }) - const serviceLedgerRevReg = createServiceLedgerRevocationRegistry({ - logger, - saveRevReg: storageService.saveRevocationRegistry, - loadRevReg: storageService.loadRevocationRegistry, - listCredDefIds: storageService.listCredentialDefinitionKeys - }) - const serviceCredIssuer = createServiceCredIssuer({ - logger, - loadConnection: storageService.loadConnection, - loadCredDef: storageService.loadCredentialDefinition, - loadRevReg: storageService.loadRevocationRegistry, - saveIssuerCredential: storageService.saveCredIssuer, - loadIssuerCredential: storageService.loadCredIssuer, - listIssuerCredentialIds: storageService.listCredIssuerKeys, - issuerDid - }) - const serviceCredHolder = createServiceCredHolder({ - logger, - loadConnection: storageService.loadConnection, - saveHolderCredential: storageService.saveCredHolder, - loadHolderCredential: storageService.loadCredHolder, - listHolderCredentialIds: storageService.listCredHolderKeys - }) - const serviceProver = createServiceProver({ - logger, - loadConnection: storageService.loadConnection, - saveDisclosedProof: storageService.saveDisclosedProof, - loadDisclosedProof: storageService.loadDisclosedProof, - listDislosedProofIds: storageService.listDisclosedProofKeys - }) - const serviceVerifier = createServiceVerifier({ - logger, - loadConnection: storageService.loadConnection, - saveProof: storageService.saveProof, - loadProof: storageService.loadProof, - listProofIds: storageService.listProofKeys - }) - const serviceOutOfBand = createServiceOutOfBand({ - loadConnection: storageService.loadConnection - }) - - return { - // vcx controls - agentInitVcx, - agentShutdownVcx, - getInstitutionDid, - updateWebhookUrl, - acceptTaa, - - // ledger - serviceLedgerSchema, - serviceLedgerCredDef, - serviceLedgerRevReg, - - // connections - serviceConnections, - serviceNonmediatedConnections, - - // credex - serviceCredIssuer, - serviceCredHolder, - - // proofs - serviceProver, - serviceVerifier, - - // out of band - serviceOutOfBand - } -} - -module.exports.createVcxAgent = createVcxAgent diff --git a/aries/agents/node/vcxagent-core/src/common.js b/aries/agents/node/vcxagent-core/src/common.js deleted file mode 100644 index bedd47cd95..0000000000 --- a/aries/agents/node/vcxagent-core/src/common.js +++ /dev/null @@ -1,100 +0,0 @@ -const sleepPromise = require('sleep-promise') -const axios = require('axios') - -module.exports.testTailsUrl = 'http://some-tails-url.org' - -async function waitUntilAgencyIsReady (agencyEndpoint, logger) { - let agencyReady = false - - const url = `${agencyEndpoint}/agency` - - while (!agencyReady) { - try { - await axios.get(url) - agencyReady = true - } catch (e) { - logger.warn(`Agency ${agencyEndpoint} should return 200OK on HTTP GET ${url}, but returns error: ${e}. Sleeping.`) - await sleepPromise(1000) - } - } -} - -async function getAgencyConfig (agencyUrl, logger) { - let agencyDid, agencyVerkey - - const url = `${agencyUrl}/agency` - - logger.info(`Obtaining agency DID and verkey info from ${url}`) - try { - const { data } = await axios.get(url) - agencyDid = data.DID - agencyVerkey = data.verKey - if (!agencyDid || !agencyVerkey) { - throw Error(`Agency returned unexpected DID and verkey format: ${JSON.stringify(data)}`) - } - } catch (err) { - logger.warn(`Failed to obtain DID and verkey from agency with error ${err}. Defaults will be used.`) - agencyDid = 'VsKV7grR1BUE29mG2Fm2kX' - agencyVerkey = 'Hezce2UWMZ3wUhVkh2LfKSs8nDzWwzs2Win7EzNN3YaR' - } - return { - agency_endpoint: agencyUrl, - agency_did: agencyDid, - agency_verkey: agencyVerkey - } -} - -async function pollFunction (fn, actionDescription, logger, attemptsThreshold = 10, timeoutMs = 2000) { - let { result, isFinished } = await fn() - let attempts = 1 - while (!isFinished) { - if (attempts > attemptsThreshold) { - const error = `Tried to poll ${attempts} times and result was not received.` - return [error, null] - } - logger.info(`Trying to do: ${actionDescription} Attempt ${attempts}/${attemptsThreshold}. Will try again after ${timeoutMs}ms.`) - await sleepPromise(timeoutMs); - ({ result, isFinished } = await fn()) - attempts += 1 - } - return [null, result] -} - -function getSampleSchemaData () { - const version = `${getRandomInt(1, 101)}.${getRandomInt(1, 101)}.${getRandomInt(1, 101)}` - return { - data: { - attrNames: ['name', 'last_name', 'sex', 'date', 'degree', 'age'], - name: 'FaberVcx', - version - }, - paymentHandle: 0, - sourceId: `your-identifier-fabervcx-${version}` - } -} - -module.exports.buildRevocationDetails = function buildRevocationDetails ({ supportRevocation, tailsDir, tailsUrl, maxCreds }) { - if (supportRevocation === true) { - return { - supportRevocation, - tailsDir, - tailsUrl, - maxCreds - } - } else { - return { - supportRevocation: false - } - } -} - -function getRandomInt (min, max) { - min = Math.ceil(min) - max = Math.floor(max) - return Math.floor(Math.random() * (max - min)) + min -} - -module.exports.waitUntilAgencyIsReady = waitUntilAgencyIsReady -module.exports.pollFunction = pollFunction -module.exports.getSampleSchemaData = getSampleSchemaData -module.exports.getAgencyConfig = getAgencyConfig diff --git a/aries/agents/node/vcxagent-core/src/index.js b/aries/agents/node/vcxagent-core/src/index.js deleted file mode 100644 index 1bd14c937f..0000000000 --- a/aries/agents/node/vcxagent-core/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - ...require('./agent'), - ...require('./storage/storage-service'), - ...require('./utils/messages'), - ...require('./utils/vcx-workflows'), - ...require('./common') -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-connections.js b/aries/agents/node/vcxagent-core/src/services/service-connections.js deleted file mode 100644 index 96960fb198..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-connections.js +++ /dev/null @@ -1,210 +0,0 @@ -const { getMessagesForConnection } = require('../utils/messages') -const { - updateMessages, - Connection, - ConnectionStateType -} = require('@hyperledger/node-vcx-wrapper') -const { pollFunction } = require('../common') - -module.exports.createServiceConnections = function createServiceConnections ({ logger, saveConnection, loadConnection, listConnectionIds }) { - async function inviterConnectionCreate (connectionId, cbInvitation) { - logger.info(`InviterConnectionSM creating connection ${connectionId}`) - const connection = await Connection.create({ id: connectionId }) - logger.debug(`InviterConnectionSM after created connection:\n${JSON.stringify(connection.serialize())}`) - await connection.connect('{}') - logger.debug(`InviterConnectionSM after invitation was generated:\n${JSON.stringify(connection.serialize())}`) - const invite = connection.inviteDetails() - if (cbInvitation) { - cbInvitation(invite) - } - await saveConnection(connectionId, connection) - logger.info(`InviterConnectionSM has established connection ${connectionId}`) - return invite - } - - async function inviterConnectionCreateFromRequestV2 (connectionId, pwInfo, request) { - logger.info(`InviterConnectionSM creating connection ${connectionId} from received request ${request} and pw info ${JSON.stringify(pwInfo)}`) - const connection = await Connection.createWithConnectionRequestV2({ - id: connectionId, - pwInfo, - request - }) - await saveConnection(connectionId, connection) - return connection - } - - async function inviterConnectionCreateAndAccept (conenctionId, cbInvitation, attemptThreshold = 20, timeoutMs = 500) { - const invite = await inviterConnectionCreate(conenctionId, cbInvitation) - const connection = await loadConnection(conenctionId) - await _progressConnectionToAcceptedState(connection, attemptThreshold, timeoutMs) - - await saveConnection(conenctionId, connection) - return invite - } - - async function inviteeConnectionAcceptFromInvitation (connectionId, invite) { - logger.info(`InviteeConnectionSM creating connection ${connectionId} from connection invitation.`) - const connection = await Connection.createWithInvite({ id: connectionId, invite }) - logger.debug(`InviteeConnectionSM after created from invitation:\n${JSON.stringify(await connection.serialize())}`) - await connection.connect({ data: '{}' }) - logger.debug('InviteeConnectionSM created connection agent') - await saveConnection(connectionId, connection) - } - - async function inviteeConnectionAcceptFromInvitationAndProgress (connectionId, invite, attemptThreshold = 20, timeoutMs = 500) { - await inviteeConnectionAcceptFromInvitation(connectionId, invite) - const connection = await loadConnection(connectionId) - await _progressConnectionToAcceptedState(connection, attemptThreshold, timeoutMs) - logger.info(`InviteeConnectionSM has established connection ${connectionId}`) - await saveConnection(connectionId, connection) - } - - async function _progressConnectionToAcceptedState (connection, attemptsThreshold, timeoutMs) { - async function progressToAcceptedState () { - if (await connection.updateState() !== ConnectionStateType.Finished) { - return { result: undefined, isFinished: false } - } else { - return { result: null, isFinished: true } - } - } - - const [error] = await pollFunction(progressToAcceptedState, 'Progress connection', logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't progress connection to Accepted state. ${error}`) - } - } - - async function connectionUpdate (connectionId) { - const connection = await loadConnection(connectionId) - const state = await connection.updateState() - await saveConnection(connectionId, connection) - return state - } - - async function handleMessage (connectionId, ariesMsg) { - const connection = await loadConnection(connectionId) - const state = await connection.handleMessage(ariesMsg) - await saveConnection(connectionId, connection) - return state - } - - async function connectionAutoupdate (connectionId, updateAttemptsThreshold = 20, timeoutMs = 500) { - const connection = await loadConnection(connectionId) - await _progressConnectionToAcceptedState(connection, updateAttemptsThreshold, timeoutMs) - logger.info('Success! Connection was progressed to Accepted state.') - await saveConnection(connectionId, connection) - } - - async function signData (connectionId, dataBase64) { - const connection = await loadConnection(connectionId) - const challengeBuffer = Buffer.from(dataBase64, 'base64') - let signatureBuffer - try { - signatureBuffer = await connection.signData(challengeBuffer) - } catch (err) { - throw Error(`Error occurred while connection was signing data '${dataBase64}'. Err Message = ${err.message} Stack = ${err.stack}`) - } - if (!signatureBuffer) { - throw Error(`Error occurred while connection was signing data '${dataBase64}' The resulting signature was empty.`) - } - return signatureBuffer.toString('base64') - } - - async function verifySignature (connectionId, dataBase64, signatureBase64) { - const connection = await loadConnection(connectionId) - const data = Buffer.from(dataBase64, 'base64') - const signature = Buffer.from(signatureBase64, 'base64') - return await connection.verifySignature({ data, signature }) - } - - async function getConnectionPwDid (connectionId) { - const connection = await loadConnection(connectionId) - const serConnection = await connection.serialize() - return serConnection.data.pw_did - } - - async function sendMessage (connectionId, payload) { - const connection = await loadConnection(connectionId) - await connection.sendMessage({ msg: payload, msg_title: 'msg_title', msg_type: 'msg_type', ref_msg_id: 'ref_msg_id' }) - } - - async function getMessages (connectionId, filterStatuses = [], filterUids = []) { - const connection = await loadConnection(connectionId) - return getMessagesForConnection(connection, filterStatuses, filterUids) - } - - async function getState (connectionId) { - const connection = await loadConnection(connectionId) - return await connection.getState() - } - - async function listIds () { - return listConnectionIds() - } - - async function printInfo (connectionIds) { - for (const id of connectionIds) { - const state = await getState(id) - logger.info(`Connection ${id} state=${state}`) - } - } - - async function getVcxConnection (connectionId) { - logger.warn('Usage of getVcxConnection is not recommended. You should use vcxagent-core API rather than work with vcx object directly.') - return loadConnection(connectionId) - } - - async function getMessagesV2 (connectionId, filterStatuses = [], filterUids = []) { - const connection = await getVcxConnection(connectionId) - return getMessagesForConnection(connection, filterStatuses, filterUids) - } - - async function updateMessagesStatus (connectionId, uids) { - const pwDid = await getConnectionPwDid(connectionId) - const updateInstructions = [{ pairwiseDID: pwDid, uids }] - await updateMessages({ msgJson: JSON.stringify(updateInstructions) }) - } - - async function updateAllReceivedMessages (connectionId) { - const receivedMessages = await getMessagesV2(connectionId, ['MS-103'], []) - await updateMessagesStatus(connectionId, receivedMessages.map(m => m.uid)) - } - - async function sendPing (connectionId) { - const connection = await getVcxConnection(connectionId) - await connection.sendPing() - } - - return { - // inviter - inviterConnectionCreate, - inviterConnectionCreateFromRequestV2, - inviterConnectionCreateAndAccept, - - // invitee - inviteeConnectionAcceptFromInvitation, - inviteeConnectionAcceptFromInvitationAndProgress, - - // universal - connectionAutoupdate, - connectionUpdate, - handleMessage, - getConnectionPwDid, - - signData, - verifySignature, - sendMessage, - getMessages, - - getMessagesV2, - updateMessagesStatus, - updateAllReceivedMessages, - - sendPing, - - getState, - listIds, - printInfo, - getVcxConnection - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-cred-holder.js b/aries/agents/node/vcxagent-core/src/services/service-cred-holder.js deleted file mode 100644 index 9bd3622b67..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-cred-holder.js +++ /dev/null @@ -1,185 +0,0 @@ -const { filterOffersByAttr } = require('../utils/credentials') -const { filterOffersBySchema } = require('../utils/credentials') -const { - HolderStateType, - Credential -} = require('@hyperledger/node-vcx-wrapper') -const { pollFunction } = require('../common') - -module.exports.createServiceCredHolder = function createServiceCredHolder ({ logger, loadConnection, saveHolderCredential, loadHolderCredential, listHolderCredentialIds }) { - async function _getOffers (connection, filter, attemptsThreshold, timeoutMs) { - async function findSomeCredOffer () { - let offers = await Credential.getOffers(connection) - logger.info(`Offers: ${offers}`) - if (filter && filter.schemaIdRegex) { - offers = filterOffersBySchema(offers, filter.schemaIdRegex) - } - if (filter && filter.attrRegex) { - offers = filterOffersByAttr(offers, filter.attrRegex) - } - if (offers.length === 0) { - return { result: undefined, isFinished: false } - } else { - return { result: offers, isFinished: true } - } - } - - const [error, offers] = await pollFunction(findSomeCredOffer, 'Get credential offer', logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't get credential offers. ${error}`) - } - return offers - } - - async function _progressCredentialToState (credential, connection, credentialStateTarget, attemptsThreshold = 10, timeoutMs = 2000) { - async function progressToAcceptedState () { - if (await credential.updateStateV2(connection) !== credentialStateTarget) { - return { result: undefined, isFinished: false } - } else { - return { result: null, isFinished: true } - } - } - - const [error] = await pollFunction(progressToAcceptedState, `Progress CredentialSM to state ${credentialStateTarget}`, logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't progress credential to Accepted state. ${error}`) - } - } - - async function waitForCredential (connectionId, holderCredentialId, attemptsThreshold = 10, timeoutMs = 2000) { - const connection = await loadConnection(connectionId) - const credential = await loadHolderCredential(holderCredentialId) - await _progressCredentialToState(credential, connection, HolderStateType.Finished, attemptsThreshold, timeoutMs) - logger.info('Credential has been received.') - await saveHolderCredential(holderCredentialId, credential) - return getCredentialData(holderCredentialId) - } - - async function getCredentialData (holderCredentialId) { - const credential = await loadHolderCredential(holderCredentialId) - const serCred = await credential.serialize() - return JSON.parse( - Buffer.from(serCred.data.holder_sm.state.Finished.credential['credentials~attach'][0].data.base64, 'base64') - .toString('utf8') - ) - } - - async function createCredentialFromOfferAndSendRequest (connectionId, holderCredentialId, credentialOffer) { - const connection = await loadConnection(connectionId) - const credential = Credential.create({ sourceId: 'credential', offer: credentialOffer }) - await saveHolderCredential(holderCredentialId, credential) - logger.info('Sending credential request') - await credential.sendRequest({ connection, payment: 0 }) - await saveHolderCredential(holderCredentialId, credential) - return credential - } - - async function createCredentialFromOfferAndDecline (connectionId, holderCredentialId, credentialOffer, comment) { - const connection = await loadConnection(connectionId) - const credential = Credential.create({ sourceId: 'credential', offer: credentialOffer }) - await saveHolderCredential(holderCredentialId, credential) - logger.info('Declining credential offer') - await credential.declineOffer(connection, comment) - await saveHolderCredential(holderCredentialId, credential) - return credential - } - - async function waitForCredentialOffer (connectionId, credOfferFilter = null, attemptsThreshold = 10, timeoutMs = 2000) { - logger.info('Going to try fetch credential offer and receive credential.') - const connection = await loadConnection(connectionId) - const offers = await _getOffers(connection, credOfferFilter, attemptsThreshold, timeoutMs) - logger.info(`Found ${offers.length} credential offers.`) - const pickedOffer = JSON.stringify(offers[0]) - logger.debug(`Picked credential offer = ${pickedOffer}`) - return pickedOffer - } - - async function waitForCredentialOfferAndAccept (connectionId, holderCredentialId, credOfferFilter = null, attemptsThreshold = 10, timeoutMs = 2000) { - const pickedOffer = await waitForCredentialOffer(connectionId, credOfferFilter, attemptsThreshold, timeoutMs) - return createCredentialFromOfferAndSendRequest(connectionId, holderCredentialId, pickedOffer) - } - - async function waitForCredentialOfferAndDecline (connectionId, holderCredentialId, comment = 'declining offer', credOfferFilter = null, attemptsThreshold = 10, timeoutMs = 2000) { - const pickedOffer = await waitForCredentialOffer(connectionId, credOfferFilter, attemptsThreshold, timeoutMs) - return createCredentialFromOfferAndDecline(connectionId, holderCredentialId, pickedOffer, comment) - } - - async function waitForCredentialOfferAndAcceptAndProgress (connectionId, holderCredentialId, credOfferFilter = null, attemptsThreshold = 10, timeoutMs = 2000) { - logger.info('Going to try fetch credential offer and receive credential.') - await waitForCredentialOfferAndAccept(connectionId, holderCredentialId, credOfferFilter, attemptsThreshold, timeoutMs) - return waitForCredential(connectionId, holderCredentialId, attemptsThreshold, timeoutMs) - } - - async function credentialUpdate (holderCredentialId, connectionId) { - const connection = await loadConnection(connectionId) - const cred = await loadHolderCredential(holderCredentialId) - const state = await cred.updateStateV2(connection) - await saveHolderCredential(holderCredentialId, cred) - return state - } - - async function getTailsLocation (holderCredentialId) { - logger.info(`Getting tails location for credential ${holderCredentialId}`) - const cred = await loadHolderCredential(holderCredentialId) - const tailsLocation = await cred.getTailsLocation() - logger.debug(`Holder's tails location: ${tailsLocation}`) - return tailsLocation - } - - async function getRevRegId (holderCredentialId) { - logger.info(`Getting rev reg id for credential ${holderCredentialId}`) - const cred = await loadHolderCredential(holderCredentialId) - const revRegId = await cred.getRevRegId() - logger.debug(`Holder's rev reg id: ${revRegId}`) - return revRegId - } - - async function getTailsHash (holderCredentialId) { - logger.info(`Getting to get tails hash for credential ${holderCredentialId}`) - const cred = await loadHolderCredential(holderCredentialId) - const tailsHash = await cred.getTailsHash() - logger.debug(`Holder's tails hash: ${tailsHash}`) - return tailsHash - } - - async function getState (credHolderId) { - const credential = await loadHolderCredential(credHolderId) - return await credential.getState() - } - - async function listIds () { - return listHolderCredentialIds() - } - - async function printInfo (credHolderIds) { - for (const id of credHolderIds) { - const state = await getState(id) - logger.info(`Credential ${id} state=${state}`) - } - } - - async function getVcxCredential (credHolderId) { - logger.warn('Usage of getVcxCredential is not recommended. You should use vcxagent-core API rather than work with vcx object directly.') - return loadHolderCredential(credHolderId) - } - - return { - waitForCredentialOffer, - createCredentialFromOfferAndSendRequest, - createCredentialFromOfferAndDecline, - waitForCredential, - getCredentialData, - waitForCredentialOfferAndAccept, - waitForCredentialOfferAndAcceptAndProgress, - waitForCredentialOfferAndDecline, - credentialUpdate, - getTailsLocation, - getRevRegId, - getTailsHash, - getVcxCredential, - - listIds, - printInfo, - getState - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-cred-issuer.js b/aries/agents/node/vcxagent-core/src/services/service-cred-issuer.js deleted file mode 100644 index b9ad7b9ddb..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-cred-issuer.js +++ /dev/null @@ -1,169 +0,0 @@ -const { - IssuerStateType, - IssuerCredential -} = require('@hyperledger/node-vcx-wrapper') -const { pollFunction } = require('../common') -const assert = require('assert') - -module.exports.createServiceCredIssuer = function createServiceCredIssuer ({ logger, loadConnection, loadCredDef, loadRevReg, saveIssuerCredential, loadIssuerCredential, listIssuerCredentialIds, issuerDid }) { - async function buildOfferAndMarkAsSent (issuerCredId, credDefId, revRegId, schemaAttrs) { - const credDef = await loadCredDef(credDefId) - const revReg = await loadRevReg(revRegId) - logger.debug('Building issuer credential') - const issuerCred = await IssuerCredential.create('alice_degree') - logger.info(`Per issuer credential ${issuerCredId}, building cred offer.`) - await issuerCred.buildCredentialOfferMsgV2({ - credDef, - revReg, - attr: schemaAttrs - }) - const state1 = await issuerCred.getState() - assert.equal(state1, IssuerStateType.OfferSet) - const credOfferMsg = issuerCred.getCredentialOfferMsg() - await saveIssuerCredential(issuerCredId, issuerCred) - - return credOfferMsg - } - - async function sendOfferV2 (issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) { - assert(revRegId) - const connection = await loadConnection(connectionId) - const credDef = await loadCredDef(credDefId) - const revReg = revRegId ? await loadRevReg(revRegId) : undefined - logger.debug('Building issuer credential') - const issuerCred = await IssuerCredential.create('alice_degree') - logger.info(`Per issuer credential ${issuerCredId}, sending cred offer to connection ${connectionId}`) - await issuerCred.buildCredentialOfferMsgV2({ - credDef, - attr: schemaAttrs, - revReg - }) - const state1 = await issuerCred.getState() - assert.equal(state1, IssuerStateType.OfferSet) - await issuerCred.sendOfferV2(connection) - await saveIssuerCredential(issuerCredId, issuerCred) - } - - async function sendCredential (issuerCredId, connectionId) { - const connection = await loadConnection(connectionId) - const issuerCred = await loadIssuerCredential(issuerCredId) - logger.info(`Sending credential '${issuerCredId}' to ${connectionId}`) - await issuerCred.sendCredential(connection) - const state = await issuerCred.getState() - await saveIssuerCredential(issuerCredId, issuerCred) - return state - } - - async function waitForCredentialAck (issuerCredId, connectionId, attemptThreshold = 20, timeoutMs = 500) { - const connection = await loadConnection(connectionId) - const issuerCred = await loadIssuerCredential(issuerCredId) - logger.info(`Waiting for ack on issuer credential '${issuerCredId}' with connection ${connectionId}`) - await _progressIssuerCredentialToState(issuerCred, connection, IssuerStateType.Finished, attemptThreshold, timeoutMs) - await saveIssuerCredential(issuerCredId, issuerCred) - } - - async function sendOfferAndWaitForCredRequest (issuerCredId, revRegId, connectionId, credDefId, schemaAttrs, attemptThreshold = 20, timeoutMs = 500) { - await sendOfferV2(issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) - const issuerCred = await loadIssuerCredential(issuerCredId) - const connection = await loadConnection(connectionId) - logger.debug('Going to wait until credential request is received.') - await _progressIssuerCredentialToState(issuerCred, connection, IssuerStateType.RequestReceived, attemptThreshold, timeoutMs) - await saveIssuerCredential(issuerCredId, issuerCred) - } - - async function sendCredentialAndProgress (issuerCredId, connectionId, attemptThreshold = 20, timeoutMs = 500) { - await sendCredential(issuerCredId, connectionId) - const connection = await loadConnection(connectionId) - const issuerCred = await loadIssuerCredential(issuerCredId) - logger.info('Going to wait until counterparty accepts the credential.') - await _progressIssuerCredentialToState(issuerCred, connection, IssuerStateType.Finished, attemptThreshold, timeoutMs) - await saveIssuerCredential(issuerCredId, issuerCred) - } - - async function sendOfferAndCredential (issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) { - await sendOfferAndWaitForCredRequest(issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) - await sendCredentialAndProgress(issuerCredId, connectionId) - } - - async function revokeCredentialLocal (issuerCredId) { - const issuerCred = await loadIssuerCredential(issuerCredId) - logger.info(`Revoking credential ${issuerCredId}`) - await issuerCred.revokeCredentialLocal() - } - - async function getRevRegId (issuerCredId) { - const issuerCred = await loadIssuerCredential(issuerCredId) - return issuerCred.getRevRegId() - } - - async function getRevocationId (issuerCredId) { - const issuerCred = await loadIssuerCredential(issuerCredId) - return issuerCred.getRevocationId() - } - - async function _progressIssuerCredentialToState (issuerCredential, connection, credentialStateTarget, attemptsThreshold, timeoutMs) { - async function progressToAcceptedState () { - const currentState = await issuerCredential.updateStateV2(connection) - if (currentState !== credentialStateTarget) { - return { result: undefined, isFinished: false } - } else { - logger.debug(`Cred issuer: _progressIssuerCredentialToState, currentState: ${currentState}, credentialStateTarget: ${credentialStateTarget}`) - return { result: null, isFinished: true } - } - } - - const [error, offers] = await pollFunction(progressToAcceptedState, `Progress IssuerCredentialSM to state ${credentialStateTarget}`, logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't find suitable message to progress issuerCredential to state ${credentialStateTarget}. ${error}`) - } - return offers - } - - async function credentialUpdate (issuerCredId, connectionId) { - const connection = await loadConnection(connectionId) - const issuerCred = await loadIssuerCredential(issuerCredId) - const state = await issuerCred.updateStateV2(connection) - await saveIssuerCredential(issuerCredId, issuerCred) - return state - } - - async function getState (issuerCredentialId) { - const issuerCredential = await loadIssuerCredential(issuerCredentialId) - return issuerCredential.getState() - } - - async function listIds () { - return listIssuerCredentialIds() - } - - async function printInfo (issuerCredentialIds) { - for (const id of issuerCredentialIds) { - const state = await getState(id) - logger.info(`IssuerCredential ${id} state=${state}`) - } - } - - async function getVcxCredentialIssuer (issuerCredentialId) { - logger.warn('Usage of getVcxCredentialIssuer is not recommended. You should use vcxagent-core API rather than work with vcx object directly.') - return loadIssuerCredential(issuerCredentialId) - } - - return { - sendOfferV2, - buildOfferAndMarkAsSent, - sendOfferAndWaitForCredRequest, - sendCredential, - waitForCredentialAck, - sendCredentialAndProgress, - sendOfferAndCredential, - revokeCredentialLocal, - credentialUpdate, - getVcxCredentialIssuer, - getRevocationId, - - listIds, - printInfo, - getState, - getRevRegId - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-ledger-creddef.js b/aries/agents/node/vcxagent-core/src/services/service-ledger-creddef.js deleted file mode 100644 index 3a9397f36b..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-ledger-creddef.js +++ /dev/null @@ -1,44 +0,0 @@ -const { CredentialDef } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceLedgerCredDef = function createServiceLedgerCredDef ({ logger, saveCredDef, loadCredDef, listCredDefIds }) { - async function createCredentialDefinitionV2 (issuerDid, schemaId, credDefId, supportRevocation, tag = 'tag1') { - const data = { - issuerDid, - supportRevocation, - schemaId, - sourceId: credDefId, - tag - } - logger.info(`Creating a new credential definition on the ledger from input: ${JSON.stringify(data)}`) - const credDef = await CredentialDef.create(data) - await credDef.publish() - await saveCredDef(credDefId, credDef) - logger.info(`Created credentialDefinition ${credDefId}.`) - return credDef - } - - async function listIds () { - return listCredDefIds() - } - - async function printInfo (credDefIds) { - for (const id of credDefIds) { - const credDef = await loadCredDef(id) - const serCredDef = credDef.serialize() - logger.info(`Credential definition ${id}: ${JSON.stringify(serCredDef)}`) - } - } - - async function getCredDefId (credDefId) { - const credDef = await loadCredDef(credDefId) - logger.info(`Getting credDefId for credential definition ${credDefId}`) - return credDef.getCredDefId() - } - - return { - createCredentialDefinitionV2, - listIds, - printInfo, - getCredDefId - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-ledger-schema.js b/aries/agents/node/vcxagent-core/src/services/service-ledger-schema.js deleted file mode 100644 index ecc049c8ad..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-ledger-schema.js +++ /dev/null @@ -1,30 +0,0 @@ -const { Schema } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceLedgerSchema = function createServiceLedgerSchema ({ logger, saveSchema, loadSchema, listSchemaIds }) { - async function createSchema (schemaData, issuerDid) { - logger.info(`Creating a new schema on the ledger: ${JSON.stringify(schemaData, null, 2)}`) - - const schema = await Schema.create(schemaData, issuerDid) - const schemaId = await schema.getSchemaId() - await saveSchema(schemaId, schema) - return schemaId - } - - async function listIds () { - return listSchemaIds() - } - - async function printInfo (schemaIds) { - for (const id of schemaIds) { - const serSchema = await loadSchema(id) - logger.info(`Schema ${id}: ${JSON.stringify(serSchema)}`) - } - } - - return { - createSchema, - - listIds, - printInfo - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-mediated-connections.js b/aries/agents/node/vcxagent-core/src/services/service-mediated-connections.js deleted file mode 100644 index e8526c2429..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-mediated-connections.js +++ /dev/null @@ -1,86 +0,0 @@ -const { NonmediatedConnection } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceNonmediatedConnections = function createServiceNonmediatedConnections ({ logger, saveNonmediatedConnection, loadNonmediatedConnection, endpointInfo }) { - async function inviterConnectionCreatePwInvite (connectionId) { - logger.info(`inviterConnectionCreatePwInvite >> connectionId=${connectionId}`) - const connection = await NonmediatedConnection.createInviter() - logger.debug(`InviterConnectionSM after created connection:\n${JSON.stringify(connection.serialize())}`) - await connection.createInvite(endpointInfo) - logger.debug(`InviterConnectionSM after invitation was generated:\n${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - const invite = connection.getInvitation() - logger.debug(`InviterConnectionSM created invitation ${invite}`) - return invite - } - - async function inviterConnectionCreateFromRequest (connectionId, request, pwInfo) { - logger.info(`inviterConnectionCreateFromRequest >> connectionId=${connectionId}, request: ${request}, pwInfo: ${pwInfo}`) - const connection = await NonmediatedConnection.createInviter(pwInfo) - logger.debug(`InviterConnectionSM after created connection:\n${JSON.stringify(connection.serialize())}`) - await connection.processRequest(request, endpointInfo) - logger.debug(`InviterConnectionSM after processing request:\n${JSON.stringify(connection.serialize())}`) - await connection.sendResponse() - logger.debug(`InviterConnectionSM after sending response:\n${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - } - - async function inviterConnectionProcessRequest (connectionId, request) { - logger.info(`inviterConnectionProcessRequest >> connectionId=${connectionId}, request: ${request}`) - const connection = await loadNonmediatedConnection(connectionId) - await connection.processRequest(request, endpointInfo) - logger.info(`InviterConnectionSM after processing request:\n${JSON.stringify(connection.serialize())}`) - await connection.sendResponse() - logger.info(`InviterConnectionSM after sending response:\n${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - } - - async function inviterConnectionProcessAck (connectionId, ack) { - logger.info(`inviterConnectionProcessAck >> connectionId=${connectionId}, ack: ${ack}`) - const connection = await loadNonmediatedConnection(connectionId) - await connection.processAck(ack) - logger.debug(`InviterConnectionSM after processing ack: ${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - } - - async function inviteeConnectionCreateFromInvite (connectionId, invite) { - logger.info(`inviteeConnectionCreateFromInvite >> connectionId=${connectionId}, invite: ${invite}`) - const connection = await NonmediatedConnection.createInvitee(invite) - logger.debug(`InviteeConnectionSM after created from invitation:\n${JSON.stringify(connection.serialize())}`) - await connection.processInvite(invite) - await connection.sendRequest(endpointInfo) - logger.debug(`InviteeConnectionSM after sending request:\n${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - } - - async function inviteeConnectionProcessResponse (connectionId, response) { - logger.info(`inviteeConnectionProcessResponse >> connectionId=${connectionId}, response: ${response}`) - const connection = await loadNonmediatedConnection(connectionId) - await connection.processResponse(response) - logger.debug(`InviteeConnectionSM after processing response:\n${JSON.stringify(connection.serialize())}`) - await connection.sendAck() - logger.debug(`InviteeConnectionSM connection after sending ack:\n${JSON.stringify(connection.serialize())}`) - await saveNonmediatedConnection(connectionId, connection) - } - - async function sendMessage (connectionId, content) { - logger.info(`nonmediatedConnectionSendMessage >> connectionId=${connectionId}, content: ${content}`) - const connection = await loadNonmediatedConnection(connectionId) - await connection.sendMessage(content) - } - - async function getState (connectionId) { - const connection = await loadNonmediatedConnection(connectionId) - return connection.getState() - } - - return { - inviterConnectionCreatePwInvite, - inviterConnectionCreateFromRequest, - inviterConnectionProcessRequest, - inviterConnectionProcessAck, - inviteeConnectionCreateFromInvite, - inviteeConnectionProcessResponse, - sendMessage, - getState - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-out-of-band.js b/aries/agents/node/vcxagent-core/src/services/service-out-of-band.js deleted file mode 100644 index f58e9dc36d..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-out-of-band.js +++ /dev/null @@ -1,27 +0,0 @@ -const { OutOfBandSender } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceOutOfBand = function createServiceOutOfBand ({ loadConnection }) { - async function createOobMessageWithDid (message, label, publicDid) { - const oobSender = OutOfBandSender.create({ label }) - if (message) { - const msgParsed = JSON.parse(message) - const msgType = msgParsed['@type'] - if (!msgType) { - throw Error(`Message appended to OOB message must have @type. Invalid message: ${msgParsed}`) - } - oobSender.appendMessage(message) - } - oobSender.appendServiceDid(publicDid) - return oobSender.toMessage() - } - - async function reuseConnectionFromOobMsg (connectionId, oobMsg) { - const connection = await loadConnection(connectionId) - await connection.sendHandshakeReuse(oobMsg) - } - - return { - createOobMessageWithDid, - reuseConnectionFromOobMsg - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-prover.js b/aries/agents/node/vcxagent-core/src/services/service-prover.js deleted file mode 100644 index 5484227614..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-prover.js +++ /dev/null @@ -1,131 +0,0 @@ -const { pollFunction } = require('../common') -const { holderSelectCredentialsForProof } = require('../utils/proofs') -const { - DisclosedProof, - ProverStateType -} = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceProver = function createServiceProver ({ logger, loadConnection, saveDisclosedProof, loadDisclosedProof, listDislosedProofIds }) { - async function _progressProofToState (proof, connection, targetStates, attemptsThreshold, timeoutMs) { - async function progressToAcceptedState () { - if (!Array.isArray(targetStates)) { - throw Error('Argument targetStates should be array.') - } - const state = await proof.updateStateV2(connection) - if (targetStates.includes(state)) { - return { result: null, isFinished: true } - } else { - return { result: undefined, isFinished: false } - } - } - - const [error] = await pollFunction(progressToAcceptedState, `Progress ProofSM to one of states ${JSON.stringify(targetStates)}`, logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't progress proof to Accepted state. ${error}`) - } - } - - async function _getProofRequests (connection, attemptsThreshold, timeoutMs) { - async function findSomeRequests () { - const requests = await DisclosedProof.getRequests(connection) - if (requests.length === 0) { - return { result: undefined, isFinished: false } - } else { - return { result: requests, isFinished: true } - } - } - - const [error, proofRequests] = await pollFunction(findSomeRequests, 'Get proof request', logger, attemptsThreshold, timeoutMs) - if (error) { - throw Error(`Couldn't find any proof request. ${error}`) - } - return proofRequests - } - - async function waitForProofRequests (connectionId, attemptsThreshold = 20, timeoutMs = 500) { - const connection = await loadConnection(connectionId) - const proofRequests = await _getProofRequests(connection, attemptsThreshold, timeoutMs) - logger.info(`Found ${proofRequests.length} proof requests.`) - return proofRequests - } - - async function getProofRequests (connectionId) { - const connection = await loadConnection(connectionId) - return DisclosedProof.getRequests(connection) - } - - async function buildDisclosedProof (disclosedProofId, proofRequest) { - const request = typeof proofRequest === 'string' ? proofRequest : JSON.stringify(proofRequest) - const disclosedProof = await DisclosedProof.create({ sourceId: 'proof', request }) - await saveDisclosedProof(disclosedProofId, disclosedProof) - } - - async function selectCredentials (disclosedProofId, mapRevRegIdToTailsFilePath) { - const disclosedProof = await loadDisclosedProof(disclosedProofId) - return holderSelectCredentialsForProof(disclosedProof, logger, mapRevRegIdToTailsFilePath) - } - - async function generateProof (disclosedProofId, selectedCreds, selfAttestedAttrs) { - const disclosedProof = await loadDisclosedProof(disclosedProofId) - await disclosedProof.generateProof({ selectedCreds, selfAttestedAttrs }) - await saveDisclosedProof(disclosedProofId, disclosedProof) - } - - async function sendDisclosedProof (disclosedProofId, connectionId) { - const disclosedProof = await loadDisclosedProof(disclosedProofId) - const connection = await loadConnection(connectionId) - await disclosedProof.sendProof(connection) - const state = await disclosedProof.getState() - await saveDisclosedProof(disclosedProofId, disclosedProof) - return state - } - - async function sendDisclosedProofAndProgress (disclosedProofId, connectionId) { - await sendDisclosedProof(disclosedProofId, connectionId) - const disclosedProof = await loadDisclosedProof(disclosedProofId) - const connection = await loadConnection(connectionId) - await _progressProofToState(disclosedProof, connection, [ProverStateType.PresentationPreparationFailed, ProverStateType.PresentationSent]) - const state = await disclosedProof.getState() - await saveDisclosedProof(disclosedProofId, disclosedProof) - return state - } - - async function disclosedProofUpdate (disclosedProofId, connectionId) { - const disclosedProof = await loadDisclosedProof(disclosedProofId) - const connection = await loadConnection(connectionId) - const state = await disclosedProof.updateStateV2(connection) - await saveDisclosedProof(disclosedProofId, disclosedProof) - return state - } - - async function getState (disclosedProofId) { - const disclosedProof = await loadDisclosedProof(disclosedProofId) - return await disclosedProof.getState() - } - - async function listIds () { - return listDislosedProofIds() - } - - async function printInfo (disclosedProofIds) { - for (const id of disclosedProofIds) { - const state = await getState(id) - logger.info(`DisclosedProof ${id} state=${state}`) - } - } - - return { - generateProof, - selectCredentials, - getProofRequests, - waitForProofRequests, - sendDisclosedProof, - sendDisclosedProofAndProgress, - buildDisclosedProof, - disclosedProofUpdate, - - listIds, - printInfo, - getState - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-revocation-registry.js b/aries/agents/node/vcxagent-core/src/services/service-revocation-registry.js deleted file mode 100644 index 1130c11cc9..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-revocation-registry.js +++ /dev/null @@ -1,60 +0,0 @@ -const { RevocationRegistry } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createServiceLedgerRevocationRegistry = function createServiceLedgerRevocationRegistry ({ logger, saveRevReg, loadRevReg }) { - async function createRevocationRegistry (issuerDid, credDefId, tag, tailsDir, maxCreds, tailsUrl = 'dummy.org') { - const data = { - issuerDid, - credDefId, - tag, - tailsDir, - maxCreds - } - const revReg = await RevocationRegistry.create(data) - await revReg.publish(tailsUrl) - const revRegId = revReg.getRevRegId() - await saveRevReg(revRegId, revReg) - return { revReg, revRegId } - } - - async function rotateRevocationRegistry (revRegId, maxCreds, tailsUrl = 'dummy.org') { - logger.info(`Rotating revocation registry ${revRegId}, maxCreds ${maxCreds}`) - const revReg = await loadRevReg(revRegId) - let newRevReg - try { - newRevReg = await revReg.rotate(maxCreds) - await newRevReg.publish(tailsUrl) - } catch (err) { - throw Error(`Error rotating revocation registry ${revRegId}: ${err}`) - } - const newRevRegId = await newRevReg.getRevRegId() - await saveRevReg(newRevRegId, newRevReg) - logger.info(`Revocation registry ${revRegId} rotated, new rev reg id ${newRevRegId}`) - return { revReg: newRevReg, revRegId: newRevRegId } - } - - async function publishRevocations (revRegId, submittderDid) { - logger.info(`Publishing revocations for revocation registry ${revRegId}`) - const revReg = await loadRevReg(revRegId) - await revReg.publishRevocations(submittderDid) - } - - async function getTailsFile (credDefId) { - const revReg = await loadRevReg(credDefId) - logger.info(`Getting tails file for revocation registry ${revReg}`) - return revReg.getTailsFile() - } - - async function getTailsHash (credDefId) { - const revReg = await loadRevReg(credDefId) - logger.info(`Getting tails hash for revocation registry ${revReg}`) - return revReg.getTailsHash() - } - - return { - getTailsFile, - getTailsHash, - createRevocationRegistry, - rotateRevocationRegistry, - publishRevocations - } -} diff --git a/aries/agents/node/vcxagent-core/src/services/service-verifier.js b/aries/agents/node/vcxagent-core/src/services/service-verifier.js deleted file mode 100644 index 3393314393..0000000000 --- a/aries/agents/node/vcxagent-core/src/services/service-verifier.js +++ /dev/null @@ -1,113 +0,0 @@ -const { - Proof, VerifierStateType -} = require('@hyperledger/node-vcx-wrapper') -const sleep = require('sleep-promise') -const assert = require('assert') - -module.exports.createServiceVerifier = function createServiceVerifier ({ logger, loadConnection, saveProof, loadProof, listProofIds }) { - async function createProof (proofId, proofData) { - logger.info(`Verifier creating proof ${proofId}, proofData: ${JSON.stringify(proofData)}`) - await sleep(1000) - const proof = await Proof.create(proofData) - await saveProof(proofId, proof) - return proof - } - - async function buildProofReqAndMarkAsSent (proofId, proofData) { - logger.debug(`Building proof request ${proofId}`) - const proof = await Proof.create(proofData) - const presentationRequest = proof.getProofRequestMessage() - const state1 = await proof.getState() - assert.equal(state1, VerifierStateType.PresentationRequestSet) - - await proof.markPresentationRequestMsgSent() - const state2 = await proof.getState() - assert.equal(state2, VerifierStateType.PresentationRequestSent) - - await saveProof(proofId, proof) - return presentationRequest - } - - async function sendProofRequest (connectionId, proofId) { - logger.debug(`Verifier sending proof request proofId=${proofId}, connectionId=${connectionId}`) - const connection = await loadConnection(connectionId) - const proof = await loadProof(proofId) - await proof.requestProof(connection) - const state = await proof.getState() - await saveProof(proofId, proof) - const proofRequestMessage = proof.getProofRequestMessage() - return { state, proofRequestMessage } - } - - async function proofUpdate (proofId, connectionId) { - const proof = await loadProof(proofId) - const connection = await loadConnection(connectionId) - const state = await proof.updateStateV2(connection) - await saveProof(proofId, proof) - return state - } - - async function getState (proofId) { - const proof = await loadProof(proofId) - return await proof.getState() - } - - async function getPresentationMsg (proofId) { - const proof = await loadProof(proofId) - return JSON.parse(proof.getPresentationMsg()) - } - - async function getPresentationAttachment (proofId) { - const proof = await loadProof(proofId) - return JSON.parse(proof.getPresentationAttachment()) - } - - async function getPresentationRequestAttachment (proofId) { - const proof = await loadProof(proofId) - return JSON.parse(proof.getPresentationRequestAttachment()) - } - - async function getVerificationStatus (proofId) { - const proof = await loadProof(proofId) - return proof.getVerificationStatus() - } - - async function getRevocationStatus (proofId) { - const proof = await loadProof(proofId) - return proof.getVerificationStatus() - } - - async function listIds () { - return listProofIds() - } - - async function printInfo (connectionIds) { - for (const id of connectionIds) { - const state = await getState(id) - logger.info(`Proof ${id} state=${state}`) - } - } - - async function getVcxProof (proofId) { - logger.warn('Usage of getVcxProof is not recommended. You should use vcxagent-core API rather than work with vcx object directly.') - return loadProof(proofId) - } - - return { - createProof, - buildProofReqAndMarkAsSent, - sendProofRequest, - proofUpdate, - getVcxProof, - - listIds, - printInfo, - getState, - - getPresentationMsg, - getPresentationAttachment, - getPresentationRequestAttachment, - getVerificationStatus, - getRevocationStatus - } -} diff --git a/aries/agents/node/vcxagent-core/src/storage/storage-file.js b/aries/agents/node/vcxagent-core/src/storage/storage-file.js deleted file mode 100644 index 3b0b48bb1f..0000000000 --- a/aries/agents/node/vcxagent-core/src/storage/storage-file.js +++ /dev/null @@ -1,48 +0,0 @@ -const storageFile = require('node-persist') - -async function createFileStorage (name) { - const storageInstance = storageFile.create({ dir: name }) - storageInstance.init() - - async function set (id, data) { - return storageInstance.set(id, data) - } - - async function get (id) { - return storageInstance.get(id) - } - - async function values () { - return storageInstance.values() || [] - } - - async function keys () { - return storageInstance.keys() || [] - } - - async function hasKey (key) { - const res = await get(key) - return !!res - } - - async function del (key) { - return storageInstance.removeItem(key) - } - - async function length () { - const keys = await this.keys() - return keys.length - } - - return { - set, - get, - values, - keys, - hasKey, - del, - length - } -} - -module.exports.createFileStorage = createFileStorage diff --git a/aries/agents/node/vcxagent-core/src/storage/storage-service.js b/aries/agents/node/vcxagent-core/src/storage/storage-service.js deleted file mode 100644 index 265aa79764..0000000000 --- a/aries/agents/node/vcxagent-core/src/storage/storage-service.js +++ /dev/null @@ -1,238 +0,0 @@ -const { createFileStorage } = require('./storage-file') -const mkdirp = require('mkdirp') -const { - Connection, - NonmediatedConnection, - Credential, - IssuerCredential, - CredentialDef, - RevocationRegistry, - Schema, - DisclosedProof, - Proof -} = require('@hyperledger/node-vcx-wrapper') - -async function createStorageService (agentName) { - mkdirp.sync('storage-agentProvisions/') - mkdirp.sync('storage-connections/') - mkdirp.sync('storage-nonmediated-connections/') - mkdirp.sync('storage-credentialDefinitions/') - mkdirp.sync('storage-revocationRegistries/') - mkdirp.sync('storage-schemas/') - - const storageAgentProvisions = await createFileStorage(`storage-agentProvisions/${agentName}`) - const storageConnections = await createFileStorage(`storage-connections/${agentName}`) - const storageNonmediatedConnections = await createFileStorage(`storage-connections/${agentName}`) - const storageCredIssuer = await createFileStorage(`storage-credsIssuer/${agentName}`) - const storageCredHolder = await createFileStorage(`storage-credsHolder/${agentName}`) - const storageProof = await createFileStorage(`storage-proofs/${agentName}`) - const storageDisclosedProof = await createFileStorage(`storage-dislosedProofs/${agentName}`) - const storageCredentialDefinitons = await createFileStorage(`storage-credentialDefinitions/${agentName}`) - const storageRevocationRegistries = await createFileStorage(`storage-revocationRegistries/${agentName}`) - const storageSchemas = await createFileStorage(`storage-schemas/${agentName}`) - - async function agentProvisionExists () { - return storageAgentProvisions.hasKey('agent-provision') - } - - async function saveAgentProvision (provision) { - await storageAgentProvisions.set('agent-provision', provision) - } - - async function loadAgentProvision () { - return storageAgentProvisions.get('agent-provision') - } - - async function saveConnection (name, connection) { - const serialized = await connection.serialize() - await storageConnections.set(`${name}`, serialized) - } - - async function loadConnection (name) { - const serialized = await storageConnections.get(`${name}`) - if (!serialized) { - throw Error(`Connection ${name} was not found.`) - } - return Connection.deserialize(serialized) - } - - async function saveNonmediatedConnection (name, connection) { - const serialized = await connection.serialize() - await storageNonmediatedConnections.set(`${name}`, serialized) - } - - async function loadNonmediatedConnection (name) { - const serialized = await storageNonmediatedConnections.get(`${name}`) - if (!serialized) { - throw Error(`Nonmediated connection ${name} was not found.`) - } - return NonmediatedConnection.deserialize(serialized) - } - - async function saveSchema (name, schema) { - const serialized = await schema.serialize() - await storageSchemas.set(name, serialized) - } - - async function loadSchema (name) { - const serialized = await storageSchemas.get(name) - if (!serialized) { - throw Error(`Schema ${name} was not found.`) - } - return Schema.deserialize(serialized) - } - - async function saveCredentialDefinition (name, credDef) { - const serialized = await credDef.serialize() - await storageCredentialDefinitons.set(name, serialized) - } - - async function loadCredentialDefinition (name) { - const serialized = await storageCredentialDefinitons.get(name) - if (!serialized) { - throw Error(`CredentialDefinition ${name} was not found.`) - } - return CredentialDef.deserialize(serialized) - } - - async function saveRevocationRegistry (name, revReg) { - const serialized = await revReg.serialize() - await storageRevocationRegistries.set(name, serialized) - } - - async function loadRevocationRegistry (name) { - const serialized = await storageRevocationRegistries.get(name) - if (!serialized) { - throw Error(`RevocationRegistry ${name} was not found.`) - } - return RevocationRegistry.deserialize(serialized) - } - - async function saveCredIssuer (name, credIssuer) { - const serialized = await credIssuer.serialize() - await storageCredIssuer.set(name, serialized) - } - - async function loadCredIssuer (name) { - const serialized = await storageCredIssuer.get(name) - if (!serialized) { - throw Error(`CredentialIssuer ${name} was not found.`) - } - return IssuerCredential.deserialize(serialized) - } - - async function saveCredHolder (name, credHolder) { - const serialized = await credHolder.serialize() - await storageCredHolder.set(name, serialized) - } - - async function loadCredHolder (name) { - const serialized = await storageCredHolder.get(name) - if (!serialized) { - throw Error(`CredentialHolder ${name} was not found.`) - } - return Credential.deserialize(serialized) - } - - async function saveDisclosedProof (name, disclosedProof) { - const serialized = await disclosedProof.serialize() - await storageDisclosedProof.set(name, serialized) - } - - async function loadDisclosedProof (name) { - const serialized = await storageDisclosedProof.get(name) - if (!serialized) { - throw Error(`DisclosedProof ${name} was not found.`) - } - return DisclosedProof.deserialize(serialized) - } - - async function saveProof (name, proof) { - const serialized = await proof.serialize() - await storageProof.set(name, serialized) - } - - async function loadProof (name) { - const serialized = await storageProof.get(name) - if (!serialized) { - throw Error(`Proof ${name} was not found.`) - } - return Proof.deserialize(serialized) - } - - async function listConnectionKeys () { - return storageConnections.keys() - } - - async function listSchemaKeys () { - return storageSchemas.keys() - } - - async function listCredentialDefinitionKeys () { - return storageCredentialDefinitons.keys() - } - - async function listRevocationRegistryKeys () { - return storageRevocationRegistries.keys() - } - - async function listCredIssuerKeys () { - return storageCredIssuer.keys() - } - - async function listCredHolderKeys () { - return storageCredHolder.keys() - } - - async function listDisclosedProofKeys () { - return storageDisclosedProof.keys() - } - - async function listProofKeys () { - return storageProof.keys() - } - - return { - agentProvisionExists, - saveAgentProvision, - loadAgentProvision, - - saveConnection, - loadConnection, - - saveNonmediatedConnection, - loadNonmediatedConnection, - - saveSchema, - loadSchema, - - saveCredentialDefinition, - loadCredentialDefinition, - - saveRevocationRegistry, - loadRevocationRegistry, - - saveCredIssuer, - loadCredIssuer, - - saveCredHolder, - loadCredHolder, - - saveDisclosedProof, - loadDisclosedProof, - - saveProof, - loadProof, - - listConnectionKeys, - listSchemaKeys, - listCredentialDefinitionKeys, - listRevocationRegistryKeys, - listCredIssuerKeys, - listCredHolderKeys, - listDisclosedProofKeys, - listProofKeys - } -} - -module.exports.createStorageService = createStorageService diff --git a/aries/agents/node/vcxagent-core/src/utils/credentials.js b/aries/agents/node/vcxagent-core/src/utils/credentials.js deleted file mode 100644 index 342db8be56..0000000000 --- a/aries/agents/node/vcxagent-core/src/utils/credentials.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports.filterOffersBySchema = function filterOffersBySchema (offers, schemaIdRegex) { - return offers.filter(offer => { - const base64data = offer['offers~attach'][0].data.base64 - const data = JSON.parse(Buffer.from(base64data, 'base64').toString('utf-8')) - const matches = data.schema_id.match(schemaIdRegex) - return matches && matches.length > 0 - }) -} - -module.exports.filterOffersByAttr = function filterOffersByAttr (offers, attrRegex) { - return offers.filter(offer => offer.credential_preview.attributes.find(attr => attr.name.match(attrRegex.name) && attr.value.match(attrRegex.value))) -} diff --git a/aries/agents/node/vcxagent-core/src/utils/messages.js b/aries/agents/node/vcxagent-core/src/utils/messages.js deleted file mode 100644 index 2f8ee4ad0e..0000000000 --- a/aries/agents/node/vcxagent-core/src/utils/messages.js +++ /dev/null @@ -1,40 +0,0 @@ -const _ = require('lodash') - -async function maybeJoinWithComma (list) { - let res - if (list && list.length > 0) { - res = list.join(',') - } - return res -} - -async function parseDownloadMessagesResult (msgs) { - const messages = [] - const res = JSON.parse(msgs) - if (res && res.length > 1) { - throw Error(`Expected to receive messages for single connection, but received messages for ${res.length} connection. This is agency bug.`) - } - if (res && res.length === 0) { - throw Error('Expected to receive messages for single connection, but received messages for none.') - } - if (!res[0].msgs) { - throw Error(`Invalid response, field 'msgs' is missing in response. This is agency bug. Received response = ${JSON.stringify(res)}`) - } - if (res[0].msgs.length > 0) { - await messages.push(res[0].msgs) - } - return _.flatten(messages) -} - -module.exports.getMessagesForConnection = async function getMessagesForConnection ( - connection, - filterStatuses = ['MS-103', 'MS-106'], - filterUids = [] -) { - filterStatuses = filterStatuses || ['MS-103', 'MS-106'] // explicit null or undefined interpreted as "no filter" - const downloadInstructions = { - status: await maybeJoinWithComma(filterStatuses), - uids: await maybeJoinWithComma(filterUids) - } - return parseDownloadMessagesResult(await connection.downloadMessages(downloadInstructions)) -} diff --git a/aries/agents/node/vcxagent-core/src/utils/proofs.js b/aries/agents/node/vcxagent-core/src/utils/proofs.js deleted file mode 100644 index a746fb096c..0000000000 --- a/aries/agents/node/vcxagent-core/src/utils/proofs.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Based on credentials in the wallet and proof request, this function builds data structure specifying how to - * build proof complying with the proof request. - * @param holderProof - deserialized libvcx Proof object - * @param logger - logger implementing debug and info functions - * @param mapRevRegIdToTailsFilePath - function receiving 1 argument - rev_reg_id, mapping it to a path pointing to - * file containing tails file for the given revocation registry. - * @returns {Promise<{attrs: {}}>} - */ -module.exports.holderSelectCredentialsForProof = async function holderSelectCredentialsForProof (holderProof, logger, mapRevRegIdToTailsFilePath) { - const resolvedCreds = await holderProof.getCredentials() - const selectedCreds = { attrs: {} } - logger.debug(`Resolved credentials for proof = ${JSON.stringify(resolvedCreds, null, 2)}`) - - const unresolvedRequirements = [] - for (const [attrName, attrCredInfo] of Object.entries(resolvedCreds.attrs)) { - if (Array.isArray(attrCredInfo) === false) { - throw Error('Unexpected data, expected attrCredInfo to be an array.') - } - if (attrCredInfo.length > 0) { - selectedCreds.attrs[attrName] = { - credential: resolvedCreds.attrs[attrName][0] - } - const revRegId = resolvedCreds.attrs[attrName][0].cred_info.rev_reg_id - if (revRegId && mapRevRegIdToTailsFilePath) { - selectedCreds.attrs[attrName].tails_dir = await mapRevRegIdToTailsFilePath(revRegId) - } - } else { - logger.info(`No credential was resolved for requested attribute key ${attrName}, will have to be supplied via self-attested attributes.`) - unresolvedRequirements.push(attrName) - } - } - if (selectedCreds) { - logger.debug(`Selected credentials:\n${JSON.stringify(selectedCreds, null, 2)}`) - } - return { selectedCreds, unresolvedRequirements } -} - -module.exports.extractProofRequestAttachement = function extractProofRequestAttachement (proofRequest) { - const attachment = proofRequest['request_presentations~attach'][0].data.base64 - return JSON.parse(Buffer.from(attachment, 'base64').toString('utf8')) -} diff --git a/aries/agents/node/vcxagent-core/src/utils/vcx-workflows.js b/aries/agents/node/vcxagent-core/src/utils/vcx-workflows.js deleted file mode 100644 index a22adc1c0b..0000000000 --- a/aries/agents/node/vcxagent-core/src/utils/vcx-workflows.js +++ /dev/null @@ -1,61 +0,0 @@ -const { - initVcxWithConfig, provisionCloudAgent, - createWallet, openMainWallet, closeMainWallet, - configureIssuerWallet, defaultLogger -} = require('@hyperledger/node-vcx-wrapper') - -async function initVcxWithProvisionedAgentConfig (config) { - await initVcxWithConfig(JSON.stringify(config)) -} - -function initRustLogger (logPattern) { - defaultLogger(logPattern) -} - -async function provisionAgentInAgency (agentName, agencyConfig, seed, walletExtraConfigs, logger) { - logger.info('Provisioning cloud agent') - if (!agentName) { - throw Error('agentName not specified') - } - if (!agencyConfig) { - throw Error('agencyConfig not specified') - } - if (!seed) { - throw Error('seed not specified') - } - - const walletConfig = { - wallet_name: agentName, - wallet_key: '8dvfYSt5d1taSd6yJdpjq4emkwsPDDLYxkNFysFD2cZY', - wallet_key_derivation: 'RAW' - } - walletExtraConfigs = walletExtraConfigs || { } - for (const key of Object.keys(walletExtraConfigs)) { - const value = walletExtraConfigs[key] - if (typeof value === 'object') { - walletConfig[key] = JSON.stringify(value) - } else { - walletConfig[key] = value - } - } - logger.info(`Using wallet config ${JSON.stringify(walletConfig)}`) - - logger.debug(`Creating wallet with config: ${JSON.stringify(walletConfig, null, 2)}`) - await createWallet(walletConfig) - logger.debug(`Opening wallet with config: ${JSON.stringify(walletConfig, null, 2)}`) - await openMainWallet(walletConfig) - logger.debug(`Configuring issuer's wallet with seed: ${seed}`) - const issuerConfig = JSON.parse(await configureIssuerWallet(seed)) - issuerConfig.institution_name = agentName - logger.debug(`Configured issuer wallet with config: ${JSON.stringify(issuerConfig, null, 2)}`) - logger.debug(`Provisioning agent with config: ${JSON.stringify(agencyConfig, null, 2)}`) - agencyConfig = JSON.parse(await provisionCloudAgent(agencyConfig)) - logger.debug(`Provisioned agent with config: ${JSON.stringify(agencyConfig, null, 2)}`) - await closeMainWallet() - - return { agencyConfig, issuerConfig, walletConfig } -} - -module.exports.initVcxWithProvisionedAgentConfig = initVcxWithProvisionedAgentConfig -module.exports.provisionAgentInAgency = provisionAgentInAgency -module.exports.initRustLogger = initRustLogger diff --git a/aries/agents/node/vcxagent-core/test/connection.spec.js b/aries/agents/node/vcxagent-core/test/connection.spec.js deleted file mode 100644 index 3e089dc6d4..0000000000 --- a/aries/agents/node/vcxagent-core/test/connection.spec.js +++ /dev/null @@ -1,263 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') -const bodyParser = require('body-parser') -const sleep = require('sleep-promise') -const express = require('express') -const { createAliceAndFaber } = require('./utils/utils') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('test establishing and exchanging messages via nonmediated connections', () => { - it('Establish nonmediated connection via public endpoint using public invite, exchange messages', async () => { - let faberServer, aliceServer - try { - const path = '/msg' - const faberPort = 5400 - const faberEndpoint = `http://127.0.0.1:${faberPort}${path}` - - let faberEncryptedMsg - const faberApp = express() - faberApp.use(bodyParser.raw({ type: '*/*' })) - faberApp.post(path, (req, res) => { - faberEncryptedMsg = req.body - res.status(200).send() - }) - faberServer = faberApp.listen(faberPort) - - const alicePort = 5401 - const aliceEndpoint = `http://127.0.0.1:${alicePort}${path}` - - let aliceEncryptedMsg - const aliceApp = express() - aliceApp.use(bodyParser.raw({ type: '*/*' })) - aliceApp.post(path, (req, res) => { - aliceEncryptedMsg = req.body - res.status(200).send() - }) - aliceServer = aliceApp.listen(alicePort) - - const { alice, faber } = await createAliceAndFaber({ aliceEndpoint, faberEndpoint }) - const invite = await faber.createPublicInvite() - const pwInfo = await faber.publishService(faberEndpoint) - const service = await faber.readServiceFromLedger() - expect(service.recipientKeys[0]).toBe(pwInfo.pw_vk) - - await alice.acceptInvitation(invite) - - const { message: request } = await faber.unpackMsg(faberEncryptedMsg) - await faber.createNonmediatedConnectionFromRequest(request, pwInfo) - - const { message: response } = await alice.unpackMsg(aliceEncryptedMsg) - await alice.nonmediatedConnectionProcessResponse(response) - - const { message: ack } = await faber.unpackMsg(faberEncryptedMsg) - await faber.nonmediatedConnectionProcessAck(ack) - - await alice.nonmediatedConnectionSendMessage('Hello Faber') - const { message: msgFaber } = await faber.unpackMsg(faberEncryptedMsg) - expect(JSON.parse(msgFaber).content).toBe('Hello Faber') - - await faber.nonmediatedConnectionSendMessage('Hello Alice') - const { message: msgAlice } = await alice.unpackMsg(aliceEncryptedMsg) - expect(JSON.parse(msgAlice).content).toBe('Hello Alice') - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - throw Error(err) - } finally { - if (faberServer) { - faberServer.close() - } - if (aliceServer) { - aliceServer.close() - } - await sleep(2000) - } - }) - - it('Establish nonmediated connection via public endpoint using pairwise invite, exchange messages', async () => { - let faberServer, aliceServer - try { - const path = '/msg' - const faberPort = 5402 - const faberEndpoint = `http://127.0.0.1:${faberPort}${path}` - - let faberEncryptedMsg - const faberApp = express() - faberApp.use(bodyParser.raw({ type: '*/*' })) - faberApp.post(path, (req, res) => { - faberEncryptedMsg = req.body - res.status(200).send() - }) - faberServer = faberApp.listen(faberPort) - - const alicePort = 5403 - const aliceEndpoint = `http://127.0.0.1:${alicePort}${path}` - - let aliceEncryptedMsg - const aliceApp = express() - aliceApp.use(bodyParser.raw({ type: '*/*' })) - aliceApp.post(path, (req, res) => { - aliceEncryptedMsg = req.body - res.status(200).send() - }) - aliceServer = aliceApp.listen(alicePort) - - const { alice, faber } = await createAliceAndFaber({ aliceEndpoint, faberEndpoint }) - - const invite = await faber.createNonmediatedConnectionWithInvite() - await alice.acceptInvitation(invite) - - const { message: request } = await faber.unpackMsg(faberEncryptedMsg) - await faber.nonmediatedConnectionProcessRequest(request) - - const { message: response } = await alice.unpackMsg(aliceEncryptedMsg) - await alice.nonmediatedConnectionProcessResponse(response) - - const { message: ack } = await faber.unpackMsg(faberEncryptedMsg) - await faber.nonmediatedConnectionProcessAck(ack) - - await alice.nonmediatedConnectionSendMessage('Hello Faber') - const { message: msgFaber } = await faber.unpackMsg(faberEncryptedMsg) - expect(JSON.parse(msgFaber).content).toBe('Hello Faber') - - await faber.nonmediatedConnectionSendMessage('Hello Alice') - const { message: msgAlice } = await alice.unpackMsg(aliceEncryptedMsg) - expect(JSON.parse(msgAlice).content).toBe('Hello Alice') - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - throw Error(err) - } finally { - if (faberServer) { - faberServer.close() - } - if (aliceServer) { - aliceServer.close() - } - await sleep(2000) - } - }) - - it('Establish nonmediated connection via public endpoint using OOB invite, exchange messages', async () => { - let faberServer, aliceServer - try { - const path = '/msg' - const faberPort = 5404 - const faberEndpoint = `http://127.0.0.1:${faberPort}${path}` - - let faberEncryptedMsg - const faberApp = express() - faberApp.use(bodyParser.raw({ type: '*/*' })) - faberApp.post(path, (req, res) => { - faberEncryptedMsg = req.body - res.status(200).send() - }) - faberServer = faberApp.listen(faberPort) - - const alicePort = 5405 - const aliceEndpoint = `http://127.0.0.1:${alicePort}${path}` - - let aliceEncryptedMsg - const aliceApp = express() - aliceApp.use(bodyParser.raw({ type: '*/*' })) - aliceApp.post(path, (req, res) => { - aliceEncryptedMsg = req.body - res.status(200).send() - }) - aliceServer = aliceApp.listen(alicePort) - - const { alice, faber } = await createAliceAndFaber({ aliceEndpoint, faberEndpoint }) - - const pwInfo = await faber.publishService(faberEndpoint) - const msg = await faber.createOobMessageWithDid() - await alice.acceptInvitation(msg) - - const { message: request } = await faber.unpackMsg(faberEncryptedMsg) - await faber.createNonmediatedConnectionFromRequest(request, pwInfo) - - const { message: response } = await alice.unpackMsg(aliceEncryptedMsg) - await alice.nonmediatedConnectionProcessResponse(response) - - const { message: ack } = await faber.unpackMsg(faberEncryptedMsg) - await faber.nonmediatedConnectionProcessAck(ack) - - await alice.nonmediatedConnectionSendMessage('Hello Faber') - const { message: msgFaber } = await faber.unpackMsg(faberEncryptedMsg) - expect(JSON.parse(msgFaber).content).toBe('Hello Faber') - - await faber.nonmediatedConnectionSendMessage('Hello Alice') - const { message: msgAlice } = await alice.unpackMsg(aliceEncryptedMsg) - expect(JSON.parse(msgAlice).content).toBe('Hello Alice') - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - throw Error(err) - } finally { - if (faberServer) { - faberServer.close() - } - if (aliceServer) { - aliceServer.close() - } - await sleep(2000) - } - }) - - it('Establish a nonmediated with mediated connection, exchange messages', async () => { - let faberServer - try { - const path = '/msg' - const faberPort = 5406 - const faberEndpoint = `http://127.0.0.1:${faberPort}${path}` - - let faberEncryptedMsg - const faberApp = express() - faberApp.use(bodyParser.raw({ type: '*/*' })) - faberApp.post(path, (req, res) => { - faberEncryptedMsg = req.body - res.status(200).send() - }) - faberServer = faberApp.listen(faberPort) - - const { alice, faber } = await createAliceAndFaber({ faberEndpoint }) - - const pwInfo = await faber.publishService(faberEndpoint) - const msg = await faber.createOobMessageWithDid() - await alice.acceptInvitationAndMediate(msg) - - const { message: request } = await faber.unpackMsg(faberEncryptedMsg) - await faber.createNonmediatedConnectionFromRequest(request, pwInfo) - - await alice.updateConnection(ConnectionStateType.Finished) - - const { message: ack } = await faber.unpackMsg(faberEncryptedMsg) - await faber.nonmediatedConnectionProcessAck(ack) - - await alice.sendMessage('Hello Faber') - const { message: msgFaber } = await faber.unpackMsg(faberEncryptedMsg) - expect(JSON.parse(msgFaber).content).toBe('Hello Faber') - - await faber.nonmediatedConnectionSendMessage('Hello Alice') - const msgsAlice = await alice.downloadReceivedMessagesV2() - expect(msgsAlice.length).toBe(1) - expect(msgsAlice[0].uid).toBeDefined() - expect(msgsAlice[0].statusCode).toBe('MS-103') - const payloadAlice = JSON.parse(msgsAlice[0].decryptedMsg) - expect(payloadAlice['@id']).toBeDefined() - expect(payloadAlice['@type']).toBeDefined() - expect(payloadAlice.content).toBe('Hello Alice') - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - throw Error(err) - } finally { - if (faberServer) { - faberServer.close() - } - await sleep(2000) - } - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/distribute-tails.spec.js b/aries/agents/node/vcxagent-core/test/distribute-tails.spec.js deleted file mode 100644 index 4a6acdc6bc..0000000000 --- a/aries/agents/node/vcxagent-core/test/distribute-tails.spec.js +++ /dev/null @@ -1,66 +0,0 @@ -/* eslint-env jest */ -require('jest') -const express = require('express') -const axios = require('axios') -const { buildRevocationDetails, initRustLogger } = require('../src') -const { createPairedAliceAndFaber } = require('./utils/utils') -const { IssuerStateType, HolderStateType, VerifierStateType, ProverStateType } = require('@hyperledger/node-vcx-wrapper') -const uuid = require('uuid') -const sleep = require('sleep-promise') -const fs = require('fs') -const mkdirp = require('mkdirp') -const { proofRequestDataStandard } = require('./utils/data') - -const TAILS_DIR_ALICE = '/tmp/alice/tails' -const TAILS_DIR_FABER = '/tmp/faber/tails' - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') - mkdirp(TAILS_DIR_ALICE) - mkdirp(TAILS_DIR_FABER) -}) - -describe('test tails distribution', () => { - it('Faber uploads tails and Alice downloads using tails location info from ledger', async () => { - let server - try { - const { alice, faber } = await createPairedAliceAndFaber() - - const port = 5468 - const tailsUrlId = uuid.v4() - const tailsUrl = `http://127.0.0.1:${port}/${tailsUrlId}` - await faber.buildLedgerPrimitives(buildRevocationDetails({ supportRevocation: true, tailsDir: TAILS_DIR_FABER, maxCreds: 5, tailsUrl })) - await faber.sendCredentialOffer() - await alice.acceptCredentialOffer() - await faber.updateStateCredential(IssuerStateType.RequestReceived) - await faber.sendCredential() - await alice.updateStateCredential(HolderStateType.Finished) - - const faberTailsHash = await faber.getTailsHash() - const app = express() - app.use(`/${tailsUrlId}`, express.static(`${TAILS_DIR_FABER}/${faberTailsHash}`)) - server = app.listen(port) - - const aliceTailsLocation = await alice.getTailsLocation() - const aliceTailsHash = await alice.getTailsHash() - const aliceTailsFilePath = TAILS_DIR_ALICE + `/${aliceTailsHash}` - axios.default.get(`${aliceTailsLocation}`, { responseType: 'stream' }).then(res => { - res.data.pipe(fs.createWriteStream(aliceTailsFilePath)) - }) - const issuerDid = faber.getFaberDid() - const request = await faber.requestProofFromAlice(proofRequestDataStandard(issuerDid)) - await alice.sendHolderProof(JSON.parse(request), revRegId => TAILS_DIR_ALICE, { attr_nickname: 'Smith' }) - await faber.updateStateVerifierProof(VerifierStateType.Finished) - await alice.updateStateHolderProof(ProverStateType.Finished) - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - if (server) { - await server.close() - } - await sleep(2000) - throw Error(err) - } - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/endpoint.spec.js b/aries/agents/node/vcxagent-core/test/endpoint.spec.js deleted file mode 100644 index 7b44eb2872..0000000000 --- a/aries/agents/node/vcxagent-core/test/endpoint.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-env jest */ -require('jest') -const bodyParser = require('body-parser') -const sleep = require('sleep-promise') -const express = require('express') -const { ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') -const { createAliceAndFaber } = require('./utils/utils') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('test connecting via unmediated endpoint', () => { - it('Establish connection via public nonmediated endpoint, exchange messages', async () => { - let server - try { - const port = 5422 - const path = '/msg' - const endpoint = `http://127.0.0.1:${port}${path}` - - const { alice, faber } = await createAliceAndFaber() - const invite = await faber.createPublicInvite() - const pwInfo = await faber.publishService(endpoint) - const service = await faber.readServiceFromLedger() - expect(service.recipientKeys[0]).toBe(pwInfo.pw_vk) - - let encryptedMsg - const app = express() - app.use(bodyParser.raw({ type: '*/*' })) - app.post(path, (req, res) => { - encryptedMsg = req.body - res.status(200).send() - }) - server = app.listen(port) - - await alice.acceptInvitationAndMediate(invite) - const { message } = await faber.unpackMsg(encryptedMsg) - await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(ConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) - - await alice.sendMessage('Hello Faber') - const msgsFaber = await faber.downloadReceivedMessagesV2() - expect(msgsFaber.length).toBe(1) - expect(msgsFaber[0].uid).toBeDefined() - expect(msgsFaber[0].statusCode).toBe('MS-103') - const payloadFaber = JSON.parse(msgsFaber[0].decryptedMsg) - expect(payloadFaber['@id']).toBeDefined() - expect(payloadFaber['@type']).toBeDefined() - expect(payloadFaber.content).toBe('Hello Faber') - - await faber.sendMessage('Hello Alice') - const msgsAlice = await alice.downloadReceivedMessagesV2() - expect(msgsAlice.length).toBe(1) - expect(msgsAlice[0].uid).toBeDefined() - expect(msgsAlice[0].statusCode).toBe('MS-103') - const payloadAlice = JSON.parse(msgsAlice[0].decryptedMsg) - expect(payloadAlice['@id']).toBeDefined() - expect(payloadAlice['@type']).toBeDefined() - expect(payloadAlice.content).toBe('Hello Alice') - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - await sleep(2000) - throw Error(err) - } finally { - if (server) { - server.close() - } - } - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/issue-verify.spec.js b/aries/agents/node/vcxagent-core/test/issue-verify.spec.js deleted file mode 100644 index 248726eb19..0000000000 --- a/aries/agents/node/vcxagent-core/test/issue-verify.spec.js +++ /dev/null @@ -1,179 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { createPairedAliceAndFaber } = require('./utils/utils') -const { - IssuerStateType, - HolderStateType, - ProverStateType, - VerifierStateType, - ProofVerificationStatus -} = require('@hyperledger/node-vcx-wrapper') -const sleep = require('sleep-promise') -const { initRustLogger } = require('../src') -const { proofRequestDataStandard, proofRequestDataSelfAttest } = require('./utils/data') -const mkdirp = require('mkdirp') - -const TAILS_DIR = '/tmp/faber/tails' - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') - mkdirp(TAILS_DIR) -}) - -afterAll(async () => { - await sleep(500) -}) - -describe('test update state', () => { - it('Faber should issue credential, verify proof', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - const issuerDid = faber.getFaberDid() - await faber.buildLedgerPrimitives({ tailsDir: TAILS_DIR, maxCreds: 5 }) - await faber.rotateRevReg(TAILS_DIR, 5) - await faber.sendCredentialOffer() - await alice.acceptCredentialOffer() - - await faber.updateStateCredential(IssuerStateType.RequestReceived) - await faber.sendCredential() - await alice.updateStateCredential(HolderStateType.Finished) - await faber.receiveCredentialAck() - - const request = await faber.requestProofFromAlice(proofRequestDataStandard(issuerDid)) - await alice.sendHolderProof(JSON.parse(request), revRegId => TAILS_DIR, { attr_nickname: 'Smith' }) - await faber.updateStateVerifierProof(VerifierStateType.Finished) - await alice.updateStateHolderProof(ProverStateType.Finished) - const { - presentationVerificationStatus, - presentationAttachment, - presentationRequestAttachment - } = await faber.getPresentationInfo() - expect(presentationVerificationStatus).toBe(ProofVerificationStatus.Valid) - expect(presentationRequestAttachment.requested_attributes).toStrictEqual({ - attr_basic_identity: { - names: [ - 'name', - 'last_name', - 'sex' - ], - restrictions: { - '$or': [ - { - issuer_did: 'V4SGRU86Z58d6TV7PBUe6f' - } - ] - } - }, - attr_date: { - name: 'date', - restrictions: { - issuer_did: 'V4SGRU86Z58d6TV7PBUe6f' - } - }, - attr_education: { - name: 'degree', - restrictions: { - 'attr::degree::value': 'maths' - } - }, - attr_nickname: { - name: 'nickname', - self_attest_allowed: true - } - }) - expect(presentationAttachment.requested_proof).toStrictEqual({ - revealed_attrs: { - attr_date: { - sub_proof_index: 0, - raw: '05-2018', - encoded: '101085817956371643310471822530712840836446570298192279302750234554843339322886' - }, - attr_education: { - sub_proof_index: 0, - raw: 'maths', - encoded: '78137204873448776862705240258723141940757006710839733585634143215803847410018' - } - }, - revealed_attr_groups: { - attr_basic_identity: { - sub_proof_index: 0, - values: { - sex: { - raw: 'female', - encoded: '71957174156108022857985543806816820198680233386048843176560473245156249119752' - }, - name: { - raw: 'alice', - encoded: '19831138297880367962895005496563562590284654704047651305948751287370224856720' - }, - last_name: { - raw: 'clark', - encoded: '51192516729287562420368242940555165528396706187345387515033121164720912081028' - } - } - } - }, - self_attested_attrs: { - attr_nickname: 'Smith' - }, - unrevealed_attrs: {}, - predicates: { - predicate_is_adult: { - sub_proof_index: 0 - } - } - }) - }) - - it('Faber should issue credential, revoke credential, verify proof', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - const issuerDid = faber.getFaberDid() - await faber.buildLedgerPrimitives({ tailsDir: TAILS_DIR, maxCreds: 5 }) - await faber.sendCredentialOffer() - await alice.acceptCredentialOffer() - - await faber.updateStateCredential(IssuerStateType.RequestReceived) - await faber.sendCredential() - await alice.updateStateCredential(HolderStateType.Finished) - await faber.receiveCredentialAck() - await faber.revokeCredential() - - const request = await faber.requestProofFromAlice(proofRequestDataStandard(issuerDid)) - await alice.sendHolderProof(JSON.parse(request), revRegId => TAILS_DIR, { attr_nickname: 'Smith' }) - await faber.updateStateVerifierProof(VerifierStateType.Finished) - await alice.updateStateHolderProof(ProverStateType.Failed) - const { - presentationVerificationStatus - } = await faber.getPresentationInfo() - expect(presentationVerificationStatus).toBe(ProofVerificationStatus.Invalid) - }) - - it('Faber should verify proof with self attestation', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - const request = await faber.requestProofFromAlice(proofRequestDataSelfAttest()) - await alice.sendHolderProofSelfAttested(JSON.parse(request), { attr_nickname: 'Smith' }) - await faber.updateStateVerifierProof(VerifierStateType.Finished) - await alice.updateStateHolderProof(ProverStateType.Finished) - const { - presentationVerificationStatus, - presentationAttachment, - presentationRequestAttachment - } = await faber.getPresentationInfo() - expect(presentationVerificationStatus).toBe(ProofVerificationStatus.Valid) - expect(presentationAttachment.requested_proof).toStrictEqual({ - revealed_attrs: {}, - self_attested_attrs: { - attr_nickname: 'Smith' - }, - unrevealed_attrs: {}, - predicates: {} - }) - expect(presentationRequestAttachment.requested_attributes).toStrictEqual({ - attr_nickname: { - name: 'nickname', - self_attest_allowed: true - } - }) - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/messaging.spec.js b/aries/agents/node/vcxagent-core/test/messaging.spec.js deleted file mode 100644 index 281d84ef13..0000000000 --- a/aries/agents/node/vcxagent-core/test/messaging.spec.js +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { createPairedAliceAndFaber } = require('./utils/utils') -const sleep = require('sleep-promise') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('test messaging', () => { - it('downloadReceivedMessages: Alice should send message and Faber download it', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - await alice.sendMessage('Hello Faber') - await sleep(100) - const msgs = await faber.downloadReceivedMessages() - expect(msgs.length).toBe(1) - expect(msgs[0].uid).toBeDefined() - expect(msgs[0].statusCode).toBe('MS-103') - const payload = JSON.parse(msgs[0].decryptedMsg) - expect(payload['@id']).toBeDefined() - expect(payload['@type']).toBeDefined() - expect(payload.content).toBe('Hello Faber') - await faber.updateMessageStatus([msgs[0].uid]) - const msgs2 = await faber.downloadReceivedMessages() - expect(msgs2.length).toBe(0) - }) - - it('should update all messages with Received status', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - await alice.sendMessage('Hello Faber') - await alice.sendMessage('Hello Faber') - await alice.sendMessage('Hello Faber') - const msgs1 = await faber.downloadReceivedMessages() - expect(msgs1.length).toBe(3) - - await faber.updateAllReceivedMessages() - - const msgs2 = await faber.downloadReceivedMessages() - expect(msgs2.length).toBe(0) - }) - - it('downloadReceivedMessagesV2: Alice should send message and Faber download it ', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - await alice.sendMessage('Hello Faber') - const msgs = await faber.downloadReceivedMessagesV2() - expect(msgs.length).toBe(1) - expect(msgs[0].uid).toBeDefined() - expect(msgs[0].statusCode).toBe('MS-103') - const payload = JSON.parse(msgs[0].decryptedMsg) - expect(payload['@id']).toBeDefined() - expect(payload['@type']).toBeDefined() - expect(payload.content).toBe('Hello Faber') - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/out-of-band.spec.js b/aries/agents/node/vcxagent-core/test/out-of-band.spec.js deleted file mode 100644 index e8c3edf140..0000000000 --- a/aries/agents/node/vcxagent-core/test/out-of-band.spec.js +++ /dev/null @@ -1,105 +0,0 @@ -/* eslint-env jest */ -require('jest') -const sleep = require('sleep-promise') - -const { VerifierStateType } = require('@hyperledger/node-vcx-wrapper') -const { createPairedAliceAndFaberViaOobMsg, createAliceAndFaber, connectViaOobMessage, createPairedAliceAndFaber } = require('./utils/utils') -const { IssuerStateType, HolderStateType, OutOfBandReceiver } = require('@hyperledger/node-vcx-wrapper') -const { initRustLogger } = require('../src') -const { proofRequestDataStandard } = require('./utils/data') -const mkdirp = require('mkdirp') -const logger = require('../demo/logger')('out-of-band-test') - -const TAILS_DIR = '/tmp/faber/tails' - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') - mkdirp(TAILS_DIR) -}) - -describe('test out of band communication', () => { - it('Faber establishes connection with Alice via DID OOB message', async () => { - await createPairedAliceAndFaberViaOobMsg() - }) - - it('Faber establishes connection with Alice via OOB message and they exchange messages', async () => { - const { alice, faber } = await createPairedAliceAndFaberViaOobMsg() - - logger.info('Alice sending a message') - await alice.sendMessage('Hello Faber') - const msgsFaber = await faber.downloadReceivedMessagesV2() - expect(msgsFaber.length).toBe(1) - expect(msgsFaber[0].uid).toBeDefined() - expect(msgsFaber[0].statusCode).toBe('MS-103') - const payloadFaber = JSON.parse(msgsFaber[0].decryptedMsg) - expect(payloadFaber['@id']).toBeDefined() - expect(payloadFaber['@type']).toBeDefined() - expect(payloadFaber.content).toBe('Hello Faber') - - logger.info('Faber sending a message') - await faber.sendMessage('Hello Alice') - const msgsAlice = await alice.downloadReceivedMessagesV2() - expect(msgsAlice.length).toBe(1) - expect(msgsAlice[0].uid).toBeDefined() - expect(msgsAlice[0].statusCode).toBe('MS-103') - const payloadAlice = JSON.parse(msgsAlice[0].decryptedMsg) - expect(payloadAlice['@id']).toBeDefined() - expect(payloadAlice['@type']).toBeDefined() - expect(payloadAlice.content).toBe('Hello Alice') - }) - - it('Alice reuses a connection already established by Faber', async () => { - const { alice, faber } = await createPairedAliceAndFaberViaOobMsg() - const msg = await faber.createOobMessageWithDid() - await alice.sendConnectionHandshakeReuse(msg) - const msgsFaber = await faber.downloadReceivedMessagesV2() - expect(msgsFaber.length).toBe(1) - const payloadFaber = JSON.parse(msgsFaber[0].decryptedMsg) - expect(payloadFaber['@id']).toBeDefined() - expect(payloadFaber['@type']).toBeDefined() - console.log(JSON.stringify(payloadFaber)) - }) - - it('Faber issues credential via OOB', async () => { - try { - const { alice, faber } = await createAliceAndFaber() - await faber.buildLedgerPrimitives({ tailsDir: TAILS_DIR, maxCreds: 5 }) - const oobCredOfferMsg = await faber.createOobCredOffer() - - await connectViaOobMessage(alice, faber, oobCredOfferMsg) - - await alice.acceptOobCredentialOffer(oobCredOfferMsg) - await faber.updateStateCredential(IssuerStateType.RequestReceived) - await faber.sendCredential() - await alice.updateStateCredential(HolderStateType.Finished) - } catch (e) { - console.error(e.stack) - await sleep(1000) - } - }) - - it('Faber requests proof via OOB', async () => { - try { - const { alice, faber } = await createPairedAliceAndFaber() - await faber.buildLedgerPrimitives({ tailsDir: TAILS_DIR, maxCreds: 5 }) - await faber.sendCredentialOffer() - await alice.acceptCredentialOffer() - await faber.updateStateCredential(IssuerStateType.RequestReceived) - await faber.sendCredential() - await alice.updateStateCredential(HolderStateType.Finished) - - const issuerDid = faber.getFaberDid() - const oobPresentationRequestMsg = await faber.createOobProofRequest(proofRequestDataStandard(issuerDid)) - - const oobReceiver = await OutOfBandReceiver.createWithMessage(oobPresentationRequestMsg) - const presentationRequest = oobReceiver.extractMessage() - await alice.sendHolderProof(presentationRequest, revRegId => TAILS_DIR, { attr_nickname: 'Smith' }) - await faber.updateStateVerifierProof(VerifierStateType.Finished) - } catch (e) { - console.error(e.stack) - await sleep(1000) - } - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/public-invite.spec.js b/aries/agents/node/vcxagent-core/test/public-invite.spec.js deleted file mode 100644 index 9b0cb52daa..0000000000 --- a/aries/agents/node/vcxagent-core/test/public-invite.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { createPairedAliceAndFaberViaPublicInvite } = require('./utils/utils') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('test public invite', () => { - it('Establish connection via public invite, exchange messages', async () => { - const { alice, faber } = await createPairedAliceAndFaberViaPublicInvite() - - await alice.sendMessage('Hello Faber') - const msgsFaber = await faber.downloadReceivedMessagesV2() - expect(msgsFaber.length).toBe(1) - expect(msgsFaber[0].uid).toBeDefined() - expect(msgsFaber[0].statusCode).toBe('MS-103') - const payloadFaber = JSON.parse(msgsFaber[0].decryptedMsg) - expect(payloadFaber['@id']).toBeDefined() - expect(payloadFaber['@type']).toBeDefined() - expect(payloadFaber.content).toBe('Hello Faber') - - await faber.sendMessage('Hello Alice') - const msgsAlice = await alice.downloadReceivedMessagesV2() - expect(msgsAlice.length).toBe(1) - expect(msgsAlice[0].uid).toBeDefined() - expect(msgsAlice[0].statusCode).toBe('MS-103') - const payloadAlice = JSON.parse(msgsAlice[0].decryptedMsg) - expect(payloadAlice['@id']).toBeDefined() - expect(payloadAlice['@type']).toBeDefined() - expect(payloadAlice.content).toBe('Hello Alice') - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/sign-verify.spec.js b/aries/agents/node/vcxagent-core/test/sign-verify.spec.js deleted file mode 100644 index a4a9a79afb..0000000000 --- a/aries/agents/node/vcxagent-core/test/sign-verify.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { createPairedAliceAndFaber } = require('./utils/utils') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('test signatures', () => { - it('Alice should sign data and Faber verify it', async () => { - const { alice, faber } = await createPairedAliceAndFaber() - - const dataBase64 = Buffer.from('foobar').toString('base64') - const signatureBase64 = await alice.signData(dataBase64) - const isValid = await faber.verifySignature(dataBase64, signatureBase64) - expect(isValid).toBeTruthy() - }) - - it('Faber should evaluate signature as invalid if was created by someone else', async () => { - const { faber } = await createPairedAliceAndFaber() - - const dataBase64 = Buffer.from('foobar').toString('base64') - // following is signature of "foobar" by some random key - const signatureBase64 = 'aL2gZL2YfAieArCv5hrGznnwTEinnp9UU+X16axgtFIkX29M40v4n89iH35AtqApgfjvn6Okq6B8Q2IcKn+3DQ==' - const isValid = await faber.verifySignature(dataBase64, signatureBase64) - expect(isValid).toBeFalsy() - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/trustping.spec.js b/aries/agents/node/vcxagent-core/test/trustping.spec.js deleted file mode 100644 index 59a7b48763..0000000000 --- a/aries/agents/node/vcxagent-core/test/trustping.spec.js +++ /dev/null @@ -1,36 +0,0 @@ -/* eslint-env jest */ -require('jest') -const { createPairedAliceAndFaber } = require('./utils/utils') -const sleep = require('sleep-promise') -const { initRustLogger } = require('../src') - -jest.setTimeout(1000 * 60 * 4) - -beforeAll(async () => { - initRustLogger(process.env.RUST_LOG || 'vcx=error') -}) - -describe('trustping', () => { - it('should exchange trustping between faber and alice', async () => { - try { - const { alice, faber } = await createPairedAliceAndFaber() - await alice.sendPing() - - const faberMessages1 = await faber.downloadReceivedMessagesV2() - expect(faberMessages1.length).toBe(1) - expect(JSON.parse(faberMessages1[0].decryptedMsg)['@type'].match(/trust_ping\/1.0\/ping/)) - const pingMsgId = JSON.parse(faberMessages1[0].decryptedMsg)['@id'] - await faber.handleMessage(faberMessages1[0].decryptedMsg) - - const aliceMessages1 = await alice.downloadReceivedMessagesV2() - expect(aliceMessages1.length).toBe(1) - expect(JSON.parse(aliceMessages1[0].decryptedMsg)['@type'].match(/trust_ping\/1.0\/ping_response/)) - expect(JSON.parse(aliceMessages1[0].decryptedMsg)['~thread'].thid).toBe(pingMsgId) - await alice.handleMessage(aliceMessages1[0].decryptedMsg) - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - await sleep(2000) - throw Error(err) - } - }) -}) diff --git a/aries/agents/node/vcxagent-core/test/utils/alice.js b/aries/agents/node/vcxagent-core/test/utils/alice.js deleted file mode 100644 index 29326816ad..0000000000 --- a/aries/agents/node/vcxagent-core/test/utils/alice.js +++ /dev/null @@ -1,251 +0,0 @@ -/* eslint-env jest */ -const { createVcxAgent } = require('../../src/index') -const { ConnectionStateType, ProverStateType, OutOfBandReceiver, HolderStateType, unpack } = require('@hyperledger/node-vcx-wrapper') - -module.exports.createAlice = async function createAlice (serviceEndpoint = 'http://localhost:5401') { - const agentName = `alice-${Math.floor(new Date() / 1000)}` - const connectionId = 'connection-alice-to-faber' - const holderCredentialId = 'credential-of-alice' - const disclosedProofId = 'proof-from-alice' - const logger = require('../../demo/logger')('Alice') - - const aliceAgentConfig = { - agentName, - agencyUrl: 'http://localhost:8080', - seed: '000000000000000000000000Alice000', - webhookUrl: `http://localhost:7209/notifications/${agentName}`, - endpointInfo: { - serviceEndpoint, - routingKeys: [] - }, - logger - } - const vcxAgent = await createVcxAgent(aliceAgentConfig) - - async function acceptInvitationAndMediate (invite) { - logger.info(`Alice establishing connection with Faber using invite ${invite}`) - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceConnections.inviteeConnectionAcceptFromInvitation(connectionId, invite) - const connection = await vcxAgent.serviceConnections.getVcxConnection(connectionId) - expect(await connection.getState()).toBe(ConnectionStateType.Requested) - - await vcxAgent.agentShutdownVcx() - } - - async function acceptInvitation (invite) { - logger.info(`Alice establishing connection with Faber using invite ${invite}`) - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceNonmediatedConnections.inviteeConnectionCreateFromInvite(connectionId, invite) - const state = await vcxAgent.serviceNonmediatedConnections.getState(connectionId) - expect(state).toBe(ConnectionStateType.Requested) - - await vcxAgent.agentShutdownVcx() - } - - async function sendConnectionHandshakeReuse (oobMsg) { - logger.debug(`sendConnectionHandshakeReuse >> oobMsg = ${oobMsg}`) - await vcxAgent.agentInitVcx() - await vcxAgent.serviceOutOfBand.reuseConnectionFromOobMsg(connectionId, oobMsg) - await vcxAgent.agentShutdownVcx() - } - - async function nonmediatedConnectionProcessResponse (response) { - logger.info(`Alice processing response ${response}`) - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceNonmediatedConnections.inviteeConnectionProcessResponse(connectionId, response) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Finished) - - await vcxAgent.agentShutdownVcx() - } - - async function updateConnection (expectedNextState) { - logger.info(`Alice is going to update connection, expecting new state of ${expectedNextState}`) - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(expectedNextState) - - await vcxAgent.agentShutdownVcx() - } - - async function handleMessage (ariesMsg) { - logger.info('Alice is going to try handle incoming messages') - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceConnections.handleMessage(connectionId, ariesMsg) - - await vcxAgent.agentShutdownVcx() - } - - async function acceptCredentialOffer () { - await vcxAgent.agentInitVcx() - logger.info('Alice accepting credential offer') - - await vcxAgent.serviceCredHolder.waitForCredentialOfferAndAccept(connectionId, holderCredentialId) - - await vcxAgent.agentShutdownVcx() - } - - async function acceptOobCredentialOffer (oobCredOfferMsg) { - await vcxAgent.agentInitVcx() - logger.info('acceptOobCredentialOffer >>> Alice going to accept oob cred offer.') - - const oobReceiver = await OutOfBandReceiver.createWithMessage(oobCredOfferMsg) - const credOffer = oobReceiver.extractMessage() - logger.info('acceptOobCredentialOffer >>> Extracted attached message') - logger.debug(`acceptOobCredentialOffer >>> attached message: ${credOffer}`) - await vcxAgent.serviceCredHolder.createCredentialFromOfferAndSendRequest(connectionId, holderCredentialId, credOffer) - const state = await vcxAgent.serviceCredHolder.getState(holderCredentialId) - expect(state).toBe(HolderStateType.RequestSet) - - await vcxAgent.agentShutdownVcx() - } - - async function sendHolderProof (proofRequest, _mapRevRegId, selfAttestedAttrs) { - await vcxAgent.agentInitVcx() - - const mapRevRegId = _mapRevRegId || ((_revRegId) => { throw Error('Tails file should not be needed') }) - await vcxAgent.serviceProver.buildDisclosedProof(disclosedProofId, proofRequest) - const { selectedCreds } = await vcxAgent.serviceProver.selectCredentials(disclosedProofId, mapRevRegId) - await vcxAgent.serviceProver.generateProof(disclosedProofId, selectedCreds, selfAttestedAttrs) - expect(await vcxAgent.serviceProver.sendDisclosedProof(disclosedProofId, connectionId)).toBe(ProverStateType.PresentationSent) - - await vcxAgent.agentShutdownVcx() - } - - async function sendHolderProofSelfAttested (proofRequest, selfAttestedAttrs) { - await vcxAgent.agentInitVcx() - await vcxAgent.serviceProver.buildDisclosedProof(disclosedProofId, proofRequest) - await vcxAgent.serviceProver.generateProof(disclosedProofId, { }, selfAttestedAttrs) - expect(await vcxAgent.serviceProver.sendDisclosedProof(disclosedProofId, connectionId)).toBe(ProverStateType.PresentationSent) - - await vcxAgent.agentShutdownVcx() - } - - async function updateStateHolderProof (expectedNextState) { - logger.info(`Holder updating state of disclosed proof, expecting it to be in state ${expectedNextState}`) - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceProver.disclosedProofUpdate(disclosedProofId, connectionId)).toBe(expectedNextState) - - await vcxAgent.agentShutdownVcx() - } - - async function updateStateCredential (expectedState) { - logger.info('Holder updating state of credential with connection') - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceCredHolder.credentialUpdate(holderCredentialId, connectionId)).toBe(expectedState) - - await vcxAgent.agentShutdownVcx() - } - - async function signData (dataBase64) { - logger.info('Alice is going to sign data') - await vcxAgent.agentInitVcx() - - const signatureBase64 = await vcxAgent.serviceConnections.signData(connectionId, dataBase64) - - await vcxAgent.agentShutdownVcx() - - logger.debug(`Alice signed data. Data=${dataBase64} signature=${signatureBase64}`) - return signatureBase64 - } - - async function sendMessage (message) { - logger.info('Alice is going to send message') - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceConnections.sendMessage(connectionId, message) - - await vcxAgent.agentShutdownVcx() - } - - async function nonmediatedConnectionSendMessage (message) { - logger.info('Alice is going to send message') - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceNonmediatedConnections.sendMessage(connectionId, message) - - await vcxAgent.agentShutdownVcx() - } - - async function getTailsLocation () { - logger.info('Alice is going to get tails location') - await vcxAgent.agentInitVcx() - - const tailsLocation = await vcxAgent.serviceCredHolder.getTailsLocation(holderCredentialId) - logger.debug(`Alice obtained tails location ${tailsLocation}`) - - await vcxAgent.agentShutdownVcx() - return tailsLocation - } - - async function getTailsHash () { - logger.info('Alice getting tails hash') - await vcxAgent.agentInitVcx() - - const tailsHash = await vcxAgent.serviceCredHolder.getTailsHash(holderCredentialId) - logger.debug(`Alice obtained tails hash ${tailsHash}`) - - await vcxAgent.agentShutdownVcx() - return tailsHash - } - - async function downloadReceivedMessagesV2 () { - logger.info('Alice is going to download messages using getMessagesV2') - await vcxAgent.agentInitVcx() - - const agencyMessages = await vcxAgent.serviceConnections.getMessagesV2(connectionId, ['MS-103']) - - await vcxAgent.agentShutdownVcx() - return agencyMessages - } - - async function sendPing () { - logger.info('Alice is going to send ping') - await vcxAgent.agentInitVcx() - - const res = await vcxAgent.serviceConnections.sendPing(connectionId) - logger.info(`Operation result = ${JSON.stringify(res)}`) - - await vcxAgent.agentShutdownVcx() - } - - async function unpackMsg (encryptedMsg) { - logger.info(`Alice is going to unpack message of length ${encryptedMsg.length}`) - await vcxAgent.agentInitVcx() - - const { message, sender_verkey: senderVerkey } = await unpack(encryptedMsg) - - logger.info(`Decrypted msg has length ${message.length}, sender verkey: ${senderVerkey}`) - await vcxAgent.agentShutdownVcx() - - return { message, senderVerkey } - } - - return { - sendMessage, - nonmediatedConnectionSendMessage, - signData, - acceptInvitationAndMediate, - acceptInvitation, - sendConnectionHandshakeReuse, - nonmediatedConnectionProcessResponse, - acceptOobCredentialOffer, - updateConnection, - handleMessage, - acceptCredentialOffer, - updateStateCredential, - sendHolderProof, - sendHolderProofSelfAttested, - updateStateHolderProof, - getTailsLocation, - getTailsHash, - downloadReceivedMessagesV2, - sendPing, - unpackMsg - } -} diff --git a/aries/agents/node/vcxagent-core/test/utils/data.js b/aries/agents/node/vcxagent-core/test/utils/data.js deleted file mode 100644 index 5603e7e8b4..0000000000 --- a/aries/agents/node/vcxagent-core/test/utils/data.js +++ /dev/null @@ -1,77 +0,0 @@ -function getFaberCredDefName () { - return 'DemoCredential123' -} - -function getFaberProofDataWithNonRevocation (issuerDid) { - const proofData = proofRequestDataStandard(issuerDid) - proofData.revocationInterval = { to: Date.now() } - return proofData -} - -function proofRequestDataStandard (issuerDid) { - const proofAttributes = { - attr_basic_identity: { - names: ['name', 'last_name', 'sex'], - restrictions: [{ issuer_did: issuerDid }] - }, - attr_date: { - name: 'date', - restrictions: { issuer_did: issuerDid } - }, - attr_education: { - name: 'degree', - restrictions: { 'attr::degree::value': 'maths' } - }, - attr_nickname: { - name: 'nickname', - self_attest_allowed: true - } - } - - const proofPredicates = { - predicate_is_adult: { name: 'age', p_type: '>=', p_value: 18, restrictions: [{ issuer_did: issuerDid }] } - } - - return { - sourceId: '213', - attrs: proofAttributes, - preds: proofPredicates, - name: 'proof-test-standard', - revocationInterval: { to: null, from: null } - } -} - -function proofRequestDataSelfAttest () { - const proofAttributes = { - attr_nickname: { - name: 'nickname', - self_attest_allowed: true - } - } - - return { - sourceId: '213', - attrs: proofAttributes, - name: 'proof-test-self-attesting', - revocationInterval: { to: null, from: null } - } -} - -function getAliceSchemaAttrs () { - return { - name: 'alice', - last_name: 'clark', - sex: 'female', - date: '05-2018', - degree: 'maths', - age: '25' - } -} - -module.exports = { - getAliceSchemaAttrs, - getFaberCredDefName, - proofRequestDataStandard, - getFaberProofDataWithNonRevocation, - proofRequestDataSelfAttest -} diff --git a/aries/agents/node/vcxagent-core/test/utils/faber.js b/aries/agents/node/vcxagent-core/test/utils/faber.js deleted file mode 100644 index 44466f5187..0000000000 --- a/aries/agents/node/vcxagent-core/test/utils/faber.js +++ /dev/null @@ -1,460 +0,0 @@ -/* eslint-env jest */ -const { createVcxAgent, getSampleSchemaData } = require('../../src') -const { - MediatedConnectionStateType, ConnectionStateType, VerifierStateType, generatePublicInvite, - createService, getServiceFromLedger, unpack, createAndStoreDid -} = require('@hyperledger/node-vcx-wrapper') -const { getAliceSchemaAttrs, getFaberCredDefName } = require('./data') -const sleep = require('sleep-promise') -const assert = require('assert') - -module.exports.createFaber = async function createFaber (serviceEndpoint = 'http://localhost:5400') { - const agentName = `faber-${Math.floor(new Date() / 1000)}` - const connectionId = 'connection-faber-to-alice' - const issuerCredId = 'credential-for-alice' - let credDefId, revRegId - const proofId = 'proof-from-alice' - const logger = require('../../demo/logger')('Faber') - let revRegTagNo = 1 - - const faberAgentConfig = { - agentName, - agencyUrl: 'http://localhost:8080', - seed: '000000000000000000000000Trustee1', - webhookUrl: `http://localhost:7209/notifications/${agentName}`, - endpointInfo: { - serviceEndpoint, - routingKeys: [] - }, - logger - } - - const vcxAgent = await createVcxAgent(faberAgentConfig) - const institutionDid = vcxAgent.getInstitutionDid() - await vcxAgent.agentInitVcx() - await vcxAgent.agentShutdownVcx() - - async function createInvite () { - logger.info('Faber is going to generate invite') - await vcxAgent.agentInitVcx() - - const invite = await vcxAgent.serviceConnections.inviterConnectionCreate(connectionId, undefined) - logger.info(`Faber generated invite:\n${invite}`) - const connection = await vcxAgent.serviceConnections.getVcxConnection(connectionId) - expect(await connection.getState()).toBe(ConnectionStateType.Invited) - - await vcxAgent.agentShutdownVcx() - - return invite - } - - async function createPublicInvite () { - logger.info('Faber is going to generate public invite') - await vcxAgent.agentInitVcx() - - const institutionDid = vcxAgent.getInstitutionDid() - logger.info(`Faber creating public invitation for did ${institutionDid}`) - const publicInvitation = generatePublicInvite(institutionDid, 'Faber') - logger.info(`Faber generated public invite:\n${publicInvitation}`) - - await vcxAgent.agentShutdownVcx() - - return publicInvitation - } - - async function publishService (endpoint) { - logger.info('Faber is going to write nonmediated service on the ledger') - await vcxAgent.agentInitVcx() - - logger.info('Faber creating pairwise info') - const pwInfo = await createAndStoreDid(undefined, undefined) - logger.info(`Faber creating service for endpoint ${endpoint} and recipient key ${pwInfo.pw_vk}`) - await createService(institutionDid, endpoint, [pwInfo.pw_vk], []) - - await vcxAgent.agentShutdownVcx() - - return pwInfo - } - - async function readServiceFromLedger () { - logger.info('Faber is going to read service from the ledger') - await vcxAgent.agentInitVcx() - - const service = await getServiceFromLedger(institutionDid) - - await vcxAgent.agentShutdownVcx() - - return service - } - - async function unpackMsg (encryptedMsg) { - assert(encryptedMsg) - logger.info(`Faber is going to unpack message of length ${encryptedMsg.length}`) - await vcxAgent.agentInitVcx() - - const { message, sender_verkey: senderVerkey } = await unpack(encryptedMsg) - - logger.info(`Decrypted msg has length ${message.length}, sender verkey: ${senderVerkey}`) - await vcxAgent.agentShutdownVcx() - - return { message, senderVerkey } - } - - async function createOobMessageWithDid (wrappedMessage) { - logger.info('Faber is going to generate out of band message') - await vcxAgent.agentInitVcx() - - const publicDid = vcxAgent.getInstitutionDid() - const oobMsg = await vcxAgent.serviceOutOfBand.createOobMessageWithDid(wrappedMessage, 'faber-oob-msg', publicDid) - - await vcxAgent.agentShutdownVcx() - - return oobMsg - } - - async function createOobCredOffer () { - await vcxAgent.agentInitVcx() - const schemaAttrs = getAliceSchemaAttrs() - const credOfferMsg = await vcxAgent.serviceCredIssuer.buildOfferAndMarkAsSent(issuerCredId, credDefId, revRegId, schemaAttrs) - await vcxAgent.agentShutdownVcx() - return await createOobMessageWithDid(credOfferMsg) - } - - function getFaberDid () { - return vcxAgent.getInstitutionDid() - } - - async function createOobProofRequest (proofData) { - await vcxAgent.agentInitVcx() - - // todo: address - logger.info(`Faber is sending proof request to connection ${connectionId}`) - const presentationRequestMsg = await vcxAgent.serviceVerifier.buildProofReqAndMarkAsSent(proofId, proofData) - - await vcxAgent.agentShutdownVcx() - return await createOobMessageWithDid(presentationRequestMsg) - } - - async function sendConnectionResponse () { - logger.info('Faber is going to generate invite') - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(ConnectionStateType.Responded) - - await vcxAgent.agentShutdownVcx() - } - - async function updateConnection (expectedNextState) { - logger.info(`Faber is going to update connection, expecting new state of ${expectedNextState}`) - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(expectedNextState) - - await vcxAgent.agentShutdownVcx() - } - - async function handleMessage (ariesMsg) { - logger.info('Faber is going to try handle incoming messages') - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceConnections.handleMessage(connectionId, ariesMsg) - - await vcxAgent.agentShutdownVcx() - } - - async function buildLedgerPrimitives (revocationDetails) { - await vcxAgent.agentInitVcx() - - logger.info('Faber writing schema on ledger') - const issuerDid = vcxAgent.getInstitutionDid() - const schemaId = await vcxAgent.serviceLedgerSchema.createSchema(getSampleSchemaData(), issuerDid) - await sleep(500) - - logger.info('Faber writing credential definition on ledger') - const supportRevocation = !!revocationDetails - await vcxAgent.serviceLedgerCredDef.createCredentialDefinitionV2( - issuerDid, - schemaId, - getFaberCredDefName(), - supportRevocation - ) - credDefId = getFaberCredDefName() - const credDefLedgerId = await vcxAgent.serviceLedgerCredDef.getCredDefId(credDefId) - if (supportRevocation) { - const { tailsDir, maxCreds, tailsUrl } = revocationDetails - logger.info('Faber writing revocation registry'); - ({ revRegId } = await vcxAgent.serviceLedgerRevReg.createRevocationRegistry(institutionDid, credDefLedgerId, revRegTagNo, tailsDir, maxCreds, tailsUrl)) - } - await vcxAgent.agentShutdownVcx() - } - - async function rotateRevReg (tailsDir, maxCreds) { - await vcxAgent.agentInitVcx() - - logger.info('Faber rotating revocation registry') - const credDefLedgerId = await vcxAgent.serviceLedgerCredDef.getCredDefId(credDefId); - ({ revRegId } = await vcxAgent.serviceLedgerRevReg.createRevocationRegistry(institutionDid, credDefLedgerId, revRegTagNo + 1, tailsDir, maxCreds)) - revRegTagNo += 1 - - await vcxAgent.agentShutdownVcx() - } - - async function sendCredentialOffer () { - await vcxAgent.agentInitVcx() - - logger.info('Issuer sending credential offer') - const schemaAttrs = getAliceSchemaAttrs() - await vcxAgent.serviceCredIssuer.sendOfferV2(issuerCredId, revRegId, connectionId, credDefId, schemaAttrs) - logger.debug('Credential offer sent') - - await vcxAgent.agentShutdownVcx() - } - async function updateStateCredential (expectedState) { - await vcxAgent.agentInitVcx() - - logger.info('Issuer updating state of credential with connection') - expect(await vcxAgent.serviceCredIssuer.credentialUpdate(issuerCredId, connectionId)).toBe(expectedState) - - await vcxAgent.agentShutdownVcx() - } - - async function sendCredential () { - await vcxAgent.agentInitVcx() - - logger.info('Issuer sending credential') - await vcxAgent.serviceCredIssuer.sendCredential(issuerCredId, connectionId) - const revocationId = await vcxAgent.serviceCredIssuer.getRevocationId(issuerCredId) - logger.info(`Sent credential with revocation id ${revocationId}`) - - await vcxAgent.agentShutdownVcx() - } - - async function revokeCredential () { - await vcxAgent.agentInitVcx() - await vcxAgent.serviceCredIssuer.revokeCredentialLocal(issuerCredId) - const issuerDid = vcxAgent.getInstitutionDid() - await vcxAgent.serviceLedgerRevReg.publishRevocations(revRegId, issuerDid) - await vcxAgent.agentShutdownVcx() - } - - async function receiveCredentialAck () { - await vcxAgent.agentInitVcx() - - logger.info('Issuer waiting for credential ack') - await vcxAgent.serviceCredIssuer.waitForCredentialAck(issuerCredId, connectionId) - logger.info('Credential ack received') - - await vcxAgent.agentShutdownVcx() - } - - async function requestProofFromAlice (proofData) { - logger.info('Faber going to request proof from Alice') - await vcxAgent.agentInitVcx() - logger.info(`Faber is creating proof ${proofId}`) - await vcxAgent.serviceVerifier.createProof(proofId, proofData) - logger.info(`Faber is sending proof request to connection ${connectionId}`) - const { state, proofRequestMessage } = await vcxAgent.serviceVerifier.sendProofRequest(connectionId, proofId) - expect(state).toBe(VerifierStateType.PresentationRequestSent) - await vcxAgent.agentShutdownVcx() - return proofRequestMessage - } - - async function updateStateVerifierProof (expectedNextState) { - logger.info(`Verifier updating state of proof, expecting it to be in state ${expectedNextState}`) - await vcxAgent.agentInitVcx() - - expect(await vcxAgent.serviceVerifier.proofUpdate(proofId, connectionId)).toBe(expectedNextState) - - await vcxAgent.agentShutdownVcx() - } - - async function verifySignature (dataBase64, signatureBase64) { - logger.debug(`Faber is going to verify signed data. Data=${dataBase64} signature=${signatureBase64}`) - await vcxAgent.agentInitVcx() - - const isValid = await vcxAgent.serviceConnections.verifySignature(connectionId, dataBase64, signatureBase64) - - await vcxAgent.agentShutdownVcx() - return isValid - } - - async function downloadReceivedMessages () { - logger.info('Faber is going to download messages using getMessages') - await vcxAgent.agentInitVcx() - const agencyMessages = await vcxAgent.serviceConnections.getMessages(connectionId, ['MS-103']) - await vcxAgent.agentShutdownVcx() - return agencyMessages - } - - async function createNonmediatedConnectionWithInvite () { - logger.info('Faber is going to create a connection with invite') - - await vcxAgent.agentInitVcx() - const invite = await vcxAgent.serviceNonmediatedConnections.inviterConnectionCreatePwInvite(connectionId) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Invited) - - await vcxAgent.agentShutdownVcx() - return invite - } - - async function nonmediatedConnectionProcessRequest (request) { - logger.info('Faber is going to process a connection request') - - await vcxAgent.agentInitVcx() - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Invited) - await vcxAgent.serviceNonmediatedConnections.inviterConnectionProcessRequest(connectionId, request) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Requested) - - await vcxAgent.agentShutdownVcx() - } - - async function createNonmediatedConnectionFromRequest (request, pwInfo) { - logger.info(`Faber is going to create a connection from a request: ${request}`) - - await vcxAgent.agentInitVcx() - await vcxAgent.serviceNonmediatedConnections.inviterConnectionCreateFromRequest(connectionId, request, pwInfo) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Requested) - - await vcxAgent.agentShutdownVcx() - } - - async function nonmediatedConnectionProcessAck (ack) { - logger.info(`Faber is processing ack: ${ack}`) - - await vcxAgent.agentInitVcx() - await vcxAgent.serviceNonmediatedConnections.inviterConnectionProcessAck(connectionId, ack) - expect(await vcxAgent.serviceNonmediatedConnections.getState(connectionId)).toBe(ConnectionStateType.Finished) - - await vcxAgent.agentShutdownVcx() - } - - async function createConnectionFromReceivedRequestV2 (pwInfo, request) { - logger.info(`Faber is going to create a connection from a request: ${request}, using pwInfo: ${JSON.stringify(pwInfo)}`) - - await vcxAgent.agentInitVcx() - await vcxAgent.serviceConnections.inviterConnectionCreateFromRequestV2(connectionId, pwInfo, request) - expect(await vcxAgent.serviceConnections.connectionUpdate(connectionId)).toBe(MediatedConnectionStateType.Responded) - - await vcxAgent.agentShutdownVcx() - } - - async function updateMessageStatus (uids) { - await vcxAgent.agentInitVcx() - await vcxAgent.serviceConnections.updateMessagesStatus(connectionId, uids) - await vcxAgent.agentShutdownVcx() - } - - async function updateAllReceivedMessages () { - await vcxAgent.agentInitVcx() - await vcxAgent.serviceConnections.updateAllReceivedMessages(connectionId) - await vcxAgent.agentShutdownVcx() - } - - async function downloadReceivedMessagesV2 () { - logger.info('Faber is going to download messages using getMessagesV2') - await vcxAgent.agentInitVcx() - const agencyMessages = await vcxAgent.serviceConnections.getMessagesV2(connectionId, ['MS-103']) - await vcxAgent.agentShutdownVcx() - return agencyMessages - } - - async function getCredentialRevRegId () { - logger.info(`Faber is going to obtain rev reg id for cred id ${issuerCredId}`) - await vcxAgent.agentInitVcx() - const revRegId = await vcxAgent.serviceCredIssuer.getRevRegId(issuerCredId) - logger.debug(`Faber obtained rev reg id ${revRegId}`) - await vcxAgent.agentShutdownVcx() - return revRegId - } - - async function getTailsFile () { - logger.info(`Faber is going to obtain tails file for rev reg id ${revRegId}`) - await vcxAgent.agentInitVcx() - const tailsFile = await vcxAgent.serviceLedgerCredDef.getTailsFile(issuerCredId) - await vcxAgent.agentShutdownVcx() - logger.debug(`Faber obtained tails file ${tailsFile}`) - return tailsFile - } - - async function getTailsHash () { - logger.info(`Faber is going to obtain tails hash for rev reg id ${revRegId}`) - await vcxAgent.agentInitVcx() - const tailsHash = await vcxAgent.serviceLedgerRevReg.getTailsHash(revRegId) - logger.info(`Faber obtained tails hash ${tailsHash}`) - await vcxAgent.agentShutdownVcx() - return tailsHash - } - - async function sendMessage (message) { - logger.info('Faber is going to send message') - await vcxAgent.agentInitVcx() - await vcxAgent.serviceConnections.sendMessage(connectionId, message) - await vcxAgent.agentShutdownVcx() - } - - async function nonmediatedConnectionSendMessage (message) { - logger.info('Faber is going to send message') - await vcxAgent.agentInitVcx() - - await vcxAgent.serviceNonmediatedConnections.sendMessage(connectionId, message) - - await vcxAgent.agentShutdownVcx() - } - - async function getPresentationInfo () { - logger.info('Faber is gather info about received presentation') - await vcxAgent.agentInitVcx() - const presentationMsg = await vcxAgent.serviceVerifier.getPresentationMsg(proofId) - const presentationVerificationStatus = await vcxAgent.serviceVerifier.getVerificationStatus(proofId) - const presentationAttachment = await vcxAgent.serviceVerifier.getPresentationAttachment(proofId) - const presentationRequestAttachment = await vcxAgent.serviceVerifier.getPresentationRequestAttachment(proofId) - - await vcxAgent.agentShutdownVcx() - return { - presentationMsg, - presentationVerificationStatus, - presentationAttachment, - presentationRequestAttachment - } - } - - return { - buildLedgerPrimitives, - rotateRevReg, - downloadReceivedMessages, - downloadReceivedMessagesV2, - sendMessage, - nonmediatedConnectionSendMessage, - verifySignature, - createInvite, - createPublicInvite, - createOobMessageWithDid, - createOobProofRequest, - createNonmediatedConnectionWithInvite, - nonmediatedConnectionProcessRequest, - createNonmediatedConnectionFromRequest, - nonmediatedConnectionProcessAck, - createConnectionFromReceivedRequestV2, - updateConnection, - handleMessage, - getPresentationInfo, - sendConnectionResponse, - sendCredentialOffer, - createOobCredOffer, - updateStateCredential, - sendCredential, - receiveCredentialAck, - requestProofFromAlice, - updateStateVerifierProof, - getCredentialRevRegId, - getTailsFile, - getTailsHash, - updateMessageStatus, - updateAllReceivedMessages, - publishService, - revokeCredential, - readServiceFromLedger, - unpackMsg, - getFaberDid - } -} diff --git a/aries/agents/node/vcxagent-core/test/utils/utils.js b/aries/agents/node/vcxagent-core/test/utils/utils.js deleted file mode 100644 index 8df6a75cc8..0000000000 --- a/aries/agents/node/vcxagent-core/test/utils/utils.js +++ /dev/null @@ -1,112 +0,0 @@ -const bodyParser = require('body-parser') -const sleep = require('sleep-promise') -const express = require('express') -const { createFaber } = require('./faber') -const { createAlice } = require('./alice') -const assert = require('assert') -const { MediatedConnectionStateType, ConnectionStateType } = require('@hyperledger/node-vcx-wrapper') -const logger = require('../../demo/logger')('utils') - -module.exports.createAliceAndFaber = async function createAliceAndFaber ({ aliceEndpoint, faberEndpoint } = {}) { - const alice = await createAlice(aliceEndpoint) - const faber = await createFaber(faberEndpoint) - return { alice, faber } -} - -module.exports.createPairedAliceAndFaber = async function createPairedAliceAndFaber () { - const alice = await createAlice() - const faber = await createFaber() - const invite = await faber.createInvite() - await alice.acceptInvitationAndMediate(invite) - await faber.updateConnection(MediatedConnectionStateType.Responded) - await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(MediatedConnectionStateType.Finished) - return { alice, faber } -} - -async function executeFunctionWithServer (f1, f2) { - let server - try { - const port = 5419 - const path = '/msg' - const endpoint = `http://127.0.0.1:${port}${path}` - - let encryptedMsg - const app = express() - app.use(bodyParser.raw({ type: '*/*' })) - app.post(path, (req, res) => { - logger.info(`Faber received a message on endpoint ${endpoint}`) - encryptedMsg = req.body - res.status(200).send() - }) - server = app.listen(port) - - const { alice, faber, pwInfo } = await f1(endpoint) - await sleep(800) - assert(encryptedMsg, "It seems that no message has yet arrived on faber's endpoint, try to increase timeout") - const { message } = await faber.unpackMsg(encryptedMsg) - return await f2(alice, faber, pwInfo, message) - } catch (err) { - console.error(`err = ${err.message} stack = ${err.stack}`) - await sleep(2000) - throw Error(err) - } finally { - if (server) { - server.close() - await sleep(3000) - } - } -} - -module.exports.createPairedAliceAndFaberViaPublicInvite = async function createPairedAliceAndFaberViaPublicInvite () { - const f1 = async (endpoint) => { - const alice = await createAlice() - const faber = await createFaber() - const pwInfo = await faber.publishService(endpoint) - const invite = await faber.createPublicInvite() - await alice.acceptInvitationAndMediate(invite) - return { alice, faber, pwInfo } - } - const f2 = async (alice, faber, pwInfo, message) => { - await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) - return { alice, faber } - } - return await executeFunctionWithServer(f1, f2) -} - -module.exports.createPairedAliceAndFaberViaOobMsg = async function createPairedAliceAndFaberViaOobMsg () { - const f1 = async (endpoint) => { - const alice = await createAlice() - const faber = await createFaber() - const pwInfo = await faber.publishService(endpoint) - const msg = await faber.createOobMessageWithDid() - await alice.acceptInvitationAndMediate(msg) - await alice.updateConnection(MediatedConnectionStateType.Requested) - return { alice, faber, pwInfo } - } - const f2 = async (alice, faber, pwInfo, message) => { - await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(ConnectionStateType.Finished) - return { alice, faber } - } - return await executeFunctionWithServer(f1, f2) -} - -module.exports.connectViaOobMessage = async function connectViaOobMessage (alice, faber, msg) { - const f1 = async (endpoint) => { - const pwInfo = await faber.publishService(endpoint) - await alice.acceptInvitationAndMediate(msg) - await alice.updateConnection(MediatedConnectionStateType.Requested) - return { alice, faber, pwInfo } - } - const f2 = async (alice, faber, pwInfo, message) => { - await faber.createConnectionFromReceivedRequestV2(pwInfo, message) - await alice.updateConnection(MediatedConnectionStateType.Finished) - await faber.updateConnection(MediatedConnectionStateType.Finished) - return { alice, faber } - } - return await executeFunctionWithServer(f1, f2) -} diff --git a/aries/agents/rust/aries-vcx-agent/Cargo.toml b/aries/agents/rust/aries-vcx-agent/Cargo.toml deleted file mode 100644 index 6ce5515b14..0000000000 --- a/aries/agents/rust/aries-vcx-agent/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "aries-vcx-agent" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true - -[dependencies] -serde = "1.0.145" -aries_vcx = { path = "../../../aries_vcx" } -aries_vcx_core = { path = "../../../aries_vcx_core", features = [ - "credx", - "vdrtools_wallet", -] } -anoncreds_types = { path = "../../../misc/anoncreds_types" } -shared = { path = "../../../misc/shared" } -did_resolver_registry = { path = "../../../../did_core/did_resolver_registry" } -did_resolver_sov = { path = "../../../../did_core/did_methods/did_resolver_sov" } -did_peer = { path = "../../../../did_core/did_methods/did_peer" } -did_key = { path = "../../../../did_core/did_methods/did_key" } -public_key = { path = "../../../../did_core/public_key" } -async-trait = "0.1.64" -derive_builder = "0.12.0" -serde_json = "1.0.85" -log = "0.4.17" -uuid = "1.2.1" -thiserror = "1.0.37" -url = { version = "2.3.1", features = ["serde"] } -display_as_json = { path = "../../../../misc/display_as_json" } diff --git a/aries/misc/legacy/libvcx_core/Cargo.toml b/aries/misc/legacy/libvcx_core/Cargo.toml deleted file mode 100644 index 500356864d..0000000000 --- a/aries/misc/legacy/libvcx_core/Cargo.toml +++ /dev/null @@ -1,44 +0,0 @@ -[package] -name = "libvcx_core" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true - -[features] -fatal_warnings = [] -askar_wallet = ["aries_vcx/askar_wallet", "aries_vcx_core/askar_wallet"] -vdrtools_wallet = ["aries_vcx/vdrtools_wallet", "aries_vcx_core/vdrtools_wallet"] - -[dependencies] -num-traits = "0.2.0" -once_cell = { version = "1.15" } -cfg-if = { version = "1.0" } -env_logger = "0.10.0" -log = "0.4.16" -chrono = "0.4.23" -time = "0.3.20" -lazy_static = "1.3" -libc = "0.2.148" -rand = "0.8.5" -serde = "1.0.97" -serde_json = "1.0.40" -serde_derive = "1.0.97" -futures = { version = "0.3", default-features = false } -aries_vcx = { path = "../../../aries_vcx", features = ["credx"] } -aries_vcx_core = { path = "../../../aries_vcx_core" } -anoncreds_types = { path = "../../../../aries/misc/anoncreds_types" } -diddoc_legacy = { path = "../diddoc_legacy" } -public_key = { path = "../../../../did_core/public_key" } -did_parser = { path = "../../../../did_core/did_parser" } -thiserror = "1.0.37" -uuid = { version = "1.4.1", default-features = false, features = ["v4"] } -agency_client = { path = "../agency_client" } -async-trait = "0.1.61" -url = "2.3.1" -wallet_migrator = { path = "../../wallet_migrator" } -shared = { path = "../../shared" } - -[dev-dependencies] -test_utils = {path = "../../test_utils", features = ["vdrtools_wallet"] } -tokio = { version = "1.20", features = [ "rt", "macros" ] } diff --git a/aries/misc/legacy/libvcx_core/build.rs b/aries/misc/legacy/libvcx_core/build.rs deleted file mode 100644 index c941ece423..0000000000 --- a/aries/misc/legacy/libvcx_core/build.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::{env, fs, path::Path}; - -fn main() { - let target = env::var("TARGET").unwrap(); - println!("target={}", target); - - if target.contains("-windows-") { - let profile = env::var("PROFILE").unwrap(); - println!("profile={}", profile); - - let output_dir = env::var("OUT_DIR").unwrap(); - println!("output_dir={}", output_dir); - let output_dir = Path::new(output_dir.as_str()); - - let indy_dir = - env::var("INDY_DIR").unwrap_or(format!("..\\..\\libvdrtools\\target\\{}", profile)); - println!("indy_dir={}", indy_dir); - let indy_dir = Path::new(indy_dir.as_str()); - - let dst = output_dir.join("..\\..\\..\\.."); - println!( - "cargo:rustc-flags=-L {}", - indy_dir.as_os_str().to_str().unwrap() - ); - - let files = [ - "libeay32md.dll", - "libsodium.dll", - "libzmq.dll", - "ssleay32md.dll", - ]; - - for f in files.iter() { - if fs::copy(&indy_dir.join(f), &dst.join(f)).is_ok() { - println!( - "copy {} -> {}", - &indy_dir.join(f).display(), - &dst.join(f).display() - ); - } - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/agency_client.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/agency_client.rs deleted file mode 100644 index 7bbb54608c..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/agency_client.rs +++ /dev/null @@ -1,127 +0,0 @@ -use std::{ - ops::Deref, - sync::{RwLock, RwLockWriteGuard}, -}; - -use aries_vcx::agency_client::{ - agency_client::AgencyClient, - configuration::{AgencyClientConfig, AgentProvisionConfig}, - messages::update_message::UIDsByConn, - MessageStatusCode, -}; -use aries_vcx_core::wallet::{ - agency_client_wallet::ToBaseAgencyClientWallet, base_wallet::did_wallet::DidWallet, -}; - -use super::profile::get_main_wallet; -use crate::errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}; - -lazy_static! { - pub static ref AGENCY_CLIENT: RwLock = RwLock::new(AgencyClient::new()); -} - -pub fn get_main_agency_client_mut() -> LibvcxResult> { - let agency_client = AGENCY_CLIENT.write()?; - Ok(agency_client) -} - -pub fn get_main_agency_client() -> LibvcxResult { - let agency_client = AGENCY_CLIENT.read()?.deref().clone(); - Ok(agency_client) -} - -pub fn create_agency_client_for_main_wallet(config: &AgencyClientConfig) -> LibvcxResult<()> { - let client = get_main_agency_client()? - .configure(get_main_wallet()?.to_base_agency_client_wallet(), config)?; - set_main_agency_client(client); - Ok(()) -} - -pub fn reset_main_agency_client() { - trace!("reset_agency_client >>>"); - let mut agency_client = AGENCY_CLIENT - .write() - .expect("Unable to access AGENCY_CLIENT"); - *agency_client = AgencyClient::new(); -} - -pub fn set_main_agency_client(new_agency_client: AgencyClient) { - trace!("set_main_agency_client >>>"); - let mut agency_client = AGENCY_CLIENT - .write() - .expect("Unable to access AGENCY_CLIENT"); - *agency_client = new_agency_client; -} - -pub async fn agency_update_messages( - status_code: MessageStatusCode, - uids_by_conns: Vec, -) -> LibvcxResult<()> { - let client = get_main_agency_client()?; - client - .update_messages(status_code, uids_by_conns) - .await - .map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::UnknownError, - format!("Error updating state of message in agency.\nError: {}", err), - ) - }) -} - -pub async fn update_webhook_url(webhook_url: &str) -> LibvcxResult<()> { - let client = get_main_agency_client()?; - client.update_agent_webhook(webhook_url).await?; - Ok(()) -} - -pub async fn provision_cloud_agent( - agency_config: &AgentProvisionConfig, -) -> LibvcxResult { - let wallet = get_main_wallet()?; - let mut client = get_main_agency_client()?; - let seed = agency_config.agent_seed.as_deref(); - let did_data = wallet.create_and_store_my_did(seed, None).await?; - client - .provision_cloud_agent( - wallet.to_base_agency_client_wallet(), - did_data.did(), - &did_data.verkey().base58(), - &agency_config.agency_did, - &agency_config.agency_verkey, - agency_config.agency_endpoint.clone(), - ) - .await?; - let config = client.get_config()?; - Ok(config) -} - -#[cfg(test)] -mod tests { - use aries_vcx::agency_client::{ - messages::update_message::UIDsByConn, testing::mocking::AgencyMockDecrypted, - MessageStatusCode, - }; - use test_utils::{constants::GET_MESSAGES_DECRYPTED_RESPONSE, devsetup::SetupMocks}; - - use crate::api_vcx::api_global::agency_client::{agency_update_messages, update_webhook_url}; - - #[tokio::test] - async fn test_update_institution_webhook() { - let _setup = SetupMocks::init(); - update_webhook_url("https://example.com").await.unwrap(); - } - - #[tokio::test] - async fn test_messages_update_status() { - let _setup = SetupMocks::init(); - AgencyMockDecrypted::set_next_decrypted_response(GET_MESSAGES_DECRYPTED_RESPONSE); - - let uids_by_conns_str = - String::from(r#"[{"pairwiseDID":"QSrw8hebcvQxiwBETmAaRs","uids":["mgrmngq"]}]"#); - let uids_by_conns: Vec = serde_json::from_str(&uids_by_conns_str).unwrap(); - agency_update_messages(MessageStatusCode::Received, uids_by_conns) - .await - .unwrap(); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/ledger.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/ledger.rs deleted file mode 100644 index 8286f27d8f..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/ledger.rs +++ /dev/null @@ -1,271 +0,0 @@ -use std::str::FromStr; - -use aries_vcx::{ - aries_vcx_core::ledger::base_ledger::TxnAuthrAgrmtOptions, - common::ledger::{ - service_didsov::{DidSovServiceType, EndpointDidSov}, - transactions::{ - clear_attr, get_attr, get_service, write_endorser_did, write_endpoint, - write_endpoint_legacy, - }, - }, -}; -use aries_vcx_core::ledger::base_ledger::{IndyLedgerRead, IndyLedgerWrite}; -use did_parser::Did; -use diddoc_legacy::aries::service::AriesService; -use url::Url; - -use super::profile::{get_main_ledger_read, get_main_ledger_write, update_taa_configuration}; -use crate::{ - api_vcx::api_global::profile::get_main_wallet, - errors::{ - error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, - mapping_from_ariesvcx::map_ariesvcx_result, - mapping_from_ariesvcxcore::map_ariesvcx_core_result, - }, -}; - -pub async fn endorse_transaction(transaction: &str, endorser_did: &str) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - let ledger = get_main_ledger_write()?; - map_ariesvcx_core_result( - ledger - .endorse_transaction(wallet.as_ref(), &endorser_did.parse()?, transaction) - .await, - ) -} - -pub async fn get_ledger_txn(seq_no: i32, submitter_did: Option) -> LibvcxResult { - let ledger = get_main_ledger_read()?; - map_ariesvcx_core_result( - ledger - .get_ledger_txn( - seq_no, - submitter_did - .map(|did| did.parse::()) - .transpose()? - .as_ref(), - ) - .await, - ) -} - -pub async fn rotate_verkey(did: &str) -> LibvcxResult<()> { - let result = aries_vcx::common::keys::rotate_verkey( - get_main_wallet()?.as_ref(), - get_main_ledger_write()?.as_ref(), - &did.to_owned().parse()?, - ) - .await; - map_ariesvcx_result(result) -} - -pub async fn get_verkey_from_ledger(did: &str) -> LibvcxResult { - let indy_ledger = get_main_ledger_read()?; - map_ariesvcx_result( - aries_vcx::common::keys::get_verkey_from_ledger(indy_ledger.as_ref(), &did.parse()?).await, - ) -} - -pub async fn ledger_write_endpoint_legacy( - target_did: &str, - recipient_keys: Vec, - routing_keys: Vec, - endpoint: String, -) -> LibvcxResult { - let wallet = get_main_wallet()?; - let service = - AriesService::create() - .set_service_endpoint(Url::from_str(&endpoint).map_err(|err| { - LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()) - })?) - .set_recipient_keys(recipient_keys) - .set_routing_keys(routing_keys); - write_endpoint_legacy( - wallet.as_ref(), - get_main_ledger_write()?.as_ref(), - &target_did.parse()?, - &service, - ) - .await?; - Ok(service) -} - -pub async fn ledger_write_endpoint( - target_did: &str, - routing_keys: Vec, - endpoint: String, -) -> LibvcxResult { - let wallet = get_main_wallet()?; - let service = - EndpointDidSov::create() - .set_service_endpoint(Url::from_str(&endpoint).map_err(|err| { - LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()) - })?) - .set_types(Some(vec![ - DidSovServiceType::Endpoint, - DidSovServiceType::DidCommunication, - ])) - .set_routing_keys(Some(routing_keys)); - write_endpoint( - wallet.as_ref(), - get_main_ledger_write()?.as_ref(), - &target_did.parse()?, - &service, - ) - .await?; - Ok(service) -} - -pub async fn ledger_get_service(target_did: &str) -> LibvcxResult { - let target_did = target_did.to_owned(); - map_ariesvcx_result(get_service(get_main_ledger_read()?.as_ref(), &target_did.parse()?).await) -} - -pub async fn ledger_get_attr(target_did: &str, attr: &str) -> LibvcxResult { - map_ariesvcx_result( - get_attr(get_main_ledger_read()?.as_ref(), &target_did.parse()?, attr).await, - ) -} - -pub async fn ledger_clear_attr(target_did: &str, attr: &str) -> LibvcxResult { - let wallet = get_main_wallet()?; - map_ariesvcx_result( - clear_attr( - wallet.as_ref(), - get_main_ledger_write()?.as_ref(), - &target_did.parse()?, - attr, - ) - .await, - ) -} - -pub async fn ledger_write_endorser_did( - submitter_did: &str, - target_did: &str, - target_vk: &str, - alias: Option, -) -> LibvcxResult { - let wallet = get_main_wallet()?; - map_ariesvcx_result( - write_endorser_did( - wallet.as_ref(), - get_main_ledger_write()?.as_ref(), - &submitter_did.parse()?, - &target_did.parse()?, - target_vk, - alias, - ) - .await, - ) -} - -pub async fn ledger_get_txn_author_agreement() -> LibvcxResult { - get_main_ledger_read()? - .as_ref() - .get_txn_author_agreement() - .await? - .ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::LedgerItemNotFound, - "No transaction author agreement found", - ) - }) -} - -pub fn set_taa_configuration( - text: String, - version: String, - acceptance_mechanism: String, -) -> LibvcxResult<()> { - let taa_options = TxnAuthrAgrmtOptions { - text, - version, - mechanism: acceptance_mechanism, - }; - update_taa_configuration(taa_options) -} - -pub fn get_taa_configuration() -> LibvcxResult> { - super::profile::get_taa_configuration() -} - -#[cfg(feature = "vdrtools_wallet")] -#[cfg(test)] -mod tests { - use aries_vcx::{ - aries_vcx_core::ledger::indy::pool::test_utils::{ - create_genesis_txn_file, create_testpool_genesis_txn_file, get_temp_file_path, - get_txns_sovrin_testnet, - }, - global::settings::DEFAULT_GENESIS_PATH, - }; - use test_utils::devsetup::SetupMocks; - - use crate::api_vcx::api_global::{ - ledger::{get_taa_configuration, ledger_get_txn_author_agreement, set_taa_configuration}, - pool::{open_main_pool, LibvcxLedgerConfig}, - wallet::wallet::test_utils::_create_and_open_wallet, - }; - - #[tokio::test] - async fn test_vcx_get_sovrin_taa() { - let _setup = SetupMocks::init(); - _create_and_open_wallet().await.unwrap(); - let genesis_path = get_temp_file_path(DEFAULT_GENESIS_PATH) - .to_str() - .unwrap() - .to_string(); - create_genesis_txn_file(&genesis_path, Box::new(get_txns_sovrin_testnet)); - let config = LibvcxLedgerConfig { - genesis_path, - pool_config: None, - cache_config: None, - exclude_nodes: Some(vec!["NECValidator".into(), "Entrustient".into()]), - }; - open_main_pool(&config).await.unwrap(); - - let taa = ledger_get_txn_author_agreement().await.unwrap(); - let taa_parsed = serde_json::from_str::(&taa).unwrap(); - assert!(taa_parsed["text"].is_string()); - assert!(taa_parsed["version"].is_string()); - assert!(taa_parsed["digest"].is_string()); - } - - #[tokio::test] - async fn test_vcx_set_active_txn_author_agreement_meta() { - let _setup = SetupMocks::init(); - _create_and_open_wallet().await.unwrap(); - let genesis_path = get_temp_file_path(DEFAULT_GENESIS_PATH) - .to_str() - .unwrap() - .to_string(); - create_testpool_genesis_txn_file(&genesis_path); - let config = LibvcxLedgerConfig { - genesis_path, - pool_config: None, - cache_config: None, - exclude_nodes: None, - }; - open_main_pool(&config).await.unwrap(); - - assert!(get_taa_configuration().unwrap().is_none()); - - let text = "text"; - let version = "1.0.0"; - let acc_mech_type = "type 1"; - - set_taa_configuration(text.into(), version.into(), acc_mech_type.into()).unwrap(); - let auth_agreement = get_taa_configuration().unwrap().unwrap(); - - let expected = json!({ - "text": text, - "version": version, - "mechanism": acc_mech_type - }); - - let auth_agreement = serde_json::to_value(auth_agreement).unwrap(); - assert_eq!(expected, auth_agreement); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/mod.rs deleted file mode 100644 index 443fe33765..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -pub mod agency_client; -pub mod ledger; -pub mod pool; -pub mod profile; -pub mod state; -pub mod wallet; - -use crate::api_vcx::utils::version_constants; - -lazy_static! { - pub static ref VERSION_STRING: String = format!( - "{}{}", - version_constants::VERSION, - version_constants::REVISION - ); -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/pool.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/pool.rs deleted file mode 100644 index 275e9553d0..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/pool.rs +++ /dev/null @@ -1,274 +0,0 @@ -use std::{ - num::NonZeroUsize, - sync::{Arc, RwLock}, - time::Duration, -}; - -use aries_vcx::aries_vcx_core::{ - ledger::{ - request_submitter::vdr_ledger::{IndyVdrLedgerPool, IndyVdrSubmitter}, - response_cacher::in_memory::{ - InMemoryResponseCacherConfig, InMemoryResponseCacherConfigBuilder, - }, - }, - PoolConfig, -}; -use aries_vcx_core::ledger::{ - indy_vdr_ledger::{ - indyvdr_build_ledger_read, indyvdr_build_ledger_write, IndyVdrLedgerRead, - IndyVdrLedgerWrite, - }, - response_cacher::in_memory::InMemoryResponseCacher, -}; - -use crate::errors::error::{LibvcxError, LibvcxResult}; - -pub static GLOBAL_LEDGER_INDY_READ: RwLock< - Option>>, -> = RwLock::new(None); -pub static GLOBAL_LEDGER_INDY_WRITE: RwLock>>> = - RwLock::new(None); - -pub fn is_main_pool_open() -> bool { - GLOBAL_LEDGER_INDY_READ - .read() - .map(|v| v.is_some()) - .unwrap_or_default() -} - -// todo : enable opting out of caching completely be specifying 0 capacity -#[derive(Clone, Debug, Deserialize)] -// unlike internal config struct InMemoryResponseCacherConfig, this doesn't deal with Duration -// but simply numeric seconds, making it easier to pass consumers of libvcx -pub struct LibvcxInMemoryResponseCacherConfig { - ttl_secs: NonZeroUsize, - capacity: usize, -} - -#[derive(Clone, Debug, Deserialize)] -pub struct LibvcxLedgerConfig { - pub genesis_path: String, - pub pool_config: Option, - pub cache_config: Option, - pub exclude_nodes: Option>, -} - -impl TryFrom for InMemoryResponseCacherConfig { - type Error = LibvcxError; - - fn try_from( - config: LibvcxInMemoryResponseCacherConfig, - ) -> LibvcxResult { - let m = InMemoryResponseCacherConfigBuilder::default() - .ttl(Duration::from_secs(config.ttl_secs.get() as u64)) - .capacity(config.capacity)?; - Ok(m.build()) - } -} - -fn build_components_ledger( - libvcx_pool_config: &LibvcxLedgerConfig, -) -> LibvcxResult<( - IndyVdrLedgerRead, - IndyVdrLedgerWrite, -)> { - let indy_vdr_config = match &libvcx_pool_config.pool_config { - None => PoolConfig::default(), - Some(cfg) => cfg.clone(), - }; - let ledger_pool = IndyVdrLedgerPool::new( - libvcx_pool_config.genesis_path.clone(), - indy_vdr_config, - libvcx_pool_config.exclude_nodes.clone().unwrap_or_default(), - )?; - let request_submitter = IndyVdrSubmitter::new(ledger_pool); - - let cache_config = match &libvcx_pool_config.cache_config { - None => InMemoryResponseCacherConfig::builder() - .ttl(Duration::from_secs(60)) - .capacity(1000)? - .build(), - Some(cfg) => cfg.clone().try_into()?, - }; - let ledger_read = indyvdr_build_ledger_read(request_submitter.clone(), cache_config)?; - let ledger_write = indyvdr_build_ledger_write(request_submitter, None); - - Ok((ledger_read, ledger_write)) -} - -pub fn reset_ledger_components() -> LibvcxResult<()> { - let mut indy_read = GLOBAL_LEDGER_INDY_READ.write()?; - *indy_read = None; - let mut indy_write = GLOBAL_LEDGER_INDY_WRITE.write()?; - *indy_write = None; - Ok(()) -} - -pub async fn setup_ledger_components(config: &LibvcxLedgerConfig) -> LibvcxResult<()> { - let (ledger_read, ledger_write) = build_components_ledger(config)?; - let mut indy_read_guard = GLOBAL_LEDGER_INDY_READ.write()?; - *indy_read_guard = Some(Arc::new(ledger_read)); - let mut indy_write_guard = GLOBAL_LEDGER_INDY_WRITE.write()?; - *indy_write_guard = Some(Arc::new(ledger_write)); - Ok(()) -} - -pub async fn open_main_pool(config: &LibvcxLedgerConfig) -> LibvcxResult<()> { - if is_main_pool_open() { - return Ok(()); - } - - trace!( - "open_pool >> path: {}, pool_config: {:?}", - config.genesis_path, - config.pool_config - ); - - setup_ledger_components(config).await?; - - info!("open_pool >> Pool Opened Successfully"); - - Ok(()) -} - -pub async fn close_main_pool() -> LibvcxResult<()> { - info!("close_main_pool >> Closing main pool"); - - reset_ledger_components()?; - Ok(()) -} - -#[cfg(feature = "vdrtools_wallet")] -#[cfg(test)] -mod tests { - - use std::num::NonZeroUsize; - - use aries_vcx::{ - aries_vcx_core::ledger::indy::pool::test_utils::{ - create_testpool_genesis_txn_file, get_temp_file_path, - }, - global::settings::DEFAULT_GENESIS_PATH, - }; - use serde_json; - use test_utils::{ - constants::POOL1_TXN, - devsetup::{SetupMocks, TempFile}, - }; - - use crate::{ - api_vcx::api_global::{ - pool::{close_main_pool, open_main_pool, reset_ledger_components, LibvcxLedgerConfig}, - profile::get_main_ledger_read, - wallet::wallet::{close_main_wallet, test_utils::_create_and_open_wallet}, - }, - errors::error::LibvcxErrorKind, - }; - - #[test] - fn test_deserialize_libvcx_ledger_config() { - let data = r#" - { - "genesis_path": "/tmp/genesis", - "pool_config": { - "protocol_version": "Node1_4", - "freshness_threshold": 300, - "ack_timeout": 20, - "reply_timeout": 60, - "conn_request_limit": 5, - "conn_active_timeout": 5, - "request_read_nodes": 2 - }, - "cache_config": { - "ttl_secs": 3600, - "capacity": 1000 - } - } - "#; - - let config: LibvcxLedgerConfig = serde_json::from_str(data).unwrap(); - - assert_eq!(config.genesis_path, "/tmp/genesis"); - assert_eq!(config.pool_config.as_ref().unwrap().protocol_version, 2); - assert_eq!( - config.pool_config.as_ref().unwrap().freshness_threshold, - 300 - ); - assert_eq!(config.pool_config.as_ref().unwrap().ack_timeout, 20); - assert_eq!(config.pool_config.as_ref().unwrap().reply_timeout, 60); - assert_eq!(config.pool_config.as_ref().unwrap().conn_request_limit, 5); - assert_eq!(config.pool_config.as_ref().unwrap().conn_active_timeout, 5); - assert_eq!(config.pool_config.as_ref().unwrap().request_read_nodes, 2); - assert_eq!( - config.cache_config.as_ref().unwrap().ttl_secs, - NonZeroUsize::new(3600).unwrap() - ); - assert_eq!(config.cache_config.as_ref().unwrap().capacity, 1000); - assert!(config.exclude_nodes.is_none()); - } - - #[tokio::test] - #[ignore] - async fn test_open_pool() { - let _setup = SetupMocks::init(); - _create_and_open_wallet().await.unwrap(); - let genesis_path = get_temp_file_path(DEFAULT_GENESIS_PATH) - .to_str() - .unwrap() - .to_string(); - create_testpool_genesis_txn_file(&genesis_path); - let config = LibvcxLedgerConfig { - genesis_path, - pool_config: None, - cache_config: None, - exclude_nodes: None, - }; - open_main_pool(&config).await.unwrap(); - close_main_pool().await.unwrap(); - close_main_wallet().await.unwrap(); - reset_ledger_components().unwrap(); - } - - #[tokio::test] - #[ignore] - async fn test_open_pool_fails_if_genesis_file_is_invalid() { - let _setup = SetupMocks::init(); - _create_and_open_wallet().await.unwrap(); - - let _genesis_transactions = - TempFile::create_with_data(POOL1_TXN, "{ \"invalid\": \"genesis\" }"); - - // todo: indy-vdr panics if the file is invalid, see: - // indy-vdr-0.3.4/src/pool/runner.rs:44:22 - assert_eq!( - get_main_ledger_read().unwrap_err().kind(), - LibvcxErrorKind::NotReady - ); - - close_main_wallet().await.unwrap(); - reset_ledger_components().unwrap(); - } - - #[tokio::test] - #[ignore] - async fn test_open_pool_fails_if_genesis_path_is_invalid() { - let _setup = SetupMocks::init(); - _create_and_open_wallet().await.unwrap(); - - let config = LibvcxLedgerConfig { - genesis_path: "invalid/txn/path".to_string(), - pool_config: None, - cache_config: None, - exclude_nodes: None, - }; - assert_eq!( - open_main_pool(&config).await.unwrap_err().kind(), - LibvcxErrorKind::IOError - ); - assert_eq!( - get_main_ledger_read().unwrap_err().kind(), - LibvcxErrorKind::NotReady - ); - close_main_wallet().await.unwrap(); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/profile.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/profile.rs deleted file mode 100644 index 6a711e8b50..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/profile.rs +++ /dev/null @@ -1,137 +0,0 @@ -use std::sync::Arc; - -use aries_vcx::{ - self, - aries_vcx_core::{ - anoncreds::base_anoncreds::BaseAnonCreds, - ledger::base_ledger::{IndyLedgerRead, IndyLedgerWrite}, - }, -}; -#[cfg(feature = "askar_wallet")] -use aries_vcx_core::wallet::askar::AskarWallet; -#[cfg(feature = "vdrtools_wallet")] -use aries_vcx_core::wallet::indy::IndySdkWallet; -use aries_vcx_core::{ - ledger::base_ledger::{ - AnoncredsLedgerRead, AnoncredsLedgerWrite, TaaConfigurator, TxnAuthrAgrmtOptions, - }, - wallet::base_wallet::BaseWallet, -}; - -#[cfg(feature = "askar_wallet")] -use super::wallet::askar::GLOBAL_ASKAR_WALLET; -#[cfg(feature = "vdrtools_wallet")] -use super::wallet::indy::GLOBAL_INDY_WALLET; -use crate::{ - api_vcx::api_global::{ - pool::{GLOBAL_LEDGER_INDY_READ, GLOBAL_LEDGER_INDY_WRITE}, - wallet::GLOBAL_BASE_ANONCREDS, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -#[cfg(feature = "vdrtools_wallet")] -pub fn try_get_main_indy_wallet() -> LibvcxResult>> { - let base_wallet = GLOBAL_INDY_WALLET.read()?; - base_wallet.as_ref().cloned().map(Some).ok_or_else(|| { - LibvcxError::from_msg(LibvcxErrorKind::NotReady, "Wallet is not initialized") - }) -} - -#[cfg(feature = "askar_wallet")] -pub fn try_get_main_askar_wallet() -> LibvcxResult>> { - let base_wallet = GLOBAL_ASKAR_WALLET.read()?; - base_wallet.as_ref().cloned().map(Some).ok_or_else(|| { - LibvcxError::from_msg(LibvcxErrorKind::NotReady, "Wallet is not initialized") - }) -} - -#[allow(unused_variables)] -pub fn try_get_main_wallet() -> LibvcxResult>> { - #[cfg(feature = "vdrtools_wallet")] - let wallet = try_get_main_indy_wallet()?; - - #[cfg(feature = "askar_wallet")] - let wallet = try_get_main_askar_wallet()?; - - Ok(wallet) -} - -#[cfg(feature = "askar_wallet")] -pub fn get_main_askar_wallet() -> LibvcxResult> { - let base_wallet = GLOBAL_ASKAR_WALLET.read()?; - base_wallet.as_ref().cloned().ok_or_else(|| { - LibvcxError::from_msg(LibvcxErrorKind::NotReady, "Wallet is not initialized") - }) -} - -#[cfg(feature = "vdrtools_wallet")] -pub fn get_main_indy_wallet() -> LibvcxResult> { - let base_wallet = GLOBAL_INDY_WALLET.read()?; - base_wallet.as_ref().cloned().ok_or_else(|| { - LibvcxError::from_msg(LibvcxErrorKind::NotReady, "Wallet is not initialized") - }) -} - -#[allow(unused_variables)] -pub fn get_main_wallet() -> LibvcxResult> { - #[cfg(feature = "vdrtools_wallet")] - let wallet = get_main_indy_wallet()?; - - #[cfg(feature = "askar_wallet")] - let wallet = get_main_askar_wallet()?; - - Ok(wallet) -} - -pub fn get_main_anoncreds() -> LibvcxResult> { - let anoncreds = GLOBAL_BASE_ANONCREDS.read()?; - anoncreds.as_ref().cloned().ok_or_else(|| { - LibvcxError::from_msg(LibvcxErrorKind::NotReady, "Anoncreds is not initialized") - }) -} - -pub fn get_main_ledger_read() -> LibvcxResult> { - let ledger = GLOBAL_LEDGER_INDY_READ.read()?; - ledger.as_ref().cloned().ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::NotReady, - "Anoncreds ledger read is not initialized", - ) - }) -} - -pub fn get_main_ledger_write() -> LibvcxResult> { - let ledger = GLOBAL_LEDGER_INDY_WRITE.read()?; - ledger.as_ref().cloned().ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::NotReady, - "Indy ledger write is not initialized", - ) - }) -} - -pub fn update_taa_configuration(taa_options: TxnAuthrAgrmtOptions) -> LibvcxResult<()> { - let configurator = GLOBAL_LEDGER_INDY_WRITE.read()?; - match configurator.as_ref() { - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::NotReady, - "Ledger is not initialized", - ))?, - Some(configurator) => configurator.set_txn_author_agreement_options(taa_options)?, - }; - Ok(()) -} - -pub fn get_taa_configuration() -> LibvcxResult> { - let configurator = GLOBAL_LEDGER_INDY_WRITE.read()?; - match configurator.as_ref() { - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::NotReady, - "Ledger is not initialized", - ))?, - Some(configurator) => configurator - .get_txn_author_agreement_options() - .map_err(|err| err.into()), - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/state.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/state.rs deleted file mode 100644 index 3a59fc9549..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/state.rs +++ /dev/null @@ -1,28 +0,0 @@ -use crate::api_vcx::api_global::{ - agency_client::reset_main_agency_client, - pool::{close_main_pool, reset_ledger_components}, - wallet::wallet::close_main_wallet, -}; - -pub fn state_vcx_shutdown() { - info!("vcx_shutdown >>>"); - - if let Ok(()) = futures::executor::block_on(close_main_wallet()) {} - if let Ok(()) = futures::executor::block_on(close_main_pool()) {} - - crate::api_vcx::api_handle::schema::release_all(); - crate::api_vcx::api_handle::mediated_connection::release_all(); - crate::api_vcx::api_handle::issuer_credential::release_all(); - crate::api_vcx::api_handle::credential_def::release_all(); - crate::api_vcx::api_handle::proof::release_all(); - crate::api_vcx::api_handle::disclosed_proof::release_all(); - crate::api_vcx::api_handle::credential::release_all(); - - reset_main_agency_client(); - match reset_ledger_components() { - Ok(_) => {} - Err(err) => { - error!("Failed to reset global pool: {}", err); - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/askar.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/askar.rs deleted file mode 100644 index 84ecd59e15..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/askar.rs +++ /dev/null @@ -1,205 +0,0 @@ -use std::sync::{Arc, RwLock}; - -use aries_vcx_core::{ - anoncreds::base_anoncreds::BaseAnonCreds, - global::settings::DEFAULT_LINK_SECRET_ALIAS, - wallet::{ - askar::{ - askar_import_config::AskarImportConfig, askar_wallet_config::AskarWalletConfig, - AskarWallet, - }, - base_wallet::ManageWallet, - }, -}; - -use crate::{ - api_vcx::api_global::{ - profile::{get_main_anoncreds, try_get_main_wallet}, - wallet::{get_main_wallet, setup_global_anoncreds, BaseWallet}, - }, - errors::{ - error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, - mapping_from_ariesvcxcore::map_ariesvcx_core_result, - }, -}; - -pub static GLOBAL_ASKAR_WALLET: RwLock>> = RwLock::new(None); - -fn setup_global_wallet(wallet: Arc) -> LibvcxResult<()> { - let mut b_wallet = GLOBAL_ASKAR_WALLET.write()?; - *b_wallet = Some(wallet); - - setup_global_anoncreds() -} - -pub async fn open_as_main_wallet( - wallet_config: &AskarWalletConfig, -) -> LibvcxResult> { - let wallet = Arc::new(wallet_config.open_wallet().await?); - setup_global_wallet(wallet.clone())?; - Ok(wallet) -} - -pub async fn create_and_open_as_main_wallet( - wallet_config: &AskarWalletConfig, -) -> LibvcxResult> { - let wallet = Arc::new(wallet_config.create_wallet().await?); - - setup_global_wallet(wallet.clone())?; - Ok(wallet) -} - -pub async fn close_main_wallet() -> LibvcxResult<()> { - let wallet = try_get_main_wallet()?; - match wallet { - None => { - warn!("Skipping wallet close, no global wallet component available.") - } - Some(wallet) => { - wallet.close_wallet().await?; - let mut b_wallet = GLOBAL_ASKAR_WALLET.write()?; - *b_wallet = None; - } - } - Ok(()) -} - -pub async fn create_main_wallet(config: &AskarWalletConfig) -> LibvcxResult<()> { - create_and_open_as_main_wallet(config).await?; - let wallet = get_main_wallet()?; - - // If MS is already in wallet then just continue - get_main_anoncreds()? - .prover_create_link_secret(wallet.as_ref(), &DEFAULT_LINK_SECRET_ALIAS.to_string()) - .await - .ok(); - - // TODO: enable when closing askar wallet is implemented - // close_main_wallet().await?; - Ok(()) -} - -pub async fn wallet_import(config: &AskarImportConfig) -> LibvcxResult<()> { - map_ariesvcx_core_result(config.import_wallet().await) -} - -pub async fn wallet_migrate(wallet_config: &impl ManageWallet) -> LibvcxResult<()> { - let src_wallet = get_main_wallet()?; - info!("Opening target wallet."); - let dest_wallet = wallet_config.create_wallet().await?; - - let migration_res = wallet_migrator::migrate_wallet( - src_wallet.as_ref(), - &dest_wallet, - wallet_migrator::vdrtools2credx::migrate_any_record, - ) - .await; - - migration_res.map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::WalletMigrationFailed, e)) -} - -#[cfg(test)] -pub mod test_utils { - use aries_vcx_core::wallet::askar::{ - askar_wallet_config::AskarWalletConfig, key_method::KeyMethod, - }; - use test_utils::devsetup::TempFile; - use uuid::Uuid; - - // use crate::api_vcx::api_global::wallet::askar::open_main_wallet; - use crate::api_vcx::api_global::wallet::askar::open_as_main_wallet; - use crate::{ - api_vcx::api_global::wallet::{ - askar::{create_and_open_as_main_wallet, create_main_wallet}, - test_utils::setup_wallet_backup, - }, - errors::error::LibvcxResult, - }; - - pub async fn _create_main_wallet_and_its_backup() -> (TempFile, String, AskarWalletConfig) { - let wallet_config = AskarWalletConfig::new( - "sqlite://:memory:", - KeyMethod::Unprotected, - "", - &Uuid::new_v4().to_string(), - ); - - let wallet_name = &format!("export_test_wallet_{}", uuid::Uuid::new_v4()); - - let export_file = TempFile::prepare_path(wallet_name); - - let wallet = create_and_open_as_main_wallet(&wallet_config) - .await - .unwrap(); - - setup_wallet_backup(wallet.as_ref(), &export_file).await; - - (export_file, wallet_name.to_string(), wallet_config) - } - - pub async fn _create_and_open_wallet() -> LibvcxResult { - let config_wallet: AskarWalletConfig = AskarWalletConfig::new( - "sqlite://:memory:", - KeyMethod::Unprotected, - "", - &Uuid::new_v4().to_string(), - ); - create_main_wallet(&config_wallet).await?; - open_as_main_wallet(&config_wallet).await?; - Ok(config_wallet) - } -} - -#[cfg(test)] -pub mod tests { - use test_utils::devsetup::SetupMocks; - - use crate::api_vcx::api_global::wallet::askar::create_main_wallet; - - #[tokio::test] - async fn test_wallet_migrate() { - use aries_vcx_core::wallet::askar::{ - askar_wallet_config::AskarWalletConfig, key_method::KeyMethod, - }; - use uuid::Uuid; - - use crate::api_vcx::api_global::wallet::askar::create_and_open_as_main_wallet; - - let config = AskarWalletConfig::new( - "sqlite://:memory:", - KeyMethod::Unprotected, - "", - &Uuid::new_v4().to_string(), - ); - - create_and_open_as_main_wallet(&config).await.unwrap(); - - let new_config = AskarWalletConfig::new( - "sqlite://:memory:", - KeyMethod::Unprotected, - "", - &Uuid::new_v4().to_string(), - ); - - super::wallet_migrate(&new_config).await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_create() { - use aries_vcx_core::wallet::askar::{ - askar_wallet_config::AskarWalletConfig, key_method::KeyMethod, - }; - use uuid::Uuid; - - let _setup = SetupMocks::init(); - - let config = AskarWalletConfig::new( - "sqlite://:memory:", - KeyMethod::Unprotected, - "", - &Uuid::new_v4().to_string(), - ); - - create_main_wallet(&config).await.unwrap(); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/indy.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/indy.rs deleted file mode 100644 index aa14510573..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/indy.rs +++ /dev/null @@ -1,341 +0,0 @@ -use std::sync::{Arc, RwLock}; - -use aries_vcx_core::{ - anoncreds::base_anoncreds::BaseAnonCreds, - global::settings::DEFAULT_LINK_SECRET_ALIAS, - wallet::{ - base_wallet::{BaseWallet, ImportWallet, ManageWallet}, - indy::{ - indy_import_config::IndyImportConfig, indy_wallet_config::IndyWalletConfig, - IndySdkWallet, - }, - }, -}; - -use crate::{ - api_vcx::api_global::{ - profile::{get_main_anoncreds, try_get_main_wallet}, - wallet::{get_main_wallet, setup_global_anoncreds}, - }, - errors::{ - error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, - mapping_from_ariesvcxcore::map_ariesvcx_core_result, - }, -}; - -pub static GLOBAL_INDY_WALLET: RwLock>> = RwLock::new(None); - -fn setup_global_wallet(wallet: Arc) -> LibvcxResult<()> { - let mut b_wallet = GLOBAL_INDY_WALLET.write()?; - *b_wallet = Some(wallet); - - setup_global_anoncreds() -} - -pub async fn open_as_main_wallet( - wallet_config: &IndyWalletConfig, -) -> LibvcxResult> { - let wallet = Arc::new(wallet_config.open_wallet().await?); - setup_global_wallet(wallet.clone())?; - Ok(wallet) -} - -pub async fn create_and_open_as_main_wallet( - wallet_config: &IndyWalletConfig, -) -> LibvcxResult> { - let wallet = Arc::new(wallet_config.create_wallet().await?); - - setup_global_wallet(wallet.clone())?; - Ok(wallet) -} - -pub async fn close_main_wallet() -> LibvcxResult<()> { - let wallet = try_get_main_wallet()?; - match wallet { - None => { - warn!("Skipping wallet close, no global wallet component available.") - } - Some(wallet) => { - wallet.close_wallet().await?; - let mut b_wallet = GLOBAL_INDY_WALLET.write()?; - *b_wallet = None; - } - } - Ok(()) -} - -pub async fn create_main_wallet(config: &IndyWalletConfig) -> LibvcxResult<()> { - let wallet = create_and_open_as_main_wallet(config).await?; - trace!("Created wallet {:?}", wallet); - let wallet = get_main_wallet()?; - - // If MS is already in wallet then just continue - get_main_anoncreds()? - .prover_create_link_secret(wallet.as_ref(), &DEFAULT_LINK_SECRET_ALIAS.to_string()) - .await - .ok(); - - close_main_wallet().await?; - Ok(()) -} - -pub async fn wallet_import(config: &IndyImportConfig) -> LibvcxResult<()> { - map_ariesvcx_core_result(config.import_wallet().await) -} - -pub async fn wallet_migrate(wallet_config: &IndyWalletConfig) -> LibvcxResult<()> { - let src_wallet = get_main_wallet()?; - info!("Opening target wallet."); - let dest_wallet = wallet_config.create_wallet().await?; - - let migration_res = wallet_migrator::migrate_wallet( - src_wallet.as_ref(), - &dest_wallet, - wallet_migrator::vdrtools2credx::migrate_any_record, - ) - .await; - - migration_res.map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::WalletMigrationFailed, e)) -} - -#[cfg(test)] -pub mod test_utils { - use aries_vcx_core::global::settings::{DEFAULT_WALLET_KEY, WALLET_KDF_RAW}; - use test_utils::devsetup::TempFile; - - use crate::{ - api_vcx::api_global::wallet::{ - indy::{ - create_and_open_as_main_wallet, create_main_wallet, open_as_main_wallet, - IndyWalletConfig, - }, - test_utils::setup_wallet_backup, - }, - errors::error::LibvcxResult, - }; - - pub async fn _create_and_open_wallet() -> LibvcxResult { - let wallet_name = format!("test_create_wallet_{}", uuid::Uuid::new_v4()); - let config_wallet: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": wallet_name, - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW - }))?; - create_main_wallet(&config_wallet).await?; - open_as_main_wallet(&config_wallet).await?; - Ok(config_wallet) - } - - pub async fn _create_main_wallet_and_its_backup() -> (TempFile, String, IndyWalletConfig) { - let wallet_name = format!("test_create_wallet_{}", uuid::Uuid::new_v4()); - - let wallet_config = IndyWalletConfig { - wallet_name: wallet_name.clone(), - wallet_key: DEFAULT_WALLET_KEY.into(), - wallet_key_derivation: WALLET_KDF_RAW.into(), - wallet_type: None, - storage_config: None, - storage_credentials: None, - rekey: None, - rekey_derivation_method: None, - }; - let export_file = TempFile::prepare_path(&wallet_name); - - let wallet = create_and_open_as_main_wallet(&wallet_config) - .await - .unwrap(); - - setup_wallet_backup(wallet.as_ref(), &export_file).await; - - (export_file, wallet_name.to_string(), wallet_config) - } -} - -#[cfg(test)] -pub mod tests { - use aries_vcx_core::{ - global::settings::{DEFAULT_WALLET_BACKUP_KEY, DEFAULT_WALLET_KEY, WALLET_KDF_RAW}, - wallet::base_wallet::ManageWallet, - }; - use test_utils::devsetup::{SetupMocks, TempFile}; - - use crate::{ - api_vcx::api_global::wallet::{ - export_main_wallet, - indy::{ - close_main_wallet, create_and_open_as_main_wallet, create_main_wallet, - open_as_main_wallet, test_utils::_create_main_wallet_and_its_backup, wallet_import, - IndyImportConfig, IndyWalletConfig, - }, - }, - errors::error::LibvcxErrorKind, - }; - - #[tokio::test] - async fn test_wallet_create() { - let _setup = SetupMocks::init(); - - let wallet_name = format!("test_create_wallet_{}", uuid::Uuid::new_v4()); - let config: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": wallet_name, - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW - })) - .unwrap(); - - create_main_wallet(&config).await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_migrate() { - let wallet_name = format!("test_create_wallet_{}", uuid::Uuid::new_v4()); - let config: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": wallet_name, - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW - })) - .unwrap(); - - create_and_open_as_main_wallet(&config).await.unwrap(); - - let wallet_name = format!("test_migrate_wallet_{}", uuid::Uuid::new_v4()); - let new_config: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": wallet_name, - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW - })) - .unwrap(); - - super::wallet_migrate(&new_config).await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_export_import() { - let _setup = SetupMocks::init(); - let wallet_name = uuid::Uuid::new_v4().to_string(); - let export_file = TempFile::prepare_path(&wallet_name); - let wallet_config = IndyWalletConfig { - wallet_name, - wallet_key: DEFAULT_WALLET_KEY.into(), - wallet_key_derivation: WALLET_KDF_RAW.into(), - wallet_type: None, - storage_config: None, - storage_credentials: None, - rekey: None, - rekey_derivation_method: None, - }; - create_and_open_as_main_wallet(&wallet_config) - .await - .unwrap(); - let backup_key = DEFAULT_WALLET_BACKUP_KEY; - export_main_wallet(&export_file.path.to_string(), backup_key) - .await - .unwrap(); - close_main_wallet().await.unwrap(); - wallet_config.delete_wallet().await.unwrap(); - let import_config: IndyImportConfig = serde_json::from_value(json!({ - "wallet_name": wallet_config.wallet_name.clone(), - "wallet_key": wallet_config.wallet_key.clone(), - "exported_wallet_path": export_file.path, - "backup_key": backup_key, - "wallet_key_derivation": WALLET_KDF_RAW - })) - .unwrap(); - wallet_import(&import_config).await.unwrap(); - wallet_config.delete_wallet().await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_open_with_incorrect_key_fails() { - let _setup = SetupMocks::init(); - let wallet_name = uuid::Uuid::new_v4().to_string(); - let _export_file = TempFile::prepare_path(&wallet_name); - let mut wallet_config = IndyWalletConfig { - wallet_name, - wallet_key: DEFAULT_WALLET_KEY.into(), - wallet_key_derivation: WALLET_KDF_RAW.into(), - wallet_type: None, - storage_config: None, - storage_credentials: None, - rekey: None, - rekey_derivation_method: None, - }; - create_and_open_as_main_wallet(&wallet_config) - .await - .unwrap(); - close_main_wallet().await.unwrap(); - wallet_config.wallet_key = "8dvfYSt5d1taSd6yJdpjq4emkwsPDDLYxkNFysFA2cAA".to_string(); - let err = open_as_main_wallet(&wallet_config).await.unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::WalletAccessFailed); - } - - #[tokio::test] - async fn test_wallet_open_with_wrong_name_fails() { - let _setup = SetupMocks::init(); - - let wallet_config: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": "different_wallet_name", - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW, - })) - .unwrap(); - - assert_eq!( - open_as_main_wallet(&wallet_config) - .await - .unwrap_err() - .kind(), - LibvcxErrorKind::WalletNotFound - ) - } - - #[tokio::test] - async fn test_wallet_open_of_imported_wallet_succeeds() { - let _setup = SetupMocks::init(); - - let (export_wallet_path, wallet_name, wallet_config) = - _create_main_wallet_and_its_backup().await; - - wallet_config.delete_wallet().await.unwrap(); - - let import_config = IndyImportConfig { - wallet_name: wallet_name.clone(), - wallet_key: DEFAULT_WALLET_KEY.into(), - exported_wallet_path: export_wallet_path.path.clone(), - backup_key: DEFAULT_WALLET_BACKUP_KEY.to_string(), - wallet_key_derivation: Some(WALLET_KDF_RAW.into()), - }; - wallet_import(&import_config).await.unwrap(); - - let wallet_config: IndyWalletConfig = serde_json::from_value(json!({ - "wallet_name": &wallet_name, - "wallet_key": DEFAULT_WALLET_KEY, - "wallet_key_derivation": WALLET_KDF_RAW, - })) - .unwrap(); - - open_as_main_wallet(&wallet_config).await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_import_of_opened_wallet_fails() { - let _setup = SetupMocks::init(); - - let (export_wallet_path, wallet_name, wallet_config) = - _create_main_wallet_and_its_backup().await; - - open_as_main_wallet(&wallet_config).await.unwrap(); - - let import_config = IndyImportConfig { - wallet_name, - wallet_key: DEFAULT_WALLET_KEY.into(), - exported_wallet_path: export_wallet_path.path.clone(), - backup_key: DEFAULT_WALLET_BACKUP_KEY.to_string(), - wallet_key_derivation: None, - }; - assert_eq!( - wallet_import(&import_config).await.unwrap_err().kind(), - LibvcxErrorKind::DuplicationWallet - ) - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/mod.rs deleted file mode 100644 index fdb32fc8d4..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_global/wallet/mod.rs +++ /dev/null @@ -1,447 +0,0 @@ -#[cfg(feature = "askar_wallet")] -pub mod askar; -#[cfg(feature = "askar_wallet")] -pub use askar as wallet; - -#[cfg(feature = "vdrtools_wallet")] -pub mod indy; -#[cfg(feature = "vdrtools_wallet")] -pub use indy as wallet; - -pub static GLOBAL_BASE_ANONCREDS: RwLock>> = RwLock::new(None); - -pub fn setup_global_anoncreds() -> LibvcxResult<()> { - let base_anoncreds_impl = Arc::new(IndyCredxAnonCreds); - let mut b_anoncreds = GLOBAL_BASE_ANONCREDS.write()?; - *b_anoncreds = Some(base_anoncreds_impl); - Ok(()) -} - -pub async fn export_main_wallet(path: &str, backup_key: &str) -> LibvcxResult<()> { - let main_wallet = get_main_wallet()?; - map_ariesvcx_core_result(main_wallet.as_ref().export_wallet(path, backup_key).await) -} - -use std::{ - str::FromStr, - sync::{Arc, RwLock}, -}; - -use aries_vcx::{ - aries_vcx_core::{ - anoncreds::credx_anoncreds::IndyCredxAnonCreds, wallet::structs_io::UnpackMessageOutput, - }, - protocols::mediated_connection::pairwise_info::PairwiseInfo, -}; -use aries_vcx_core::{ - errors::error::{AriesVcxCoreError, AriesVcxCoreErrorKind}, - wallet::{ - base_wallet::{ - did_wallet::DidWallet, issuer_config::IssuerConfig, record::Record, - record_category::RecordCategory, record_wallet::RecordWallet, - search_filter::SearchFilter, BaseWallet, - }, - indy::indy_wallet_record::IndyWalletRecord, - record_tags::RecordTags, - }, -}; -use public_key::{Key, KeyType}; - -use crate::{ - api_vcx::api_global::profile::{get_main_ledger_write, get_main_wallet}, - errors::{ - error::LibvcxResult, mapping_from_ariesvcx::map_ariesvcx_result, - mapping_from_ariesvcxcore::map_ariesvcx_core_result, - }, -}; - -#[cfg(all(feature = "vdrtools_wallet", feature = "askar_wallet"))] -compile_error!("features `vdrtools_wallet` and `askar_wallet` are mutually exclusive"); - -pub async fn key_for_local_did(did: &str) -> LibvcxResult { - let wallet = get_main_wallet()?; - - map_ariesvcx_core_result(wallet.key_for_did(did).await.map(|key| key.base58())) -} - -pub async fn wallet_sign(vk: &str, data_raw: &[u8]) -> LibvcxResult> { - let wallet = get_main_wallet()?; - - let verkey = Key::from_base58(vk, KeyType::Ed25519)?; - map_ariesvcx_core_result(wallet.sign(&verkey, data_raw).await) -} - -pub async fn wallet_verify(vk: &str, msg: &[u8], signature: &[u8]) -> LibvcxResult { - let wallet = get_main_wallet()?; - - let verkey = Key::from_base58(vk, KeyType::Ed25519)?; - map_ariesvcx_core_result(wallet.verify(&verkey, msg, signature).await) -} - -pub async fn replace_did_keys_start(did: &str) -> LibvcxResult { - let wallet = get_main_wallet()?; - - map_ariesvcx_core_result( - wallet - .replace_did_key_start(did, None) - .await - .map(|key| key.base58()), - ) -} - -pub async fn rotate_verkey_apply(did: &str, temp_vk: &str) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - map_ariesvcx_result( - aries_vcx::common::keys::rotate_verkey_apply( - wallet.as_ref(), - get_main_ledger_write()?.as_ref(), - &did.parse()?, - temp_vk, - ) - .await, - ) -} - -pub async fn wallet_unpack_message(payload: &[u8]) -> LibvcxResult { - let wallet = get_main_wallet()?; - map_ariesvcx_core_result(wallet.unpack_message(payload).await) -} - -pub async fn wallet_create_and_store_did(seed: Option<&str>) -> LibvcxResult { - let wallet = get_main_wallet()?; - let did_data = wallet.create_and_store_my_did(seed, None).await?; - Ok(PairwiseInfo { - pw_did: did_data.did().into(), - pw_vk: did_data.verkey().base58(), - }) -} - -pub async fn wallet_configure_issuer(enterprise_seed: &str) -> LibvcxResult { - let wallet = get_main_wallet()?; - map_ariesvcx_core_result(wallet.configure_issuer(enterprise_seed).await) -} - -pub async fn wallet_add_wallet_record( - type_: &str, - id: &str, - value: &str, - option: Option<&str>, -) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - let tags: Option = option.map(serde_json::from_str).transpose()?; - - let record = if let Some(record_tags) = tags { - Record::builder() - .name(id.into()) - .category(RecordCategory::from_str(type_)?) - .value(value.into()) - .tags(record_tags) - .build() - } else { - Record::builder() - .name(id.into()) - .category(RecordCategory::from_str(type_)?) - .value(value.into()) - .build() - }; - - map_ariesvcx_core_result(wallet.add_record(record).await) -} - -pub async fn wallet_update_wallet_record_value( - xtype: &str, - id: &str, - value: &str, -) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - map_ariesvcx_core_result( - wallet - .update_record_value(RecordCategory::from_str(xtype)?, id, value) - .await, - ) -} - -pub async fn wallet_update_wallet_record_tags( - xtype: &str, - id: &str, - tags_json: &str, -) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - let tags: RecordTags = serde_json::from_str(tags_json)?; - map_ariesvcx_core_result( - wallet - .update_record_tags(RecordCategory::from_str(xtype)?, id, tags) - .await, - ) -} - -pub async fn wallet_add_wallet_record_tags( - xtype: &str, - id: &str, - tags_json: &str, -) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - let record = wallet - .get_record(RecordCategory::from_str(xtype)?, id) - .await?; - - let tags = { - let mut tags: RecordTags = serde_json::from_str(tags_json)?; - tags.merge(record.tags().clone()); - tags - }; - - map_ariesvcx_core_result( - wallet - .update_record_tags(RecordCategory::from_str(xtype)?, id, tags) - .await, - ) -} - -pub async fn wallet_delete_wallet_record_tags( - xtype: &str, - id: &str, - tags_json: &str, -) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - let tags: RecordTags = serde_json::from_str(tags_json)?; - - let record = wallet - .get_record(RecordCategory::from_str(xtype)?, id) - .await?; - - let mut found_tags = record.tags().clone(); - for key in tags { - found_tags.remove(key); - } - - map_ariesvcx_core_result( - wallet - .update_record_tags(RecordCategory::from_str(xtype)?, id, found_tags) - .await, - ) -} - -pub async fn wallet_get_wallet_record( - xtype: &str, - id: &str, - _options: &str, -) -> LibvcxResult { - let wallet = get_main_wallet()?; - - map_ariesvcx_result( - wallet - .get_record(RecordCategory::from_str(xtype)?, id) - .await - .map(|res| { - let wallet_record = IndyWalletRecord::from_record(res)?; - - Ok(serde_json::to_string(&wallet_record)?) - })?, - ) -} - -pub async fn wallet_delete_wallet_record(xtype: &str, id: &str) -> LibvcxResult<()> { - let wallet = get_main_wallet()?; - map_ariesvcx_core_result( - wallet - .delete_record(RecordCategory::from_str(xtype)?, id) - .await, - ) -} - -pub async fn wallet_search_records(xtype: &str, query_json: &str) -> LibvcxResult { - let wallet = get_main_wallet()?; - let records = wallet - .search_record( - RecordCategory::from_str(xtype)?, - Some(SearchFilter::JsonFilter(query_json.into())), - ) - .await?; - - let indy_records = records - .into_iter() - .map(IndyWalletRecord::from_record) - .collect::, _>>()?; - - let res = serde_json::to_string(&indy_records) - .map_err(|err| AriesVcxCoreError::from_msg(AriesVcxCoreErrorKind::InvalidJson, err)); - - map_ariesvcx_core_result(res) -} - -#[cfg(test)] -pub mod test_utils { - use ::test_utils::devsetup::TempFile; - use aries_vcx::global::settings::DEFAULT_WALLET_BACKUP_KEY; - use aries_vcx_core::wallet::base_wallet::{ - record::Record, record_category::RecordCategory, BaseWallet, - }; - - use crate::api_vcx::api_global::wallet::{export_main_wallet, wallet::close_main_wallet}; - - pub async fn setup_wallet_backup(wallet: &impl BaseWallet, export_file: &TempFile) { - wallet.create_and_store_my_did(None, None).await.unwrap(); - - let new_record = Record::builder() - .name("id1".to_owned()) - .category(RecordCategory::default()) - .value("value1".to_owned()) - .build(); - - wallet.add_record(new_record).await.unwrap(); - export_main_wallet(&export_file.path, DEFAULT_WALLET_BACKUP_KEY) - .await - .unwrap(); - - close_main_wallet().await.unwrap(); - } -} - -// TODO: remove feature flag when closing wallet is implemented for askar -#[cfg(feature = "vdrtools_wallet")] -#[cfg(test)] -mod tests { - use aries_vcx_core::wallet::{ - base_wallet::record_category::RecordCategory, indy::indy_wallet_record::IndyWalletRecord, - }; - - use crate::{ - api_vcx::api_global::wallet::{ - wallet::{close_main_wallet, test_utils::_create_and_open_wallet}, - wallet_add_wallet_record, wallet_delete_wallet_record, wallet_get_wallet_record, - wallet_update_wallet_record_value, - }, - errors::error::{LibvcxErrorKind, LibvcxResult}, - }; - - #[tokio::test] - async fn test_wallet_record_add_with_tag() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - let tags = r#"{"tagName1":"tag1","tagName2":"tag2"}"#.to_string(); - wallet_add_wallet_record(&xtype, &id, &value, Some(&tags)) - .await - .unwrap(); - close_main_wallet().await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_record_add_with_no_tag() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - - wallet_add_wallet_record(&xtype, &id, &value, None) - .await - .unwrap(); - close_main_wallet().await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_record_add_fails_with_duplication_error() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - - wallet_add_wallet_record(&xtype, &id, &value, None) - .await - .unwrap(); - let err = wallet_add_wallet_record(&xtype, &id, &value, None) - .await - .unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::DuplicationWalletRecord); - close_main_wallet().await.unwrap(); - } - - #[tokio::test] - async fn test_wallet_record_get_fails_if_record_does_not_exist() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let options = json!({ - "retrieveType": true, - "retrieveValue": true, - "retrieveTags": false - }) - .to_string(); - let _err = wallet_get_wallet_record(&xtype, &id, &options) - .await - .unwrap_err(); - // copilot demo: example - close_main_wallet().await.unwrap(); - } - - async fn _add_and_get_wallet_record() -> LibvcxResult<()> { - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - let tags = r#"{"tagName1":"tag1","tagName2":"tag2"}"#.to_string(); - - wallet_add_wallet_record(&xtype, &id, &value, Some(&tags)).await?; - - let options = json!({ - "retrieveType": true, - "retrieveValue": true, - "retrieveTags": true - }) - .to_string(); - - let record = wallet_get_wallet_record(&xtype, &id, &options).await?; - let record: IndyWalletRecord = serde_json::from_str(&record)?; - assert_eq!(record.value.unwrap(), value); - Ok(()) - } - - #[tokio::test] - async fn test_wallet_record_delete() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - - wallet_add_wallet_record(&xtype, &id, &value, None) - .await - .unwrap(); - wallet_delete_wallet_record(&xtype, &id).await.unwrap(); - let err = wallet_delete_wallet_record(&xtype, &id).await.unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::WalletRecordNotFound); - let err = wallet_get_wallet_record(&xtype, &id, "{}") - .await - .unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::WalletRecordNotFound); - } - - #[tokio::test] - async fn test_wallet_record_update() { - _create_and_open_wallet().await.unwrap(); - - let xtype = RecordCategory::default().to_string(); - let id = "123".to_string(); - let value = "Record Value".to_string(); - let new_value = "New Record Value".to_string(); - - let err = wallet_update_wallet_record_value(&xtype, &id, &new_value) - .await - .unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::WalletRecordNotFound); - wallet_add_wallet_record(&xtype, &id, &value, None) - .await - .unwrap(); - wallet_update_wallet_record_value(&xtype, &id, &new_value) - .await - .unwrap(); - let record = wallet_get_wallet_record(&xtype, &id, "{}").await.unwrap(); - let record: IndyWalletRecord = serde_json::from_str(&record).unwrap(); - assert_eq!(record.value.unwrap(), new_value); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/connection.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/connection.rs deleted file mode 100644 index c0e60fbb30..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/connection.rs +++ /dev/null @@ -1,452 +0,0 @@ -use std::{any::type_name, collections::HashMap, str::FromStr, sync::RwLock}; - -use aries_vcx::{ - errors::error::{AriesVcxError, VcxResult}, - messages::msg_fields::protocols::connection::request::Request, - protocols::connection::{ - invitee::InviteeConnection, inviter::InviterConnection, pairwise_info::PairwiseInfo, - Connection, GenericConnection, State, ThinState, - }, - transport::Transport, -}; -use async_trait::async_trait; -use rand::Rng; -use shared::http_client::post_message; -use url::Url; - -use crate::{ - api_vcx::api_global::profile::{get_main_ledger_read, get_main_wallet}, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -type Map = HashMap; -type Cache = RwLock; - -lazy_static! { - pub static ref CONNECTION_MAP: Cache = RwLock::new(HashMap::new()); -} - -pub struct HttpClient; - -#[async_trait] -impl Transport for HttpClient { - async fn send_message(&self, msg: Vec, service_endpoint: Url) -> VcxResult<()> { - post_message(msg, service_endpoint).await?; - Ok(()) - } -} - -fn new_handle() -> LibvcxResult { - loop { - let handle = rand::thread_rng().gen::(); - if !CONNECTION_MAP.read()?.contains_key(&handle) { - break Ok(handle); - } - } -} - -pub fn get_cloned_generic_connection(handle: &u32) -> LibvcxResult { - CONNECTION_MAP.write()?.get(handle).cloned().ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No connection found for handle: {}", handle), - ) - }) -} - -fn get_con_attribute_with_closure(handle: &u32, closure: F) -> LibvcxResult -where - F: Fn(&GenericConnection) -> LibvcxResult, -{ - let lock = CONNECTION_MAP.read()?; - let con = lock.get(handle).ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No connection found for handle: {}", handle), - ) - })?; - - closure(con) -} - -fn get_cloned_connection(handle: &u32) -> LibvcxResult> -where - Connection: TryFrom, -{ - let con = CONNECTION_MAP - .write()? - .get(handle) - .ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No connection found for handle: {}", handle), - ) - })? - .clone() - .try_into()?; - - Ok(con) -} - -fn add_connection(connection: Connection) -> LibvcxResult -where - GenericConnection: From>, -{ - let handle = new_handle()?; - insert_connection(handle, connection)?; - Ok(handle) -} - -pub fn insert_connection(handle: u32, connection: Connection) -> LibvcxResult<()> -where - GenericConnection: From>, -{ - trace!( - "Inserting connection; Handle: {} - Type: {}", - &handle, - type_name::>() - ); - - CONNECTION_MAP.write()?.insert(handle, connection.into()); - Ok(()) -} - -fn serialize(data: &T) -> LibvcxResult -where - T: serde::ser::Serialize, -{ - serde_json::to_string(data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::SerializationError, - format!("Serialization failed: {}", err), - ) - }) -} - -fn deserialize(data: &str) -> LibvcxResult -where - T: serde::de::DeserializeOwned, -{ - serde_json::from_str(data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Deserialization failed: {}", err), - ) - }) -} - -// ----------------------------- CONSTRUCTORS ------------------------------------ -pub async fn create_inviter(pw_info: Option) -> LibvcxResult { - trace!("create_inviter >>>"); - let pw_info = pw_info.unwrap_or(PairwiseInfo::create(get_main_wallet()?.as_ref()).await?); - let con = InviterConnection::new_inviter("".to_owned(), pw_info); - add_connection(con) -} - -pub async fn create_invitee(_invitation: &str) -> LibvcxResult { - trace!("create_invitee >>>"); - let pairwise_info = PairwiseInfo::create(get_main_wallet()?.as_ref()).await?; - let con = InviteeConnection::new_invitee("".to_owned(), pairwise_info); - add_connection(con) -} - -// ----------------------------- GETTERS ------------------------------------ -pub fn get_thread_id(handle: u32) -> LibvcxResult { - trace!("get_thread_id >>> handle: {}", handle); - - let closure = |con: &GenericConnection| { - GenericConnection::thread_id(con) - .map(ToOwned::to_owned) - .ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No thread ID for connection with handle: {}", &handle), - ) - }) - }; - - get_con_attribute_with_closure(&handle, closure) -} - -pub fn get_pairwise_info(handle: u32) -> LibvcxResult { - trace!("get_pairwise_info >>> handle: {}", handle); - - let closure = |con: &GenericConnection| serialize(GenericConnection::pairwise_info(con)); - - get_con_attribute_with_closure(&handle, closure) -} - -pub fn get_remote_did(handle: u32) -> LibvcxResult { - trace!("get_remote_did >>> handle: {}", handle); - - let closure = |con: &GenericConnection| { - GenericConnection::remote_did(con) - .map(ToOwned::to_owned) - .ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No remote DID for connection with handle: {}", handle), - ) - }) - }; - - get_con_attribute_with_closure(&handle, closure) -} - -pub fn get_remote_vk(handle: u32) -> LibvcxResult { - trace!("get_remote_vk >>> handle: {}", handle); - - let closure = |con: &GenericConnection| GenericConnection::remote_vk(con).map_err(From::from); - - get_con_attribute_with_closure(&handle, closure) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - trace!("get_state >>> handle: {}", handle); - - let closure = |con: &GenericConnection| Ok(GenericConnection::state(con)); - let state = get_con_attribute_with_closure(&handle, closure)?; - - let state_id = match state { - ThinState::Invitee(s) => s as u32, - ThinState::Inviter(s) => s as u32, - }; - - Ok(state_id) -} - -pub fn get_invitation(handle: u32) -> LibvcxResult { - trace!("get_invitation >>> handle: {}", handle); - - let closure = |con: &GenericConnection| { - let invitation = GenericConnection::invitation(con).ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!("No invitation for connection with handle: {}", handle), - ) - })?; - - serialize(invitation) - }; - - get_con_attribute_with_closure(&handle, closure) -} - -// ----------------------------- MSG PROCESSING ------------------------------------ -pub async fn process_invite(handle: u32, invitation: &str) -> LibvcxResult<()> { - trace!("process_invite >>>"); - - let ledger = get_main_ledger_read()?; - let invitation = deserialize(invitation)?; - let con = get_cloned_connection(&handle)? - .accept_invitation(ledger.as_ref(), invitation) - .await?; - - insert_connection(handle, con) -} - -pub async fn process_request( - handle: u32, - request: &str, - service_endpoint: String, - routing_keys: Vec, -) -> LibvcxResult<()> { - trace!("process_request >>>"); - - let con = get_cloned_generic_connection(&handle)?; - let wallet = get_main_wallet()?; - let request: Request = deserialize(request)?; - - let con = match con.state() { - ThinState::Inviter(State::Initial) => { - Connection::try_from(con).map_err(From::from).map(|c| { - c.into_invited( - request - .decorators - .thread - .as_ref() - .map(|t| t.thid.as_str()) - .unwrap_or(request.id.as_str()), - ) - }) - } - ThinState::Inviter(State::Invited) => Connection::try_from(con).map_err(From::from), - s => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "Connection with handle {} cannot process a request; State: {:?}", - handle, s - ), - )), - }?; - - let con = con - .handle_request( - wallet.as_ref(), - request, - Url::from_str(&service_endpoint).map_err(|err| { - LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()) - })?, - routing_keys, - ) - .await?; - - insert_connection(handle, con) -} - -pub async fn process_response(handle: u32, response: &str) -> LibvcxResult<()> { - trace!("process_response >>>"); - - let con = get_cloned_connection(&handle)?; - let response = deserialize(response)?; - let con = con - .handle_response(get_main_wallet()?.as_ref(), response) - .await?; - - insert_connection(handle, con) -} - -pub async fn process_ack(handle: u32, message: &str) -> LibvcxResult<()> { - trace!("process_ack >>>"); - - let con = get_cloned_connection(&handle)?; - let msg = deserialize(message)?; - let con = con.acknowledge_connection(&msg)?; - - insert_connection(handle, con) -} - -// In the old implementation this only consumed the ProblemReport without doing -// anything with it and returned the connection in the initial state. -// -// We'll emulate that for backwards compatibility. -pub fn process_problem_report(handle: u32, _problem_report: &str) -> LibvcxResult<()> { - trace!("process_problem_report >>>"); - let con = get_cloned_generic_connection(&handle)?; - match con.state() { - ThinState::Invitee(_) => insert_connection( - handle, - Connection::new_invitee("".to_owned(), con.pairwise_info().to_owned()), - ), - ThinState::Inviter(_) => insert_connection( - handle, - Connection::new_inviter("".to_owned(), con.pairwise_info().to_owned()), - ), - } -} - -pub async fn send_response(handle: u32) -> LibvcxResult<()> { - trace!("send_response >>>"); - - let con = get_cloned_connection(&handle)?; - let response = con.get_connection_response_msg(); - con.send_message(get_main_wallet()?.as_ref(), &response.into(), &HttpClient) - .await?; - insert_connection(handle, con) -} - -pub async fn send_request( - handle: u32, - service_endpoint: String, - routing_keys: Vec, -) -> LibvcxResult<()> { - trace!("send_request >>>"); - - let con = get_cloned_connection(&handle)?; - let url = Url::from_str(&service_endpoint) - .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?; - let con = con.prepare_request(url, routing_keys).await?; - let request = con.get_request().clone(); - con.send_message(get_main_wallet()?.as_ref(), &request.into(), &HttpClient) - .await?; - - insert_connection(handle, con) -} - -pub async fn send_ack(handle: u32) -> LibvcxResult<()> { - trace!("send_ack >>>"); - - let con = get_cloned_connection(&handle)?; - con.send_message( - get_main_wallet()?.as_ref(), - &con.get_ack().into(), - &HttpClient, - ) - .await?; - Ok(()) -} - -pub async fn send_generic_message(handle: u32, content: String) -> LibvcxResult<()> { - trace!("send_generic_message >>>"); - - let message = serde_json::from_str(&content)?; - let con = get_cloned_generic_connection(&handle)?; - con.send_message(get_main_wallet()?.as_ref(), &message, &HttpClient) - .await?; - Ok(()) -} - -pub async fn create_invite( - handle: u32, - service_endpoint: String, - routing_keys: Vec, -) -> LibvcxResult<()> { - trace!("create_invite >>>"); - - let con = get_cloned_connection(&handle)?; - let con = con.create_invitation( - routing_keys, - Url::from_str(&service_endpoint) - .map_err(|err| LibvcxError::from_msg(LibvcxErrorKind::InvalidUrl, err.to_string()))?, - ); - - insert_connection(handle, con) -} - -// // ------------------------- (DE)SERIALIZATION ---------------------------------- -pub fn to_string(handle: u32) -> LibvcxResult { - trace!("to_string >>>"); - - CONNECTION_MAP - .read()? - .get(&handle) - .ok_or_else(|| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[Connection Cache] get >> Object not found for handle: {}", - handle - ), - ) - }) - .and_then(serialize) -} - -pub fn from_string(connection_data: &str) -> LibvcxResult { - trace!("from_string >>>"); - - let connection = deserialize(connection_data)?; - let handle = new_handle()?; - CONNECTION_MAP.write()?.insert(handle, connection); - - Ok(handle) -} - -// --------------------------------------- CLEANUP --------------------------------------- -pub fn release(handle: u32) -> LibvcxResult<()> { - trace!("release >>>"); - - CONNECTION_MAP - .write() - .map(|mut map| map.remove(&handle)) - .ok(); - Ok(()) -} - -pub fn release_all() { - trace!("release_all >>>"); - CONNECTION_MAP - .write() - .map(|mut map| map.drain().for_each(drop)) - .ok(); -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential.rs deleted file mode 100644 index c1f31208c4..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential.rs +++ /dev/null @@ -1,627 +0,0 @@ -use std::collections::HashMap; - -#[cfg(test)] -use aries_vcx::agency_client::testing::mocking::AgencyMockDecrypted; -use aries_vcx::{ - handlers::{ - issuance::holder::Holder, - util::{matches_opt_thread_id, matches_thread_id}, - }, - messages::{ - msg_fields::protocols::{ - cred_issuance::{ - v1::{offer_credential::OfferCredentialV1, CredentialIssuanceV1}, - CredentialIssuance, - }, - notification::Notification, - }, - AriesMessage, - }, - protocols::issuance::holder::state_machine::HolderState, -}; -use serde_json; -#[cfg(test)] -use test_utils::{ - constants::GET_MESSAGES_DECRYPTED_RESPONSE, mockdata::mockdata_credex::ARIES_CREDENTIAL_OFFER, -}; - -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_read, get_main_wallet}, - api_handle::{ - mediated_connection::{self, send_message}, - object_cache::ObjectCache, - ToU32, - }, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - static ref HANDLE_MAP: ObjectCache = ObjectCache::::new("credentials-cache"); -} - -// This enum is left only to avoid making breaking serialization changes -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(tag = "version", content = "data")] -enum Credentials { - #[serde(rename = "2.0")] - V3(Holder), -} - -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)] -pub struct Credential {} - -fn create_credential(source_id: &str, offer: &str) -> LibvcxResult> { - trace!( - "create_credential >>> source_id: {}, offer: {}", - source_id, - secret!(&offer) - ); - - let offer_message = serde_json::from_str::(offer).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize Message: {:?}", err), - ) - })?; - - let offer_message = match offer_message { - serde_json::Value::Array(_) => { - return Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - "Received offer in legacy format", - )); - } - offer => offer, - }; - - if let Ok(cred_offer) = serde_json::from_value::(offer_message) { - return Ok(Some(Holder::create_from_offer(source_id, cred_offer)?)); - } - - // TODO: Return error in case of error - Ok(None) -} - -pub fn credential_create_with_offer(source_id: &str, offer: &str) -> LibvcxResult { - trace!( - "credential_create_with_offer >>> source_id: {}, offer: {}", - source_id, - secret!(&offer) - ); - - let cred_offer: OfferCredentialV1 = serde_json::from_str(offer).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!( - "Strict `aries` protocol is enabled. Can not parse `aries` formatted Credential \ - Offer: {}", - err - ), - ) - })?; - - let holder = Holder::create_from_offer(source_id, cred_offer)?; - HANDLE_MAP.add(holder) -} - -pub async fn credential_create_with_msgid( - source_id: &str, - connection_handle: u32, - msg_id: &str, -) -> LibvcxResult<(u32, String)> { - trace!( - "credential_create_with_msgid >>> source_id: {}, connection_handle: {}, msg_id: {}", - source_id, - connection_handle, - secret!(&msg_id) - ); - - let offer = get_credential_offer_msg(connection_handle, msg_id).await?; - trace!( - "credential_create_with_msgid ::: for msg_id {} found offer {}", - msg_id, - offer - ); - - let credential = create_credential(source_id, &offer)?.ok_or(LibvcxError::from_msg( - LibvcxErrorKind::InvalidCredentialHandle, - "Connection can not be used for Proprietary Issuance protocol", - ))?; - - let handle = HANDLE_MAP.add(credential)?; - - debug!("inserting credential {} into handle map", source_id); - Ok((handle, offer)) -} - -pub fn holder_find_message_to_handle( - sm: &Holder, - messages: HashMap, -) -> Option<(String, AriesMessage)> { - trace!("holder_find_message_to_handle >>>"); - for (uid, message) in messages { - match sm.get_state() { - HolderState::ProposalSet => { - if let AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::OfferCredential(offer), - )) = &message - { - if matches_opt_thread_id!(offer, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - } - HolderState::RequestSet => match &message { - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::IssueCredential(credential), - )) => { - if matches_thread_id!(credential, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::ProblemReport(problem_report), - )) => { - if matches_opt_thread_id!(problem_report, sm.get_thread_id().unwrap().as_str()) - { - return Some((uid, message)); - } - } - AriesMessage::ReportProblem(problem_report) => { - if matches_opt_thread_id!(problem_report, sm.get_thread_id().unwrap().as_str()) - { - return Some((uid, message)); - } - } - AriesMessage::Notification(Notification::ProblemReport(msg)) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - _ => {} - }, - _ => {} - }; - } - None -} - -pub async fn update_state( - credential_handle: u32, - message: Option<&str>, - connection_handle: u32, -) -> LibvcxResult { - let mut credential = HANDLE_MAP.get_cloned(credential_handle)?; - - trace!("credential::update_state >>> "); - if credential.is_terminal_state() { - return Ok(credential.get_state().to_u32()); - } - let (mediator_uid, aries_msg) = if let Some(message) = message { - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Cannot update state: Message deserialization failed: {:?}", - err - ), - ) - })?; - (None, Some(message)) - } else { - let messages = mediated_connection::get_messages(connection_handle).await?; - match holder_find_message_to_handle(&credential, messages) { - None => (None, None), - Some((uid, msg)) => (Some(uid), Some(msg)), - } - }; - match aries_msg { - None => { - trace!( - "credential::update_state >>> no suitable messages found to progress the protocol" - ); - } - Some(aries_msg) => { - credential - .process_aries_msg( - get_main_wallet()?.as_ref(), - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - aries_msg.clone(), - ) - .await?; - if let Some(uid) = mediator_uid { - trace!("credential::update_state >>> updating messages status in mediator"); - mediated_connection::update_message_status(connection_handle, &uid).await?; - } - match credential.get_final_message()? { - None => {} - Some(msg_response) => { - send_message(connection_handle, msg_response).await?; - } - } - } - } - let state = credential.get_state().to_u32(); - HANDLE_MAP.insert(credential_handle, credential)?; - Ok(state) -} - -pub fn get_credential(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - Ok(json!(credential.get_credential()?.1).to_string()) - }) -} - -pub fn get_attributes(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_attributes().map_err(|err| err.into()) - }) -} - -pub fn get_attachment(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_attachment().map_err(|err| err.into()) - }) -} - -pub fn get_tails_location(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_tails_location().map_err(|err| err.into()) - }) -} - -pub fn get_tails_hash(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_tails_hash().map_err(|err| err.into()) - }) -} - -pub fn get_rev_reg_id(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_rev_reg_id().map_err(|err| err.into()) - }) -} - -pub async fn is_revokable(handle: u32) -> LibvcxResult { - let credential = HANDLE_MAP.get_cloned(handle)?; - credential - .is_revokable(get_main_ledger_read()?.as_ref()) - .await - .map_err(|err| err.into()) -} - -pub async fn delete_credential(handle: u32) -> LibvcxResult<()> { - trace!( - "Credential::delete_credential >>> credential_handle: {}", - handle - ); - let credential = HANDLE_MAP.get_cloned(handle)?; - credential - .delete_credential(get_main_wallet()?.as_ref(), get_main_anoncreds()?.as_ref()) - .await?; - HANDLE_MAP.release(handle) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| Ok(credential.get_state().to_u32())) -} - -pub fn generate_credential_request_msg( - _handle: u32, - _my_pw_did: &str, - _their_pw_did: &str, -) -> LibvcxResult { - Err(LibvcxError::from_msg( - LibvcxErrorKind::ActionNotSupported, - "This action is not implemented yet", - )) - // TODO: implement -} - -pub async fn send_credential_request(handle: u32, connection_handle: u32) -> LibvcxResult<()> { - trace!( - "Credential::send_credential_request >>> credential_handle: {}, connection_handle: {}", - handle, - connection_handle - ); - let mut credential = HANDLE_MAP.get_cloned(handle)?; - let my_pw_did = mediated_connection::get_pw_did(connection_handle)?; - let msg_response = credential - .prepare_credential_request( - get_main_wallet()?.as_ref(), - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - my_pw_did.parse()?, - ) - .await?; - send_message(connection_handle, msg_response).await?; - HANDLE_MAP.insert(handle, credential) -} - -async fn get_credential_offer_msg(connection_handle: u32, msg_id: &str) -> LibvcxResult { - trace!( - "get_credential_offer_msg >>> connection_handle: {}, msg_id: {}", - connection_handle, - msg_id - ); - - let credential_offer = - match mediated_connection::get_message_by_id(connection_handle, msg_id).await { - Ok(message) => match message { - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::OfferCredential(_), - )) => Ok(message), - msg => { - return Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidMessages, - format!("Message of different type was received: {:?}", msg), - )); - } - }, - Err(err) => Err(err), - }?; - - serde_json::to_string(&credential_offer).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidState, - format!("Cannot serialize Offers: {:?}", err), - ) - }) -} - -pub async fn get_credential_offer_messages_with_conn_handle( - connection_handle: u32, -) -> LibvcxResult { - trace!( - "Credential::get_credential_offer_messages_with_conn_handle >>> connection_handle: {}", - connection_handle - ); - - #[cfg(test)] - { - AgencyMockDecrypted::set_next_decrypted_response(GET_MESSAGES_DECRYPTED_RESPONSE); - AgencyMockDecrypted::set_next_decrypted_message(ARIES_CREDENTIAL_OFFER); - } - - let credential_offers: Vec = mediated_connection::get_messages(connection_handle) - .await? - .into_iter() - .filter_map(|(_, a2a_message)| match a2a_message { - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::OfferCredential(_), - )) => Some(a2a_message), - _ => None, - }) - .collect(); - - Ok(json!(credential_offers).to_string()) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - HANDLE_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidCredentialHandle, e.to_string())) -} - -pub fn release_all() { - HANDLE_MAP.drain().ok(); -} - -pub fn is_valid_handle(handle: u32) -> bool { - HANDLE_MAP.has_handle(handle) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - serde_json::to_string(&Credentials::V3(credential.clone())).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidState, - format!("cannot serialize Credential credentialect: {:?}", err), - ) - }) - }) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - HANDLE_MAP - .get(handle, |credential| Ok(credential.get_source_id())) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidCredentialHandle, e.to_string())) -} - -pub fn from_string(credential_data: &str) -> LibvcxResult { - let credential: Credentials = serde_json::from_str(credential_data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize Credential: {:?}", err), - ) - })?; - - match credential { - Credentials::V3(credential) => HANDLE_MAP.add(credential), - } -} - -pub fn is_payment_required(_handle: u32) -> LibvcxResult { - Ok(false) -} - -pub fn get_credential_status(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_credential_status().map_err(|err| err.into()) - }) -} - -pub fn get_thread_id(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |credential| { - credential.get_thread_id().map_err(|err| err.into()) - }) -} - -pub async fn decline_offer( - handle: u32, - connection_handle: u32, - comment: Option<&str>, -) -> LibvcxResult<()> { - let mut credential = HANDLE_MAP.get_cloned(handle)?; - let problem_report = credential.decline_offer(comment)?; - send_message(connection_handle, problem_report.into()).await?; - HANDLE_MAP.insert(handle, credential) -} - -pub mod tests_utils { - pub const BAD_CREDENTIAL_OFFER: &str = r#"{"version": "0.1","to_did": "LtMgSjtFcyPwenK9SHCyb8","from_did": "LtMgSjtFcyPwenK9SHCyb8","claim": {"account_num": ["8BEaoLf8TBmK4BUyX8WWnA"],"name_on_account": ["Alice"]},"schema_seq_no": 48,"issuer_did": "Pd4fnFtRBcMKRVC2go5w3j","claim_name": "Account Certificate","claim_id": "3675417066","msg_ref_id": "ymy5nth"}"#; -} - -#[cfg(test)] - -mod tests { - use aries_vcx::{ - messages::msg_fields::protocols::cred_issuance::v1::issue_credential::IssueCredentialV1, - protocols::issuance::holder::state_machine::HolderState, - }; - use test_utils::{ - devsetup::SetupMocks, - mockdata::{ - mockdata_credex, - mockdata_credex::{ - ARIES_CREDENTIAL_OFFER, ARIES_CREDENTIAL_OFFER_JSON_FORMAT, CREDENTIAL_SM_FINISHED, - }, - }, - }; - - use super::*; - use crate::api_vcx::api_handle::{ - credential::{ - credential_create_with_offer, get_attributes, get_credential, - tests_utils::BAD_CREDENTIAL_OFFER, - }, - mediated_connection::test_utils::build_test_connection_invitee_completed, - }; - - async fn _get_offer(handle: u32) -> String { - let offers = get_credential_offer_messages_with_conn_handle(handle) - .await - .unwrap(); - let offers: serde_json::Value = serde_json::from_str(&offers).unwrap(); - serde_json::to_string(&offers[0]).unwrap() - } - - #[test] - fn test_vcx_credential_release() { - let _setup = SetupMocks::init(); - let handle = credential_create_with_offer( - "test_credential_create_with_offer", - ARIES_CREDENTIAL_OFFER, - ) - .unwrap(); - release(handle).unwrap(); - assert_eq!( - to_string(handle).unwrap_err().kind, - LibvcxErrorKind::InvalidHandle - ); - } - - #[tokio::test] - async fn test_credential_create_with_offer() { - let _setup = SetupMocks::init(); - - let handle = credential_create_with_offer( - "test_credential_create_with_offer", - ARIES_CREDENTIAL_OFFER, - ) - .unwrap(); - assert!(handle > 0); - } - - #[tokio::test] - async fn test_credential_create_with_offer_with_json_attach() { - let _setup = SetupMocks::init(); - - let handle = credential_create_with_offer( - "test_credential_create_with_offer", - ARIES_CREDENTIAL_OFFER_JSON_FORMAT, - ) - .unwrap(); - assert!(handle > 0); - } - - #[tokio::test] - async fn test_credential_create_with_bad_offer() { - let _setup = SetupMocks::init(); - - let err = credential_create_with_offer( - "test_credential_create_with_bad_offer", - BAD_CREDENTIAL_OFFER, - ) - .unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::InvalidJson); - } - - #[tokio::test] - async fn test_credential_serialize_deserialize() { - let _setup = SetupMocks::init(); - - let handle1 = credential_create_with_offer( - "test_credential_serialize_deserialize", - ARIES_CREDENTIAL_OFFER, - ) - .unwrap(); - let cred_original_state = get_state(handle1).unwrap(); - let cred_original_serialized = to_string(handle1).unwrap(); - release(handle1).unwrap(); - - let handle2 = from_string(&cred_original_serialized).unwrap(); - let cred_restored_serialized = to_string(handle2).unwrap(); - let cred_restored_state = get_state(handle2).unwrap(); - - assert_eq!(cred_original_state, cred_restored_state); - assert_eq!(cred_original_serialized, cred_restored_serialized); - } - - #[tokio::test] - async fn test_get_attributes_json_attach() { - let _setup = SetupMocks::init(); - - let handle_cred = - credential_create_with_offer("TEST_CREDENTIAL", ARIES_CREDENTIAL_OFFER_JSON_FORMAT) - .unwrap(); - assert_eq!( - HolderState::OfferReceived as u32, - get_state(handle_cred).unwrap() - ); - - let offer_attrs: String = get_attributes(handle_cred).unwrap(); - let offer_attrs: serde_json::Value = serde_json::from_str(&offer_attrs).unwrap(); - let offer_attrs_expected: serde_json::Value = - serde_json::from_str(mockdata_credex::OFFERED_ATTRIBUTES).unwrap(); - assert_eq!(offer_attrs, offer_attrs_expected); - } - - #[tokio::test] - async fn test_get_credential_offer() { - let _setup = SetupMocks::init(); - - let connection_h = build_test_connection_invitee_completed(); - - let offer = get_credential_offer_messages_with_conn_handle(connection_h) - .await - .unwrap(); - let o: serde_json::Value = serde_json::from_str(&offer).unwrap(); - debug!("Serialized credential offer: {:?}", &o[0]); - let _credential_offer: OfferCredentialV1 = serde_json::from_str(&o[0].to_string()).unwrap(); - } - - #[tokio::test] - async fn test_get_credential_and_deserialize() { - let _setup = SetupMocks::init(); - - let handle = from_string(CREDENTIAL_SM_FINISHED).unwrap(); - let cred_string: String = get_credential(handle).unwrap(); - let cred_value: serde_json::Value = serde_json::from_str(&cred_string).unwrap(); - let _credential_struct: IssueCredentialV1 = - serde_json::from_str(cred_value.to_string().as_str()).unwrap(); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential_def.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential_def.rs deleted file mode 100644 index 933913fc0b..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/credential_def.rs +++ /dev/null @@ -1,104 +0,0 @@ -use anoncreds_types::data_types::identifiers::{ - cred_def_id::CredentialDefinitionId, schema_id::SchemaId, -}; -use aries_vcx::common::primitives::credential_definition::{CredentialDef, PublicEntityStateType}; - -use crate::{ - api_vcx::{ - api_global::profile::{ - get_main_anoncreds, get_main_ledger_read, get_main_ledger_write, get_main_wallet, - }, - api_handle::object_cache::ObjectCache, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - pub static ref CREDENTIALDEF_MAP: ObjectCache = - ObjectCache::::new("credential-defs-cache"); -} - -pub async fn create( - issuer_did: String, - source_id: String, - schema_id: String, - tag: String, - support_revocation: bool, -) -> LibvcxResult { - let cred_def = CredentialDef::create( - get_main_wallet()?.as_ref(), - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - source_id, - did_parser::Did::parse(issuer_did)?, - SchemaId::new(schema_id)?, - tag, - support_revocation, - ) - .await?; - let handle = CREDENTIALDEF_MAP.add(cred_def)?; - Ok(handle) -} - -pub async fn publish(handle: u32) -> LibvcxResult<()> { - let mut cd = CREDENTIALDEF_MAP.get_cloned(handle)?; - if !cd.was_published() { - cd = cd - .publish_cred_def( - get_main_wallet()?.as_ref(), - get_main_ledger_read()?.as_ref(), - get_main_ledger_write()?.as_ref(), - ) - .await?; - } else { - info!("publish >>> Credential definition was already published") - } - CREDENTIALDEF_MAP.insert(handle, cd) -} - -pub fn is_valid_handle(handle: u32) -> bool { - CREDENTIALDEF_MAP.has_handle(handle) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - CREDENTIALDEF_MAP.get(handle, |cd| cd.to_string().map_err(|err| err.into())) -} - -pub fn from_string(data: &str) -> LibvcxResult { - let cred_def: CredentialDef = CredentialDef::from_string(data) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::CreateCredDef, e.to_string()))?; - CREDENTIALDEF_MAP.add(cred_def) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - CREDENTIALDEF_MAP.get(handle, |c| Ok(c.get_source_id().clone())) -} - -pub fn get_cred_def_id(handle: u32) -> LibvcxResult { - CREDENTIALDEF_MAP.get(handle, |c| Ok(c.get_cred_def_id().to_owned())) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - CREDENTIALDEF_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidCredDefHandle, e.to_string())) -} - -pub fn release_all() { - CREDENTIALDEF_MAP.drain().ok(); -} - -pub async fn update_state(handle: u32) -> LibvcxResult { - let mut cd = CREDENTIALDEF_MAP.get_cloned(handle)?; - let res = cd.update_state(get_main_ledger_read()?.as_ref()).await?; - CREDENTIALDEF_MAP.insert(handle, cd)?; - Ok(res) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - CREDENTIALDEF_MAP.get(handle, |s| Ok(s.get_state())) -} - -pub fn check_is_published(handle: u32) -> LibvcxResult { - CREDENTIALDEF_MAP.get(handle, |s| Ok(PublicEntityStateType::Published == s.state)) -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/disclosed_proof.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/disclosed_proof.rs deleted file mode 100644 index 796096795a..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/disclosed_proof.rs +++ /dev/null @@ -1,504 +0,0 @@ -use std::collections::HashMap; - -use aries_vcx::{ - handlers::{ - proof_presentation::prover::Prover, - util::{matches_opt_thread_id, matches_thread_id}, - }, - messages::{ - msg_fields::protocols::{ - notification::Notification, - present_proof::{ - v1::{request::RequestPresentationV1, PresentProofV1}, - PresentProof, - }, - }, - AriesMessage, - }, - protocols::proof_presentation::prover::state_machine::ProverState, -}; -use serde_json; - -use super::mediated_connection::send_message; -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_read, get_main_wallet}, - api_handle::{mediated_connection, object_cache::ObjectCache, ToU32}, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - static ref HANDLE_MAP: ObjectCache = - ObjectCache::::new("disclosed-proofs-cache"); -} - -#[derive(Serialize, Deserialize, Debug)] -#[serde(tag = "version", content = "data")] -enum DisclosedProofs { - #[serde(rename = "2.0")] - V3(Prover), -} - -pub fn create_with_proof_request(source_id: &str, proof_req: &str) -> LibvcxResult { - trace!( - "create_with_proof_request >>> source_id: {}, proof_req: {}", - source_id, - proof_req - ); - - let presentation_request: RequestPresentationV1 = - serde_json::from_str(proof_req).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!( - "Strict `aries` protocol is enabled. Can not parse `aries` formatted \ - Presentation Request: {}\nError: {}", - proof_req, err - ), - ) - })?; - - let proof = Prover::create_from_request(source_id, presentation_request)?; - HANDLE_MAP.add(proof) -} - -pub async fn create_with_msgid( - source_id: &str, - connection_handle: u32, - msg_id: &str, -) -> LibvcxResult<(u32, String)> { - let proof_request = get_proof_request(connection_handle, msg_id).await?; - - let presentation_request: RequestPresentationV1 = serde_json::from_str(&proof_request) - .map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!( - "Strict `aries` protocol is enabled. Can not parse `aries` formatted \ - Presentation Request: {}\nError: {}", - proof_request, err - ), - ) - })?; - - let proof = Prover::create_from_request(source_id, presentation_request)?; - - let handle = HANDLE_MAP.add(proof)?; - - debug!("inserting disclosed proof {} into handle map", source_id); - Ok((handle, proof_request)) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - HANDLE_MAP - .get(handle, |proof| Ok(proof.get_state().to_u32())) - .map_err(|e| { - LibvcxError::from_msg(LibvcxErrorKind::InvalidDisclosedProofHandle, e.to_string()) - }) -} - -pub fn prover_find_message_to_handle( - sm: &Prover, - messages: HashMap, -) -> Option<(String, AriesMessage)> { - trace!("prover_find_message_to_handle >>> messages: {:?}", messages); - for (uid, message) in messages { - match sm.get_state() { - ProverState::PresentationProposalSent => match &message { - AriesMessage::ReportProblem(msg) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::Notification(Notification::ProblemReport(msg)) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::PresentProof(PresentProof::V1( - PresentProofV1::RequestPresentation(msg), - )) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - _ => {} - }, - ProverState::PresentationSent => match &message { - AriesMessage::Notification(Notification::Ack(msg)) => { - if matches_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::PresentProof(PresentProof::V1(PresentProofV1::Ack(msg))) => { - if matches_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::ReportProblem(msg) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::Notification(Notification::ProblemReport(msg)) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::PresentProof(PresentProof::V1(PresentProofV1::ProblemReport( - msg, - ))) => { - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - _ => {} - }, - _ => {} - }; - } - None -} - -pub async fn update_state( - handle: u32, - message: Option<&str>, - connection_handle: u32, -) -> LibvcxResult { - let mut proof = HANDLE_MAP.get_cloned(handle)?; - trace!( - "disclosed_proof::update_state >>> connection_handle: {:?}, message: {:?}", - connection_handle, - message - ); - if !proof.progressable_by_message() { - trace!("disclosed_proof::update_state >> found no available transition"); - return Ok(proof.get_state().to_u32()); - } - - if let Some(message) = message { - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Can not updated state with message: Message deserialization failed: {:?}", - err - ), - ) - })?; - trace!( - "disclosed_proof::update_state >>> updating using message {:?}", - message - ); - proof.process_aries_msg(message).await?; - } else { - let messages = mediated_connection::get_messages(connection_handle).await?; - trace!( - "disclosed_proof::update_state >>> found messages: {:?}", - messages - ); - if let Some((uid, message)) = prover_find_message_to_handle(&proof, messages) { - proof.process_aries_msg(message).await?; - mediated_connection::update_message_status(connection_handle, &uid).await?; - }; - } - let state: u32 = proof.get_state().to_u32(); - HANDLE_MAP.insert(handle, proof)?; - Ok(state) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| { - serde_json::to_string(&DisclosedProofs::V3(proof.clone())).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidState, - format!("cannot serialize DisclosedProof proofect: {:?}", err), - ) - }) - }) -} - -pub fn from_string(proof_data: &str) -> LibvcxResult { - let proof: DisclosedProofs = serde_json::from_str(proof_data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("cannot deserialize DisclosedProofs object: {:?}", err), - ) - })?; - - match proof { - DisclosedProofs::V3(proof) => HANDLE_MAP.add(proof), - } -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - HANDLE_MAP.release(handle).map_err(|e| { - LibvcxError::from_msg(LibvcxErrorKind::InvalidDisclosedProofHandle, e.to_string()) - }) -} - -pub fn release_all() { - HANDLE_MAP.drain().ok(); -} - -pub fn get_presentation_msg(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| { - let presentation = proof.get_presentation_msg()?; - Ok(json!(presentation).to_string()) - }) -} - -pub async fn send_proof(handle: u32, connection_handle: u32) -> LibvcxResult<()> { - let mut proof = HANDLE_MAP.get_cloned(handle)?; - let message = proof.mark_presentation_sent()?; - send_message(connection_handle, message).await?; - HANDLE_MAP.insert(handle, proof) -} - -pub fn generate_reject_proof_msg(_handle: u32) -> LibvcxResult { - Err(LibvcxError::from_msg( - LibvcxErrorKind::ActionNotSupported, - "Action generate_reject_proof_msg is not implemented for V3 disclosed proof.", - )) -} - -pub async fn reject_proof(handle: u32, connection_handle: u32) -> LibvcxResult<()> { - info!( - "reject_proof >> handle: {}, connection_handle: {}", - handle, connection_handle - ); - let mut proof = HANDLE_MAP.get_cloned(handle)?; - let message = proof - .decline_presentation_request( - Some(String::from("Presentation Request was rejected")), - None, - ) - .await?; - send_message(connection_handle, message).await?; - HANDLE_MAP.insert(handle, proof) -} - -pub async fn generate_proof( - handle: u32, - credentials: &str, - self_attested_attrs: &str, -) -> LibvcxResult<()> { - let mut proof = HANDLE_MAP.get_cloned(handle)?; - proof - .generate_presentation( - get_main_wallet()?.as_ref(), - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - serde_json::from_str(credentials)?, - serde_json::from_str(self_attested_attrs)?, - ) - .await?; - HANDLE_MAP.insert(handle, proof) -} - -pub async fn decline_presentation_request( - handle: u32, - connection_handle: u32, - reason: Option<&str>, - proposal: Option<&str>, -) -> LibvcxResult<()> { - let mut proof = HANDLE_MAP.get_cloned(handle)?; - let message = proof - .decline_presentation_request( - reason.map(|s| s.to_string()), - proposal.map(|s| s.to_string()), - ) - .await?; - send_message(connection_handle, message).await?; - HANDLE_MAP.insert(handle, proof) -} - -pub async fn retrieve_credentials(handle: u32) -> LibvcxResult { - let proof = HANDLE_MAP.get_cloned(handle)?; - let retrieved_creds = proof - .retrieve_credentials(get_main_wallet()?.as_ref(), get_main_anoncreds()?.as_ref()) - .await?; - - Ok(serde_json::to_string(&retrieved_creds)?) -} - -pub fn get_proof_request_data(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| { - proof.presentation_request_data().map_err(|err| err.into()) - }) -} - -pub fn get_proof_request_attachment(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| { - proof - .get_proof_request_attachment() - .map_err(|err| err.into()) - }) -} - -pub fn is_valid_handle(handle: u32) -> bool { - HANDLE_MAP.has_handle(handle) -} - -pub fn get_thread_id(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| { - proof.get_thread_id().map_err(|err| err.into()) - }) -} - -async fn get_proof_request(connection_handle: u32, msg_id: &str) -> LibvcxResult { - let presentation_request = { - trace!( - "Prover::get_presentation_request >>> connection_handle: {:?}, msg_id: {:?}", - connection_handle, - msg_id - ); - - let message = mediated_connection::get_message_by_id(connection_handle, msg_id).await?; - - match message { - AriesMessage::PresentProof(PresentProof::V1(PresentProofV1::RequestPresentation( - presentation_request, - ))) => presentation_request, - msg => { - return Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidMessages, - format!("Message of different type was received: {:?}", msg), - )); - } - } - }; - serde_json::to_string_pretty(&presentation_request).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot serialize message: {}", err), - ) - }) -} - -pub async fn get_proof_request_messages(connection_handle: u32) -> LibvcxResult { - trace!( - "get_proof_request_messages >>> connection_handle: {}", - connection_handle - ); - - let presentation_requests: Vec = - mediated_connection::get_messages(connection_handle) - .await? - .into_iter() - .filter_map(|(_, message)| match message { - AriesMessage::PresentProof(PresentProof::V1( - PresentProofV1::RequestPresentation(_), - )) => Some(message), - _ => None, - }) - .collect(); - - Ok(json!(presentation_requests).to_string()) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - HANDLE_MAP - .get(handle, |proof| Ok(proof.get_source_id())) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidProofHandle, e.to_string())) -} - -pub fn get_presentation_status(handle: u32) -> LibvcxResult { - HANDLE_MAP.get(handle, |proof| Ok(proof.presentation_status())) -} - -#[cfg(test)] - -mod tests { - extern crate serde_json; - - use serde_json::Value; - use test_utils::{ - constants::V3_OBJECT_SERIALIZE_VERSION, devsetup::SetupMocks, - mockdata::mockdata_proof::ARIES_PROOF_REQUEST_PRESENTATION, - }; - - use super::*; - use crate::aries_vcx::protocols::proof_presentation::prover::state_machine::ProverState; - - async fn _get_proof_request_messages(connection_h: u32) -> String { - let requests = get_proof_request_messages(connection_h).await.unwrap(); - let requests: Value = serde_json::from_str(&requests).unwrap(); - serde_json::to_string(&requests[0]).unwrap() - } - - #[tokio::test] - async fn test_vcx_disclosed_proof_release() { - let _setup = SetupMocks::init(); - let handle = - create_with_proof_request("TEST_CREDENTIAL", ARIES_PROOF_REQUEST_PRESENTATION).unwrap(); - release(handle).unwrap(); - assert_eq!( - to_string(handle).unwrap_err().kind, - LibvcxErrorKind::InvalidHandle - ) - } - - #[tokio::test] - async fn test_create_proof() { - let _setup = SetupMocks::init(); - - assert!(create_with_proof_request("1", ARIES_PROOF_REQUEST_PRESENTATION).unwrap() > 0); - } - - #[tokio::test] - async fn test_create_fails() { - let _setup = SetupMocks::init(); - - assert_eq!( - create_with_proof_request("1", "{}").unwrap_err().kind(), - LibvcxErrorKind::InvalidJson - ); - } - - #[tokio::test] - async fn get_state_test() { - let _setup = SetupMocks::init(); - - let handle = create_with_proof_request("id", ARIES_PROOF_REQUEST_PRESENTATION).unwrap(); - assert_eq!( - ProverState::PresentationRequestReceived as u32, - get_state(handle).unwrap() - ) - } - - #[tokio::test] - async fn to_string_test() { - let _setup = SetupMocks::init(); - - let handle = create_with_proof_request("id", ARIES_PROOF_REQUEST_PRESENTATION).unwrap(); - - let serialized = to_string(handle).unwrap(); - let j: Value = serde_json::from_str(&serialized).unwrap(); - assert_eq!(j["version"], V3_OBJECT_SERIALIZE_VERSION); - - let handle_2 = from_string(&serialized).unwrap(); - assert_ne!(handle, handle_2); - } - - #[tokio::test] - async fn test_deserialize_fails() { - let _setup = SetupMocks::init(); - - assert_eq!( - from_string("{}").unwrap_err().kind(), - LibvcxErrorKind::InvalidJson - ); - } - - #[tokio::test] - async fn test_deserialize_succeeds_with_self_attest_allowed() { - let _setup = SetupMocks::init(); - - let handle = create_with_proof_request("id", ARIES_PROOF_REQUEST_PRESENTATION).unwrap(); - - let serialized = to_string(handle).unwrap(); - from_string(&serialized).unwrap(); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/issuer_credential.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/issuer_credential.rs deleted file mode 100644 index 5280c28673..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/issuer_credential.rs +++ /dev/null @@ -1,490 +0,0 @@ -use std::collections::HashMap; - -use aries_vcx::{ - handlers::{ - issuance::issuer::Issuer, - util::{matches_opt_thread_id, matches_thread_id, OfferInfo}, - }, - messages::{ - msg_fields::protocols::{ - cred_issuance::{v1::CredentialIssuanceV1, CredentialIssuance}, - notification::Notification, - }, - AriesMessage, - }, - protocols::{issuance::issuer::state_machine::IssuerState, SendClosure}, -}; -use serde_json; - -use super::mediated_connection::send_message; -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_read, get_main_wallet}, - api_handle::{ - connection, connection::HttpClient, credential_def, mediated_connection, - object_cache::ObjectCache, revocation_registry::REV_REG_MAP, ToU32, - }, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - static ref ISSUER_CREDENTIAL_MAP: ObjectCache = - ObjectCache::::new("issuer-credentials-cache"); -} - -#[derive(Serialize, Deserialize, Debug)] -#[serde(tag = "version", content = "data")] -enum IssuerCredentials { - #[serde(rename = "2.0")] - V3(Issuer), -} - -pub fn issuer_credential_create(source_id: String) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.add(Issuer::create(&source_id)?) -} - -pub fn issuer_find_message_to_handle( - sm: &Issuer, - messages: HashMap, -) -> Option<(String, AriesMessage)> { - trace!( - "issuer_find_messages_to_handle >>> messages: {:?}, state: {:?}", - messages, - sm - ); - - for (uid, message) in messages { - match sm.get_state() { - IssuerState::Initial => { - if let AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::ProposeCredential(_), - )) = &message - { - info!( - "In state IssuerState::OfferSet, found matching message ProposeCredential" - ); - return Some((uid, message)); - } - } - IssuerState::OfferSet => match &message { - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::RequestCredential(msg), - )) => { - info!( - "In state IssuerState::OfferSet, found potentially matching message \ - RequestCredential" - ); - warn!("Matching for {}", sm.get_thread_id().unwrap().as_str()); // todo: the state machine has "test" thid, and doesnt match msg - warn!("Msg: {msg:?}"); - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::ProposeCredential(msg), - )) => { - info!( - "In state IssuerState::OfferSet, found potentially matching message \ - ProposeCredential" - ); - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::ReportProblem(msg) => { - info!("In state IssuerState::OfferSet, found matching message ReportProblem"); - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - _ => {} - }, - IssuerState::CredentialSet => match &message { - AriesMessage::CredentialIssuance(CredentialIssuance::V1( - CredentialIssuanceV1::Ack(msg), - )) => { - info!( - "In state IssuerState::CredentialSet, found matching message \ - CredentialIssuance::Ack" - ); - if matches_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::Notification(Notification::Ack(msg)) => { - info!( - "In state IssuerState::CredentialSet, found matching message \ - Notification::Ack" - ); - if matches_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::ReportProblem(msg) => { - info!( - "In state IssuerState::CredentialSet, found matching message ReportProblem" - ); - if matches_opt_thread_id!(msg, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - _ => {} - }, - _ => {} - }; - } - None -} - -pub async fn update_state( - handle: u32, - message: Option<&str>, - connection_handle: u32, -) -> LibvcxResult { - trace!("issuer_credential::update_state >>> "); - let mut credential = ISSUER_CREDENTIAL_MAP.get_cloned(handle)?; - if credential.is_terminal_state() { - return Ok(credential.get_state().to_u32()); - } - if let Some(message) = message { - let msg: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Cannot update state: Message deserialization failed: {:?}", - err - ), - ) - })?; - credential.process_aries_msg(msg).await?; - } else { - let messages = mediated_connection::get_messages(connection_handle).await?; - if let Some((uid, msg)) = issuer_find_message_to_handle(&credential, messages) { - credential.process_aries_msg(msg).await?; - mediated_connection::update_message_status(connection_handle, &uid).await?; - } - } - let res: u32 = credential.get_state().to_u32(); - ISSUER_CREDENTIAL_MAP.insert(handle, credential)?; - Ok(res) -} - -pub async fn update_state_with_message_nonmediated( - handle: u32, - _connection_handle: u32, - message: &str, -) -> LibvcxResult { - trace!("issuer_credential::update_state_nonmediated >>> "); - let mut credential = ISSUER_CREDENTIAL_MAP.get_cloned(handle)?; - if credential.is_terminal_state() { - return Ok(credential.get_state().to_u32()); - } - - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Cannot update state: Message deserialization failed: {:?}", - err - ), - ) - })?; - credential.process_aries_msg(message).await?; - - let res: u32 = credential.get_state().to_u32(); - ISSUER_CREDENTIAL_MAP.insert(handle, credential)?; - Ok(res) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| Ok(credential.get_state().to_u32())) -} - -pub fn get_credential_status(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - credential.get_credential_status().map_err(|err| err.into()) - }) -} - -pub fn get_revocation_id(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - credential.get_revocation_id().map_err(|err| err.into()) - }) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - ISSUER_CREDENTIAL_MAP.release(handle).map_err(|e| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidIssuerCredentialHandle, - e.to_string(), - ) - }) -} - -pub fn release_all() { - ISSUER_CREDENTIAL_MAP.drain().ok(); -} - -pub fn is_valid_handle(handle: u32) -> bool { - ISSUER_CREDENTIAL_MAP.has_handle(handle) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - serde_json::to_string(&IssuerCredentials::V3(credential.clone())).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidState, - format!("cannot serialize IssuerCredential credentialect: {:?}", err), - ) - }) - }) -} - -pub fn from_string(credential_data: &str) -> LibvcxResult { - let issuer_credential: IssuerCredentials = - serde_json::from_str(credential_data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize IssuerCredential: {:?}", err), - ) - })?; - - match issuer_credential { - IssuerCredentials::V3(credential) => ISSUER_CREDENTIAL_MAP.add(credential), - } -} - -pub async fn build_credential_offer_msg_v2( - credential_handle: u32, - cred_def_handle: u32, - rev_reg_handle: u32, - credential_json: &str, - comment: Option<&str>, -) -> LibvcxResult<()> { - if !credential_def::check_is_published(cred_def_handle)? { - return Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - "Cannot issue credential of specified credential definition has not been published on \ - the ledger", - )); - }; - // todo: add check if rev reg was published - let mut credential = ISSUER_CREDENTIAL_MAP.get_cloned(credential_handle)?; - let cred_def = credential_def::CREDENTIALDEF_MAP.get_cloned(cred_def_handle)?; - let offer_info = if cred_def.get_support_revocation() { - let rev_reg = REV_REG_MAP.get_cloned(rev_reg_handle)?; - OfferInfo { - credential_json: credential_json.to_string(), - cred_def_id: credential_def::get_cred_def_id(cred_def_handle)?, - rev_reg_id: Some(rev_reg.get_rev_reg_id()), - tails_file: Some(rev_reg.get_tails_dir()), - } - } else { - OfferInfo { - credential_json: credential_json.to_string(), - cred_def_id: credential_def::get_cred_def_id(cred_def_handle)?, - rev_reg_id: None, - tails_file: None, - } - }; - credential - .build_credential_offer_msg( - get_main_wallet()?.as_ref(), - get_main_anoncreds()?.as_ref(), - offer_info.clone(), - comment.map(|s| s.to_string()), - ) - .await?; - ISSUER_CREDENTIAL_MAP.insert(credential_handle, credential) -} - -pub fn get_credential_offer_msg(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - Ok(credential.get_credential_offer_msg()?) - }) -} - -pub async fn send_credential_offer_v2( - credential_handle: u32, - connection_handle: u32, -) -> LibvcxResult<()> { - let credential = ISSUER_CREDENTIAL_MAP.get_cloned(credential_handle)?; - let credential_offer = credential.get_credential_offer_msg()?; - send_message(connection_handle, credential_offer).await?; - ISSUER_CREDENTIAL_MAP.insert(credential_handle, credential)?; - Ok(()) -} - -pub async fn send_credential_offer_nonmediated( - credential_handle: u32, - connection_handle: u32, -) -> LibvcxResult<()> { - let credential = ISSUER_CREDENTIAL_MAP.get_cloned(credential_handle)?; - - let con = connection::get_cloned_generic_connection(&connection_handle)?; - let wallet = get_main_wallet()?; - - let send_message: SendClosure = Box::new(|msg: AriesMessage| { - Box::pin(async move { con.send_message(wallet.as_ref(), &msg, &HttpClient).await }) - }); - let credential_offer = credential.get_credential_offer_msg()?; - send_message(credential_offer).await?; - - ISSUER_CREDENTIAL_MAP.insert(credential_handle, credential)?; - Ok(()) -} - -pub async fn send_credential(handle: u32, connection_handle: u32) -> LibvcxResult { - let mut credential = ISSUER_CREDENTIAL_MAP.get_cloned(handle)?; - credential - .build_credential(get_main_wallet()?.as_ref(), get_main_anoncreds()?.as_ref()) - .await?; - match credential.get_state() { - IssuerState::Failed => { - let problem_report = credential.get_problem_report()?; - send_message(connection_handle, problem_report.into()).await?; - } - _ => { - let msg_issue_credential = credential.get_msg_issue_credential()?; - send_message(connection_handle, msg_issue_credential.into()).await?; - } - } - let state: u32 = credential.get_state().to_u32(); - ISSUER_CREDENTIAL_MAP.insert(handle, credential)?; - Ok(state) -} - -pub async fn send_credential_nonmediated(handle: u32, connection_handle: u32) -> LibvcxResult { - let mut credential = ISSUER_CREDENTIAL_MAP.get_cloned(handle)?; - let con = connection::get_cloned_generic_connection(&connection_handle)?; - let wallet = get_main_wallet()?; - let send_closure: SendClosure = Box::new(|msg: AriesMessage| { - Box::pin(async move { con.send_message(wallet.as_ref(), &msg, &HttpClient).await }) - }); - credential - .build_credential(get_main_wallet()?.as_ref(), get_main_anoncreds()?.as_ref()) - .await?; - match credential.get_state() { - IssuerState::Failed => { - let problem_report = credential.get_problem_report()?; - send_closure(problem_report.into()).await?; - } - _ => { - let msg_issue_credential = credential.get_msg_issue_credential()?; - send_closure(msg_issue_credential.into()).await?; - } - } - let state: u32 = credential.get_state().to_u32(); - ISSUER_CREDENTIAL_MAP.insert(handle, credential)?; - Ok(state) -} - -pub async fn revoke_credential_local(handle: u32) -> LibvcxResult<()> { - let credential = ISSUER_CREDENTIAL_MAP.get_cloned(handle)?; - credential - .revoke_credential_local( - get_main_wallet()?.as_ref(), - get_main_anoncreds()?.as_ref(), - get_main_ledger_read()?.as_ref(), - ) - .await - .map_err(|err| err.into()) -} - -pub fn get_rev_reg_id(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - credential.get_rev_reg_id().map_err(|err| err.into()) - }) -} - -pub fn is_revokable(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| Ok(credential.is_revokable())) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - credential.get_source_id().map_err(|err| err.into()) - }) -} - -pub fn get_thread_id(handle: u32) -> LibvcxResult { - ISSUER_CREDENTIAL_MAP.get(handle, |credential| { - credential.get_thread_id().map_err(|err| err.into()) - }) -} - -#[cfg(test)] -mod tests { - use test_utils::{constants::V3_OBJECT_SERIALIZE_VERSION, devsetup::SetupMocks}; - - use super::*; - - fn _issuer_credential_create() -> u32 { - issuer_credential_create("1".to_string()).unwrap() - } - - fn _cred_json() -> &'static str { - "{\"attr\":\"value\"}" - } - - #[test] - fn test_vcx_issuer_credential_release() { - let _setup = SetupMocks::init(); - let handle = _issuer_credential_create(); - release(handle).unwrap(); - assert_eq!( - to_string(handle).unwrap_err().kind, - LibvcxErrorKind::InvalidHandle - ) - } - - #[tokio::test] - async fn test_issuer_credential_create_succeeds() { - let _setup = SetupMocks::init(); - - let handle = _issuer_credential_create(); - assert!(handle > 0); - } - - #[tokio::test] - async fn test_to_string_succeeds() { - let _setup = SetupMocks::init(); - - let handle = _issuer_credential_create(); - let string = to_string(handle).unwrap(); - assert!(!string.is_empty()); - } - - #[tokio::test] - async fn test_from_string_succeeds() { - let _setup = SetupMocks::init(); - - let handle = _issuer_credential_create(); - - let string = to_string(handle).unwrap(); - - let value: serde_json::Value = serde_json::from_str(&string).unwrap(); - assert_eq!(value["version"], V3_OBJECT_SERIALIZE_VERSION); - - release(handle).unwrap(); - - let new_handle = from_string(&string).unwrap(); - - let new_string = to_string(new_handle).unwrap(); - assert_eq!(new_string, string); - } - - #[tokio::test] - async fn test_release_all() { - let _setup = SetupMocks::init(); - - let h1 = _issuer_credential_create(); - let h2 = _issuer_credential_create(); - let h3 = _issuer_credential_create(); - release_all(); - assert!(!is_valid_handle(h1)); - assert!(!is_valid_handle(h2)); - assert!(!is_valid_handle(h3)); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mediated_connection.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mediated_connection.rs deleted file mode 100644 index 48d60de9b8..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mediated_connection.rs +++ /dev/null @@ -1,569 +0,0 @@ -use std::collections::HashMap; - -use aries_vcx::{ - agency_client::{api::downloaded_message::DownloadedMessage, MessageStatusCode}, - handlers::{mediated_connection::MediatedConnection, util::AnyInvitation}, - messages::{ - msg_fields::protocols::connection::{ - invitation::{Invitation, InvitationContent}, - request::Request, - }, - AriesMessage, - }, - protocols::{ - connection::invitee::any_invitation_into_did_doc, - mediated_connection::pairwise_info::PairwiseInfo, - }, -}; -use serde_json; -use uuid::Uuid; - -use crate::{ - api_vcx::{ - api_global::{ - agency_client::get_main_agency_client, - profile::{get_main_ledger_read, get_main_wallet}, - wallet::{wallet_sign, wallet_verify}, - }, - api_handle::{object_cache::ObjectCache, ToU32}, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - pub static ref CONNECTION_MAP: ObjectCache = - ObjectCache::::new("connections-cache"); -} - -pub fn generate_public_invitation(public_did: &str, label: &str) -> LibvcxResult { - trace!( - "generate_public_invite >>> label: {}, public_did: {}", - public_did, - label - ); - let content = InvitationContent::builder_public() - .label(label.to_owned()) - .did(public_did.to_owned()) - .build(); - let invite: Invitation = Invitation::builder() - .id(Uuid::new_v4().to_string()) - .content(content) - .build(); - - let invitation = AriesMessage::from(invite); - Ok(json!(invitation).to_string()) -} - -pub fn is_valid_handle(handle: u32) -> bool { - CONNECTION_MAP.has_handle(handle) -} - -pub fn get_agent_did(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| { - Ok(connection - .cloud_agent_info() - .ok_or(LibvcxError::from_msg( - LibvcxErrorKind::NoAgentInformation, - "Missing cloud agent info", - ))? - .agent_did) - }) -} - -pub fn get_agent_verkey(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| { - Ok(connection - .cloud_agent_info() - .ok_or(LibvcxError::from_msg( - LibvcxErrorKind::NoAgentInformation, - "Missing cloud agent info", - ))? - .agent_vk) - }) -} - -pub fn get_pw_did(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| { - Ok(connection.pairwise_info().pw_did.to_string()) - }) -} - -pub fn get_pw_verkey(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| { - Ok(connection.pairwise_info().pw_vk.clone()) - }) -} - -pub fn get_their_pw_did(handle: u32) -> LibvcxResult { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection.remote_did().map_err(|err| err.into()) -} - -pub fn get_their_pw_verkey(handle: u32) -> LibvcxResult { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection.remote_vk().map_err(|err| err.into()) -} - -pub async fn verify_signature( - connection_handle: u32, - data: &[u8], - signature: &[u8], -) -> LibvcxResult { - let vk = get_their_pw_verkey(connection_handle)?; - wallet_verify(&vk, data, signature).await -} - -pub async fn sign_data(connection_handle: u32, data: &[u8]) -> LibvcxResult> { - let vk = get_pw_verkey(connection_handle)?; - wallet_sign(&vk, data).await -} - -pub fn get_thread_id(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| Ok(connection.get_thread_id())) -} - -pub fn get_state(handle: u32) -> u32 { - trace!("get_state >>> handle = {:?}", handle); - CONNECTION_MAP - .get(handle, |connection| Ok(connection.get_state().to_u32())) - .unwrap_or(0) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| Ok(connection.get_source_id())) -} - -pub fn store_connection(connection: MediatedConnection) -> LibvcxResult { - CONNECTION_MAP - .add(connection) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::CreateConnection, e.to_string())) -} - -pub async fn create_connection(source_id: &str) -> LibvcxResult { - trace!("create_connection >>> source_id: {}", source_id); - let connection = MediatedConnection::create( - source_id, - get_main_wallet()?.as_ref(), - &get_main_agency_client()?, - true, - ) - .await?; - store_connection(connection) -} - -pub async fn create_connection_with_invite(source_id: &str, details: &str) -> LibvcxResult { - debug!("create connection {} with invite {}", source_id, details); - if let Ok(invitation) = serde_json::from_str::(details) { - let ddo = - any_invitation_into_did_doc(get_main_ledger_read()?.as_ref(), &invitation).await?; - let connection = MediatedConnection::create_with_invite( - source_id, - get_main_wallet()?.as_ref(), - &get_main_agency_client()?, - invitation, - ddo, - true, - ) - .await?; - store_connection(connection) - } else { - Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - "Used invite has invalid structure", - )) - } -} - -pub async fn create_with_request_v2(request: &str, pw_info: PairwiseInfo) -> LibvcxResult { - let request: Request = serde_json::from_str(request).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize connection request: {:?}", err), - ) - })?; - - let connection = MediatedConnection::create_with_request( - get_main_wallet()?.as_ref(), - request, - pw_info, - &get_main_agency_client()?, - ) - .await?; - store_connection(connection) -} - -pub async fn send_generic_message(handle: u32, msg: &str) -> LibvcxResult { - let connection = CONNECTION_MAP.get_cloned(handle)?; - - connection - .send_generic_message(get_main_wallet()?.as_ref(), msg) - .await - .map_err(|err| err.into()) -} - -pub async fn send_handshake_reuse(handle: u32, oob_msg: &str) -> LibvcxResult<()> { - let connection = CONNECTION_MAP.get_cloned(handle)?; - - connection - .send_handshake_reuse(get_main_wallet()?.as_ref(), oob_msg) - .await - .map_err(|err| err.into()) -} - -pub async fn update_state_with_message(handle: u32, message: &str) -> LibvcxResult { - let mut connection = CONNECTION_MAP.get_cloned(handle)?; - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!( - "Failed to deserialize message {} into A2AMessage, err: {:?}", - message, err - ), - ) - })?; - - connection - .update_state_with_message( - get_main_wallet()?.as_ref(), - get_main_agency_client()?, - Some(message), - ) - .await?; - let state: u32 = connection.get_state().to_u32(); - CONNECTION_MAP.insert(handle, connection)?; - Ok(state) -} - -pub async fn handle_message(handle: u32, message: &str) -> LibvcxResult<()> { - let mut connection = CONNECTION_MAP.get_cloned(handle)?; - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!( - "Failed to deserialize message {} into A2AMessage, err: {:?}", - message, err - ), - ) - })?; - - connection - .handle_message(message, get_main_wallet()?.as_ref()) - .await?; - CONNECTION_MAP.insert(handle, connection) -} - -pub async fn update_state(handle: u32) -> LibvcxResult { - let mut connection = CONNECTION_MAP.get_cloned(handle)?; - if connection.is_in_final_state() { - info!( - "connection::update_state >> connection {} is in final state, trying to respond to \ - messages", - handle - ); - - connection - .find_and_handle_message(get_main_wallet()?.as_ref(), &get_main_agency_client()?) - .await? - } else { - info!( - "connection::update_state >> connection {} is not in final state, trying to update \ - state", - handle - ); - - connection - .find_message_and_update_state(get_main_wallet()?.as_ref(), &get_main_agency_client()?) - .await? - }; - let state: u32 = connection.get_state().to_u32(); - CONNECTION_MAP.insert(handle, connection)?; - Ok(state) -} - -pub async fn delete_connection(handle: u32) -> LibvcxResult<()> { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection.delete(&get_main_agency_client()?).await?; - release(handle) -} - -pub async fn connect(handle: u32) -> LibvcxResult> { - let mut connection = CONNECTION_MAP.get_cloned(handle)?; - - connection - .connect( - get_main_wallet()?.as_ref(), - &get_main_agency_client()?, - None, - ) - .await?; - let invitation = connection - .get_invite_details() - .map(|invitation| match invitation { - AnyInvitation::Con(invitation) => { - json!(AriesMessage::from(invitation.clone())).to_string() - } - AnyInvitation::Oob(invitation) => { - json!(AriesMessage::from(invitation.clone())).to_string() - } - }); - CONNECTION_MAP.insert(handle, connection)?; - Ok(invitation) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - CONNECTION_MAP.get(handle, |connection| { - connection.to_string().map_err(|err| err.into()) - }) -} - -pub fn from_string(connection_data: &str) -> LibvcxResult { - let connection = MediatedConnection::from_string(connection_data)?; - CONNECTION_MAP.add(connection) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - CONNECTION_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidConnectionHandle, e.to_string())) -} - -pub fn release_all() { - CONNECTION_MAP.drain().ok(); -} - -pub fn get_invite_details(handle: u32) -> LibvcxResult { - CONNECTION_MAP - .get(handle, |connection| { - connection - .get_invite_details() - .map(|invitation| match invitation { - AnyInvitation::Con(invitation) => { - json!(AriesMessage::from(invitation.clone())).to_string() - } - AnyInvitation::Oob(invitation) => { - json!(AriesMessage::from(invitation.clone())).to_string() - } - }) - .ok_or(LibvcxError::from_msg( - LibvcxErrorKind::ActionNotSupported, - "Invitation is not available for the connection.", - )) - }) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidConnectionHandle, e.to_string())) -} - -pub async fn get_messages(handle: u32) -> LibvcxResult> { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection - .get_messages(&get_main_agency_client()?) - .await - .map_err(|err| err.into()) -} - -pub async fn update_message_status(handle: u32, uid: &str) -> LibvcxResult<()> { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection - .update_message_status(uid, &get_main_agency_client()?) - .await - .map_err(|err| err.into()) -} - -pub async fn get_message_by_id(handle: u32, msg_id: &str) -> LibvcxResult { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection - .get_message_by_id(msg_id, &get_main_agency_client()?) - .await - .map_err(|err| err.into()) -} - -pub async fn send_message(handle: u32, message: AriesMessage) -> LibvcxResult<()> { - trace!("connection::send_message >>>"); - let connection = CONNECTION_MAP.get_cloned(handle)?; - let wallet = get_main_wallet()?; - let send_message = connection.send_message_closure(wallet.as_ref()).await?; - send_message(message).await.map_err(|err| err.into()) -} - -pub async fn send_ping(handle: u32, comment: Option<&str>) -> LibvcxResult<()> { - let mut connection = CONNECTION_MAP.get_cloned(handle)?; - - connection - .send_ping(get_main_wallet()?.as_ref(), comment.map(String::from)) - .await?; - CONNECTION_MAP.insert(handle, connection) -} - -pub async fn get_connection_info(handle: u32) -> LibvcxResult { - let connection = CONNECTION_MAP.get_cloned(handle)?; - connection - .get_connection_info(&get_main_agency_client()?) - .await - .map_err(|err| err.into()) -} - -#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, Default)] -pub struct MessageByConnection { - #[serde(rename = "pairwiseDID")] - pub pairwise_did: String, - pub msgs: Vec, -} - -pub fn parse_status_codes( - status_codes: Option>, -) -> LibvcxResult>> { - match status_codes { - Some(codes) => { - let codes = codes - .iter() - .map(|code| { - ::serde_json::from_str::(&format!("\"{}\"", code)).map_err( - |err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot parse message status code: {}", err), - ) - }, - ) - }) - .collect::>>()?; - Ok(Some(codes)) - } - None => Ok(None), - } -} - -pub fn parse_connection_handles(conn_handles: Vec) -> LibvcxResult> { - trace!( - "parse_connection_handles >>> conn_handles: {:?}", - conn_handles - ); - let codes = conn_handles - .iter() - .map(|handle| { - ::serde_json::from_str::(handle).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot parse connection handles: {}", err), - ) - }) - }) - .collect::>>()?; - Ok(codes) -} - -pub async fn download_messages( - conn_handles: Vec, - status_codes: Option>, - uids: Option>, -) -> LibvcxResult> { - trace!( - "download_messages >>> cann_handles: {:?}, status_codes: {:?}, uids: {:?}", - conn_handles, - status_codes, - uids - ); - let mut res = Vec::new(); - let mut connections = Vec::new(); - for conn_handle in conn_handles { - let connection = CONNECTION_MAP.get(conn_handle, |connection| Ok(connection.clone()))?; - connections.push(connection) - } - for connection in connections { - let msgs = connection - .download_messages( - &get_main_agency_client()?, - status_codes.clone(), - uids.clone(), - ) - .await?; - res.push(MessageByConnection { - pairwise_did: connection.pairwise_info().pw_did.clone(), - msgs, - }); - } - trace!("download_messages <<< res: {:?}", res); - Ok(res) -} - -#[cfg(test)] -pub mod test_utils { - use ::test_utils::mockdata::mockdata_mediated_connection::{ - ARIES_CONNECTION_REQUEST, CONNECTION_SM_INVITEE_COMPLETED, - }; - - use super::*; - - pub async fn mock_connection() -> u32 { - build_test_connection_inviter_requested().await - } - - pub async fn build_test_connection_inviter_null() -> u32 { - create_connection("faber_to_alice").await.unwrap() - } - - pub async fn build_test_connection_inviter_invited() -> u32 { - let handle = create_connection("faber_to_alice").await.unwrap(); - connect(handle).await.unwrap(); - handle - } - - pub fn build_test_connection_invitee_completed() -> u32 { - from_string(CONNECTION_SM_INVITEE_COMPLETED).unwrap() - } - - pub async fn build_test_connection_inviter_requested() -> u32 { - let handle = build_test_connection_inviter_invited().await; - update_state_with_message(handle, ARIES_CONNECTION_REQUEST) - .await - .unwrap(); - handle - } -} - -#[cfg(test)] -mod tests { - use ::test_utils::{constants::INSTITUTION_DID, devsetup::SetupMocks}; - use serde_json::Value; - - use super::*; - use crate::api_vcx::VcxStateType; - - fn _setup() { - let _setup = SetupMocks::init(); - } - - fn _source_id() -> &'static str { - "test connection" - } - - #[tokio::test] - async fn test_get_state_fails() { - let _setup = SetupMocks::init(); - - let state = get_state(1); - assert_eq!(state, VcxStateType::VcxStateNone as u32); - } - - #[tokio::test] - async fn test_get_string_fails() { - let _setup = SetupMocks::init(); - - let rc = to_string(0); - assert_eq!(rc.unwrap_err().kind(), LibvcxErrorKind::InvalidHandle); - } - - #[test] - fn test_generate_public_invitation() { - let _setup = SetupMocks::init(); - - let invitation = generate_public_invitation(INSTITUTION_DID, "faber-enterprise").unwrap(); - let parsed: Value = serde_json::from_str(&invitation).unwrap(); - assert!(parsed["@id"].is_string()); - assert_eq!( - parsed["@type"], - "https://didcomm.org/connections/1.0/invitation" - ); - assert_eq!(parsed["did"], INSTITUTION_DID); - assert_eq!(parsed["label"], "faber-enterprise"); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mod.rs deleted file mode 100644 index a904a5bde7..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/mod.rs +++ /dev/null @@ -1,105 +0,0 @@ -use aries_vcx::{ - handlers::mediated_connection::MediatedConnectionState, - protocols::{ - issuance::{holder::state_machine::HolderState, issuer::state_machine::IssuerState}, - mediated_connection::{ - invitee::state_machine::MediatedInviteeState, - inviter::state_machine::MediatedInviterState, - }, - proof_presentation::{ - prover::state_machine::ProverState, verifier::state_machine::VerifierState, - }, - }, -}; - -pub mod connection; -pub mod credential; -pub mod credential_def; -pub mod disclosed_proof; -pub mod issuer_credential; -pub mod mediated_connection; -pub mod object_cache; -pub mod out_of_band; -pub mod proof; -pub mod revocation_registry; -pub mod schema; - -trait ToU32 { - fn to_u32(&self) -> u32; -} - -impl ToU32 for MediatedConnectionState { - fn to_u32(&self) -> u32 { - match self { - MediatedConnectionState::Inviter(inviter_state) => match inviter_state { - MediatedInviterState::Initial => 0, - MediatedInviterState::Invited => 1, - MediatedInviterState::Requested => 2, - MediatedInviterState::Responded => 3, - MediatedInviterState::Completed => 4, - }, - MediatedConnectionState::Invitee(invitee_state) => match invitee_state { - MediatedInviteeState::Initial => 0, - MediatedInviteeState::Invited => 1, - MediatedInviteeState::Requested => 2, - MediatedInviteeState::Responded => 3, - MediatedInviteeState::Completed => 4, - }, - } - } -} - -impl ToU32 for HolderState { - fn to_u32(&self) -> u32 { - match self { - HolderState::Initial => 0, - HolderState::ProposalSet => 1, - HolderState::OfferReceived => 2, - HolderState::RequestSet => 3, - HolderState::Finished => 4, - HolderState::Failed => 5, - } - } -} - -impl ToU32 for IssuerState { - fn to_u32(&self) -> u32 { - match self { - IssuerState::Initial => 0, - IssuerState::ProposalReceived => 1, - IssuerState::OfferSet => 2, - IssuerState::RequestReceived => 4, - IssuerState::CredentialSet => 5, - IssuerState::Finished => 6, - IssuerState::Failed => 7, - } - } -} - -impl ToU32 for ProverState { - fn to_u32(&self) -> u32 { - match self { - ProverState::Initial => 0, - ProverState::PresentationProposalSent => 1, - ProverState::PresentationRequestReceived => 2, - ProverState::PresentationPrepared => 3, - ProverState::PresentationPreparationFailed => 4, - ProverState::PresentationSent => 5, - ProverState::Finished => 6, - ProverState::Failed => 7, - } - } -} - -impl ToU32 for VerifierState { - fn to_u32(&self) -> u32 { - match self { - VerifierState::Initial => 0, - VerifierState::PresentationRequestSet => 1, - VerifierState::PresentationProposalReceived => 2, - VerifierState::PresentationRequestSent => 3, - VerifierState::Finished => 4, - VerifierState::Failed => 5, - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/object_cache/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/object_cache/mod.rs deleted file mode 100644 index 4731552aa9..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/object_cache/mod.rs +++ /dev/null @@ -1,335 +0,0 @@ -use std::{ - collections::HashMap, - ops::{Deref, DerefMut}, - sync::{Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard}, -}; - -use futures::future::BoxFuture; -use rand::Rng; - -use crate::errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}; - -pub struct ObjectCache -where - T: Clone, -{ - pub cache_name: String, - pub store: RwLock>>, -} - -impl ObjectCache -where - T: Clone, -{ - pub fn new(cache_name: &str) -> ObjectCache { - ObjectCache { - store: Default::default(), - cache_name: cache_name.to_string(), - } - } - - fn _lock_store_read(&self) -> LibvcxResult>>> { - match self.store.read() { - Ok(g) => Ok(g), - Err(e) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] _lock_store_read >> Unable to lock Object Store: {:?}", - self.cache_name, e - ), - )), - } - } - - fn _lock_store_write(&self) -> LibvcxResult>>> { - match self.store.write() { - Ok(g) => Ok(g), - Err(e) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] _lock_store_write >> Unable to lock Object Store: {:?}", - self.cache_name, e - ), - )), - } - } - - pub fn has_handle(&self, handle: u32) -> bool { - let store = match self._lock_store_read() { - Ok(g) => g, - Err(_) => return false, - }; - store.contains_key(&handle) - } - - pub fn get(&self, handle: u32, closure: F) -> LibvcxResult - where - F: Fn(&T) -> LibvcxResult, - { - let store = self._lock_store_read()?; - match store.get(&handle) { - Some(m) => match m.lock() { - Ok(obj) => closure(obj.deref()), - Err(_) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] get >> Unable to lock Object Store", - self.cache_name - ), - )), - }, - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] get >> Object not found for handle: {}", - self.cache_name, handle - ), - )), - } - } - - pub fn get_cloned(&self, handle: u32) -> LibvcxResult { - let store = self._lock_store_read()?; - match store.get(&handle) { - Some(m) => match m.lock() { - Ok(obj) => Ok((*obj.deref()).clone()), - Err(_) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] get_cloned >> Unable to lock Object Store", - self.cache_name - ), - )), - }, - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] get_cloned >> Object not found for handle: {}", - self.cache_name, handle - ), - )), - } - } - - #[allow(clippy::await_holding_lock)] - pub async fn get_async<'up, F: 'up, R>(&self, handle: u32, closure: F) -> LibvcxResult - where - for<'r> F: Fn(&'r T, [&'r &'up (); 0]) -> BoxFuture<'r, LibvcxResult>, - { - let store = self._lock_store_read()?; - match store.get(&handle) { - Some(m) => match m.lock() { - Ok(obj) => closure(obj.deref(), []).await, - Err(_) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] get_async >> Unable to lock Object Store", - self.cache_name - ), - )), - }, - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] get_async >> Object not found for handle: {}", - self.cache_name, handle - ), - )), - } - } - - pub fn get_mut(&self, handle: u32, closure: F) -> LibvcxResult - where - F: Fn(&mut T) -> LibvcxResult, - { - let mut store = self._lock_store_write()?; - match store.get_mut(&handle) { - Some(m) => match m.get_mut() { - Ok(mut obj) => closure(obj.deref_mut()), - Err(_) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] get_mut >> Unable to lock Object Store", - self.cache_name - ), - )), - }, - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] get_mut >> Object not found for handle: {}", - self.cache_name, handle - ), - )), - } - } - - #[allow(clippy::await_holding_lock)] - pub async fn get_mut_async<'up, F: 'up, R>(&self, handle: u32, closure: F) -> LibvcxResult - where - for<'r> F: Fn(&'r mut T, [&'r &'up (); 0]) -> BoxFuture<'r, LibvcxResult>, - { - let mut store = self._lock_store_write()?; - match store.get_mut(&handle) { - Some(m) => match m.get_mut() { - Ok(mut obj) => closure(obj.deref_mut(), []).await, - Err(_) => Err(LibvcxError::from_msg( - LibvcxErrorKind::ObjectAccessError, - format!( - "[ObjectCache: {}] get_mut_async >> Unable to lock Object Store", - self.cache_name - ), - )), - }, - None => Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] get_mut_async >> Object not found for handle: {}", - self.cache_name, handle - ), - )), - } - } - - pub fn add(&self, obj: T) -> LibvcxResult { - trace!( - "[ObjectCache: {}] add >> Adding object to cache", - self.cache_name - ); - let mut store = self._lock_store_write()?; - - let mut new_handle = rand::thread_rng().gen::(); - loop { - if !store.contains_key(&new_handle) { - break; - } - new_handle = rand::thread_rng().gen::(); - } - - match store.insert(new_handle, Mutex::new(obj)) { - Some(_) => { - warn!( - "[ObjectCache: {}] add >> Object already exists for handle: {}", - self.cache_name, new_handle - ); - Err(LibvcxError::from_msg( - LibvcxErrorKind::InvalidHandle, - format!( - "[ObjectCache: {}] add >> generated handle {} conflicts with existing \ - handle, failed to store object", - self.cache_name, new_handle - ), - )) - } - None => { - trace!( - "[ObjectCache: {}] add >> Object added to cache for handle: {}", - self.cache_name, - new_handle - ); - Ok(new_handle) - } - } - } - - pub fn insert(&self, handle: u32, obj: T) -> LibvcxResult<()> { - trace!( - "[ObjectCache: {}] insert >> Inserting object with handle: {}", - self.cache_name, - handle - ); - let mut store = self._lock_store_write()?; - - store.insert(handle, Mutex::new(obj)); - Ok(()) - } - - pub fn release(&self, handle: u32) -> LibvcxResult<()> { - trace!( - "[ObjectCache: {}] release >> Releasing object with handle: {}", - self.cache_name, - handle - ); - let mut store = self._lock_store_write()?; - match store.remove(&handle) { - Some(_) => {} - None => { - warn!( - "[ObjectCache: {}] release >> Object not found for handle: {}. Perhaps \ - already released?", - self.cache_name, handle - ); - } - }; - Ok(()) - } - - pub fn drain(&self) -> LibvcxResult<()> { - warn!( - "[ObjectCache: {}] drain >> Draining object cache", - self.cache_name - ); - let mut store = self._lock_store_write()?; - store.clear(); - Ok(()) - } - - #[allow(clippy::len_without_is_empty)] - pub fn len(&self) -> LibvcxResult { - let store = self._lock_store_read()?; - Ok(store.len()) - } -} - -#[cfg(test)] -mod tests { - use test_utils::devsetup::SetupMocks; - - use crate::api_vcx::api_handle::object_cache::ObjectCache; - - #[test] - fn create_test() { - let _setup = SetupMocks::init(); - - let _c: ObjectCache = ObjectCache::new("cache0-u32"); - } - - #[test] - fn get_closure() { - let _setup = SetupMocks::init(); - - let test: ObjectCache = ObjectCache::new("cache1-u32"); - let handle = test.add(2222).unwrap(); - let rtn = test.get(handle, |obj| Ok(*obj)); - assert_eq!(2222, rtn.unwrap()) - } - - #[test] - fn to_string_test() { - let _setup = SetupMocks::init(); - - let test: ObjectCache = ObjectCache::new("cache2-u32"); - let handle = test.add(2222).unwrap(); - let string: String = test.get(handle, |_| Ok(String::from("TEST"))).unwrap(); - - assert_eq!("TEST", string); - } - - #[test] - fn mut_object_test() { - let _setup = SetupMocks::init(); - - let test: ObjectCache = ObjectCache::new("cache3-string"); - let handle = test.add(String::from("TEST")).unwrap(); - - test.get_mut(handle, |obj| { - obj.make_ascii_uppercase(); - Ok(()) - }) - .unwrap(); - - let string: String = test.get(handle, |obj| Ok(obj.clone())).unwrap(); - - assert_eq!("TEST", string); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/out_of_band.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/out_of_band.rs deleted file mode 100644 index 31f4c73a35..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/out_of_band.rs +++ /dev/null @@ -1,251 +0,0 @@ -use aries_vcx::{ - handlers::out_of_band::{receiver::OutOfBandReceiver, sender::OutOfBandSender}, - messages::{ - msg_fields::protocols::out_of_band::{invitation::OobService, OobGoalCode}, - msg_types::Protocol, - AriesMessage, - }, -}; - -use crate::{ - api_vcx::api_handle::object_cache::ObjectCache, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - pub static ref OUT_OF_BAND_SENDER_MAP: ObjectCache = - ObjectCache::::new("out-of-band-sender-cache"); - pub static ref OUT_OF_BAND_RECEIVER_MAP: ObjectCache = - ObjectCache::::new("out-of-band-receiver-cache"); -} - -#[derive(Deserialize)] -pub struct OOBConfig { - pub label: Option, - pub goal_code: Option, - pub goal: Option, - #[serde(default)] - pub handshake_protocols: Vec, -} - -fn store_out_of_band_receiver(oob: OutOfBandReceiver) -> LibvcxResult { - OUT_OF_BAND_RECEIVER_MAP - .add(oob) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::CreateOutOfBand, e.to_string())) -} - -fn store_out_of_band_sender(oob: OutOfBandSender) -> LibvcxResult { - OUT_OF_BAND_SENDER_MAP - .add(oob) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::CreateOutOfBand, e.to_string())) -} - -pub fn create_out_of_band(config: &str) -> LibvcxResult { - trace!("create_out_of_band >>> config: {}", config); - let config: OOBConfig = serde_json::from_str(config).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize out of band message config: {:?}", err), - ) - })?; - let mut oob = OutOfBandSender::create(); - if let Some(label) = &config.label { - oob = oob.set_label(label); - }; - if let Some(goal) = &config.goal { - oob = oob.set_goal(goal); - }; - if let Some(goal_code) = &config.goal_code { - oob = oob.set_goal_code(*goal_code); - }; - for protocol in config.handshake_protocols { - oob = oob.append_handshake_protocol(protocol)?; - } - store_out_of_band_sender(oob) -} - -pub fn create_out_of_band_msg_from_msg(msg: &str) -> LibvcxResult { - trace!("create_out_of_band_msg_from_msg >>> msg: {}", msg); - let msg: AriesMessage = serde_json::from_str(msg).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize supplied message: {:?}", err), - ) - })?; - store_out_of_band_receiver(OutOfBandReceiver::create_from_a2a_msg(&msg)?) -} - -pub fn append_message(handle: u32, msg: &str) -> LibvcxResult<()> { - trace!("append_message >>> handle: {}, msg: {}", handle, msg); - let mut oob = OUT_OF_BAND_SENDER_MAP.get_cloned(handle)?; - let msg = serde_json::from_str(msg).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize supplied message: {:?}", err), - ) - })?; - oob = oob.clone().append_a2a_message(msg)?; - OUT_OF_BAND_SENDER_MAP.insert(handle, oob) -} - -pub fn append_service(handle: u32, service: &str) -> LibvcxResult<()> { - trace!( - "append_service >>> handle: {}, service: {}", - handle, - service - ); - let mut oob = OUT_OF_BAND_SENDER_MAP.get_cloned(handle)?; - let service = serde_json::from_str(service).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("Cannot deserialize supplied message: {:?}", err), - ) - })?; - oob = oob - .clone() - .append_service(&OobService::AriesService(service)); - OUT_OF_BAND_SENDER_MAP.insert(handle, oob) -} - -pub fn append_service_did(handle: u32, did: &str) -> LibvcxResult<()> { - trace!("append_service_did >>> handle: {}, did: {}", handle, did); - let mut oob = OUT_OF_BAND_SENDER_MAP.get_cloned(handle)?; - oob = oob - .clone() - .append_service(&OobService::Did(did.to_string())); - OUT_OF_BAND_SENDER_MAP.insert(handle, oob) -} - -pub fn get_services(handle: u32) -> LibvcxResult> { - trace!("get_services >>> handle: {}", handle); - OUT_OF_BAND_SENDER_MAP.get(handle, |oob| Ok(oob.get_services())) -} - -pub fn extract_a2a_message(handle: u32) -> LibvcxResult { - trace!("extract_a2a_message >>> handle: {}", handle); - OUT_OF_BAND_RECEIVER_MAP.get(handle, |oob| { - if let Some(msg) = oob.extract_a2a_message()? { - let msg = serde_json::to_string(&msg).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::SerializationError, - format!("Cannot serialize message {:?}, err: {:?}", msg, err), - ) - })?; - Ok(msg) - } else { - Ok("".to_string()) - } - }) -} - -pub fn to_a2a_message(handle: u32) -> LibvcxResult { - OUT_OF_BAND_SENDER_MAP.get(handle, |oob| { - let msg = oob.to_aries_message(); - serde_json::to_string(&msg).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::SerializationError, - format!("Cannot serialize message {:?}, err: {:?}", msg, err), - ) - }) - }) -} - -pub fn get_thread_id_sender(handle: u32) -> LibvcxResult { - trace!("get_thread_id_sender >>> handle: {}", handle); - OUT_OF_BAND_SENDER_MAP.get(handle, |oob| Ok(oob.get_id())) -} - -pub fn get_thread_id_receiver(handle: u32) -> LibvcxResult { - trace!("get_thread_id_receiver >>> handle: {}", handle); - OUT_OF_BAND_RECEIVER_MAP.get(handle, |oob| Ok(oob.get_id())) -} - -pub fn to_string_sender(handle: u32) -> LibvcxResult { - OUT_OF_BAND_SENDER_MAP.get(handle, |oob| Ok(oob.to_string())) -} - -pub fn to_string_receiver(handle: u32) -> LibvcxResult { - OUT_OF_BAND_RECEIVER_MAP.get(handle, |oob| Ok(oob.to_string())) -} - -pub fn from_string_sender(oob_data: &str) -> LibvcxResult { - let oob = OutOfBandSender::from_string(oob_data)?; - OUT_OF_BAND_SENDER_MAP.add(oob) -} - -pub fn from_string_receiver(oob_data: &str) -> LibvcxResult { - let oob = OutOfBandReceiver::from_string(oob_data)?; - OUT_OF_BAND_RECEIVER_MAP.add(oob) -} - -pub fn release_sender(handle: u32) -> LibvcxResult<()> { - OUT_OF_BAND_SENDER_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidHandle, e.to_string())) -} - -pub fn release_receiver(handle: u32) -> LibvcxResult<()> { - OUT_OF_BAND_RECEIVER_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidHandle, e.to_string())) -} - -#[cfg(test)] - -mod tests { - use aries_vcx::messages::msg_types::connection::{ConnectionType, ConnectionTypeV1}; - use diddoc_legacy::aries::service::AriesService; - - use super::*; - - async fn build_and_append_service(did: &str) { - let config = json!({ - "label": "foo", - "goal_code": OobGoalCode::IssueVC, - "goal": "foobar" - }) - .to_string(); - let oob_handle = create_out_of_band(&config).unwrap(); - assert!(oob_handle > 0); - let service = OobService::AriesService( - AriesService::create() - .set_service_endpoint("http://example.org/agent".parse().expect("valid url")) - .set_routing_keys(vec!["12345".into()]) - .set_recipient_keys(vec!["abcde".into()]), - ); - append_service(oob_handle, &json!(service).to_string()).unwrap(); - append_service_did(oob_handle, did).unwrap(); - let resolved_services = get_services(oob_handle).unwrap(); - assert_eq!(resolved_services.len(), 2); - assert_eq!(service, resolved_services[0]); - assert_eq!(OobService::Did(did.to_owned()), resolved_services[1]); - } - - #[tokio::test] - async fn test_build_oob_sender_append_services() { - build_and_append_service("V4SGRU86Z58d6TV7PBUe6f").await - } - - #[tokio::test] - async fn test_build_oob_sender_append_services_prefix_did_sov() { - build_and_append_service("did:sov:V4SGRU86Z58d6TV7PBUe6f").await - } - - #[test] - fn test_serde_oob_config_handshake_protocols() { - let config_str = - json!({ "handshake_protocols": vec!["https://didcomm.org/connections/1.0"] }) - .to_string(); - let config_actual: OOBConfig = serde_json::from_str(&config_str).unwrap(); - assert_eq!( - config_actual.handshake_protocols, - vec![Protocol::ConnectionType(ConnectionType::V1( - ConnectionTypeV1::new_v1_0() - ))] - ); - - let config_str = json!({}).to_string(); - let config_actual: OOBConfig = serde_json::from_str(&config_str).unwrap(); - assert_eq!(config_actual.handshake_protocols, vec![]); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/proof.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/proof.rs deleted file mode 100644 index a5ebe89ae0..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/proof.rs +++ /dev/null @@ -1,380 +0,0 @@ -use std::collections::HashMap; - -use anoncreds_types::data_types::messages::{ - nonce::Nonce, pres_request::PresentationRequestPayload, -}; -use aries_vcx::{ - handlers::{ - proof_presentation::verifier::Verifier, - util::{matches_opt_thread_id, matches_thread_id}, - }, - messages::{ - msg_fields::protocols::present_proof::{v1::PresentProofV1, PresentProof}, - AriesMessage, - }, - protocols::{ - proof_presentation::verifier::{ - state_machine::VerifierState, verification_status::PresentationVerificationStatus, - }, - SendClosure, - }, -}; -use serde_json; - -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_read, get_main_wallet}, - api_handle::{ - connection, - connection::HttpClient, - mediated_connection::{self, send_message}, - object_cache::ObjectCache, - }, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - static ref PROOF_MAP: ObjectCache = ObjectCache::::new("proofs-cache"); -} -use crate::api_vcx::api_handle::ToU32; - -#[derive(Serialize, Deserialize, Debug)] -#[serde(tag = "version", content = "data")] -enum Proofs { - #[serde(rename = "2.0")] - V3(Verifier), -} - -pub async fn create_proof( - source_id: String, - requested_attrs: String, - requested_predicates: String, - revocation_details: String, - name: String, -) -> LibvcxResult { - let requested_attrs = serde_json::from_str(&requested_attrs)?; - let requested_predicates = serde_json::from_str(&requested_predicates)?; - let revocation_details = serde_json::from_str(&revocation_details)?; - let presentation_request = PresentationRequestPayload::builder() - .name(name) - .requested_attributes(requested_attrs) - .requested_predicates(requested_predicates) - .non_revoked(revocation_details) - .nonce(Nonce::new()?) - .build(); - let verifier = Verifier::create_from_request(source_id, &presentation_request.into())?; - PROOF_MAP.add(verifier) -} - -pub fn is_valid_handle(handle: u32) -> bool { - PROOF_MAP.has_handle(handle) -} - -pub fn verifier_find_message_to_handle( - sm: &Verifier, - messages: HashMap, -) -> Option<(String, AriesMessage)> { - trace!( - "verifier_find_message_to_handle >>> messages: {:?}", - messages - ); - for (uid, message) in messages { - match sm.get_state() { - VerifierState::Initial => match &message { - AriesMessage::PresentProof(PresentProof::V1( - PresentProofV1::ProposePresentation(_), - )) => { - return Some((uid, message)); - } - AriesMessage::PresentProof(PresentProof::V1( - PresentProofV1::RequestPresentation(_), - )) => { - return Some((uid, message)); - } - _ => {} - }, - VerifierState::PresentationRequestSent => match &message { - AriesMessage::PresentProof(PresentProof::V1(PresentProofV1::Presentation( - presentation, - ))) => { - if matches_thread_id!(presentation, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::PresentProof(PresentProof::V1( - PresentProofV1::ProposePresentation(proposal), - )) => { - if matches_opt_thread_id!(proposal, sm.get_thread_id().unwrap().as_str()) { - return Some((uid, message)); - } - } - AriesMessage::ReportProblem(problem_report) => { - if matches_opt_thread_id!(problem_report, sm.get_thread_id().unwrap().as_str()) - { - return Some((uid, message)); - } - } - _ => {} - }, - _ => {} - }; - } - None -} - -pub async fn update_state( - handle: u32, - message: Option<&str>, - connection_handle: u32, -) -> LibvcxResult { - let mut proof = PROOF_MAP.get_cloned(handle)?; - trace!( - "proof::update_state >>> handle: {}, message: {:?}, connection_handle: {}", - handle, - message, - connection_handle - ); - if !proof.progressable_by_message() { - return Ok(proof.get_state().to_u32()); - } - - if let Some(message) = message { - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Cannot updated state with message: Message deserialization failed: {:?}", - err - ), - ) - })?; - trace!( - "proof::update_state >>> updating using message {:?}", - message - ); - if let Some(message) = proof - .process_aries_msg( - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - message, - ) - .await? - { - send_message(connection_handle, message).await?; - } - } else { - let messages = mediated_connection::get_messages(connection_handle).await?; - trace!("proof::update_state >>> found messages: {:?}", messages); - if let Some((uid, message)) = verifier_find_message_to_handle(&proof, messages) { - if let Some(message) = proof - .process_aries_msg( - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - message, - ) - .await? - { - send_message(connection_handle, message).await?; - } - mediated_connection::update_message_status(connection_handle, &uid).await?; - }; - } - let state: u32 = proof.get_state().to_u32(); - PROOF_MAP.insert(handle, proof)?; - Ok(state) -} - -pub async fn update_state_nonmediated( - handle: u32, - connection_handle: u32, - message: &str, -) -> LibvcxResult { - let mut proof = PROOF_MAP.get_cloned(handle)?; - trace!( - "proof::update_state_nonmediated >>> handle: {}, message: {:?}, connection_handle: {}", - handle, - message, - connection_handle - ); - if !proof.progressable_by_message() { - return Ok(proof.get_state().to_u32()); - } - - let con = connection::get_cloned_generic_connection(&connection_handle)?; - let wallet = get_main_wallet()?; - - let send_message: SendClosure = Box::new(|msg: AriesMessage| { - Box::pin(async move { con.send_message(wallet.as_ref(), &msg, &HttpClient).await }) - }); - - let message: AriesMessage = serde_json::from_str(message).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidOption, - format!( - "Cannot updated state with message: Message deserialization failed: {:?}", - err - ), - ) - })?; - if let Some(message) = proof - .process_aries_msg( - get_main_ledger_read()?.as_ref(), - get_main_anoncreds()?.as_ref(), - message, - ) - .await? - { - send_message(message).await?; - } - - let state: u32 = proof.get_state().to_u32(); - PROOF_MAP.insert(handle, proof)?; - Ok(state) -} - -pub fn get_state(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| Ok(proof.get_state().to_u32())) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - PROOF_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidProofHandle, e.to_string())) -} - -pub fn release_all() { - PROOF_MAP.drain().ok(); -} - -pub fn to_string(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - serde_json::to_string(&Proofs::V3(proof.clone())).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidState, - format!("cannot serialize Proof proofect: {:?}", err), - ) - }) - }) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| Ok(proof.get_source_id())) -} - -pub fn from_string(proof_data: &str) -> LibvcxResult { - let proof: Proofs = serde_json::from_str(proof_data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::InvalidJson, - format!("cannot deserialize Proofs proofect: {:?}", err), - ) - })?; - - match proof { - Proofs::V3(proof) => PROOF_MAP.add(proof), - } -} - -pub async fn send_proof_request(handle: u32, connection_handle: u32) -> LibvcxResult<()> { - let mut proof = PROOF_MAP.get_cloned(handle)?; - let message = proof.mark_presentation_request_sent()?; - send_message(connection_handle, message.into()).await?; - PROOF_MAP.insert(handle, proof) -} - -pub async fn send_proof_request_nonmediated( - handle: u32, - connection_handle: u32, -) -> LibvcxResult<()> { - let mut proof = PROOF_MAP.get_cloned(handle)?; - - let con = connection::get_cloned_generic_connection(&connection_handle)?; - let wallet = get_main_wallet()?; - - let send_message: SendClosure = Box::new(|msg: AriesMessage| { - Box::pin(async move { con.send_message(wallet.as_ref(), &msg, &HttpClient).await }) - }); - - let message = proof.mark_presentation_request_sent()?; - send_message(message.into()).await?; - - PROOF_MAP.insert(handle, proof) -} - -// --- Presentation request --- -pub fn mark_presentation_request_msg_sent(handle: u32) -> LibvcxResult<()> { - let mut proof = PROOF_MAP.get_cloned(handle)?; - proof.mark_presentation_request_sent()?; - PROOF_MAP.insert(handle, proof) -} - -pub fn get_presentation_request_attachment(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - proof - .get_presentation_request_attachment() - .map_err(|err| err.into()) - }) -} - -pub fn get_presentation_request_msg(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - let msg = AriesMessage::from(proof.get_presentation_request_msg()?); - Ok(json!(msg).to_string()) - }) -} - -// --- Presentation --- -pub fn get_presentation_msg(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - let msg = AriesMessage::from(proof.get_presentation_msg()?); - Ok(json!(msg).to_string()) - }) -} - -pub fn get_presentation_attachment(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - proof - .get_presentation_attachment() - .map_err(|err| err.into()) - }) -} - -pub fn get_verification_status(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| Ok(proof.get_verification_status().into())) -} - -#[derive(Debug, PartialEq, Eq)] -pub enum VcxPresentationVerificationStatus { - Valid, - Invalid, - Unavailable, -} - -impl VcxPresentationVerificationStatus { - pub fn code(&self) -> u32 { - match self { - VcxPresentationVerificationStatus::Unavailable => 0, - VcxPresentationVerificationStatus::Valid => 1, - VcxPresentationVerificationStatus::Invalid => 2, - } - } -} - -impl From for VcxPresentationVerificationStatus { - fn from(verification_status: PresentationVerificationStatus) -> Self { - match verification_status { - PresentationVerificationStatus::Valid => VcxPresentationVerificationStatus::Valid, - PresentationVerificationStatus::Invalid => VcxPresentationVerificationStatus::Invalid, - PresentationVerificationStatus::Unavailable => { - VcxPresentationVerificationStatus::Unavailable - } - } - } -} - -// --- General --- -pub fn get_thread_id(handle: u32) -> LibvcxResult { - PROOF_MAP.get(handle, |proof| { - proof.get_thread_id().map_err(|err| err.into()) - }) -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/revocation_registry.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/revocation_registry.rs deleted file mode 100644 index 568792f56f..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/revocation_registry.rs +++ /dev/null @@ -1,106 +0,0 @@ -use anoncreds_types::data_types::{ - identifiers::cred_def_id::CredentialDefinitionId, - ledger::rev_reg_def::RevocationRegistryDefinition, -}; -use aries_vcx::common::primitives::revocation_registry::RevocationRegistry; - -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_write, get_main_wallet}, - api_handle::object_cache::ObjectCache, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; -lazy_static! { - pub static ref REV_REG_MAP: ObjectCache = - ObjectCache::::new("revocation-registry-cache"); -} - -#[derive(Clone, Deserialize, Debug, Serialize, PartialEq, Eq)] -pub struct RevocationRegistryConfig { - pub issuer_did: String, - pub cred_def_id: CredentialDefinitionId, - pub tag: u32, - pub tails_dir: String, - pub max_creds: u32, -} - -pub async fn create(config: RevocationRegistryConfig) -> LibvcxResult { - let RevocationRegistryConfig { - issuer_did, - cred_def_id, - tails_dir, - max_creds, - tag, - } = config; - let rev_reg = RevocationRegistry::create( - get_main_wallet()?.as_ref(), - get_main_anoncreds()?.as_ref(), - &issuer_did.to_string().parse()?, - &cred_def_id, - &tails_dir, - max_creds, - tag, - ) - .await?; - let handle = REV_REG_MAP.add(rev_reg)?; - Ok(handle) -} - -pub async fn publish(handle: u32, tails_url: &str) -> LibvcxResult { - let mut rev_reg = REV_REG_MAP.get_cloned(handle)?; - rev_reg - .publish_revocation_primitives( - get_main_wallet()?.as_ref(), - get_main_ledger_write()?.as_ref(), - tails_url, - ) - .await?; - REV_REG_MAP.insert(handle, rev_reg)?; - Ok(handle) -} - -pub async fn publish_revocations(handle: u32, submitter_did: &str) -> LibvcxResult<()> { - let rev_reg = REV_REG_MAP.get_cloned(handle)?; - rev_reg - .publish_local_revocations( - get_main_wallet()?.as_ref(), - get_main_anoncreds()?.as_ref(), - get_main_ledger_write()?.as_ref(), - &submitter_did.to_string().parse()?, - ) - .await?; - - Ok(()) -} - -pub fn get_rev_reg_id(handle: u32) -> LibvcxResult { - REV_REG_MAP.get(handle, |rev_reg| Ok(rev_reg.rev_reg_id.clone())) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - REV_REG_MAP.get(handle, |rev_reg| { - rev_reg.to_string().map_err(|err| err.into()) - }) -} - -pub fn from_string(rev_reg_data: &str) -> LibvcxResult { - let rev_reg = RevocationRegistry::from_string(rev_reg_data)?; - REV_REG_MAP.add(rev_reg) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - REV_REG_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidHandle, e.to_string())) -} - -pub fn get_tails_hash(handle: u32) -> LibvcxResult { - REV_REG_MAP.get(handle, |rev_reg| { - Ok(rev_reg.get_rev_reg_def().value.tails_hash) - }) -} - -pub fn get_rev_reg_def(handle: u32) -> LibvcxResult { - REV_REG_MAP.get(handle, |rev_reg| Ok(rev_reg.get_rev_reg_def())) -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/schema.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/schema.rs deleted file mode 100644 index 1c97dba366..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/api_handle/schema.rs +++ /dev/null @@ -1,138 +0,0 @@ -use std::string::ToString; - -use aries_vcx::common::primitives::credential_schema::Schema; -use serde_json; - -use crate::{ - api_vcx::{ - api_global::profile::{get_main_anoncreds, get_main_ledger_write, get_main_wallet}, - api_handle::object_cache::ObjectCache, - }, - errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}, -}; - -lazy_static! { - static ref SCHEMA_MAP: ObjectCache = ObjectCache::::new("schemas-cache"); -} - -pub async fn create_and_publish_schema( - issuer_did: &str, - source_id: &str, - name: String, - version: String, - data: String, -) -> LibvcxResult { - trace!( - "create_new_schema >>> source_id: {}, issuer_did: {}, name: {}, version: {}, data: {}", - source_id, - issuer_did, - name, - version, - data - ); - debug!( - "creating schema with source_id: {}, name: {}, issuer_did: {}", - source_id, name, issuer_did - ); - - let data: Vec = serde_json::from_str(&data).map_err(|err| { - LibvcxError::from_msg( - LibvcxErrorKind::SerializationError, - format!("Cannot deserialize schema data to vec: {:?}", err), - ) - })?; - let schema = Schema::create( - get_main_anoncreds()?.as_ref(), - source_id, - &issuer_did.parse()?, - &name, - &version, - data, - ) - .await? - .publish( - get_main_wallet()?.as_ref(), - get_main_ledger_write()?.as_ref(), - ) - .await?; - std::thread::sleep(std::time::Duration::from_millis(100)); - debug!( - "created schema on ledger with id: {}", - schema.get_schema_id() - ); - - SCHEMA_MAP - .add(schema) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::CreateSchema, e.to_string())) -} - -pub fn is_valid_handle(handle: u32) -> bool { - SCHEMA_MAP.has_handle(handle) -} - -pub fn to_string(handle: u32) -> LibvcxResult { - SCHEMA_MAP.get(handle, |s| { - s.to_string_versioned().map_err(|err| err.into()) - }) -} - -pub fn get_source_id(handle: u32) -> LibvcxResult { - SCHEMA_MAP.get(handle, |s| Ok(s.get_source_id())) -} - -pub fn get_schema_id(handle: u32) -> LibvcxResult { - SCHEMA_MAP.get(handle, |s| Ok(s.get_schema_id().to_string())) -} - -pub fn from_string(schema_data: &str) -> LibvcxResult { - let schema: Schema = Schema::from_string_versioned(schema_data)?; - SCHEMA_MAP.add(schema) -} - -pub fn release(handle: u32) -> LibvcxResult<()> { - SCHEMA_MAP - .release(handle) - .map_err(|e| LibvcxError::from_msg(LibvcxErrorKind::InvalidSchemaHandle, e.to_string())) -} - -pub fn release_all() { - SCHEMA_MAP.drain().ok(); -} - -pub fn get_state(handle: u32) -> LibvcxResult { - SCHEMA_MAP.get(handle, |s| Ok(s.get_state())) -} - -#[cfg(test)] -mod tests { - use ::test_utils::devsetup::SetupMocks; - use aries_vcx::global::settings::DEFAULT_DID; - - use super::*; - - #[tokio::test] - async fn test_create_schema_fails() { - let _setup = SetupMocks::init(); - - let err = create_and_publish_schema( - DEFAULT_DID, - "1", - "name".to_string(), - "1.0".to_string(), - "".to_string(), - ) - .await - .unwrap_err(); - assert_eq!(err.kind(), LibvcxErrorKind::SerializationError) - } - - #[test] - fn test_handle_errors() { - let _setup = SetupMocks::init(); - - assert_eq!( - to_string(13435178).unwrap_err().kind(), - LibvcxErrorKind::InvalidHandle - ); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/mod.rs deleted file mode 100644 index fd6d6b0df0..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/mod.rs +++ /dev/null @@ -1,112 +0,0 @@ -#[macro_use] -pub mod utils; -pub mod api_global; -pub mod api_handle; - -#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Default)] -#[serde(try_from = "u8")] -#[repr(u8)] -pub enum VcxStateType { - #[default] - VcxStateNone = 0, - VcxStateInitialized = 1, - VcxStateOfferSent = 2, - VcxStateRequestReceived = 3, - VcxStateAccepted = 4, - VcxStateUnfulfilled = 5, - VcxStateExpired = 6, - VcxStateRevoked = 7, - VcxStateRedirected = 8, - VcxStateRejected = 9, -} -impl serde::Serialize for VcxStateType { - fn serialize(&self, serializer: S) -> Result - where - S: ::serde::Serializer, - { - serializer.serialize_u8(*self as u8) - } -} - -impl TryFrom for VcxStateType { - type Error = String; - - fn try_from(value: u8) -> Result { - match value { - 0 => Ok(VcxStateType::VcxStateNone), - 1 => Ok(VcxStateType::VcxStateInitialized), - 2 => Ok(VcxStateType::VcxStateOfferSent), - 3 => Ok(VcxStateType::VcxStateRequestReceived), - 4 => Ok(VcxStateType::VcxStateAccepted), - 5 => Ok(VcxStateType::VcxStateUnfulfilled), - 6 => Ok(VcxStateType::VcxStateExpired), - 7 => Ok(VcxStateType::VcxStateRevoked), - 8 => Ok(VcxStateType::VcxStateRedirected), - 9 => Ok(VcxStateType::VcxStateRejected), - _ => Err(format!( - "unknown {} value: {}", - stringify!(VcxStateType), - value - )), - } - } -} - -// undefined is correlated with VcxStateNon -> Haven't received Proof -// Validated is both validated by indy-sdk and by comparing proof-request -// Invalid is that it failed one or both of validation processes -#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize)] -#[serde(try_from = "u8")] -#[repr(u8)] -pub enum ProofStateType { - ProofUndefined = 0, - ProofValidated = 1, - ProofInvalid = 2, -} -impl ::serde::Serialize for ProofStateType { - fn serialize(&self, serializer: S) -> Result - where - S: ::serde::Serializer, - { - serializer.serialize_u8(*self as u8) - } -} - -impl TryFrom for ProofStateType { - type Error = String; - - fn try_from(value: u8) -> Result { - match value { - 0 => Ok(ProofStateType::ProofUndefined), - 1 => Ok(ProofStateType::ProofValidated), - 2 => Ok(ProofStateType::ProofInvalid), - _ => Err(format!( - "unknown {} value: {}", - stringify!(ProofStateType), - value - )), - } - } -} - -#[repr(C)] -pub struct VcxStatus { - pub handle: libc::c_int, - pub status: libc::c_int, - pub msg: *mut libc::c_char, -} - -#[cfg(test)] -mod tests { - use serde_json; - - use self::VcxStateType::*; - use super::*; - - #[test] - fn test_serialize_vcx_state_type() { - let z = VcxStateNone; - let y = serde_json::to_string(&z).unwrap(); - assert_eq!(y, "0"); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/utils/mod.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/utils/mod.rs deleted file mode 100644 index 5ce4e74abe..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/utils/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod version_constants; diff --git a/aries/misc/legacy/libvcx_core/src/api_vcx/utils/version_constants.rs b/aries/misc/legacy/libvcx_core/src/api_vcx/utils/version_constants.rs deleted file mode 100644 index 0fabfd1362..0000000000 --- a/aries/misc/legacy/libvcx_core/src/api_vcx/utils/version_constants.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); -pub const REVISION: &str = "+"; diff --git a/aries/misc/legacy/libvcx_core/src/errors/error.rs b/aries/misc/legacy/libvcx_core/src/errors/error.rs deleted file mode 100644 index 63758e066b..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/error.rs +++ /dev/null @@ -1,265 +0,0 @@ -use std::{error::Error, fmt}; - -pub static TIMEOUT_LIBINDY_ERROR: u32 = 5555; - -#[derive(Copy, Clone, Eq, PartialEq, Debug, thiserror::Error)] -pub enum LibvcxErrorKind { - // Common - #[error("Object is in invalid state for requested operation")] - InvalidState, - #[error("Invalid Configuration")] - InvalidConfiguration, - #[error("Obj was not found with handle")] - InvalidHandle, - #[error("Invalid JSON string")] - InvalidJson, - #[error("Invalid Option")] - InvalidOption, - #[error("Invalid MessagePack")] - InvalidMessagePack, - #[error("Object not ready for specified action")] - NotReady, - #[error("IO Error, possibly creating a backup wallet")] - IOError, - #[error( - "Object (json, config, key, credential and etc...) passed to libindy has invalid structure" - )] - LibindyInvalidStructure, - #[error("Parameter passed to libindy was invalid")] - InvalidLibindyParam, - #[error("Library already initialized")] - AlreadyInitialized, - #[error("Action is not supported")] - ActionNotSupported, - #[error("Invalid input parameter")] - InvalidInput, - #[error("Unimplemented feature")] - UnimplementedFeature, - - // Connection - #[error("Could not create connection")] - CreateConnection, - #[error("Invalid Connection Handle")] - InvalidConnectionHandle, - - // Credential Definition error - #[error("Call to create Credential Definition failed")] - CreateCredDef, - #[error("Can't create, Credential Def already on ledger")] - CredDefAlreadyCreated, - #[error("Invalid Credential Definition handle")] - InvalidCredDefHandle, - #[error( - "No revocation delta found in storage for this revocation registry. Were any credentials \ - locally revoked?" - )] - RevDeltaNotFound, - #[error("Failed to clean stored revocation delta")] - RevDeltaFailedToClear, - - // Revocation - #[error("Failed to create Revocation Registration Definition")] - CreateRevRegDef, - #[error("Invalid Revocation Details")] - InvalidRevocationDetails, - #[error("Unable to Update Revocation Delta On Ledger")] - InvalidRevocationEntry, - #[error("Invalid Credential Revocation timestamp")] - InvalidRevocationTimestamp, - #[error("No revocation definition found")] - RevRegDefNotFound, - - // Credential - #[error("Invalid credential handle")] - InvalidCredentialHandle, - - // Issuer Credential - #[error("Invalid Credential Issuer Handle")] - InvalidIssuerCredentialHandle, - #[error("Invalid credential json")] - InvalidCredential, - #[error("Attributes provided to Credential Offer are not correct, possibly malformed")] - InvalidAttributesStructure, - - // Proof - #[error("Invalid proof handle")] - InvalidProofHandle, - #[error("Obj was not found with handle")] - InvalidDisclosedProofHandle, - #[error("Proof had invalid format")] - InvalidProof, - #[error("Schema was invalid or corrupt")] - InvalidSchema, - #[error("The Proof received does not have valid credentials listed.")] - InvalidProofCredentialData, - #[error("Proof Request Passed into Libindy Call Was Invalid")] - InvalidProofRequest, - #[error("The proof was rejected")] - ProofRejected, - #[error("Authentication error")] - AuthenticationError, - - // Schema - #[error("Could not create schema")] - CreateSchema, - #[error("Invalid Schema Handle")] - InvalidSchemaHandle, - #[error("No Schema for that schema sequence number")] - InvalidSchemaSeqNo, - #[error( - "Duplicate Schema: Ledger Already Contains Schema For Given DID, Version, and Name \ - Combination" - )] - DuplicationSchema, - #[error("Unknown Rejection of Schema Creation, refer to libindy documentation")] - UnknownSchemaRejection, - - // Out of Band - #[error("Could not create out of band message.")] - CreateOutOfBand, - - // Pool - #[error("Invalid genesis transactions path.")] - InvalidGenesisTxnPath, - #[error("Formatting for Pool Config are incorrect.")] - CreatePoolConfig, - #[error("Connection to Pool Ledger.")] - PoolLedgerConnect, - #[error("Ledger rejected submitted request.")] - InvalidLedgerResponse, - #[error("No Pool open. Can't return handle.")] - NoPoolOpen, - #[error("Message failed in post")] - PostMessageFailed, - #[error("Ledger item not found.")] - LedgerItemNotFound, - - // Wallet - #[error("Error Creating a wallet")] - WalletCreate, - #[error("Attempt to open wallet with invalid credentials")] - WalletAccessFailed, - #[error("Invalid Wallet or Search Handle")] - InvalidWalletHandle, - #[error("Indy wallet already exists")] - DuplicationWallet, - #[error("Wallet record not found")] - WalletRecordNotFound, - #[error("Wallet migration failed")] - WalletMigrationFailed, - #[error("Record already exists in the wallet")] - DuplicationWalletRecord, - #[error("Wallet not found")] - WalletNotFound, - #[error("Indy wallet already open")] - WalletAlreadyOpen, - #[error("Configuration is missing wallet key")] - MissingWalletKey, - #[error("Attempted to add a Master Secret that already existed in wallet")] - DuplicationMasterSecret, - #[error("Attempted to add a DID to wallet when that DID already exists in wallet")] - DuplicationDid, - - #[error("Unexpected wallet error")] - WalletError, - - // Logger - #[error("Logging Error")] - LoggingError, - - // Validation - #[error("Could not encode string to a big integer.")] - EncodeError, - #[error("Unknown Error")] - UnknownError, - #[error("Invalid DID")] - InvalidDid, - #[error("Invalid VERKEY")] - InvalidVerkey, - #[error("Invalid NONCE")] - InvalidNonce, - #[error("Invalid URL")] - InvalidUrl, - #[error("Unable to serialize")] - SerializationError, - #[error("Value needs to be base58")] - NotBase58, - #[error("Could not parse a value")] - ParsingError, - - // A2A - #[error("Invalid HTTP response.")] - InvalidHttpResponse, - #[error("Error Retrieving messages from API")] - InvalidMessages, - - #[error("Libndy error {}", 0)] - LibndyError(u32), - #[error("Ursa error")] - UrsaError, - #[error("Unknown libindy error")] - UnknownLibndyError, - #[error("No Agent pairwise information")] - NoAgentInformation, - - #[error("Invalid message format")] - InvalidMessageFormat, - - #[error("Attempted to unlock poisoned lock")] - PoisonedLock, - #[error("Error accessing an object")] - ObjectAccessError, -} - -#[derive(Debug, thiserror::Error)] -pub struct LibvcxError { - pub msg: String, - pub kind: LibvcxErrorKind, -} - -impl LibvcxError { - pub fn from_msg(kind: LibvcxErrorKind, msg: D) -> Self - where - D: fmt::Display + fmt::Debug + Send + Sync + 'static, - { - Self { - msg: msg.to_string(), - kind, - } - } - - pub fn find_root_cause(&self) -> String { - let mut current = self.source(); - while let Some(cause) = current { - if cause.source().is_none() { - return cause.to_string(); - } - current = cause.source(); - } - self.to_string() - } - - pub fn kind(&self) -> LibvcxErrorKind { - self.kind - } -} - -impl fmt::Display for LibvcxError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let code: u32 = self.kind.into(); - // todo: how can we get the enum variant error annotation? - writeln!( - f, - "Error num: {}, Error kind: {:?}, Error message: {}\n", - code, self.kind, self.msg - )?; - let mut source = self.source(); - while let Some(cause) = source { - writeln!(f, "Caused by:\n\t{}", cause)?; - source = cause.source(); - } - Ok(()) - } -} - -pub type LibvcxResult = Result; diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_ffi_tests.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_ffi_tests.rs deleted file mode 100644 index 367713335c..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_ffi_tests.rs +++ /dev/null @@ -1,39 +0,0 @@ -// extern crate num_traits; - -use num_traits::PrimInt; - -use crate::errors::error::LibvcxErrorKind; - -pub fn map_indy_error(rtn: T, error_code: C) -> Result { - if error_code == C::zero() { - return Ok(rtn); - } - - Err(map_indy_error_code(error_code)) -} - -pub fn map_indy_error_code(error_code: C) -> u32 { - let error_code = match error_code.to_u32() { - Some(n) => n, - None => return LibvcxErrorKind::UnknownError.into(), - }; - - if error_code >= LibvcxErrorKind::UnknownError.into() { - return error_code; - } - - match error_code { - code @ 100..=111 => code, - code @ 113 => code, - 200 => LibvcxErrorKind::InvalidWalletHandle.into(), - 203 => LibvcxErrorKind::DuplicationWallet.into(), - 206 => LibvcxErrorKind::WalletAlreadyOpen.into(), - 212 => LibvcxErrorKind::WalletRecordNotFound.into(), - 213 => LibvcxErrorKind::DuplicationWalletRecord.into(), - 306 => LibvcxErrorKind::CreatePoolConfig.into(), - 404 => LibvcxErrorKind::DuplicationMasterSecret.into(), - 407 => LibvcxErrorKind::CredDefAlreadyCreated.into(), - 600 => LibvcxErrorKind::DuplicationDid.into(), - code => code, - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_agency_client.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_from_agency_client.rs deleted file mode 100644 index 5f46863fc3..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_agency_client.rs +++ /dev/null @@ -1,32 +0,0 @@ -use aries_vcx::agency_client::errors::error::{AgencyClientError, AgencyClientErrorKind}; - -use crate::errors::error::{LibvcxError, LibvcxErrorKind}; - -impl From for LibvcxError { - fn from(agency_err: AgencyClientError) -> LibvcxError { - let vcx_error_kind: LibvcxErrorKind = agency_err.kind().into(); - LibvcxError::from_msg(vcx_error_kind, agency_err.to_string()) - } -} - -impl From for LibvcxErrorKind { - fn from(agency_err: AgencyClientErrorKind) -> LibvcxErrorKind { - match agency_err { - AgencyClientErrorKind::InvalidState => LibvcxErrorKind::InvalidState, - AgencyClientErrorKind::InvalidConfiguration => LibvcxErrorKind::InvalidConfiguration, - AgencyClientErrorKind::InvalidJson => LibvcxErrorKind::InvalidJson, - AgencyClientErrorKind::InvalidOption => LibvcxErrorKind::InvalidOption, - AgencyClientErrorKind::InvalidMessagePack => LibvcxErrorKind::InvalidMessagePack, - AgencyClientErrorKind::IOError => LibvcxErrorKind::IOError, - AgencyClientErrorKind::PostMessageFailed => LibvcxErrorKind::PostMessageFailed, - AgencyClientErrorKind::InvalidWalletHandle => LibvcxErrorKind::InvalidWalletHandle, - AgencyClientErrorKind::UnknownError => LibvcxErrorKind::UnknownError, - AgencyClientErrorKind::InvalidDid => LibvcxErrorKind::InvalidDid, - AgencyClientErrorKind::InvalidVerkey => LibvcxErrorKind::InvalidVerkey, - AgencyClientErrorKind::InvalidUrl => LibvcxErrorKind::InvalidUrl, - AgencyClientErrorKind::SerializationError => LibvcxErrorKind::SerializationError, - AgencyClientErrorKind::NotBase58 => LibvcxErrorKind::NotBase58, - AgencyClientErrorKind::InvalidHttpResponse => LibvcxErrorKind::InvalidHttpResponse, - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcx.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcx.rs deleted file mode 100644 index 84a2fd7482..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcx.rs +++ /dev/null @@ -1,98 +0,0 @@ -use aries_vcx::errors::error::{AriesVcxError, AriesVcxErrorKind, VcxResult}; - -use crate::errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}; - -pub fn map_ariesvcx_result(result: VcxResult) -> LibvcxResult { - match result { - Ok(val) => Ok(val), - Err(err) => Err(err.into()), - } -} - -impl From for LibvcxError { - fn from(error: AriesVcxError) -> LibvcxError { - LibvcxError { - kind: error.kind().into(), - msg: error.to_string(), - } - } -} - -impl From for LibvcxErrorKind { - fn from(kind: AriesVcxErrorKind) -> Self { - match kind { - AriesVcxErrorKind::InvalidState => LibvcxErrorKind::InvalidState, - AriesVcxErrorKind::InvalidConfiguration => LibvcxErrorKind::InvalidConfiguration, - AriesVcxErrorKind::InvalidJson => LibvcxErrorKind::InvalidJson, - AriesVcxErrorKind::InvalidOption => LibvcxErrorKind::InvalidOption, - AriesVcxErrorKind::InvalidMessagePack => LibvcxErrorKind::InvalidMessagePack, - AriesVcxErrorKind::NotReady => LibvcxErrorKind::NotReady, - AriesVcxErrorKind::IOError => LibvcxErrorKind::IOError, - AriesVcxErrorKind::LibindyInvalidStructure => LibvcxErrorKind::LibindyInvalidStructure, - AriesVcxErrorKind::InvalidLibindyParam => LibvcxErrorKind::InvalidLibindyParam, - AriesVcxErrorKind::ActionNotSupported => LibvcxErrorKind::ActionNotSupported, - AriesVcxErrorKind::InvalidInput => LibvcxErrorKind::InvalidInput, - AriesVcxErrorKind::UnimplementedFeature => LibvcxErrorKind::UnimplementedFeature, - AriesVcxErrorKind::CredDefAlreadyCreated => LibvcxErrorKind::CredDefAlreadyCreated, - AriesVcxErrorKind::RevDeltaNotFound => LibvcxErrorKind::RevDeltaNotFound, - AriesVcxErrorKind::RevDeltaFailedToClear => LibvcxErrorKind::RevDeltaFailedToClear, - AriesVcxErrorKind::CreateRevRegDef => LibvcxErrorKind::CreateRevRegDef, - AriesVcxErrorKind::InvalidRevocationDetails => { - LibvcxErrorKind::InvalidRevocationDetails - } - AriesVcxErrorKind::InvalidRevocationEntry => LibvcxErrorKind::InvalidRevocationEntry, - AriesVcxErrorKind::InvalidRevocationTimestamp => { - LibvcxErrorKind::InvalidRevocationTimestamp - } - AriesVcxErrorKind::RevRegDefNotFound => LibvcxErrorKind::RevRegDefNotFound, - AriesVcxErrorKind::InvalidAttributesStructure => { - LibvcxErrorKind::InvalidAttributesStructure - } - AriesVcxErrorKind::InvalidProof => LibvcxErrorKind::InvalidProof, - AriesVcxErrorKind::InvalidSchema => LibvcxErrorKind::InvalidSchema, - AriesVcxErrorKind::InvalidProofCredentialData => { - LibvcxErrorKind::InvalidProofCredentialData - } - AriesVcxErrorKind::InvalidProofRequest => LibvcxErrorKind::InvalidProofRequest, - AriesVcxErrorKind::InvalidSchemaSeqNo => LibvcxErrorKind::InvalidSchemaSeqNo, - AriesVcxErrorKind::DuplicationSchema => LibvcxErrorKind::DuplicationSchema, - AriesVcxErrorKind::UnknownSchemaRejection => LibvcxErrorKind::UnknownSchemaRejection, - AriesVcxErrorKind::InvalidGenesisTxnPath => LibvcxErrorKind::InvalidGenesisTxnPath, - AriesVcxErrorKind::CreatePoolConfig => LibvcxErrorKind::CreatePoolConfig, - AriesVcxErrorKind::PoolLedgerConnect => LibvcxErrorKind::PoolLedgerConnect, - AriesVcxErrorKind::InvalidLedgerResponse => LibvcxErrorKind::InvalidLedgerResponse, - AriesVcxErrorKind::NoPoolOpen => LibvcxErrorKind::NoPoolOpen, - AriesVcxErrorKind::PostMessageFailed => LibvcxErrorKind::PostMessageFailed, - AriesVcxErrorKind::WalletCreate => LibvcxErrorKind::WalletCreate, - AriesVcxErrorKind::WalletAccessFailed => LibvcxErrorKind::WalletAccessFailed, - AriesVcxErrorKind::InvalidWalletHandle => LibvcxErrorKind::InvalidWalletHandle, - AriesVcxErrorKind::DuplicationWallet => LibvcxErrorKind::DuplicationWallet, - AriesVcxErrorKind::WalletRecordNotFound => LibvcxErrorKind::WalletRecordNotFound, - AriesVcxErrorKind::DuplicationWalletRecord => LibvcxErrorKind::DuplicationWalletRecord, - AriesVcxErrorKind::WalletNotFound => LibvcxErrorKind::WalletNotFound, - AriesVcxErrorKind::WalletAlreadyOpen => LibvcxErrorKind::WalletAlreadyOpen, - AriesVcxErrorKind::DuplicationMasterSecret => LibvcxErrorKind::DuplicationMasterSecret, - AriesVcxErrorKind::DuplicationDid => LibvcxErrorKind::DuplicationDid, - AriesVcxErrorKind::WalletError => LibvcxErrorKind::WalletError, - AriesVcxErrorKind::LoggingError => LibvcxErrorKind::LoggingError, - AriesVcxErrorKind::EncodeError => LibvcxErrorKind::EncodeError, - AriesVcxErrorKind::UnknownError => LibvcxErrorKind::UnknownError, - AriesVcxErrorKind::InvalidDid => LibvcxErrorKind::InvalidDid, - AriesVcxErrorKind::InvalidVerkey => LibvcxErrorKind::InvalidVerkey, - AriesVcxErrorKind::InvalidNonce => LibvcxErrorKind::InvalidNonce, - AriesVcxErrorKind::InvalidUrl => LibvcxErrorKind::InvalidUrl, - AriesVcxErrorKind::SerializationError => LibvcxErrorKind::SerializationError, - AriesVcxErrorKind::NotBase58 => LibvcxErrorKind::NotBase58, - AriesVcxErrorKind::ParsingError => LibvcxErrorKind::ParsingError, - AriesVcxErrorKind::InvalidHttpResponse => LibvcxErrorKind::InvalidHttpResponse, - AriesVcxErrorKind::InvalidMessages => LibvcxErrorKind::InvalidMessages, - AriesVcxErrorKind::VdrToolsError(num) => LibvcxErrorKind::LibndyError(num), - AriesVcxErrorKind::NoAgentInformation => LibvcxErrorKind::NoAgentInformation, - AriesVcxErrorKind::InvalidMessageFormat => LibvcxErrorKind::InvalidMessageFormat, - AriesVcxErrorKind::LedgerItemNotFound => LibvcxErrorKind::LedgerItemNotFound, - AriesVcxErrorKind::UrsaError => LibvcxErrorKind::UrsaError, - AriesVcxErrorKind::ProofRejected => LibvcxErrorKind::ProofRejected, - AriesVcxErrorKind::AuthenticationError => LibvcxErrorKind::AuthenticationError, - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs deleted file mode 100644 index 41b696f9b8..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_ariesvcxcore.rs +++ /dev/null @@ -1,109 +0,0 @@ -use aries_vcx::aries_vcx_core::errors::error::{ - AriesVcxCoreError, AriesVcxCoreErrorKind, VcxCoreResult, -}; - -use crate::errors::error::{LibvcxError, LibvcxErrorKind, LibvcxResult}; - -pub fn map_ariesvcx_core_result(result: VcxCoreResult) -> LibvcxResult { - match result { - Ok(val) => Ok(val), - Err(err) => Err(err.into()), - } -} - -impl From for LibvcxError { - fn from(error: AriesVcxCoreError) -> LibvcxError { - LibvcxError { - kind: error.kind().into(), - msg: error.to_string(), - } - } -} - -impl From for LibvcxErrorKind { - fn from(kind: AriesVcxCoreErrorKind) -> Self { - match kind { - AriesVcxCoreErrorKind::InvalidState => LibvcxErrorKind::InvalidState, - AriesVcxCoreErrorKind::InvalidConfiguration => LibvcxErrorKind::InvalidConfiguration, - AriesVcxCoreErrorKind::InvalidJson => LibvcxErrorKind::InvalidJson, - AriesVcxCoreErrorKind::InvalidOption => LibvcxErrorKind::InvalidOption, - AriesVcxCoreErrorKind::InvalidMessagePack => LibvcxErrorKind::InvalidMessagePack, - AriesVcxCoreErrorKind::NotReady => LibvcxErrorKind::NotReady, - AriesVcxCoreErrorKind::IOError => LibvcxErrorKind::IOError, - AriesVcxCoreErrorKind::LibindyInvalidStructure => { - LibvcxErrorKind::LibindyInvalidStructure - } - AriesVcxCoreErrorKind::InvalidLibindyParam => LibvcxErrorKind::InvalidLibindyParam, - AriesVcxCoreErrorKind::ActionNotSupported => LibvcxErrorKind::ActionNotSupported, - AriesVcxCoreErrorKind::InvalidInput => LibvcxErrorKind::InvalidInput, - AriesVcxCoreErrorKind::UnimplementedFeature => LibvcxErrorKind::UnimplementedFeature, - AriesVcxCoreErrorKind::CredDefAlreadyCreated => LibvcxErrorKind::CredDefAlreadyCreated, - AriesVcxCoreErrorKind::RevDeltaNotFound => LibvcxErrorKind::RevDeltaNotFound, - AriesVcxCoreErrorKind::RevDeltaFailedToClear => LibvcxErrorKind::RevDeltaFailedToClear, - AriesVcxCoreErrorKind::CreateRevRegDef => LibvcxErrorKind::CreateRevRegDef, - AriesVcxCoreErrorKind::InvalidRevocationDetails => { - LibvcxErrorKind::InvalidRevocationDetails - } - AriesVcxCoreErrorKind::InvalidRevocationEntry => { - LibvcxErrorKind::InvalidRevocationEntry - } - AriesVcxCoreErrorKind::InvalidRevocationTimestamp => { - LibvcxErrorKind::InvalidRevocationTimestamp - } - AriesVcxCoreErrorKind::RevRegDefNotFound => LibvcxErrorKind::RevRegDefNotFound, - AriesVcxCoreErrorKind::InvalidAttributesStructure => { - LibvcxErrorKind::InvalidAttributesStructure - } - AriesVcxCoreErrorKind::InvalidProof => LibvcxErrorKind::InvalidProof, - AriesVcxCoreErrorKind::InvalidSchema => LibvcxErrorKind::InvalidSchema, - AriesVcxCoreErrorKind::InvalidProofCredentialData => { - LibvcxErrorKind::InvalidProofCredentialData - } - AriesVcxCoreErrorKind::InvalidProofRequest => LibvcxErrorKind::InvalidProofRequest, - AriesVcxCoreErrorKind::InvalidSchemaSeqNo => LibvcxErrorKind::InvalidSchemaSeqNo, - AriesVcxCoreErrorKind::DuplicationSchema => LibvcxErrorKind::DuplicationSchema, - AriesVcxCoreErrorKind::UnknownSchemaRejection => { - LibvcxErrorKind::UnknownSchemaRejection - } - AriesVcxCoreErrorKind::InvalidGenesisTxnPath => LibvcxErrorKind::InvalidGenesisTxnPath, - AriesVcxCoreErrorKind::CreatePoolConfig => LibvcxErrorKind::CreatePoolConfig, - AriesVcxCoreErrorKind::PoolLedgerConnect => LibvcxErrorKind::PoolLedgerConnect, - AriesVcxCoreErrorKind::InvalidLedgerResponse => LibvcxErrorKind::InvalidLedgerResponse, - AriesVcxCoreErrorKind::NoPoolOpen => LibvcxErrorKind::NoPoolOpen, - AriesVcxCoreErrorKind::PostMessageFailed => LibvcxErrorKind::PostMessageFailed, - AriesVcxCoreErrorKind::WalletCreate => LibvcxErrorKind::WalletCreate, - AriesVcxCoreErrorKind::WalletAccessFailed => LibvcxErrorKind::WalletAccessFailed, - AriesVcxCoreErrorKind::InvalidWalletHandle => LibvcxErrorKind::InvalidWalletHandle, - AriesVcxCoreErrorKind::DuplicationWallet => LibvcxErrorKind::DuplicationWallet, - AriesVcxCoreErrorKind::WalletRecordNotFound => LibvcxErrorKind::WalletRecordNotFound, - AriesVcxCoreErrorKind::DuplicationWalletRecord => { - LibvcxErrorKind::DuplicationWalletRecord - } - AriesVcxCoreErrorKind::WalletNotFound => LibvcxErrorKind::WalletNotFound, - AriesVcxCoreErrorKind::WalletAlreadyOpen => LibvcxErrorKind::WalletAlreadyOpen, - AriesVcxCoreErrorKind::DuplicationMasterSecret => { - LibvcxErrorKind::DuplicationMasterSecret - } - AriesVcxCoreErrorKind::DuplicationDid => LibvcxErrorKind::DuplicationDid, - AriesVcxCoreErrorKind::WalletError => LibvcxErrorKind::WalletError, - AriesVcxCoreErrorKind::LoggingError => LibvcxErrorKind::LoggingError, - AriesVcxCoreErrorKind::EncodeError => LibvcxErrorKind::EncodeError, - AriesVcxCoreErrorKind::UnknownError => LibvcxErrorKind::UnknownError, - AriesVcxCoreErrorKind::InvalidDid => LibvcxErrorKind::InvalidDid, - AriesVcxCoreErrorKind::InvalidVerkey => LibvcxErrorKind::InvalidVerkey, - AriesVcxCoreErrorKind::InvalidNonce => LibvcxErrorKind::InvalidNonce, - AriesVcxCoreErrorKind::InvalidUrl => LibvcxErrorKind::InvalidUrl, - AriesVcxCoreErrorKind::SerializationError => LibvcxErrorKind::SerializationError, - AriesVcxCoreErrorKind::NotBase58 => LibvcxErrorKind::NotBase58, - AriesVcxCoreErrorKind::ParsingError => LibvcxErrorKind::ParsingError, - AriesVcxCoreErrorKind::InvalidHttpResponse => LibvcxErrorKind::InvalidHttpResponse, - AriesVcxCoreErrorKind::InvalidMessages => LibvcxErrorKind::InvalidMessages, - AriesVcxCoreErrorKind::VdrToolsError(num) => LibvcxErrorKind::LibndyError(num), - AriesVcxCoreErrorKind::NoAgentInformation => LibvcxErrorKind::NoAgentInformation, - AriesVcxCoreErrorKind::InvalidMessageFormat => LibvcxErrorKind::InvalidMessageFormat, - AriesVcxCoreErrorKind::LedgerItemNotFound => LibvcxErrorKind::LedgerItemNotFound, - AriesVcxCoreErrorKind::UrsaError => LibvcxErrorKind::UrsaError, - AriesVcxCoreErrorKind::ProofRejected => LibvcxErrorKind::ProofRejected, - } - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_others.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_from_others.rs deleted file mode 100644 index d85e781d86..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_from_others.rs +++ /dev/null @@ -1,40 +0,0 @@ -use std::sync::PoisonError; - -use public_key::PublicKeyError; - -use crate::errors::error::{LibvcxError, LibvcxErrorKind}; - -impl From> for LibvcxError { - fn from(err: PoisonError) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::PoisonedLock, err.to_string()) - } -} - -impl From for LibvcxError { - fn from(_err: serde_json::Error) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::InvalidJson, "Invalid json".to_string()) - } -} - -impl From for LibvcxError { - fn from(value: PublicKeyError) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::InvalidVerkey, value) - } -} - -impl From for LibvcxError { - fn from(err: anoncreds_types::Error) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::ParsingError, err.to_string()) - } -} -impl From for LibvcxError { - fn from(err: did_parser::ParseError) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::InvalidDid, err.to_string()) - } -} - -impl From for LibvcxError { - fn from(err: anoncreds_types::cl::Error) -> Self { - LibvcxError::from_msg(LibvcxErrorKind::InvalidState, err.to_string()) - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mapping_to_u32.rs b/aries/misc/legacy/libvcx_core/src/errors/mapping_to_u32.rs deleted file mode 100644 index f9a18cfcde..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mapping_to_u32.rs +++ /dev/null @@ -1,437 +0,0 @@ -use crate::errors::error::{LibvcxError, LibvcxErrorKind}; - -impl From for u32 { - fn from(error: LibvcxError) -> u32 { - error.kind().into() - } -} - -static UNKNOWN_ERROR_CODE: u32 = 1001; - -lazy_static! { - static ref ERROR_KINDS: Vec<(LibvcxErrorKind, u32)> = vec![ - (LibvcxErrorKind::InvalidConnectionHandle, 1003), - (LibvcxErrorKind::InvalidConfiguration, 1004), - (LibvcxErrorKind::NotReady, 1005), - (LibvcxErrorKind::InvalidOption, 1007), - (LibvcxErrorKind::InvalidDid, 1008), - (LibvcxErrorKind::InvalidVerkey, 1009), - (LibvcxErrorKind::PostMessageFailed, 1010), - (LibvcxErrorKind::InvalidNonce, 1011), - (LibvcxErrorKind::InvalidUrl, 1013), - (LibvcxErrorKind::NotBase58, 1014), - (LibvcxErrorKind::InvalidIssuerCredentialHandle, 1015), - (LibvcxErrorKind::InvalidJson, 1016), - (LibvcxErrorKind::InvalidProofHandle, 1017), - (LibvcxErrorKind::InvalidMessagePack, 1019), - (LibvcxErrorKind::InvalidMessages, 1020), - (LibvcxErrorKind::InvalidAttributesStructure, 1021), - (LibvcxErrorKind::EncodeError, 1022), - (LibvcxErrorKind::InvalidProof, 1023), - (LibvcxErrorKind::InvalidGenesisTxnPath, 1024), - (LibvcxErrorKind::PoolLedgerConnect, 1025), - (LibvcxErrorKind::CreatePoolConfig, 1026), - (LibvcxErrorKind::InvalidProofCredentialData, 1027), - (LibvcxErrorKind::NoPoolOpen, 1030), - (LibvcxErrorKind::InvalidSchema, 1031), - (LibvcxErrorKind::InvalidHttpResponse, 1033), - (LibvcxErrorKind::CreateCredDef, 1034), - (LibvcxErrorKind::UnknownLibndyError, 1035), - (LibvcxErrorKind::InvalidCredDefHandle, 1037), - (LibvcxErrorKind::CredDefAlreadyCreated, 1039), - (LibvcxErrorKind::InvalidSchemaSeqNo, 1040), - (LibvcxErrorKind::CreateSchema, 1041), - (LibvcxErrorKind::InvalidSchemaHandle, 1042), - (LibvcxErrorKind::AlreadyInitialized, 1044), - (LibvcxErrorKind::InvalidHandle, 1048), - (LibvcxErrorKind::InvalidDisclosedProofHandle, 1049), - (LibvcxErrorKind::SerializationError, 1050), - (LibvcxErrorKind::DuplicationWallet, 1051), - (LibvcxErrorKind::WalletAlreadyOpen, 1052), - (LibvcxErrorKind::InvalidCredentialHandle, 1053), - (LibvcxErrorKind::InvalidWalletHandle, 1057), - (LibvcxErrorKind::WalletCreate, 1058), - (LibvcxErrorKind::CreateConnection, 1061), - (LibvcxErrorKind::InvalidLibindyParam, 1067), - (LibvcxErrorKind::IOError, 1074), - (LibvcxErrorKind::WalletAccessFailed, 1075), - (LibvcxErrorKind::WalletRecordNotFound, 1073), - (LibvcxErrorKind::DuplicationWalletRecord, 1072), - (LibvcxErrorKind::WalletNotFound, 1079), - (LibvcxErrorKind::LibindyInvalidStructure, 1080), - (LibvcxErrorKind::InvalidState, 1081), - (LibvcxErrorKind::InvalidLedgerResponse, 1082), - (LibvcxErrorKind::DuplicationDid, 1083), - (LibvcxErrorKind::DuplicationMasterSecret, 1084), - (LibvcxErrorKind::InvalidProofRequest, 1086), - (LibvcxErrorKind::DuplicationSchema, 1088), - (LibvcxErrorKind::LoggingError, 1090), - (LibvcxErrorKind::InvalidRevocationDetails, 1091), - (LibvcxErrorKind::InvalidRevocationEntry, 1092), - (LibvcxErrorKind::InvalidRevocationTimestamp, 1093), - (LibvcxErrorKind::UnknownSchemaRejection, 1094), - (LibvcxErrorKind::CreateRevRegDef, 1095), - (LibvcxErrorKind::ActionNotSupported, 1103), - (LibvcxErrorKind::NoAgentInformation, 1106), - (LibvcxErrorKind::RevRegDefNotFound, 1107), - (LibvcxErrorKind::RevDeltaNotFound, 1108), - (LibvcxErrorKind::PoisonedLock, 1109), - (LibvcxErrorKind::ObjectAccessError, 1110), - (LibvcxErrorKind::InvalidMessageFormat, 1111), - (LibvcxErrorKind::CreateOutOfBand, 1112), - (LibvcxErrorKind::RevDeltaFailedToClear, 1114), - (LibvcxErrorKind::InvalidInput, 1115), - (LibvcxErrorKind::ParsingError, 1116), - (LibvcxErrorKind::UnimplementedFeature, 1117), - (LibvcxErrorKind::LedgerItemNotFound, 1118), - (LibvcxErrorKind::UnknownError, UNKNOWN_ERROR_CODE), - ]; -} - -// note: iterating few tens of values in case of error should not have much impact, but it surely -// can be optimized. The implementation is optimizing on easy of adding new errors and minimizing -// duplication of error code pairs. -impl From for u32 { - fn from(kind: LibvcxErrorKind) -> u32 { - match kind { - LibvcxErrorKind::LibndyError(code) => code, - _ => match ERROR_KINDS - .iter() - .find(|(mapping_kind, _)| *mapping_kind == kind) - { - Some((_, mapping_code)) => *mapping_code, - None => UNKNOWN_ERROR_CODE, - }, - } - } -} - -impl From for LibvcxErrorKind { - fn from(code: u32) -> LibvcxErrorKind { - match ERROR_KINDS.iter().find(|(_, n)| *n == code) { - Some((kind, _)) => *kind, - None => LibvcxErrorKind::UnknownError, - } - } -} - -#[cfg(test)] -mod tests { - use crate::errors::error::LibvcxErrorKind; - - #[test] - fn it_should_map_error_kinds_to_codes() { - assert_eq!(u32::from(LibvcxErrorKind::InvalidState), 1081); - assert_eq!(u32::from(LibvcxErrorKind::InvalidConfiguration), 1004); - assert_eq!(u32::from(LibvcxErrorKind::InvalidHandle), 1048); - assert_eq!(u32::from(LibvcxErrorKind::InvalidJson), 1016); - assert_eq!(u32::from(LibvcxErrorKind::InvalidOption), 1007); - assert_eq!(u32::from(LibvcxErrorKind::InvalidMessagePack), 1019); - assert_eq!(u32::from(LibvcxErrorKind::NotReady), 1005); - assert_eq!(u32::from(LibvcxErrorKind::InvalidRevocationDetails), 1091); - assert_eq!(u32::from(LibvcxErrorKind::IOError), 1074); - assert_eq!(u32::from(LibvcxErrorKind::LibindyInvalidStructure), 1080); - assert_eq!(u32::from(LibvcxErrorKind::InvalidLibindyParam), 1067); - assert_eq!(u32::from(LibvcxErrorKind::AlreadyInitialized), 1044); - assert_eq!(u32::from(LibvcxErrorKind::CreateConnection), 1061); - assert_eq!(u32::from(LibvcxErrorKind::InvalidConnectionHandle), 1003); - assert_eq!(u32::from(LibvcxErrorKind::CreateCredDef), 1034); - assert_eq!(u32::from(LibvcxErrorKind::CredDefAlreadyCreated), 1039); - assert_eq!(u32::from(LibvcxErrorKind::InvalidCredDefHandle), 1037); - assert_eq!(u32::from(LibvcxErrorKind::InvalidRevocationEntry), 1092); - assert_eq!(u32::from(LibvcxErrorKind::CreateRevRegDef), 1095); - assert_eq!(u32::from(LibvcxErrorKind::InvalidCredentialHandle), 1053); - assert_eq!( - u32::from(LibvcxErrorKind::InvalidIssuerCredentialHandle), - 1015 - ); - assert_eq!(u32::from(LibvcxErrorKind::InvalidProofHandle), 1017); - assert_eq!( - u32::from(LibvcxErrorKind::InvalidDisclosedProofHandle), - 1049 - ); - assert_eq!(u32::from(LibvcxErrorKind::InvalidProof), 1023); - assert_eq!(u32::from(LibvcxErrorKind::InvalidSchema), 1031); - assert_eq!(u32::from(LibvcxErrorKind::InvalidProofCredentialData), 1027); - assert_eq!(u32::from(LibvcxErrorKind::InvalidRevocationTimestamp), 1093); - assert_eq!(u32::from(LibvcxErrorKind::CreateSchema), 1041); - assert_eq!(u32::from(LibvcxErrorKind::InvalidSchemaHandle), 1042); - assert_eq!(u32::from(LibvcxErrorKind::InvalidSchemaSeqNo), 1040); - assert_eq!(u32::from(LibvcxErrorKind::DuplicationSchema), 1088); - assert_eq!(u32::from(LibvcxErrorKind::UnknownSchemaRejection), 1094); - assert_eq!(u32::from(LibvcxErrorKind::WalletCreate), 1058); - assert_eq!(u32::from(LibvcxErrorKind::WalletAccessFailed), 1075); - assert_eq!(u32::from(LibvcxErrorKind::InvalidWalletHandle), 1057); - assert_eq!(u32::from(LibvcxErrorKind::DuplicationWallet), 1051); - assert_eq!(u32::from(LibvcxErrorKind::WalletNotFound), 1079); - assert_eq!(u32::from(LibvcxErrorKind::WalletRecordNotFound), 1073); - assert_eq!(u32::from(LibvcxErrorKind::PoolLedgerConnect), 1025); - assert_eq!(u32::from(LibvcxErrorKind::InvalidGenesisTxnPath), 1024); - assert_eq!(u32::from(LibvcxErrorKind::CreatePoolConfig), 1026); - assert_eq!(u32::from(LibvcxErrorKind::DuplicationWalletRecord), 1072); - assert_eq!(u32::from(LibvcxErrorKind::WalletAlreadyOpen), 1052); - assert_eq!(u32::from(LibvcxErrorKind::DuplicationMasterSecret), 1084); - assert_eq!(u32::from(LibvcxErrorKind::DuplicationDid), 1083); - assert_eq!(u32::from(LibvcxErrorKind::InvalidLedgerResponse), 1082); - assert_eq!(u32::from(LibvcxErrorKind::InvalidAttributesStructure), 1021); - assert_eq!(u32::from(LibvcxErrorKind::InvalidProofRequest), 1086); - assert_eq!(u32::from(LibvcxErrorKind::NoPoolOpen), 1030); - assert_eq!(u32::from(LibvcxErrorKind::PostMessageFailed), 1010); - assert_eq!(u32::from(LibvcxErrorKind::LoggingError), 1090); - assert_eq!(u32::from(LibvcxErrorKind::EncodeError), 1022); - assert_eq!(u32::from(LibvcxErrorKind::UnknownError), 1001); - assert_eq!(u32::from(LibvcxErrorKind::InvalidDid), 1008); - assert_eq!(u32::from(LibvcxErrorKind::InvalidVerkey), 1009); - assert_eq!(u32::from(LibvcxErrorKind::InvalidNonce), 1011); - assert_eq!(u32::from(LibvcxErrorKind::InvalidUrl), 1013); - assert_eq!(u32::from(LibvcxErrorKind::SerializationError), 1050); - assert_eq!(u32::from(LibvcxErrorKind::NotBase58), 1014); - assert_eq!(u32::from(LibvcxErrorKind::InvalidHttpResponse), 1033); - assert_eq!(u32::from(LibvcxErrorKind::InvalidMessages), 1020); - assert_eq!(u32::from(LibvcxErrorKind::UnknownLibndyError), 1035); - assert_eq!(u32::from(LibvcxErrorKind::ActionNotSupported), 1103); - assert_eq!(u32::from(LibvcxErrorKind::LibndyError(22222)), 22222); - assert_eq!(u32::from(LibvcxErrorKind::NoAgentInformation), 1106); - assert_eq!(u32::from(LibvcxErrorKind::RevRegDefNotFound), 1107); - assert_eq!(u32::from(LibvcxErrorKind::RevDeltaNotFound), 1108); - assert_eq!(u32::from(LibvcxErrorKind::RevDeltaFailedToClear), 1114); - assert_eq!(u32::from(LibvcxErrorKind::PoisonedLock), 1109); - assert_eq!(u32::from(LibvcxErrorKind::ObjectAccessError), 1110); - assert_eq!(u32::from(LibvcxErrorKind::InvalidMessageFormat), 1111); - assert_eq!(u32::from(LibvcxErrorKind::CreateOutOfBand), 1112); - assert_eq!(u32::from(LibvcxErrorKind::InvalidInput), 1115); - assert_eq!(u32::from(LibvcxErrorKind::ParsingError), 1116); - assert_eq!(u32::from(LibvcxErrorKind::UnimplementedFeature), 1117); - assert_eq!(u32::from(LibvcxErrorKind::LedgerItemNotFound), 1118); - } - - #[test] - fn it_should_map_error_codes_to_error_kinds() { - assert_eq!(LibvcxErrorKind::from(1081), LibvcxErrorKind::InvalidState); - assert_eq!( - LibvcxErrorKind::from(1004), - LibvcxErrorKind::InvalidConfiguration - ); - assert_eq!(LibvcxErrorKind::from(1048), LibvcxErrorKind::InvalidHandle); - assert_eq!(LibvcxErrorKind::from(1016), LibvcxErrorKind::InvalidJson); - assert_eq!(LibvcxErrorKind::from(1007), LibvcxErrorKind::InvalidOption); - assert_eq!( - LibvcxErrorKind::from(1019), - LibvcxErrorKind::InvalidMessagePack - ); - assert_eq!(LibvcxErrorKind::from(1005), LibvcxErrorKind::NotReady); - assert_eq!( - LibvcxErrorKind::from(1091), - LibvcxErrorKind::InvalidRevocationDetails - ); - assert_eq!(LibvcxErrorKind::from(1074), LibvcxErrorKind::IOError); - assert_eq!( - LibvcxErrorKind::from(1080), - LibvcxErrorKind::LibindyInvalidStructure - ); - assert_eq!( - LibvcxErrorKind::from(1067), - LibvcxErrorKind::InvalidLibindyParam - ); - assert_eq!( - LibvcxErrorKind::from(1044), - LibvcxErrorKind::AlreadyInitialized - ); - assert_eq!( - LibvcxErrorKind::from(1061), - LibvcxErrorKind::CreateConnection - ); - assert_eq!( - LibvcxErrorKind::from(1003), - LibvcxErrorKind::InvalidConnectionHandle - ); - assert_eq!(LibvcxErrorKind::from(1034), LibvcxErrorKind::CreateCredDef); - assert_eq!( - LibvcxErrorKind::from(1039), - LibvcxErrorKind::CredDefAlreadyCreated - ); - assert_eq!( - LibvcxErrorKind::from(1037), - LibvcxErrorKind::InvalidCredDefHandle - ); - assert_eq!( - LibvcxErrorKind::from(1092), - LibvcxErrorKind::InvalidRevocationEntry - ); - assert_eq!( - LibvcxErrorKind::from(1095), - LibvcxErrorKind::CreateRevRegDef - ); - assert_eq!( - LibvcxErrorKind::from(1053), - LibvcxErrorKind::InvalidCredentialHandle - ); - assert_eq!( - LibvcxErrorKind::from(1015), - LibvcxErrorKind::InvalidIssuerCredentialHandle - ); - assert_eq!( - LibvcxErrorKind::from(1017), - LibvcxErrorKind::InvalidProofHandle - ); - assert_eq!( - LibvcxErrorKind::from(1049), - LibvcxErrorKind::InvalidDisclosedProofHandle - ); - assert_eq!(LibvcxErrorKind::from(1023), LibvcxErrorKind::InvalidProof); - assert_eq!(LibvcxErrorKind::from(1031), LibvcxErrorKind::InvalidSchema); - assert_eq!( - LibvcxErrorKind::from(1027), - LibvcxErrorKind::InvalidProofCredentialData - ); - assert_eq!( - LibvcxErrorKind::from(1093), - LibvcxErrorKind::InvalidRevocationTimestamp - ); - assert_eq!(LibvcxErrorKind::from(1041), LibvcxErrorKind::CreateSchema); - assert_eq!( - LibvcxErrorKind::from(1042), - LibvcxErrorKind::InvalidSchemaHandle - ); - assert_eq!( - LibvcxErrorKind::from(1040), - LibvcxErrorKind::InvalidSchemaSeqNo - ); - assert_eq!( - LibvcxErrorKind::from(1088), - LibvcxErrorKind::DuplicationSchema - ); - assert_eq!( - LibvcxErrorKind::from(1094), - LibvcxErrorKind::UnknownSchemaRejection - ); - assert_eq!(LibvcxErrorKind::from(1058), LibvcxErrorKind::WalletCreate); - assert_eq!( - LibvcxErrorKind::from(1075), - LibvcxErrorKind::WalletAccessFailed - ); - assert_eq!( - LibvcxErrorKind::from(1057), - LibvcxErrorKind::InvalidWalletHandle - ); - assert_eq!( - LibvcxErrorKind::from(1051), - LibvcxErrorKind::DuplicationWallet - ); - assert_eq!(LibvcxErrorKind::from(1079), LibvcxErrorKind::WalletNotFound); - assert_eq!( - LibvcxErrorKind::from(1073), - LibvcxErrorKind::WalletRecordNotFound - ); - assert_eq!( - LibvcxErrorKind::from(1025), - LibvcxErrorKind::PoolLedgerConnect - ); - assert_eq!( - LibvcxErrorKind::from(1024), - LibvcxErrorKind::InvalidGenesisTxnPath - ); - assert_eq!( - LibvcxErrorKind::from(1026), - LibvcxErrorKind::CreatePoolConfig - ); - assert_eq!( - LibvcxErrorKind::from(1072), - LibvcxErrorKind::DuplicationWalletRecord - ); - assert_eq!( - LibvcxErrorKind::from(1052), - LibvcxErrorKind::WalletAlreadyOpen - ); - assert_eq!( - LibvcxErrorKind::from(1084), - LibvcxErrorKind::DuplicationMasterSecret - ); - assert_eq!(LibvcxErrorKind::from(1083), LibvcxErrorKind::DuplicationDid); - assert_eq!( - LibvcxErrorKind::from(1082), - LibvcxErrorKind::InvalidLedgerResponse - ); - assert_eq!( - LibvcxErrorKind::from(1021), - LibvcxErrorKind::InvalidAttributesStructure - ); - assert_eq!( - LibvcxErrorKind::from(1086), - LibvcxErrorKind::InvalidProofRequest - ); - assert_eq!(LibvcxErrorKind::from(1030), LibvcxErrorKind::NoPoolOpen); - assert_eq!( - LibvcxErrorKind::from(1010), - LibvcxErrorKind::PostMessageFailed - ); - assert_eq!(LibvcxErrorKind::from(1090), LibvcxErrorKind::LoggingError); - assert_eq!(LibvcxErrorKind::from(1022), LibvcxErrorKind::EncodeError); - assert_eq!(LibvcxErrorKind::from(1001), LibvcxErrorKind::UnknownError); - assert_eq!(LibvcxErrorKind::from(1008), LibvcxErrorKind::InvalidDid); - assert_eq!(LibvcxErrorKind::from(1009), LibvcxErrorKind::InvalidVerkey); - assert_eq!(LibvcxErrorKind::from(1011), LibvcxErrorKind::InvalidNonce); - assert_eq!(LibvcxErrorKind::from(1013), LibvcxErrorKind::InvalidUrl); - assert_eq!( - LibvcxErrorKind::from(1050), - LibvcxErrorKind::SerializationError - ); - assert_eq!(LibvcxErrorKind::from(1014), LibvcxErrorKind::NotBase58); - assert_eq!( - LibvcxErrorKind::from(1033), - LibvcxErrorKind::InvalidHttpResponse - ); - assert_eq!( - LibvcxErrorKind::from(1020), - LibvcxErrorKind::InvalidMessages - ); - assert_eq!( - LibvcxErrorKind::from(1035), - LibvcxErrorKind::UnknownLibndyError - ); - assert_eq!( - LibvcxErrorKind::from(1103), - LibvcxErrorKind::ActionNotSupported - ); - assert_eq!( - LibvcxErrorKind::from(1106), - LibvcxErrorKind::NoAgentInformation - ); - assert_eq!( - LibvcxErrorKind::from(1107), - LibvcxErrorKind::RevRegDefNotFound - ); - assert_eq!( - LibvcxErrorKind::from(1108), - LibvcxErrorKind::RevDeltaNotFound - ); - assert_eq!( - LibvcxErrorKind::from(1114), - LibvcxErrorKind::RevDeltaFailedToClear - ); - assert_eq!(LibvcxErrorKind::from(1109), LibvcxErrorKind::PoisonedLock); - assert_eq!( - LibvcxErrorKind::from(1110), - LibvcxErrorKind::ObjectAccessError - ); - assert_eq!( - LibvcxErrorKind::from(1111), - LibvcxErrorKind::InvalidMessageFormat - ); - assert_eq!( - LibvcxErrorKind::from(1112), - LibvcxErrorKind::CreateOutOfBand - ); - assert_eq!(LibvcxErrorKind::from(1115), LibvcxErrorKind::InvalidInput); - assert_eq!(LibvcxErrorKind::from(1116), LibvcxErrorKind::ParsingError); - assert_eq!( - LibvcxErrorKind::from(1117), - LibvcxErrorKind::UnimplementedFeature - ); - assert_eq!( - LibvcxErrorKind::from(1118), - LibvcxErrorKind::LedgerItemNotFound - ); - assert_eq!(LibvcxErrorKind::from(9999), LibvcxErrorKind::UnknownError); - } -} diff --git a/aries/misc/legacy/libvcx_core/src/errors/mod.rs b/aries/misc/legacy/libvcx_core/src/errors/mod.rs deleted file mode 100644 index ba2cf3ad47..0000000000 --- a/aries/misc/legacy/libvcx_core/src/errors/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod error; -pub mod mapping_ffi_tests; -pub mod mapping_from_agency_client; -pub mod mapping_from_ariesvcx; -pub mod mapping_from_ariesvcxcore; -pub mod mapping_from_others; -pub mod mapping_to_u32; diff --git a/aries/misc/legacy/libvcx_core/src/lib.rs b/aries/misc/legacy/libvcx_core/src/lib.rs deleted file mode 100644 index 153c3b167f..0000000000 --- a/aries/misc/legacy/libvcx_core/src/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -// todo: is this recursion_limit still needed and justified? -//this is needed for some large json macro invocations -#![recursion_limit = "128"] -#[macro_use] -pub extern crate aries_vcx; - -extern crate num_traits; - -#[macro_use] -extern crate lazy_static; - -#[macro_use] -extern crate log; - -#[macro_use] -extern crate serde_derive; - -#[macro_use] -pub extern crate serde_json; - -#[macro_use] -pub mod api_vcx; - -pub mod errors; diff --git a/aries/wrappers/node/.eslintignore b/aries/wrappers/node/.eslintignore deleted file mode 100644 index 947a5a1242..0000000000 --- a/aries/wrappers/node/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -build/* -dist/* \ No newline at end of file diff --git a/aries/wrappers/node/.eslintrc.js b/aries/wrappers/node/.eslintrc.js deleted file mode 100644 index 4c9b6413bc..0000000000 --- a/aries/wrappers/node/.eslintrc.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', // Specifies the ESLint parser - parserOptions: { - ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features - sourceType: 'module', // Allows for the use of imports - }, - extends: [ - 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin - 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier - 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. - ], - rules: { - 'prettier/prettier': 'warn', - 'no-console': 'warn', - '@typescript-eslint/no-unused-vars': [ - 'warn', - { argsIgnorePattern: '^_', ignoreRestSiblings: true }, - ], - '@typescript-eslint/no-inferrable-types': 'warn', - '@typescript-eslint/no-empty-function': 'off', - }, -}; diff --git a/aries/wrappers/node/.gitignore b/aries/wrappers/node/.gitignore deleted file mode 100644 index d49a6cc2d7..0000000000 --- a/aries/wrappers/node/.gitignore +++ /dev/null @@ -1,69 +0,0 @@ -dist/ -lib/ -doc/ -.npmrc - -# Created by https://www.gitignore.io/api/node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Typescript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - - -# End of https://www.gitignore.io/api/node diff --git a/aries/wrappers/node/.npmignore b/aries/wrappers/node/.npmignore deleted file mode 100644 index c0026ef655..0000000000 --- a/aries/wrappers/node/.npmignore +++ /dev/null @@ -1,73 +0,0 @@ -build/ -.idea/ -test/ -src/ -tsconfig.json - -*.map - -# Created by https://www.gitignore.io/api/node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Typescript v1 declaration files -typings/ - - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - - -# End of https://www.gitignore.io/api/node diff --git a/aries/wrappers/node/.prettierrc.js b/aries/wrappers/node/.prettierrc.js deleted file mode 100644 index 41ae39e0e8..0000000000 --- a/aries/wrappers/node/.prettierrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - semi: true, - bracketSpacing: true, - trailingComma: "all", - singleQuote: true, - printWidth: 100, - tabWidth: 2, -}; \ No newline at end of file diff --git a/aries/wrappers/node/README.md b/aries/wrappers/node/README.md deleted file mode 100644 index dacec1cbed..0000000000 --- a/aries/wrappers/node/README.md +++ /dev/null @@ -1,26 +0,0 @@ -## Pre-requirements -##### Libraries -Before you'll be able to run demo, you need to make sure you've compiled -- [`vdrtools`](https://gitlab.com/evernym/verity/vdr-tools) -- [`libvcx`](https://github.com/hyperledger/aries-vcx) - -Library binaries must be located `/usr/local/lib` on OSX, `/usr/lib` on Linux. - -# Testing -- To run all unit tests: -``` -npm run test -``` - -## Contribution Guide - -Make sure you have these packages installed: - -* StandardJS -* Typescript - -Run this commands before submitting your PR: - -``` -npm run lint -``` diff --git a/aries/wrappers/node/ci/generate-docs.sh b/aries/wrappers/node/ci/generate-docs.sh deleted file mode 100755 index 8b6db19668..0000000000 --- a/aries/wrappers/node/ci/generate-docs.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Convert this to an npm command - - -typedoc --out doc --excludePrivate --excludeProtected --ignoreCompilerErrors src - diff --git a/aries/wrappers/node/ci/node.dockerfile b/aries/wrappers/node/ci/node.dockerfile deleted file mode 100644 index 02d54db33e..0000000000 --- a/aries/wrappers/node/ci/node.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Development -FROM libindy -ARG uid=1000 -RUN useradd -ms /bin/bash -u $uid node - -WORKDIR vcx/aries/wrappers/node -# Assumes we are in the ./vcx directory -RUN npm i npm@6.1.0 -COPY vcx/libvcx/target/debian/*.deb . -RUN dpkg -i *.deb -USER node diff --git a/aries/wrappers/node/ci/package.sh b/aries/wrappers/node/ci/package.sh deleted file mode 100755 index c77d4b7ed5..0000000000 --- a/aries/wrappers/node/ci/package.sh +++ /dev/null @@ -1,18 +0,0 @@ -export PATH=${PATH}:$(pwd)/vcx/ci/scripts -OUTPUTDIR=output -DIR=vcx/aries/wrappers/node -CURDIR=$(pwd) -cd $DIR -npm i -npm run compile -npm pack - -rename \s/node-vcx-wrapper-/node-vcx-wrapper_/ *.tgz -rename \s/\\.tgz\$/_amd64\\.tgz/ *.tgz - -find . -type f -name 'node-vcx-wrapper*.tgz' -exec create_npm_deb.py {} \; - -cd $CURDIR -cp $DIR/node-vcx*.tgz $OUTPUTDIR -cp $DIR/node-vcx-wrapper_*.deb $OUTPUTDIR - diff --git a/aries/wrappers/node/ci/test-and-package.sh b/aries/wrappers/node/ci/test-and-package.sh deleted file mode 100755 index b4bee2ce58..0000000000 --- a/aries/wrappers/node/ci/test-and-package.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -OUTPUTDIR=/sdk/vcx/output -npm ci -npm run lint -npm run compile -npm test -npm pack - -rename \s/vcx-/vcx_/ *.tgz -rename \s/\\.tgz\$/_amd64\\.tgz/ *.tgz - -cp *.tgz $OUTPUTDIR - -find $OUTPUTDIR -type f -name 'vcx_*.tgz' -exec python3 /sdk/vcx/ci/scripts/create_npm_deb.py {} \; -find -type f -name 'vcx_*.deb' -exec cp {} $OUTPUTDIR \; - - diff --git a/aries/wrappers/node/ci/test.sh b/aries/wrappers/node/ci/test.sh deleted file mode 100755 index e427e4fac1..0000000000 --- a/aries/wrappers/node/ci/test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cd vcx/aries/wrappers/node/ -npm i -npm run lint -npm run compile -npm test -npm run test-logging diff --git a/aries/wrappers/node/ci/test_wrapper.sh b/aries/wrappers/node/ci/test_wrapper.sh deleted file mode 100755 index 3ea4d22c99..0000000000 --- a/aries/wrappers/node/ci/test_wrapper.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -npm -v -npm run lint -npm run compile -npm test -npm pack -test -f vcx-*.tgz diff --git a/aries/wrappers/node/notification-server.js b/aries/wrappers/node/notification-server.js deleted file mode 100644 index c0fde74f33..0000000000 --- a/aries/wrappers/node/notification-server.js +++ /dev/null @@ -1,55 +0,0 @@ -const express = require('express') -const bodyParser = require('body-parser') - -const PORT = 7209 - -const app = express() -app.use(bodyParser.json()) - -const FgRed = '\x1b[31m' -const FgGreen = '\x1b[32m' -const FgYellow = '\x1b[33m' -const FgBlue = '\x1b[34m' -const FgMagenta = '\x1b[35m' -const FgCyan = '\x1b[36m' -const FgWhite = '\x1b[37m' - -const colors = [FgRed, FgGreen, FgYellow, FgBlue, FgMagenta, FgCyan, FgWhite] -let colorIdx = 0 - -const agentColors = {} - -function getAgentColor (agentId) { - if (!agentColors[agentId]) { - agentColors[agentId] = colors[colorIdx] - colorIdx = (colorIdx + 1) % colors.length - } - return agentColors[agentId] -} - -async function run () { - const notifications = {} - - app.post('/notifications/:agentId', async function (req, res) { - const { agentId } = req.params - console.log(getAgentColor(agentId), `${new Date()}] ${agentId}: ${JSON.stringify(req.body, null, 2)}`) - if (!notifications[agentId]) { - notifications[agentId] = [] - } - notifications[agentId].push(req.body) - return res.status(200).send() - }) - - app.get('/notifications', async function (req, res) { - return res.status(200).send(JSON.stringify(notifications)) - }) - - app.use(function (req, res, next) { - console.error(`Request ${req.method} '${req.originalUrl}' was not matched with any handler.\nRequest header:${JSON.stringify(req.headers, null, 2)}\nRequest body: ${JSON.stringify(req.body, null, 2)}`) - res.status(404).send({ message: `Your request: '${req.originalUrl}' didn't reach any handler.` }) - }) - - app.listen(PORT, () => console.log(`Server listening on port ${PORT}!`)) -} - -run() diff --git a/aries/wrappers/node/package-lock.json b/aries/wrappers/node/package-lock.json deleted file mode 100644 index 73fa826382..0000000000 --- a/aries/wrappers/node/package-lock.json +++ /dev/null @@ -1,4806 +0,0 @@ -{ - "name": "@hyperledger/node-vcx-wrapper", - "version": "0.62.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "@hyperledger/node-vcx-wrapper", - "version": "0.62.0", - "license": "Apache-2.0", - "dependencies": { - "@hyperledger/vcx-napi-rs": "file:../vcx-napi-rs", - "fs-extra": "^4.0.2", - "lodash": "^4.17.21", - "uuid": "^8.3.2", - "weak-napi": "^2.0.2" - }, - "devDependencies": { - "@types/app-module-path": "^2.2.0", - "@types/chai": "^4.2.22", - "@types/lodash": "^4.14.177", - "@types/mocha": "^8.2.3", - "@types/node": "^12.20.55", - "@types/uuid": "^8.3.3", - "@types/weak-napi": "^1.0.0", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", - "app-module-path": "^2.2.0", - "chai": "^4.3.4", - "eslint": "^7.32.0", - "eslint-config-prettier": "^7.2.0", - "eslint-plugin-prettier": "^3.4.1", - "mocha": "^9.2.2", - "prettier": "^2.5.0", - "ts-node": "^10.9.1", - "typescript": "^4.8.4" - } - }, - "../vcx-napi-rs": { - "name": "@hyperledger/vcx-napi-rs", - "license": "Apache-2.0", - "devDependencies": { - "@napi-rs/cli": "^2.9.1", - "@types/node": "^18.11.18", - "typescript": "^4.8.4" - }, - "optionalDependencies": { - "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", - "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", - "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", - "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.10.4" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", - "dev": true, - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "node_modules/@hyperledger/vcx-napi-rs": { - "resolved": "../vcx-napi-rs", - "link": true - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "node_modules/@types/app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-r47Kt3ApJDzUU2xCNzaBI25Au5Xfdvf0Gyomveqvg46nQ3J4PaDLicObhyX6cMhvMVWJMB/BnkXdv1E4zxP+6w==", - "dev": true - }, - "node_modules/@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "node_modules/@types/lodash": { - "version": "4.14.194", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.194.tgz", - "integrity": "sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==", - "dev": true - }, - "node_modules/@types/mocha": { - "version": "8.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", - "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", - "dev": true - }, - "node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, - "node_modules/@types/uuid": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", - "dev": true - }, - "node_modules/@types/weak-napi": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/weak-napi/-/weak-napi-1.0.1.tgz", - "integrity": "sha512-EqTeT7n+f6uxfLFRDcJEOu12dH0AT2fZlb8MTQKDG8E70T7uP//qG4CMdNKV3Ra/cxG7/Z1i04GT7Ll0QriWvQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", - "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", - "dev": true, - "dependencies": { - "@typescript-eslint/experimental-utils": "4.33.0", - "@typescript-eslint/scope-manager": "4.33.0", - "debug": "^4.3.1", - "functional-red-black-tree": "^1.0.1", - "ignore": "^5.1.8", - "regexpp": "^3.1.0", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^4.0.0", - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", - "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.33.0", - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/typescript-estree": "4.33.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "*" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", - "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "4.33.0", - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/typescript-estree": "4.33.0", - "debug": "^4.3.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", - "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0" - }, - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", - "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", - "dev": true, - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", - "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "4.33.0", - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^8.10.0 || ^10.13.0 || >=11.10.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==", - "dev": true - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-prettier": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", - "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz", - "integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==", - "dev": true, - "dependencies": { - "prettier-linter-helpers": "^1.0.0" - }, - "engines": { - "node": ">=6.0.0" - }, - "peerDependencies": { - "eslint": ">=5.0.0", - "prettier": ">=1.13.0" - }, - "peerDependenciesMeta": { - "eslint-config-prettier": { - "optional": true - } - } - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint/node_modules/ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", - "dev": true, - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "node_modules/fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/get-symbol-from-current-process-h": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", - "integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==" - }, - "node_modules/get-uv-event-loop-napi-h": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz", - "integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==", - "dependencies": { - "get-symbol-from-current-process-h": "^1.0.1" - } - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true, - "engines": { - "node": ">=4.x" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", - "dev": true, - "dependencies": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.3", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "4.2.1", - "ms": "2.1.3", - "nanoid": "3.3.1", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" - } - }, - "node_modules/mocha/node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/mocha/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/mocha/node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/mocha/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/mocha/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" - }, - "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prettier": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", - "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "dependencies": { - "fast-diff": "^1.1.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/setimmediate-napi": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/setimmediate-napi/-/setimmediate-napi-1.0.6.tgz", - "integrity": "sha512-sdNXN15Av1jPXuSal4Mk4tEAKn0+8lfF9Z50/negaQMrAIO9c1qM0eiCh8fT6gctp0RiCObk+6/Xfn5RMGdZoA==", - "dependencies": { - "get-symbol-from-current-process-h": "^1.0.1", - "get-uv-event-loop-napi-h": "^1.0.5" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", - "dev": true, - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/table/node_modules/ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "node_modules/weak-napi": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", - "integrity": "sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==", - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", - "setimmediate-napi": "^1.0.3" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true - }, - "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - } - }, - "@eslint/eslintrc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", - "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - } - } - }, - "@humanwhocodes/config-array": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", - "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - } - }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true - }, - "@hyperledger/vcx-napi-rs": { - "version": "file:../vcx-napi-rs", - "requires": { - "@hyperledger/vcx-napi-rs-darwin-arm64": "undefined", - "@hyperledger/vcx-napi-rs-darwin-x64": "undefined", - "@hyperledger/vcx-napi-rs-linux-x64-gnu": "undefined", - "@hyperledger/vcx-napi-rs-linux-x64-musl": "undefined", - "@napi-rs/cli": "^2.9.1", - "@types/node": "^18.11.18", - "typescript": "^4.8.4" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true - }, - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", - "dev": true - }, - "@types/app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@types/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-r47Kt3ApJDzUU2xCNzaBI25Au5Xfdvf0Gyomveqvg46nQ3J4PaDLicObhyX6cMhvMVWJMB/BnkXdv1E4zxP+6w==", - "dev": true - }, - "@types/chai": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", - "integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==", - "dev": true - }, - "@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", - "dev": true - }, - "@types/lodash": { - "version": "4.14.194", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.194.tgz", - "integrity": "sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==", - "dev": true - }, - "@types/mocha": { - "version": "8.2.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", - "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", - "dev": true - }, - "@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, - "@types/uuid": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", - "dev": true - }, - "@types/weak-napi": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/weak-napi/-/weak-napi-1.0.1.tgz", - "integrity": "sha512-EqTeT7n+f6uxfLFRDcJEOu12dH0AT2fZlb8MTQKDG8E70T7uP//qG4CMdNKV3Ra/cxG7/Z1i04GT7Ll0QriWvQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@typescript-eslint/eslint-plugin": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz", - "integrity": "sha512-aINiAxGVdOl1eJyVjaWn/YcVAq4Gi/Yo35qHGCnqbWVz61g39D0h23veY/MA0rFFGfxK7TySg2uwDeNv+JgVpg==", - "dev": true, - "requires": { - "@typescript-eslint/experimental-utils": "4.33.0", - "@typescript-eslint/scope-manager": "4.33.0", - "debug": "^4.3.1", - "functional-red-black-tree": "^1.0.1", - "ignore": "^5.1.8", - "regexpp": "^3.1.0", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/experimental-utils": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.33.0.tgz", - "integrity": "sha512-zeQjOoES5JFjTnAhI5QY7ZviczMzDptls15GFsI6jyUOq0kOf9+WonkhtlIhh0RgHRnqj5gdNxW5j1EvAyYg6Q==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.33.0", - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/typescript-estree": "4.33.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" - } - }, - "@typescript-eslint/parser": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.33.0.tgz", - "integrity": "sha512-ZohdsbXadjGBSK0/r+d87X0SBmKzOq4/S5nzK6SBgJspFo9/CUDJ7hjayuze+JK7CZQLDMroqytp7pOcFKTxZA==", - "dev": true, - "requires": { - "@typescript-eslint/scope-manager": "4.33.0", - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/typescript-estree": "4.33.0", - "debug": "^4.3.1" - } - }, - "@typescript-eslint/scope-manager": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.33.0.tgz", - "integrity": "sha512-5IfJHpgTsTZuONKbODctL4kKuQje/bzBRkwHE8UOZ4f89Zeddg+EGZs8PD8NcN4LdM3ygHWYB3ukPAYjvl/qbQ==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0" - } - }, - "@typescript-eslint/types": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", - "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", - "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.33.0", - "@typescript-eslint/visitor-keys": "4.33.0", - "debug": "^4.3.1", - "globby": "^11.0.3", - "is-glob": "^4.0.1", - "semver": "^7.3.5", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "4.33.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", - "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "4.33.0", - "eslint-visitor-keys": "^2.0.0" - } - }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, - "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "app-module-path": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", - "integrity": "sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==", - "dev": true - }, - "arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chai": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.7.tgz", - "integrity": "sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", - "dev": true - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "eslint": { - "version": "7.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", - "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", - "dev": true, - "requires": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "ignore": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true - } - } - }, - "eslint-config-prettier": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", - "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", - "dev": true, - "requires": {} - }, - "eslint-plugin-prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.1.tgz", - "integrity": "sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - }, - "espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", - "dev": true, - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - }, - "esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, - "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true - }, - "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", - "dev": true - }, - "get-symbol-from-current-process-h": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", - "integrity": "sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==" - }, - "get-uv-event-loop-napi-h": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/get-uv-event-loop-napi-h/-/get-uv-event-loop-napi-h-1.0.6.tgz", - "integrity": "sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==", - "requires": { - "get-symbol-from-current-process-h": "^1.0.1" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, - "loupe": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", - "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", - "dev": true, - "requires": { - "get-func-name": "^2.0.0" - } - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "mocha": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz", - "integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.3", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "4.2.1", - "ms": "2.1.3", - "nanoid": "3.3.1", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "dependencies": { - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "minimatch": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz", - "integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "nanoid": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", - "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node-addon-api": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", - "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" - }, - "node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==" - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "prettier": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", - "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", - "dev": true - }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "setimmediate-napi": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/setimmediate-napi/-/setimmediate-napi-1.0.6.tgz", - "integrity": "sha512-sdNXN15Av1jPXuSal4Mk4tEAKn0+8lfF9Z50/negaQMrAIO9c1qM0eiCh8fT6gctp0RiCObk+6/Xfn5RMGdZoA==", - "requires": { - "get-symbol-from-current-process-h": "^1.0.1", - "get-uv-event-loop-napi-h": "^1.0.5" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", - "dev": true, - "requires": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ajv": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", - "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - } - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "dependencies": { - "acorn": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", - "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - } - } - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, - "v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true - }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true - }, - "weak-napi": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/weak-napi/-/weak-napi-2.0.2.tgz", - "integrity": "sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==", - "requires": { - "node-addon-api": "^3.0.0", - "node-gyp-build": "^4.2.1", - "setimmediate-napi": "^1.0.3" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true - }, - "workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } - } -} diff --git a/aries/wrappers/node/package.json b/aries/wrappers/node/package.json deleted file mode 100644 index a19ecaf9aa..0000000000 --- a/aries/wrappers/node/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "homepage": "https://github.com/hyperledger/aries-vcx/tree/master/wrappers/node", - "name": "@hyperledger/node-vcx-wrapper", - "description": "NodeJS wrapper Aries Framework", - "license": "Apache-2.0", - "version": "0.62.0", - "directories": { - "test": "test", - "build": "dist", - "lib": "src" - }, - "contributors": [ - { - "name": "Hyperledger Indy Contributors", - "email": "indy@lists.hyperledger.org" - } - ], - "bugs": { - "url": "https://github.com/hyperledger/aries-vcx/issues" - }, - "standard": { - "env": [ - "mocha" - ] - }, - "repository": { - "url": "https://github.com/hyperledger/aries-vcx.git", - "type": "git" - }, - "publishConfig": { - "access": "public" - }, - "dependencies": { - "fs-extra": "^4.0.2", - "lodash": "^4.17.21", - "uuid": "^8.3.2", - "@hyperledger/vcx-napi-rs": "file:../vcx-napi-rs", - "weak-napi": "^2.0.2" - }, - "devDependencies": { - "@types/app-module-path": "^2.2.0", - "@types/chai": "^4.2.22", - "@types/lodash": "^4.14.177", - "@types/mocha": "^8.2.3", - "@types/node": "^12.20.55", - "@types/uuid": "^8.3.3", - "@types/weak-napi": "^1.0.0", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", - "app-module-path": "^2.2.0", - "chai": "^4.3.4", - "eslint": "^7.32.0", - "eslint-config-prettier": "^7.2.0", - "eslint-plugin-prettier": "^3.4.1", - "mocha": "^9.2.2", - "prettier": "^2.5.0", - "ts-node": "^10.9.1", - "typescript": "^4.8.4" - }, - "scripts": { - "tscversion": "tsc --version", - "compile": "./node_modules/.bin/tsc -p ./tsconfig.json", - "clean": "rm -rf dist node_modules", - "lint": "eslint '*/**/*.{js,ts,tsx}'", - "lint-fix": "npm run lint -- --fix", - "jslint:fix": "standard --fix", - "test": "npm run test:connection && npm run test:nonmediatedConnection && npm run test:credentialDef && npm run test:credential && npm run test:disclosedProof && npm run test:issuerCredential && npm run test:proof && npm run test:oob && npm run test:schema && npm run test:utils && npm run test:wallet", - "test:nonmediatedConnection": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register test/suite1/ariesvcx-connection.test.ts", - "test:connection": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register test/suite1/ariesvcx-mediated-connection.test.ts", - "test:credentialDef": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-credential-def.test.ts", - "test:credential": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-credential.test.ts", - "test:disclosedProof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-disclosed-proof.test.ts", - "test:issuerCredential": "TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-issuer-credential.test.ts", - "test:proof": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-proof.test.ts", - "test:schema": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-schema.test.ts", - "test:utils": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-utils.test.ts", - "test:oob": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-oob.test.ts", - "test:wallet": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/suite1/ariesvcx-wallet.test.ts", - "test:integration": " TS_NODE_PROJECT=./test/tsconfig.json NODE_ENV=test RUST_BACKTRACE=full mocha --timeout 5000 --v8-use-strict --exit --require ts-node/register ./test/integration/ledger.test.ts" - }, - "main": "dist/index.js", - "typings": "dist/index.d.ts" -} diff --git a/aries/wrappers/node/publish.sh b/aries/wrappers/node/publish.sh deleted file mode 100755 index 050f364a7f..0000000000 --- a/aries/wrappers/node/publish.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -errcho(){ >&2 echo ">> ERROR: $@"; } - -function exitWithErrMsg() { - errcho "$1" - exit 1 -} - -if [ -z "$NPMJS_TOKEN" ]; then - exitWithErrMsg "NPMJS_TOKEN environment variable not set." -fi -if [ -z "$PUBLISH_VERSION" ]; then - exitWithErrMsg "PUBLISH_VERSION environment variable not set." -fi - -cd "$(dirname "$0")" || exit -echo '//registry.npmjs.org/:_authToken=${NPMJS_TOKEN}' > .npmrc -npm install --save-exact @hyperledger/vcx-napi-rs@${PUBLISH_VERSION} || exitWithErrMsg "Failed to install @hyperledger/vcx-napi-rs@${PUBLISH_VERSION}" -npm install -npm run compile -npm version --no-git-tag-version $PUBLISH_VERSION -npm publish diff --git a/aries/wrappers/node/resources/localhost.txn b/aries/wrappers/node/resources/localhost.txn deleted file mode 100644 index 66fb071b90..0000000000 --- a/aries/wrappers/node/resources/localhost.txn +++ /dev/null @@ -1,4 +0,0 @@ -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"127.0.0.1","client_port":9702,"node_ip":"127.0.0.1","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"127.0.0.1","client_port":9704,"node_ip":"127.0.0.1","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node3","blskey":"3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5","blskey_pop":"QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh","client_ip":"127.0.0.1","client_port":9706,"node_ip":"127.0.0.1","node_port":9705,"services":["VALIDATOR"]},"dest":"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya"},"metadata":{"from":"4cU41vWW82ArfxJxHkzXPG"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"7e9f355dffa78ed24668f0e0e369fd8c224076571c51e2ea8be5f26479edebe4"},"ver":"1"} -{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node4","blskey":"2zN3bHM1m4rLz54MJHYSwvqzPchYp8jkHswveCLAEJVcX6Mm1wHQD1SkPYMzUDTZvWvhuE6VNAkK3KxVeEmsanSmvjVkReDeBEMxeDaayjcZjFGPydyey1qxBHmTvAnBKoPydvuTAqx5f7YNNRAdeLmUi99gERUU7TD8KfAa6MpQ9bw","blskey_pop":"RPLagxaR5xdimFzwmzYnz4ZhWtYQEj8iR5ZU53T2gitPCyCHQneUn2Huc4oeLd2B2HzkGnjAff4hWTJT6C7qHYB1Mv2wU5iHHGFWkhnTX9WsEAbunJCV2qcaXScKj4tTfvdDKfLiVuU2av6hbsMztirRze7LvYBkRHV3tGwyCptsrP","client_ip":"127.0.0.1","client_port":9708,"node_ip":"127.0.0.1","node_port":9707,"services":["VALIDATOR"]},"dest":"4PS3EDQ3dW1tci1Bp6543CfuuebjFrg36kLAUcskGfaA"},"metadata":{"from":"TWwCRQRZ2ZHMJFn9TzLp7W"},"type":"0"},"txnMetadata":{"seqNo":4,"txnId":"aa5e817d7cc626170eca175822029339a444eb0ee8f0bd20d3b0b76e566fb008"},"ver":"1"} \ No newline at end of file diff --git a/aries/wrappers/node/src/api/common.ts b/aries/wrappers/node/src/api/common.ts deleted file mode 100644 index cdaecd3e42..0000000000 --- a/aries/wrappers/node/src/api/common.ts +++ /dev/null @@ -1,178 +0,0 @@ -export enum VCXCode { - SUCCESS = 0, - INDY_WALLET_RECORD_NOT_FOUND = 212, - INDY_DUPLICATE_WALLET_RECORD = 213, - UNKNOWN_ERROR = 1001, - CONNECTION_ERROR = 1002, - INVALID_CONNECTION_HANDLE = 1003, - INVALID_CONFIGURATION = 1004, - NOT_READY = 1005, - NO_ENDPOINT = 1006, - INVALID_OPTION = 1007, - INVALID_DID = 1008, - INVALID_VERKEY = 1009, - POST_MSG_FAILURE = 1010, - INVALID_NONCE = 1011, - INVALID_KEY_DELEGATE = 1012, - INVALID_URL = 1013, - NOT_BASE58 = 1014, - INVALID_ISSUER_CREDENTIAL_HANDLE = 1015, - INVALID_JSON = 1016, - INVALID_PROOF_HANDLE = 1017, - INVALID_CREDENTIAL_REQUEST = 1018, - INVALID_MESSAGE_PACK = 1019, - INVALID_MESSAGES = 1020, - INVALID_ATTRIBUTES_STRUCTURE = 1021, - BIG_NUMBER_ERROR = 1022, - INVALID_PROOF = 1023, - INVALID_GENESIS_TXN_PATH = 1024, - POOL_LEDGER_CONNECT = 1025, - CREATE_POOL_CONIFG = 1026, - INVALID_PROOF_CREDENTIAL_DATA = 1027, - INDY_SUBMIT_REQUEST_ERROR = 1028, - BUILD_CREDENTIAL_DEF_REQ_ERR = 1029, - NO_POOL_OPEN = 1030, - INVALID_SCHEMA = 1031, - FAILED_POOL_COMPLIANCE = 1032, - INVALID_HTTP_RESPONSE = 1033, - CREATE_CREDENTIAL_DEF_ERR = 1034, - UNKNOWN_LIBINDY_ERROR = 1035, - INVALID_CREDENTIAL_DEF = 1036, - INVALID_CREDENTIAL_DEF_HANDLE = 1037, - TIMEOUT_LIBINDY_ERROR = 1038, - CREDENTIAL_DEF_ALREADY_CREATED = 1039, - INVALID_SCHEMA_SEQUENCE_NUMBER = 1040, - INVALID_SCHEMA_CREATION = 1041, - INVALID_SCHEMA_HANDLE = 1042, - INVALID_MASTER_SECRET = 1043, - ALREADY_INITIALIZED = 1044, - INVALID_INVITE_DETAILS = 1045, - INVALID_SELF_ATTESTED_VAL = 1046, - INVALID_PREDICATE = 1047, - INVALID_OBJ_HANDLE = 1048, - INVALID_DISCLOSED_PROOF_HANDLE = 1049, - SERIALIZATION_ERROR = 1050, - WALLET_ALREADY_EXISTS = 1051, - WALLET_ALREADY_OPEN = 1052, - INVALID_CREDENTIAL_HANDLE = 1053, - INVALID_CREDENTIAL_JSON = 1054, - CREATE_CREDENTIAL_FAILED = 1055, - CREATE_PROOF_ERROR = 1056, - INVALID_WALLET_HANDLE = 1057, - INVALID_WALLET_CREATION = 1058, - INVALID_POOL_NAME = 1059, - CANNOT_DELETE_CONNECTION = 1060, - CREATE_CONNECTION_ERROR = 1061, - INVALID_WALLET_SETUP = 1062, - COMMON_ERROR = 1063, - INSUFFICIENT_TOKEN_AMOUNT = 1064, - UNKNOWN_TXN_TYPE = 1065, - INVALID_PAYMENT_ADDRESS = 1066, - INVALID_LIBINDY_PARAM = 1067, - INVALID_PAYMENT = 1068, - MISSING_WALLET_KEY = 1069, - OBJECT_CACHE_ERROR = 1070, - NO_PAYMENT_INFORMATION = 1071, - DUPLICATE_WALLET_RECORD = 1072, - WALLET_RECORD_NOT_FOUND = 1073, - IO_ERROR = 1074, - WALLET_ACCESS_FAILED = 1075, - MISSING_WALLET_NAME = 1076, - MISSING_EXPORTED_WALLET_PATH = 1077, - MISSING_BACKUP_KEY = 1078, - WALLET_NOR_FOUND = 1079, - LIBINDY_INVALID_STRUCTURE = 1080, - INVALID_STATE = 1081, - INVALID_LEDGER_RESPONSE = 1082, - DID_ALREADY_EXISTS_IN_WALLET = 1083, - DUPLICATE_MASTER_SECRET = 1084, - THREAD_ERROR = 1085, - INVALID_PROOF_REQUEST = 1086, - MISSING_PAYMENT_METHOD = 1087, - DUPLICATE_SCHEMA = 1088, - UNKNOWN_LIBINDY_REJECTION = 1089, - LOGGING_ERROR = 1090, - INVALID_REVOCATION_DETAILS = 1091, - INVALID_REV_ENTRY = 1092, - INVALID_REVOCATION_TIMESTAMP = 1093, - UNKNOWN_SCHEMA_REJECTION = 1094, - INVALID_REV_REG_DEF_CREATION = 1095, - /* EC 1096 - 1099 are reserved for proprietary forks of libVCX */ - INVALID_ATTACHMENT_ENCODING = 1100, - UNKNOWN_ATTACHMENT_ENCODING = 1101, - UNKNOWN_MIME_TYPE = 1102, - ACTION_NOT_SUPPORTED = 1103, - INVALID_REDIRECT_DETAILS = 1104, - NO_AGENT_INFO = 1106, - REV_REG_DEF_NOT_FOUND = 1107, - REV_DELTA_NOT_FOUND = 1108, - POISONED_LOCK = 1109, - CREATE_PUBLIC_AGENT = 1110, - INVALID_MESSAGE_FORMAT = 1111, - CREATE_OUT_OF_BAND = 1112, - CREATE_AGENT = 1113, - REV_DELTA_FAILED_TO_CLEAR = 1114, - INVALID_INPUT = 1115, - PARSING_ERROR = 1116, - UNIMPLEMENTED_FEATURE = 1117, - LEDGER_ITEM_NOT_FOUND = 1118, -} -export enum MediatedConnectionStateType { - Initial = 0, - Invited = 1, - Responded = 3, - Requested = 2, - Finished = 4, -} - -export enum ConnectionStateType { - Initial = 0, - Invited = 1, - Requested = 2, - Finished = 4, -} - -export enum HolderStateType { - Initial = 0, - ProposalSet = 1, - OfferReceived = 2, - RequestSet = 3, - Finished = 4, - Failed = 5, -} - -export enum IssuerStateType { - Initial = 0, - ProposalReceived = 1, - OfferSet = 2, - RequestReceived = 4, - CredentialSet = 5, - Finished = 6, - Failed = 7, -} - -export enum ProverStateType { - Initial = 0, - PresentationProposalSent = 1, - PresentationRequestReceived = 2, - PresentationPrepared = 3, - PresentationPreparationFailed = 4, - PresentationSent = 5, - Finished = 6, - Failed = 7, -} - -export enum VerifierStateType { - Initial = 0, - PresentationRequestSet = 1, - PresentationProposalReceived = 2, - PresentationRequestSent = 3, - Finished = 4, - Failed = 5, -} - -export interface ISerializedData { - version: string; - data: T; - source_id: string; -} diff --git a/aries/wrappers/node/src/api/connection.ts b/aries/wrappers/node/src/api/connection.ts deleted file mode 100644 index 887fe48e4d..0000000000 --- a/aries/wrappers/node/src/api/connection.ts +++ /dev/null @@ -1,198 +0,0 @@ -import * as ffiNapi from '@hyperledger/vcx-napi-rs'; -import { VCXInternalError } from '../errors'; -import { ISerializedData, ConnectionStateType } from './common'; -import { VcxBaseWithState } from './vcx-base-with-state'; -import { IPwInfo } from './utils'; - -export type INonmediatedConnectionInvite = string; - -export type INonmeditatedConnectionData = string; - -export interface IEndpointInfo { - serviceEndpoint: string; - routingKeys: string[]; -} - -export class NonmediatedConnection extends VcxBaseWithState< - INonmeditatedConnectionData, - ConnectionStateType -> { - public static async createInviter(pwInfo?: IPwInfo): Promise { - try { - const connection = new NonmediatedConnection(); - connection._setHandle( - await ffiNapi.connectionCreateInviter(pwInfo ? JSON.stringify(pwInfo) : null), - ); - return connection; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static async createInvitee(invite: string): Promise { - try { - const connection = new NonmediatedConnection(); - connection._setHandle(await ffiNapi.connectionCreateInvitee(invite)); - return connection; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getThreadId(): string { - try { - return ffiNapi.connectionGetThreadId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getPairwiseInfo(): string { - try { - return ffiNapi.connectionGetPairwiseInfo(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getRemoteDid(): string { - try { - return ffiNapi.connectionGetRemoteDid(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getRemoteVerkey(): string { - try { - return ffiNapi.connectionGetRemoteVk(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async processInvite(invite: string): Promise { - try { - await ffiNapi.connectionProcessInvite(this.handle, invite); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async processRequest(request: string, endpointInfo: IEndpointInfo): Promise { - try { - const { serviceEndpoint, routingKeys } = endpointInfo; - await ffiNapi.connectionProcessRequest(this.handle, request, serviceEndpoint, routingKeys); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async processResponse(response: string): Promise { - try { - await ffiNapi.connectionProcessResponse(this.handle, response); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async processAck(message: string): Promise { - try { - await ffiNapi.connectionProcessAck(this.handle, message); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public processProblemReport(problemReport: string): void { - try { - ffiNapi.connectionProcessProblemReport(this.handle, problemReport); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendResponse(): Promise { - try { - await ffiNapi.connectionSendResponse(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendRequest(endpointInfo: IEndpointInfo): Promise { - try { - const { serviceEndpoint, routingKeys } = endpointInfo; - await ffiNapi.connectionSendRequest(this.handle, serviceEndpoint, routingKeys); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendAck(): Promise { - try { - await ffiNapi.connectionSendAck(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendMessage(content: string): Promise { - try { - return await ffiNapi.connectionSendGenericMessage(this.handle, content); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendAriesMessage(content: string): Promise { - try { - return await ffiNapi.connectionSendAriesMessage(this.handle, content); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async createInvite(endpointInfo: IEndpointInfo): Promise { - try { - const { serviceEndpoint, routingKeys } = endpointInfo; - await ffiNapi.connectionCreateInvite(this.handle, serviceEndpoint, routingKeys); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getInvitation(): INonmediatedConnectionInvite { - try { - return ffiNapi.connectionGetInvitation(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getState(): ConnectionStateType { - try { - return ffiNapi.connectionGetState(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static deserialize(connectionData: ISerializedData): NonmediatedConnection { - try { - return super._deserialize(NonmediatedConnection, connectionData as any); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - protected _releaseFn = ffiNapi.connectionRelease; - protected _updateStFn = ffiNapi.mediatedConnectionUpdateState; - protected _updateStFnV2 = async (_handle: number, _connHandle: number): Promise => { - throw new Error('_updateStFnV2 cannot be called for a Connection object'); - }; - protected _getStFn = ffiNapi.connectionGetState; - protected _serializeFn = ffiNapi.connectionSerialize; - protected _deserializeFn = ffiNapi.connectionDeserialize; - protected _inviteDetailFn = ffiNapi.connectionGetInvitation; -} diff --git a/aries/wrappers/node/src/api/credential-def.ts b/aries/wrappers/node/src/api/credential-def.ts deleted file mode 100644 index 8660d84cc6..0000000000 --- a/aries/wrappers/node/src/api/credential-def.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as ffi from '@hyperledger/vcx-napi-rs'; -import { ISerializedData } from './common'; -import { VcxBase } from './vcx-base'; -import { VCXInternalError } from '../errors'; - -export interface ICredentialDefCreateDataV2 { - issuerDid: string; - sourceId: string; - schemaId: string; - supportRevocation: boolean; - tag: string; -} - -export interface ICredentialDefData { - source_id: string; - handle: number; - name: string; - credential_def: ICredentialDefDataObj; -} - -export interface ICredentialDefDataObj { - ref: number; - origin: string; - signature_type: string; - data: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export interface ICredentialDefParams { - schemaId?: string; - name?: string; - credDefId?: string; - tailsDir?: string; -} - -export interface IRevocationDetails { - maxCreds?: number; - supportRevocation?: boolean; - tailsDir?: string; -} - -export enum CredentialDefState { - Built = 0, - Published = 1, -} - -export class CredentialDef extends VcxBase { - public static async create({ - issuerDid, - supportRevocation, - schemaId, - sourceId, - tag, - }: ICredentialDefCreateDataV2): Promise { - try { - const credentialDef = new CredentialDef({ schemaId }); - const handle = await ffi.credentialdefCreateV2(issuerDid, sourceId, schemaId, tag, supportRevocation); - credentialDef._setHandle(handle); - return credentialDef; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static deserialize( - credentialDef: ISerializedData, - ): CredentialDef { - const { - data: { name }, - } = credentialDef; - const credentialDefParams = { - name, - schemaId: null, - }; - return super._deserialize(CredentialDef, credentialDef as any, credentialDefParams); - } - - protected _serializeFn = ffi.credentialdefSerialize; - protected _deserializeFn = ffi.credentialdefDeserialize; - protected _releaseFn = ffi.credentialdefRelease; - private _name: string | undefined; - private _schemaId: string | undefined; - private _credDefId: string | undefined; - private _tailsDir: string | undefined; - - constructor({ name, schemaId, credDefId, tailsDir }: ICredentialDefParams) { - super(); - this._name = name; - this._schemaId = schemaId; - this._credDefId = credDefId; - this._tailsDir = tailsDir; - } - - public releaseRustData(): void { - try { - this._releaseFn(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async publish(): Promise { - try { - await ffi.credentialdefPublish(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getCredDefId(): string { - try { - return ffi.credentialdefGetCredDefId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async updateState(): Promise { - try { - return await ffi.credentialdefUpdateState(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getState(): CredentialDefState { - try { - return ffi.credentialdefGetState(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - get name(): string | undefined { - return this._name; - } - - get schemaId(): string | undefined { - return this._schemaId; - } - - get credDefId(): string | undefined { - return this._credDefId; - } - - get tailsDir(): string | undefined { - return this._tailsDir; - } - - protected _setHandle(handle: number): void { - super._setHandle(handle); - } -} diff --git a/aries/wrappers/node/src/api/credential.ts b/aries/wrappers/node/src/api/credential.ts deleted file mode 100644 index 0e052b0d44..0000000000 --- a/aries/wrappers/node/src/api/credential.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as ffi from '@hyperledger/vcx-napi-rs'; -import { ISerializedData, HolderStateType } from './common'; -import { Connection } from './mediated-connection'; -import { VcxBaseWithState } from './vcx-base-with-state'; -import { VCXInternalError } from '../errors'; - -export interface ICredentialStructData { - source_id: string; -} - -// eslint-disable-next-line @typescript-eslint/ban-types -export type ICredentialOffer = [object, object]; - -export interface ICredentialCreateWithOffer { - sourceId: string; - offer: string; - connection: Connection; -} - -export interface ICredentialSendData { - connection: Connection; -} - -export class Credential extends VcxBaseWithState { - public static create({ sourceId, offer }: ICredentialCreateWithOffer): Credential { - try { - const credential = new Credential(); - const handle = ffi.credentialCreateWithOffer(sourceId, offer); - credential._setHandle(handle); - return credential; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static deserialize( - credentialData: ISerializedData, - ): Credential { - // running into issue https://github.com/microsoft/TypeScript/issues/15300 without using "as any" - const credential = super._deserialize(Credential, credentialData as any); - return credential; - } - - protected _releaseFn = ffi.credentialRelease; - protected _updateStFnV2 = ffi.v2CredentialUpdateState; - protected _getStFn = ffi.credentialGetState; - protected _serializeFn = ffi.credentialSerialize; - protected _deserializeFn = ffi.credentialDeserialize; - - public static async getOffers(connection: Connection): Promise { - try { - const offersStr = await ffi.credentialGetOffers(connection.handle); - const offers: ICredentialOffer[] = JSON.parse(offersStr); - return offers; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendRequest({ connection }: ICredentialSendData): Promise { - try { - return await ffi.credentialSendRequest(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getAttributes(): string { - try { - return ffi.credentialGetAttributes(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getAttachment(): string { - try { - return ffi.credentialGetAttachment(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getTailsLocation(): string { - try { - return ffi.credentialGetTailsLocation(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getTailsHash(): string { - try { - return ffi.credentialGetTailsHash(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getRevRegId(): string { - try { - return ffi.credentialGetRevRegId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getThreadId(): string { - try { - return ffi.credentialGetThreadId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async declineOffer(connection: Connection, comment: string) { - try { - await ffi.credentialDeclineOffer(this.handle, connection.handle, comment); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - protected _setHandle(handle: number): void { - super._setHandle(handle); - } -} diff --git a/aries/wrappers/node/src/api/disclosed-proof.ts b/aries/wrappers/node/src/api/disclosed-proof.ts deleted file mode 100644 index 6d0f816dde..0000000000 --- a/aries/wrappers/node/src/api/disclosed-proof.ts +++ /dev/null @@ -1,163 +0,0 @@ -import { ISerializedData, ProverStateType } from './common'; -import { Connection } from './mediated-connection'; -import { VcxBaseWithState } from './vcx-base-with-state'; -import * as ffi from '@hyperledger/vcx-napi-rs'; -import { VCXInternalError } from '../errors'; - -export interface IDisclosedProofData { - source_id: string; -} - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type IDisclosedProofRequest = Record; - -export interface IDisclosedProofCreateData { - connection: Connection; - sourceId: string; - request: string; -} - -export interface IRetrievedCreds { - attrs: { - [index: string]: ICredData[]; - }; - predicates: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export interface ICredData { - cred_info: { - [index: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any - }; - interval: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export interface IGenerateProofData { - selectedCreds: { - [index: string]: ICredData; - }; - selfAttestedAttrs: { - [index: string]: string; - }; -} - -export interface IDeclinePresentationRequestData { - connection: Connection; - reason?: string; - proposal?: any; // eslint-disable-line @typescript-eslint/no-explicit-any -} - -export class DisclosedProof extends VcxBaseWithState { - public static create({ sourceId, request }: IDisclosedProofCreateData): DisclosedProof { - try { - const disclosedProof = new DisclosedProof(); - disclosedProof._setHandle(ffi.disclosedProofCreateWithRequest(sourceId, request)); - return disclosedProof; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static deserialize(data: ISerializedData): DisclosedProof { - try { - return super._deserialize(DisclosedProof, data as any); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - protected _releaseFn = ffi.disclosedProofRelease; - protected _updateStFnV2 = ffi.v2DisclosedProofUpdateState; - protected _getStFn = ffi.disclosedProofGetState; - protected _serializeFn = ffi.disclosedProofSerialize; - protected _deserializeFn = ffi.disclosedProofDeserialize; - - public static async getRequests(connection: Connection): Promise { - try { - const string_msgs = await ffi.disclosedProofGetRequests(connection.handle); - return JSON.parse(string_msgs); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async getCredentials(): Promise { - try { - const credentials = await ffi.disclosedProofRetrieveCredentials(this.handle); - return JSON.parse(credentials); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getProofRequestAttachment(): string { - try { - return ffi.disclosedProofGetProofRequestAttachment(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getThreadId(): string { - try { - return ffi.disclosedProofGetThreadId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendProof(connection: Connection): Promise { - try { - return await ffi.disclosedProofSendProof(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async rejectProof(connection: Connection): Promise { - try { - return await ffi.disclosedProofRejectProof(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getProofMessage(): string { - try { - return ffi.disclosedProofGetProofMsg(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async generateProof({ - selectedCreds, - selfAttestedAttrs, - }: IGenerateProofData): Promise { - try { - return await ffi.disclosedProofGenerateProof( - this.handle, - JSON.stringify(selectedCreds), - JSON.stringify(selfAttestedAttrs), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async declinePresentationRequest({ - connection, - reason, - proposal, - }: IDeclinePresentationRequestData): Promise { - try { - return await ffi.disclosedProofDeclinePresentationRequest( - this.handle, - connection.handle, - reason, - JSON.stringify(proposal), - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } -} diff --git a/aries/wrappers/node/src/api/init.ts b/aries/wrappers/node/src/api/init.ts deleted file mode 100644 index e0ba3b72b5..0000000000 --- a/aries/wrappers/node/src/api/init.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as ffiNapi from '@hyperledger/vcx-napi-rs'; -import { VCXInternalError } from '../errors'; - -export function createAgencyClientForMainWallet(config: object): void { - try { - ffiNapi.createAgencyClientForMainWallet(JSON.stringify(config)); - } catch (err: any) { - throw new VCXInternalError(err); - } -} - -export async function openMainPool(config: object): Promise { - try { - return await ffiNapi.openMainPool(JSON.stringify(config)); - } catch (err: any) { - throw new VCXInternalError(err); - } -} \ No newline at end of file diff --git a/aries/wrappers/node/src/api/issuer-credential.ts b/aries/wrappers/node/src/api/issuer-credential.ts deleted file mode 100644 index e3a68439eb..0000000000 --- a/aries/wrappers/node/src/api/issuer-credential.ts +++ /dev/null @@ -1,188 +0,0 @@ -import * as ffi from '@hyperledger/vcx-napi-rs'; -import { ISerializedData, IssuerStateType } from './common'; -import { Connection } from './mediated-connection'; -import { NonmediatedConnection } from './connection'; -import { CredentialDef } from './credential-def'; -import { RevocationRegistry } from './revocation-registry'; -import { VcxBaseWithState } from './vcx-base-with-state'; -import { VCXInternalError } from '../errors'; - -export interface IIssuerCredentialBuildOfferDataV2 { - credDef: CredentialDef; - revReg?: RevocationRegistry; - attr: { - [index: string]: string; - }; - comment?: string; -} - -/** - * Interface that represents the attributes of an Issuer credential object. - * This interface is expected as the type for deserialize's parameter and serialize's return value - */ -export interface IIssuerCredentialData { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - issuer_sm: Record; - source_id: string; -} - -/** - * A Credential created by the issuing party (institution) - */ -export class IssuerCredential extends VcxBaseWithState { - public static async create(sourceId: string): Promise { - try { - const connection = new IssuerCredential(); - connection._setHandle(ffi.issuerCredentialCreate(sourceId)); - return connection; - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public static deserialize( - serializedData: ISerializedData, - ): IssuerCredential { - try { - return super._deserialize(IssuerCredential, serializedData as any); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - protected _releaseFn = ffi.issuerCredentialRelease; - protected _updateStFnV2 = ffi.issuerCredentialUpdateStateV2; - protected _getStFn = ffi.issuerCredentialGetState; - protected _serializeFn = ffi.issuerCredentialSerialize; - protected _deserializeFn = ffi.issuerCredentialDeserialize; - - public async updateStateWithMessage(connection: Connection, message: string): Promise { - try { - return await ffi.issuerCredentialUpdateStateWithMessageV2( - this.handle, - connection.handle, - message, - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async updateStateWithMessageNonmediated( - connection: NonmediatedConnection, - message: string, - ): Promise { - try { - return await ffi.issuerCredentialUpdateStateWithMessageNonmediated( - this.handle, - connection.handle, - message, - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendOfferV2(connection: Connection): Promise { - try { - return await ffi.issuerCredentialSendOfferV2(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendOfferNonmediated(connection: NonmediatedConnection): Promise { - try { - return await ffi.issuerCredentialSendOfferNonmediated(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async buildCredentialOfferMsgV2({ - credDef, - attr, - revReg, - comment, - }: IIssuerCredentialBuildOfferDataV2): Promise { - try { - return await ffi.issuerCredentialBuildOfferMsgV2( - this.handle, - credDef.handle, - revReg?.handle || 0, - JSON.stringify(attr), - comment || '', - ); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getCredentialOfferMsg(): string { - try { - return ffi.issuerCredentialGetOfferMsg(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getThreadId(): string { - try { - return ffi.issuerCredentialGetThreadId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendCredential(connection: Connection): Promise { - try { - return await ffi.issuerCredentialSendCredential(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async sendCredentialNonmediated(connection: NonmediatedConnection): Promise { - try { - return await ffi.issuerCredentialSendCredentialNonmediated(this.handle, connection.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public async revokeCredentialLocal() { - try { - return await ffi.issuerCredentialRevokeLocal(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public isRevokable(): boolean { - try { - return ffi.issuerCredentialIsRevokable(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getRevRegId(): string { - try { - return ffi.issuerCredentialGetRevRegId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - public getRevocationId(): number { - try { - return ffi.issuerCredentialGetRevocationId(this.handle); - } catch (err: any) { - throw new VCXInternalError(err); - } - } - - protected _setHandle(handle: number): void { - super._setHandle(handle); - } -} diff --git a/aries/wrappers/node/src/api/logging.ts b/aries/wrappers/node/src/api/logging.ts deleted file mode 100644 index a4b58ccdf1..0000000000 --- a/aries/wrappers/node/src/api/logging.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as ffiNapi from '@hyperledger/vcx-napi-rs'; - -import {VCXInternalError} from "../errors"; - -export function defaultLogger(level: string): void { - try { - ffiNapi.initDefaultLogger(level) - } catch (err: any) { - throw new VCXInternalError(err); - } -} diff --git a/aries/wrappers/node/src/api/mediated-connection.ts b/aries/wrappers/node/src/api/mediated-connection.ts deleted file mode 100644 index ea8a9def24..0000000000 --- a/aries/wrappers/node/src/api/mediated-connection.ts +++ /dev/null @@ -1,318 +0,0 @@ -import * as ffiNapi from '@hyperledger/vcx-napi-rs'; -import { VCXInternalError } from '../errors'; -import { ISerializedData, MediatedConnectionStateType } from './common'; -import { VcxBaseWithState } from './vcx-base-with-state'; -import { IPwInfo } from './utils'; - -export interface IConnectionData { - source_id: string; - invite_detail: string; - handle: number; - pw_did: string; - pw_verkey: string; - did_endpoint: string; - endpoint: string; - uuid: string; - wallet: string; - state: MediatedConnectionStateType; -} - -/** - * @description Interface that represents the parameters for `Connection.create` function. - * @interface - */ -export interface IConnectionCreateData { - // Institution's personal identification for the connection - id: string; -} - -// A string representing a invitation json object. -export type IConnectionInvite = string; - -/** - * @description Interface that represents the parameters for `Connection.createWithInvite` function. - * @interface - */ -export interface IRecipientInviteInfo extends IConnectionCreateData { - // Invitation provided by an entity that wishes to make a connection. - invite: IConnectionInvite; -} - -export interface IFromRequestInfoV2 extends IConnectionCreateData { - pwInfo: IPwInfo; - request: string; -} - -/** - * @description Interface that represents the parameters for `Connection.sendMessage` function. - * @interface - */ -export interface IMessageData { - // Actual message to send - msg: string; - // Type of message to send. Can be any string - type: string; - // Message title (user notification) - title: string; - // If responding to a message, id of the message - refMsgId?: string; -} - -/** - * @description Interface that represents the parameters for `Connection.verifySignature` function. - * @interface - */ -export interface ISignatureData { - // Message was signed - data: Buffer; - // Generated signature - signature: Buffer; -} - -/** - * @description A string representing a connection info json object. - * { - * "current": { - * "did": - * "recipientKeys": array - * "routingKeys": array - * "serviceEndpoint": , - * "protocols": array - The set of protocol supported by current side. - * }, - * "remote: {