From 2ab907d6bc21aee5412e7e8c93694eef33538d69 Mon Sep 17 00:00:00 2001 From: Rajat Sharma Date: Fri, 14 Jun 2024 11:43:45 +0530 Subject: [PATCH] docs(examples/discounted-asset-trade): fix rendering of docs on website Signed-off-by: Rajat Sharma --- .cspell.json | 8 +- .dcilintignore | 4 + .github/workflows/ci.yaml | 8 +- .../workflows/fabric-all-in-one-publish.yaml | 60 - .github/workflows/scorecard.yml | 78 + .taprc | 2 - README.md | 5 +- .../main/typescript/carbon-accounting-app.ts | 1 + .../admin-enroll-v1-endpoint.test.ts | 1 + .../src/main/json/openapi.tpl.json | 235 +++ .../README.md | 365 ++-- .../src/main/typescript/supply-chain-app.ts | 3 +- .../src/main/json/openapi.tpl.json | 393 ++++ .../src/main/json/openapi.json | 98 +- .../src/main/json/openapi.tpl.json | 311 +++ .../src/main/json/openapi.json | 186 +- .../src/main/json/openapi.tpl.json | 102 + jest.config.js | 1 - package.json | 5 + .../src/main/json/openapi.json | 2 - .../src/main/json/openapi.tpl.json | 240 +++ .../src/main/json/openapi.tpl.json | 159 ++ .../benchmark/run-cmd-api-server-benchmark.ts | 1 + .../jwt-endpoint-authorization.test.ts | 1 + ...t-endpoint-authz-scope-enforcement.test.ts | 1 + ...wt-socketio-endpoint-authorization.test.ts | 1 + ...otected-endpoint-authz-ops-confirm.test.ts | 1 + .../jwt-unprotected-endpoint-authz.test.ts | 1 + .../plugin-import-from-github.test.ts | 1 + .../plugin-import-without-install.test.ts | 3 + .../integration/remote-plugin-imports.test.ts | 1 + .../get-open-api-spec-v1-endpoint.test.ts | 1 + ...js-proto-loader-client-healthcheck.test.ts | 1 + ...pc-proto-gen-ts-client-healthcheck.test.ts | 1 + ...-proto-gen-ts-client-m-tls-enabled.test.ts | 1 + ...all-basic-plugin-consortium-manual.test.ts | 1 + ...stall-basic-plugin-keychain-memory.test.ts | 1 + .../src/main/json/openapi.json | 1 - .../src/main/json/openapi.tpl.json | 811 ++++++++ .../openapitools/client/models/LedgerType.kt | 5 +- .../generated/openapi/typescript-axios/api.ts | 1 - .../src/main/json/openapi.json | 864 ++++---- .../src/main/json/openapi.tpl.json | 451 +++++ .../src/main/json/openapi.json | 38 +- .../src/main/json/openapi.tpl.json | 149 ++ .../package.json | 4 +- .../src/main/json/openapi.json | 191 +- .../src/main/json/openapi.tpl.json | 499 +++++ .../src/main/json/openapi.json | 191 +- .../src/main/json/openapi.tpl.json | 467 +++++ .../src/main/json/openapi.json | 301 ++- .../src/main/json/openapi.tpl.json | 179 ++ .../src/main/json/openapi.json | 301 ++- .../src/main/json/openapi.tpl.json | 149 ++ .../src/main/json/openapi.json | 289 ++- .../src/main/json/openapi.tpl.json | 131 ++ .../src/main/json/openapi.json | 305 ++- .../src/main/json/openapi.tpl.json | 137 ++ .../src/main/json/openapi.json | 301 ++- .../src/main/json/openapi.tpl.json | 170 ++ .../src/main/json/openapi.json | 157 +- .../src/main/json/openapi.tpl.json | 242 +++ .../src/main/json/openapi.tpl.json | 745 +++++++ .../src/main/json/openapi.tpl.json | 1322 ++++++++++++ .../src/main/json/openapi.tpl.json | 505 +++++ .../src/main/json/openapi.tpl.json | 1215 ++++++++++++ .../src/main/json/openapi.tpl.json | 1179 +++++++++++ .../.gitignore | 3 - .../src/main/json/openapi.tpl.json | 1646 +++++++++++++++ .../hello-world-contract-fabric-v14/README.md | 35 - .../hello-world-contract-go-source.ts | 105 - .../deploy-cc-from-golang-source.test.ts | 260 --- .../run-transaction-endpoint-v1.test.ts | 226 --- .../openapi/openapi-validation-go.test.ts | 62 +- .../src/main/json/openapi.tpl.json | 671 +++++++ .../src/main/json/openapi.tpl.json | 834 ++++++++ .../src/main/json/openapi.tpl.json | 1434 +++++++++++++ .../src/main/json/openapi.tpl.json | 363 ++++ .../src/main/json/openapi.tpl.json | 1033 ++++++++++ .../src/main/json/openapi.tpl.json | 164 ++ .../src/main/json/openapi.tpl.json | 16 + .../src/main/json/openapi.tpl.json | 1765 +++++++++++++++++ .../api-client-routing-node-to-node.test.ts | 2 + ...with-npm-install-version-selection.test.ts | 1 + .../plugin-import-with-npm-install.test.ts | 1 + .../integration/remote-plugin-imports.test.ts | 1 + .../runtime-plugin-imports.test.ts | 1 + .../get-consortium-jws-endpoint.test.ts | 2 + .../openapi/openapi-validation.test.ts | 6 + .../connector-besu-grpc-services.test.ts | 1 + .../get-balance-endpoint.test.ts | 1 + .../get-block-endpoint.test.ts | 1 + .../get-past-logs-endpoint.test.ts | 1 + .../get-transaction-endpoint.test.ts | 1 + .../sign-transaction-endpoint.test.ts | 1 + .../fabric/fabric-test-ledger-v1.ts | 42 +- tools/bundle-open-api-tpl-files.ts | 255 +++ tools/docker/fabric-all-in-one/README.md | 28 - yarn.lock | 84 +- 99 files changed, 21043 insertions(+), 1587 deletions(-) delete mode 100644 .github/workflows/fabric-all-in-one-publish.yaml create mode 100644 .github/workflows/scorecard.yml create mode 100644 examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/json/openapi.tpl.json create mode 100644 examples/cactus-example-supply-chain-business-logic-plugin/src/main/json/openapi.tpl.json create mode 100644 extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.tpl.json create mode 100644 extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.tpl.json create mode 100644 packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-cmd-api-server/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-core-api/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-bungee-hermes/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-consortium-manual/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-memory/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-keychain-vault/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-aries/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-cdl/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-ethereum/src/main/json/openapi.tpl.json delete mode 100644 packages/cactus-plugin-ledger-connector-fabric/.gitignore create mode 100644 packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json delete mode 100644 packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/README.md delete mode 100644 packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source.ts delete mode 100644 packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts delete mode 100644 packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts create mode 100644 packages/cactus-plugin-ledger-connector-iroha2/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-polkadot/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-quorum/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-sawtooth/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-xdai/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-persistence-ethereum/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-persistence-fabric/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-satp-hermes/src/main/json/openapi.tpl.json create mode 100644 tools/bundle-open-api-tpl-files.ts diff --git a/.cspell.json b/.cspell.json index 54d4559034..f5c9a3b586 100644 --- a/.cspell.json +++ b/.cspell.json @@ -153,6 +153,8 @@ "protos", "qscc", "recoverupdateackmessage", + "redoc", + "redocly", "rogpeppe", "RUSTC", "Rwset", @@ -163,8 +165,8 @@ "shrn", "Smonitor", "socketio", - "Soroban", "soroban", + "Soroban", "SPDX", "Splug", "Sprintf", @@ -193,7 +195,9 @@ "Xdai", "xeipuuv" ], - "dictionaries": ["typescript,node,npm,go,rust"], + "dictionaries": [ + "typescript,node,npm,go,rust" + ], "ignorePaths": [ "**/node_modules/**", "**/build/**", diff --git a/.dcilintignore b/.dcilintignore index 0a5a91f2c7..cfd767c057 100644 --- a/.dcilintignore +++ b/.dcilintignore @@ -29,3 +29,7 @@ CHANGELOG.md # Ignore the Gradle Wrapper scripts because they are vendored dependencies that we cannot alter **/gradlew + +# We can't get around this one because there's a yarn plugin whose install URL +# only supports the old default branch name in git +.yarnrc.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7766c2726c..ff13c33769 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1961,6 +1961,7 @@ jobs: ctp-htlc-eth-besu: continue-on-error: false env: + ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }} FULL_BUILD_DISABLED: true JEST_TEST_PATTERN: packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts JEST_TEST_RUNNER_DISABLED: false @@ -2296,13 +2297,6 @@ jobs: - name: ghcr.io/hyperledger/cactus-example-supply-chain-app run: DOCKER_BUILDKIT=1 docker build . -f ./examples/cactus-example-supply-chain-backend/Dockerfile -t cactus-example-supply-chain-app - ghcr-fabric-all-in-one: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4.1.1 - - name: ghcr.io/hyperledger/cactus-fabric-all-in-one - run: DOCKER_BUILDKIT=1 docker build ./tools/docker/fabric-all-in-one/ -f ./tools/docker/fabric-all-in-one/Dockerfile_v1.4.x - ghcr-fabric2-all-in-one: runs-on: ubuntu-22.04 steps: diff --git a/.github/workflows/fabric-all-in-one-publish.yaml b/.github/workflows/fabric-all-in-one-publish.yaml deleted file mode 100644 index 71e7db3efb..0000000000 --- a/.github/workflows/fabric-all-in-one-publish.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: fabric-all-in-one-publish - -on: - push: - # Publish `main` as Docker `latest` image. - branches: - - main - - # Publish `v1.2.3` tags as releases. - tags: - - v* - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - IMAGE_NAME: cactus-fabric-all-in-one - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - build-tag-push-container: - runs-on: ubuntu-22.04 - env: - DOCKER_BUILDKIT: 1 - DOCKERFILE_PATH: ./tools/docker/fabric-all-in-one/Dockerfile_v1.4.x - DOCKER_BUILD_DIR: ./tools/docker/fabric-all-in-one/ - permissions: - packages: write - contents: read - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Build image - run: docker build "$DOCKER_BUILD_DIR" --file "$DOCKERFILE_PATH" --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}" - - - name: Log in to registry - # This is where you will update the PAT to GITHUB_TOKEN - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - SHORTHASH=$(git rev-parse --short "$GITHUB_SHA") - TODAYS_DATE="$(date +%F)" - DOCKER_TAG="$TODAYS_DATE-$SHORTHASH" - IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME" - # Change all uppercase to lowercase - IMAGE_ID=$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/*" ]] && VERSION="${VERSION//^v//}" - # Do not use the `latest` tag at all, tag with date + git short hash if there is no git tag - [ "$VERSION" == "main" ] && VERSION=$DOCKER_TAG - echo IMAGE_ID="$IMAGE_ID" - echo VERSION="$VERSION" - docker tag "$IMAGE_NAME" "$IMAGE_ID:$VERSION" - docker push "$IMAGE_ID:$VERSION" diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000000..f208c19055 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,78 @@ +# Copyright the Hyperledger Cacti contributors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: OpenSSF Scorecard +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '30 2 * * 6' + push: + branches: [ "main" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + with: + sarif_file: results.sarif + diff --git a/.taprc b/.taprc index 20c974b92b..e4dd236583 100644 --- a/.taprc +++ b/.taprc @@ -15,7 +15,6 @@ files: - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object-endpoints.test.ts - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation-no-keychain.test.ts - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-invoke-contract-json-object.test.ts - - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json.test.ts - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v21.4.1-deploy-contract-from-json-json-object.test.ts - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object.test.ts - ./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation.test.ts @@ -34,7 +33,6 @@ files: - ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/get-status-endpoint.test.ts - ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/openapi/openapi-validation.test.ts - ./packages/cactus-test-plugin-htlc-eth-besu-erc20/src/test/typescript/integration/plugin-htlc-eth-besu-erc20/refund-endpoint.test.ts - - ./packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts - ./packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/openapi/openapi-validation.test.ts - ./packages/cactus-plugin-ledger-connector-corda/src/test/typescript/integration/deploy-cordapp-jars-to-nodes-v4.7.test.ts diff --git a/README.md b/README.md index 5db19da20c..403a3d9caa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc)](https://open.vscode.dev/hyperledger/cactus) - ![license](https://img.shields.io/github/license/hyperledger/cactus) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4089/badge)](https://bestpractices.coreinfrastructure.org/projects/4089) + ![license](https://img.shields.io/github/license/hyperledger/cacti) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4089/badge)](https://bestpractices.coreinfrastructure.org/projects/4089) + [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/hyperledger/cacti/badge)](https://scorecard.dev/viewer/?uri=github.com/hyperledger/cacti) ![GitHub issues](https://img.shields.io/github/issues/hyperledger/cactus) ![Cacti Logo Color](./images/HL_Cacti_Logo_Color.png#gh-light-mode-only) @@ -62,4 +63,4 @@ We welcome contributions to Hyperledger Cacti in many forms, and there’s alway Please review [contributing](/CONTRIBUTING.md) guidelines to get started. ## License -This distribution is published under the Apache License Version 2.0 found in the [LICENSE](/LICENSE) file. \ No newline at end of file +This distribution is published under the Apache License Version 2.0 found in the [LICENSE](/LICENSE) file. diff --git a/examples/cactus-example-carbon-accounting-backend/src/main/typescript/carbon-accounting-app.ts b/examples/cactus-example-carbon-accounting-backend/src/main/typescript/carbon-accounting-app.ts index d720ec77c4..279e140b30 100644 --- a/examples/cactus-example-carbon-accounting-backend/src/main/typescript/carbon-accounting-app.ts +++ b/examples/cactus-example-carbon-accounting-backend/src/main/typescript/carbon-accounting-app.ts @@ -234,6 +234,7 @@ export class CarbonAccountingApp { config.cockpitPort = addressInfoCockpit.port; config.grpcPort = 0; // TODO - make this configurable as well config.logLevel = this.options.logLevel || "INFO"; + config.crpcPort = 0; } const apiServer = new ApiServer({ diff --git a/examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts b/examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts index 4bef291316..11c4f0cffa 100644 --- a/examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts +++ b/examples/cactus-example-carbon-accounting-backend/src/test/typescript/integration/admin-enroll-v1-endpoint.test.ts @@ -92,6 +92,7 @@ test.skip(testCase, async (t: Test) => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; const convictConfig = await configService.newExampleConfigConvict(apiSrvOpts); diff --git a/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/json/openapi.tpl.json b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..50adc5cfcf --- /dev/null +++ b/examples/cactus-example-carbon-accounting-business-logic-plugin/src/main/json/openapi.tpl.json @@ -0,0 +1,235 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Example - Carbon Accounting App", + "description": "Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "AuthzScope": { + "type": "string", + "enum": ["group:admin", "group:user"], + "x-enum-descriptions": [ + "Identities with the group:admin scope are administrators of the system.", + "Identities with the group:user scope are end users of the system who only have authorization to perform a limited set of actions." + ], + "x-enum-varnames": ["GroupAdmin", "GroupUser"] + }, + "AuthzJwtClaim": { + "description": "Stores global constants related to the authorization of the application. Specifically enumerates the claims to validate for as per RFC 7519, section 4.1. See: https://tools.ietf.org/html/rfc7519#section-4.1", + "type": "string", + "enum": ["Hyperledger Labs - Carbon Accounting Tool"], + "x-enum-descriptions": [ + "The \"iss\" (issuer) claim identifies the principal that issued the JWT. The processing of this claim is generally application specific. The \"iss\" value is a case-sensitive string containing a StringOrURI value. Use of this claim is OPTIONAL." + ], + "x-enum-varnames": ["iss"] + }, + "Checkpoint": { + "required": ["fromBlock", "votes"], + "properties": { + "fromBlock": { + "type": "integer", + "format": "uint32", + "nullable": false + }, + "votes": { + "type": "string", + "nullable": false, + "format": "uint96" + } + } + }, + "EnrollAdminInfo": { + "type": "string", + "enum": [ + "Successfully enrolled admin user and imported it into the wallet", + "ORG ADMIN REGISTERED" + ], + "x-enum-varnames": [ + "SUCCESSFULLY_ENROLLED_ADMIN", + "ORG_ADMIN_REGISTERED" + ] + }, + "EnrollAdminV1Request": { + "type": "object", + "required": ["orgName"], + "properties": { + "orgName": { + "type": "string", + "minLength": 1, + "maxLength": 1024 + } + } + }, + "EnrollAdminV1Response": { + "type": "object", + "required": ["info", "orgName", "msp", "caName"], + "properties": { + "info": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "orgName": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "msp": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "caName": { + "type": "string", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "identityId": { + "description": "The key under which the identity created will be persisted to the keychain for later retrieval.", + "type": "string", + "minLength": 1, + "maxLength": 2048, + "nullable": false + } + } + }, + "DaoTokenGetAllowanceRequest": { + "type": "object", + "required": ["account", "spender"], + "properties": { + "account": { + "description": "The address of the account holding the funds", + "type": "string", + "minLength": 40, + "maxLength": 42 + }, + "spender": { + "description": "The address of the account spending the funds", + "type": "string", + "minLength": 40, + "maxLength": 42 + } + } + }, + "DaoTokenGetAllowanceResponse": { + "type": "object", + "required": ["allowance"], + "properties": { + "allowance": { + "type": "integer", + "nullable": false, + "description": "The number of tokens approved" + } + } + }, + "DaoTokenGetAllowanceNotFoundResponse": { + "type": "object", + "required": ["accountFound", "spenderFound"], + "properties": { + "accountFound": { + "type": "boolean", + "nullable": false, + "description": "Indicates whether the account was found or not." + }, + "spenderFound": { + "type": "boolean", + "nullable": false, + "description": "Indicates whether the spender was found or not." + } + } + } + } + }, + "paths": { + "/api/v1/utilityemissionchannel/registerEnroll/admin": { + "post": { + "operationId": "enrollAdminV1", + "summary": "Registers an admin account within the Fabric organization specified.", + "x-hyperledger-cacti": { + "authz": { + "isProtected": true, + "requiredRoles": ["group:admin"] + }, + "http": { + "verbLowerCase": "post", + "path": "/api/v1/utilityemissionchannel/registerEnroll/admin" + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnrollAdminV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnrollAdminV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance": { + "post": { + "operationId": "daoTokenGetAllowanceV1", + "summary": "Get the number of tokens `spender` is approved to spend on behalf of `account`", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-example-carbon-accounting-backend/dao-token/get-allowance" + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DaoTokenGetAllowanceRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DaoTokenGetAllowanceResponse" + } + } + } + }, + "404": { + "description": "NOT_FOUND", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DaoTokenGetAllowanceNotFoundResponse" + } + } + } + } + } + } + } + } +} diff --git a/examples/cactus-example-discounted-asset-trade/README.md b/examples/cactus-example-discounted-asset-trade/README.md index 9c90484cc9..ae062f2877 100644 --- a/examples/cactus-example-discounted-asset-trade/README.md +++ b/examples/cactus-example-discounted-asset-trade/README.md @@ -87,52 +87,53 @@ Alice knows that Acme Corp. provides digital certificates. She asks Acme Corp. t - `asset_trade_indy_all_in_one` 1. Setup Indy credentials: + - Before running the sample application we need to register employment credential and issue it to Alice (user of our app). - Use `setup-credentials` script from `cactus-example-discounted-asset-trade-client`. -```bash -# In separate shell (can be used later for client app) -cd ./examples/cactus-example-discounted-asset-trade-client -yarn setup-credentials -popd -``` - -- Copy the credential definition ID from the script output into this example application BLP configuration. - -```bash -# setup-credentials script output -Running with log level INFO -Connecting Alice with Issuer... -Connecting aliceCactiAgent to issuerCactiAgent... -Agents connected! -Register and issue the employment credential... -Register Credential Schema... -Register employment certificate credential schema 'cactiJobCert'... -Employment credential schemaId: did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0 -Register Credential Definition... -Register job certificate credential definition (schemaId: 'did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0') ... -# COPY THIS >> -Employment credential credentialDefinitionId: did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default -# << -Issue the credential... -Employment credential issued: 7f93ba15-98b2-4667-a7cf-ecec3059e9d4 -Accepting credential eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5... -Credential accepted! -Credential was issed and accepted by a peer agent! -Verify employment status proof... -Proof request was sent -Accepting proof 4d03e479-073a-4f51-98e4-befd7ba34345... -Proof request accepted! -Requested proof status: done -Finishing - cleaning up the agents... -All done. - -# Replace __CREDENTIAL_DEFINITION_ID__ in config file with actual credentialDefinitionId -sed -i 's#__CREDENTIAL_DEFINITION_ID__#did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default#g' "./etc/cactus/usersetting.yaml" - -# ... or do it manually in text editor -vim ./etc/cactus/usersetting.yaml -``` + ```bash + # In separate shell (can be used later for client app) + cd ./examples/cactus-example-discounted-asset-trade-client + yarn setup-credentials + popd + ``` + + - Copy the credential definition ID from the script output into this example application BLP configuration. + + ```bash + # setup-credentials script output + Running with log level INFO + Connecting Alice with Issuer... + Connecting aliceCactiAgent to issuerCactiAgent... + Agents connected! + Register and issue the employment credential... + Register Credential Schema... + Register employment certificate credential schema 'cactiJobCert'... + Employment credential schemaId: did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0 + Register Credential Definition... + Register job certificate credential definition (schemaId: 'did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0') ... + # COPY THIS >> + Employment credential credentialDefinitionId: did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default + # << + Issue the credential... + Employment credential issued: 7f93ba15-98b2-4667-a7cf-ecec3059e9d4 + Accepting credential eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5... + Credential accepted! + Credential was issed and accepted by a peer agent! + Verify employment status proof... + Proof request was sent + Accepting proof 4d03e479-073a-4f51-98e4-befd7ba34345... + Proof request accepted! + Requested proof status: done + Finishing - cleaning up the agents... + All done. + + # Replace __CREDENTIAL_DEFINITION_ID__ in config file with actual credentialDefinitionId + sed -i 's#__CREDENTIAL_DEFINITION_ID__#did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default#g' "./etc/cactus/usersetting.yaml" + + # ... or do it manually in text editor + vim ./etc/cactus/usersetting.yaml + ``` 1. Launch discounted-asset-trade and validators from local `docker-compose.yml` (use separate console for that, docker-compose will block your prompt): @@ -167,177 +168,179 @@ For development purposes, it might be useful to run the sample application outsi - Use `run-discounted-asset-trade-client` script from `cactus-example-discounted-asset-trade-client` to interact with this application. -```bash -# In separat shell -cd ./examples/cactus-example-discounted-asset-trade-client -yarn run-discounted-asset-trade-client - -# Sample output -Running with log level INFO -Connected to the discounted asset trade sample app agent! ID: 19949a1e-0ef6-449b-9c37-256449258b51 -Action: (Use arrow keys) -❯ Start the trade - Get this agent credentials - Get assets - Exit -``` + ```bash + # In separat shell + cd ./examples/cactus-example-discounted-asset-trade-client + yarn run-discounted-asset-trade-client + + # Sample output + Running with log level INFO + Connected to the discounted asset trade sample app agent! ID: 19949a1e-0ef6-449b-9c37-256449258b51 + Action: (Use arrow keys) + ❯ Start the trade + Get this agent credentials + Get assets + Exit + ``` 1. (Optional) Check credentials in Alice wallet by selecting `Get this agent credentials`. -```bash -Action: Get this agent credentials -[ - { - "id": "eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5", - "schemaId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0", - # Note: This credential matches one we'll be requesting in discounted asset trade example - "credentialDefinitionId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default", - "connectionId": "32134b50-a245-4de5-8408-f35fcb069373", - "credentials": [ - { - "credentialRecordType": "anoncreds", - "credentialRecordId": "dd6aba0c-8674-451d-a063-a630004be1dd" - } - ], - "credentialAttributes": [ - { - "mime-type": "text/plain", - "name": "first_name", - "value": "Alice" - }, - { - "mime-type": "text/plain", - "name": "last_name", - "value": "Garcia" - }, - { - "mime-type": "text/plain", - "name": "salary", - "value": "2400" - }, - { - "mime-type": "text/plain", - "name": "employee_status", - # Note: Alice is a permanent employee - "value": "Permanent" - }, - { - "mime-type": "text/plain", - "name": "experience", - "value": "10" - } - ] - } -] -``` + ```bash + Action: Get this agent credentials + [ + { + "id": "eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5", + "schemaId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0", + # Note: This credential matches one we'll be requesting in discounted asset trade example + "credentialDefinitionId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default", + "connectionId": "32134b50-a245-4de5-8408-f35fcb069373", + "credentials": [ + { + "credentialRecordType": "anoncreds", + "credentialRecordId": "dd6aba0c-8674-451d-a063-a630004be1dd" + } + ], + "credentialAttributes": [ + { + "mime-type": "text/plain", + "name": "first_name", + "value": "Alice" + }, + { + "mime-type": "text/plain", + "name": "last_name", + "value": "Garcia" + }, + { + "mime-type": "text/plain", + "name": "salary", + "value": "2400" + }, + { + "mime-type": "text/plain", + "name": "employee_status", + # Note: Alice is a permanent employee + "value": "Permanent" + }, + { + "mime-type": "text/plain", + "name": "experience", + "value": "10" + } + ] + } + ] + ``` 1. (Optional) Check the balance on Ethereum and the asset ownership on Fabric by selecting `Get assets`. -```bash -Action: Get assets - -# Ethereum fromAccount: -1.00005515e+26 - -# Ethereum escrowAccount: -0 - -# Ethereum toAccount: -0 - -# Fabric: -[ - { - ... - }, - { - ID: 'asset2', - color: 'red', - size: 5, - owner: 'Brad', - appraisedValue: 400 - }, - ... -] -``` + ```bash + Action: Get assets + + # Ethereum fromAccount: + 1.00005515e+26 + + # Ethereum escrowAccount: + 0 + + # Ethereum toAccount: + 0 + + # Fabric: + [ + { + ... + }, + { + ID: 'asset2', + color: 'red', + size: 5, + owner: 'Brad', + appraisedValue: 400 + }, + ... + ] + ``` 1. Run the transaction execution by selecting `Start the trade` -```bash -Action: Start the trade -Trade request sent! Response: { tradeID: '20231103185232057-001' } -``` + ```bash + Action: Start the trade + Trade request sent! Response: { tradeID: '20231103185232057-001' } + ``` 1. (Optional) Check the final balance on Ethereum and the asset ownership on Fabric by selecting `Get assets`. -```bash -Action: Get assets - -# Ethereum fromAccount: -1.000057e+26 - -# Ethereum escrowAccount: -0 - -# Ethereum toAccount: -25 - -# Fabric: -[ - { - ... - }, - { - ID: 'asset2', - color: 'red', - size: 5, - owner: 'Cathy', - appraisedValue: 400 - }, - ... -] + ```bash + Action: Get assets + + # Ethereum fromAccount: + 1.000057e+26 + + # Ethereum escrowAccount: + 0 + + # Ethereum toAccount: + 25 + + # Fabric: + [ + { + ... + }, + { + ID: 'asset2', + color: 'red', + size: 5, + owner: 'Cathy', + appraisedValue: 400 + }, + ... + ] + ``` ## How to stop the application and Docker containers 1. Press `Ctrl+C` in `docker-compose` console to stop the application. 1. Run cleanup script -``` -sudo ./script-cleanup.sh # for root owned files -./script-cleanup.sh # for user owner files + ``` + + sudo ./script-cleanup.sh # for root owned files + ./script-cleanup.sh # for user owner files -``` + ``` #### Manual cleanup instructions 1. Remove the config files on your machine -``` -sudo rm -r ./etc/cactus/ + ``` + + sudo rm -r ./etc/cactus/ + + ``` -``` 1. Stop the docker containers of Ethereum, Fabric and Indy -- `docker stop geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one` -- `docker rm geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one` + - `docker stop geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one` + - `docker rm geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one` 1. Clear indy-all-in-one -``` + ``` -pushd ../../tools/docker/indy-all-in-one/ -./script-cleanup.sh -popd + pushd ../../tools/docker/indy-all-in-one/ + ./script-cleanup.sh + popd -``` + ``` 1. Remove geth files -``` - -pushd ../../tools/docker/geth-testnet/ -rm -fr ./data-geth1/geth/ -popd -``` + ``` -``` + pushd ../../tools/docker/geth-testnet/ + rm -fr ./data-geth1/geth/ + popd + ``` diff --git a/examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts b/examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts index 75aeb381ed..3ab9eeba07 100644 --- a/examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts +++ b/examples/cactus-example-supply-chain-backend/src/main/typescript/supply-chain-app.ts @@ -542,7 +542,7 @@ export class SupplyChainApp { const ledger3: Ledger = { id: "FabricDemoLedger", - ledgerType: LedgerType.Fabric14X, + ledgerType: LedgerType.Fabric2, }; cactusNodeC.ledgerIds.push(ledger3.id); @@ -589,6 +589,7 @@ export class SupplyChainApp { properties.authorizationProtocol = AuthorizationProtocol.JSON_WEB_TOKEN; properties.authorizationConfigJson = await this.getOrCreateAuthorizationConfig(); + properties.crpcPort = 0; const apiServer = new ApiServer({ config: properties, diff --git a/examples/cactus-example-supply-chain-business-logic-plugin/src/main/json/openapi.tpl.json b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..34bda9ec34 --- /dev/null +++ b/examples/cactus-example-supply-chain-business-logic-plugin/src/main/json/openapi.tpl.json @@ -0,0 +1,393 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Example - Supply Chain App", + "description": "Demonstrates how a business use case can be satisfied with Cactus when multiple distinct ledgers are involved.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Shipment": { + "type": "object", + "required": ["id", "bookshelfId"], + "properties": { + "id": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "bookshelfId": { + "description": "The foreign key ID referencing the bookshelfId that will go in the shipment.", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "Bookshelf": { + "type": "object", + "required": ["id", "shelfCount", "bambooHarvestId"], + "properties": { + "id": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "shelfCount": { + "description": "The number of shelves the bookshelf comes with.", + "type": "number", + "nullable": false, + "minimum": 1, + "maximum": 255 + }, + "bambooHarvestId": { + "description": "The foreign key ID referencing the bamboo harvest that yielded the wood material for the construction of the bookshelf.", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "BambooHarvest": { + "type": "object", + "required": ["id", "location", "startedAt", "endedAt", "harvester"], + "properties": { + "id": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "location": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "startedAt": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "endedAt": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + }, + "harvester": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 1024 + } + } + }, + "InsertBambooHarvestRequest": { + "type": "object", + "required": ["bambooHarvest"], + "properties": { + "bambooHarvest": { + "$ref": "#/components/schemas/BambooHarvest" + } + } + }, + "InsertBambooHarvestResponse": { + "type": "object", + "required": [], + "properties": { + "callOutput": { + "type": "object", + "additionalProperties": true + }, + "transactionReceipt": { + "type": "object", + "additionalProperties": true + } + } + }, + "ListBambooHarvestResponse": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "$ref": "#/components/schemas/BambooHarvest", + "minItems": 0, + "maxItems": 65535 + } + } + } + }, + "InsertBookshelfRequest": { + "type": "object", + "required": ["bookshelf"], + "properties": { + "bookshelf": { + "$ref": "#/components/schemas/Bookshelf" + } + } + }, + "InsertBookshelfResponse": { + "type": "object", + "required": [], + "properties": { + "callOutput": { + "type": "object", + "additionalProperties": true + }, + "transactionReceipt": { + "type": "object", + "additionalProperties": true + } + } + }, + "ListBookshelfResponse": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "$ref": "#/components/schemas/Bookshelf", + "minItems": 0, + "maxItems": 65535 + } + } + } + }, + "InsertShipmentRequest": { + "type": "object", + "required": ["shipment"], + "properties": { + "shipment": { + "$ref": "#/components/schemas/Shipment" + } + } + }, + "InsertShipmentResponse": { + "type": "object", + "required": [], + "properties": { + "callOutput": { + "type": "object", + "additionalProperties": true + }, + "transactionReceipt": { + "type": "object", + "additionalProperties": true + } + } + }, + "ListShipmentResponse": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "$ref": "#/components/schemas/Shipment", + "minItems": 0, + "maxItems": 65535 + } + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf": { + "post": { + "operationId": "insertBookshelfV1", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bookshelf" + } + }, + "summary": "Inserts the provided Bookshelf entity to the ledger.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertBookshelfRequest" + } + } + } + }, + "responses": { + "201": { + "description": "CREATED", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertBookshelfResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf": { + "get": { + "operationId": "listBookshelfV1", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bookshelf" + } + }, + "summary": "Lists all the Bookshelf entities stored on the ledger.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListBookshelfResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-shipment": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-shipment" + } + }, + "operationId": "insertShipmentV1", + "summary": "Inserts the provided Shipment entity to the ledger.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertShipmentRequest" + } + } + } + }, + "responses": { + "201": { + "description": "CREATED", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertShipmentResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-shipment": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-shipment" + } + }, + "operationId": "listShipmentV1", + "summary": "Lists all the Shipments entities stored on the ledger.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListShipmentResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest": { + "post": { + "operationId": "insertBambooHarvestV1", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/insert-bamboo-harvest" + } + }, + "summary": "Inserts the provided BambooHarvest entity to the ledger.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertBambooHarvestRequest" + } + } + } + }, + "responses": { + "201": { + "description": "CREATED", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InsertBambooHarvestResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest": { + "get": { + "operationId": "listBambooHarvestV1", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-example-supply-chain-backend/list-bamboo-harvest" + } + }, + "summary": "Lists all the BambooHarvest entities stored on the ledger.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListBambooHarvestResponse" + } + } + } + } + } + } + } + } +} diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.json b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.json index edec3d3232..4af52147b9 100644 --- a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.json +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.json @@ -69,7 +69,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredential", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "inputAmount": { @@ -147,7 +147,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredential", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "gas": { @@ -186,7 +186,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredential", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "htlcId": { @@ -207,6 +207,98 @@ "HtlcPackage": { "type": "string", "enum": ["BESU", "BESU_ERC20"] + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } } } }, diff --git a/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.tpl.json b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..edec3d3232 --- /dev/null +++ b/extensions/cactus-plugin-htlc-coordinator-besu/src/main/json/openapi.tpl.json @@ -0,0 +1,311 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - HTLC Coordinator", + "description": "Can exchange assets between networks", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "url": "https://www.cactus.stream/{basePath}", + "description": "Public test instance", + "variables": { + "basePath": { + "default": "" + } + } + }, + { + "url": "http://localhost:4000/{basePath}", + "description": "Local test instance", + "variables": { + "basePath": { + "default": "" + } + } + } + ], + "components": { + "schemas": { + "OwnHTLCRequest": { + "type": "object", + "required": [ + "htlcPackage", + "connectorInstanceId", + "keychainId", + "constructorArgs", + "web3SigningCredential", + "inputAmount", + "outputAmount", + "expiration", + "hashLock", + "tokenAddress", + "receiver", + "outputNetwork", + "outputAddress" + ], + "properties": { + "htlcPackage": { + "$ref": "#/components/schemas/HtlcPackage" + }, + "connectorInstanceId": { + "description": "connector Instance Id for the connector plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "description": "Web3SigningCredential", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "inputAmount": { + "description": "Input amount to lock", + "type": "number", + "nullable": false + }, + "outputAmount": { + "description": "Output amount to lock", + "type": "number", + "nullable": false + }, + "expiration": { + "description": "Timestamp to expire the contract", + "type": "number", + "nullable": false + }, + "hashLock": { + "description": "Hashlock needed to refund the amount", + "type": "string", + "nullable": false + }, + "tokenAddress": { + "description": "The token address", + "type": "string", + "nullable": false + }, + "receiver": { + "description": "The receiver address", + "type": "string", + "nullable": false + }, + "outputNetwork": { + "description": "The output network id", + "type": "string", + "nullable": false + }, + "outputAddress": { + "description": "The output addreess to receive the tokens", + "type": "string", + "nullable": false + }, + "gas": { + "type": "number" + } + } + }, + "CounterpartyHTLCRequest": { + "type": "object", + "required": [ + "htlcPackage", + "connectorInstanceId", + "keychainId", + "htlcId", + "web3SigningCredential" + ], + "properties": { + "htlcPackage": { + "$ref": "#/components/schemas/HtlcPackage" + }, + "connectorInstanceId": { + "description": "connector Instance Id for the connector plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "htlcId": { + "description": "Id for the HTLC", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredential", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "type": "number" + } + } + }, + "WithdrawCounterpartyRequest": { + "type": "object", + "required": [ + "htlcPackage", + "connectorInstanceId", + "keychainId", + "web3SigningCredential", + "htlcId", + "secret" + ], + "properties": { + "htlcPackage": { + "$ref": "#/components/schemas/HtlcPackage" + }, + "connectorInstanceId": { + "description": "connector Instance Id for the connector plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "contractId": { + "description": "contractId for the contract", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredential", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "htlcId": { + "description": "Id for the HTLC", + "type": "string", + "nullable": false + }, + "secret": { + "description": "Counterparty HTLC secret", + "type": "string", + "nullable": false + }, + "gas": { + "type": "number" + } + } + }, + "HtlcPackage": { + "type": "string", + "enum": ["BESU", "BESU_ERC20"] + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/own-htlc": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/own-htlc" + } + }, + "operationId": "ownHtlcV1", + "summary": "Create an instance to interact with the own HTLC.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OwnHTLCRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/counterparty-htlc": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/counterparty-htlc" + } + }, + "operationId": "counterpartyHtlcV1", + "summary": "Create an instance to interact with the counterparty HTLC", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CounterpartyHTLCRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/withdraw-counterparty": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/withdraw-counterparty" + } + }, + "operationId": "withdrawCounterpartyV1", + "summary": "Withdraw funds of the counterparty HTLC", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WithdrawCounterpartyRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + } + } +} diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.json b/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.json index 4ac6433c45..e16c869051 100644 --- a/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.json +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.json @@ -30,9 +30,177 @@ } ], "components": { - "schemas": {}, - "requestBodies": {}, - "responses": {} + "schemas": { + "GetObjectRequestV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetObjectResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key in the object store as a string.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetObjectRequestV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key in the object store.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetObjectResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasObjectRequestV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasObjectResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an object under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "object_store_get_object_v1_request_body": { + "description": "Request body to obtain an object via its key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetObjectRequestV1" + } + } + } + }, + "object_store_set_object_v1_request_body": { + "description": "Request body to set an object under a key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetObjectRequestV1" + } + } + } + }, + "object_store_has_object_v1_request_body": { + "description": "Request body to check presence of an object under a key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasObjectRequestV1" + } + } + } + } + }, + "responses": { + "object_store_get_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetObjectResponseV1" + } + } + } + }, + "object_store_set_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetObjectResponseV1" + } + } + } + }, + "object_store_has_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasObjectResponseV1" + } + } + } + } + } }, "paths": { "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/get-object": { @@ -47,11 +215,11 @@ "summary": "Retrieves an object from the object store.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_get_object_v1_request_body" + "$ref": "#/components/requestBodies/object_store_get_object_v1_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_get_object_v1_response_body" + "$ref": "#/components/responses/object_store_get_object_v1_response_body" } } } @@ -68,11 +236,11 @@ "summary": "Sets an object in the object store under the specified key.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_set_object_v1_request_body" + "$ref": "#/components/requestBodies/object_store_set_object_v1_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_set_object_v1_response_body" + "$ref": "#/components/responses/object_store_set_object_v1_response_body" } } } @@ -89,11 +257,11 @@ "summary": "Checks the presence of an object in the object store.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_has_object_v1_request_body" + "$ref": "#/components/requestBodies/object_store_has_object_v1_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_has_object_v1_response_body" + "$ref": "#/components/responses/object_store_has_object_v1_response_body" } } } diff --git a/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.tpl.json b/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..4ac6433c45 --- /dev/null +++ b/extensions/cactus-plugin-object-store-ipfs/src/main/json/openapi.tpl.json @@ -0,0 +1,102 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Object Store - IPFS ", + "description": "Contains/describes the Hyperledger Cactus Object Store IPFS plugin.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "url": "https://www.cactus.stream/{basePath}", + "description": "Public test instance", + "variables": { + "basePath": { + "default": "" + } + } + }, + { + "url": "http://localhost:4000/{basePath}", + "description": "Local test instance", + "variables": { + "basePath": { + "default": "" + } + } + } + ], + "components": { + "schemas": {}, + "requestBodies": {}, + "responses": {} + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/get-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/get-object" + } + }, + "operationId": "getObjectV1", + "summary": "Retrieves an object from the object store.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_get_object_v1_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_get_object_v1_response_body" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/set-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/set-object" + } + }, + "operationId": "setObjectV1", + "summary": "Sets an object in the object store under the specified key.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_set_object_v1_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_set_object_v1_response_body" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/has-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-object-store-ipfs/has-object" + } + }, + "operationId": "hasObjectV1", + "summary": "Checks the presence of an object in the object store.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/object_store_has_object_v1_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/4bf8038ea4c0c341cef3a63b59f77c12cec65a46/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/object_store_has_object_v1_response_body" + } + } + } + } + } +} diff --git a/jest.config.js b/jest.config.js index 2d17f997ae..591f13270c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,7 +26,6 @@ module.exports = { `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object-endpoints.test.ts`, `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation-no-keychain.test.ts`, `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-invoke-contract-json-object.test.ts`, - `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json.test.ts`, `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v21.4.1-deploy-contract-from-json-json-object.test.ts`, `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/v2.3.0-deploy-contract-from-json-json-object.test.ts`, `./packages/cactus-plugin-ledger-connector-quorum/src/test/typescript/integration/plugin-ledger-connector-quorum/deploy-contract/openapi/openapi-validation.test.ts`, diff --git a/package.json b/package.json index ef786c1864..021096ed70 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "custom-checks": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/custom-checks/run-custom-checks.ts", "tools:validate-bundle-names": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/validate-bundle-names.js", "tools:bump-openapi-spec-dep-versions": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/bump-openapi-spec-dep-versions.ts", + "tools:bundle-open-api-tpl-files": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/bundle-open-api-tpl-files.ts", "tools:create-production-only-archive": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/create-production-only-archive.ts", "tools:download-file-to-disk": "TS_NODE_PROJECT=./tools/tsconfig.json node --trace-deprecation --experimental-modules --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node ./tools/download-file-to-disk.ts", "tools:get-latest-sem-ver-git-tag": "TS_NODE_PROJECT=./tools/tsconfig.json node --abort-on-uncaught-exception --loader ts-node/esm --experimental-specifier-resolution=node --no-warnings ./tools/get-latest-sem-ver-git-tag.ts", @@ -57,6 +58,7 @@ "codegen": "run-s 'codegen:warmup-*' codegen:lerna codegen:cleanup", "codegen:cleanup": "rm --force --verbose ./openapitools.json", "codegen:lerna": "lerna run codegen", + "codegen:warmup-bundle": "yarn tools:bundle-open-api-tpl-files", "codegen:warmup-cleancodegendir": "node tools/clear-openapi-codegen-folders.js", "codegen:warmup-mkdir": "make-dir ./node_modules/@openapitools/openapi-generator-cli/versions/", "codegen:warmup-v6.6.0": "yarn tools:download-file-to-disk --url=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.6.0/openapi-generator-cli-6.6.0.jar --output-file-path=./node_modules/@openapitools/openapi-generator-cli/versions/6.6.0.jar", @@ -121,8 +123,10 @@ "@lerna-lite/run": "3.1.0", "@lerna-lite/version": "3.1.0", "@openapitools/openapi-generator-cli": "2.7.0", + "@redocly/openapi-core": "1.15.0", "@types/adm-zip": "0.5.0", "@types/benchmark": "2.1.5", + "@types/debug": "4.1.12", "@types/fs-extra": "9.0.13", "@types/jest": "29.5.3", "@types/node": "18.11.9", @@ -140,6 +144,7 @@ "cross-env": "7.0.3", "crypto-browserify": "3.12.0", "cspell": "5.21.2", + "debug": "4.3.5", "del": "7.1.0", "del-cli": "4.0.1", "depcheck": "1.4.7", diff --git a/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.json b/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.json index 077a180093..98b1ca2595 100644 --- a/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.json +++ b/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.json @@ -85,7 +85,6 @@ } } }, - "DeployContractV1Request": { "type": "object", "additionalProperties": false, @@ -210,7 +209,6 @@ } } }, - "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/get-prometheus-exporter-metrics": { "get": { "x-hyperledger-cacti": { diff --git a/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.tpl.json b/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..077a180093 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-stellar/src/main/json/openapi.tpl.json @@ -0,0 +1,240 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Stellar", + "description": "Can perform basic smart contract tasks on a Stellar ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cacti.api.async.stellar.WatchBlocksV1.Subscribe", + "org.hyperledger.cacti.api.async.stellar.WatchBlocksV1.Next", + "org.hyperledger.cacti.api.async.stellar.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cacti.api.async.stellar.WatchBlocksV1.Error", + "org.hyperledger.cacti.api.async.stellar.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Progress": { + "type": "object", + "required": ["blockHeader"], + "properties": { + "blockHeader": { + "type": "object", + "additionalProperties": true + } + } + }, + "TransactionInvocation": { + "type": "object", + "required": ["header", "signers"], + "properties": { + "header": { + "$ref": "#/components/schemas/TransactionHeader" + }, + "signers": { + "type": "array", + "items": { + "type": "string", + "pattern": "^S[a-zA-Z0-9]{55}$", + "nullable": false, + "minLength": 56, + "maxLength": 56, + "description": "The secret key of the account that will sign the transaction." + }, + "nullable": false + } + } + }, + "TransactionHeader": { + "type": "object", + "required": ["source", "fee", "timeout"], + "properties": { + "source": { + "type": "string", + "pattern": "^G[a-zA-Z0-9]{55}$", + "nullable": false, + "minLength": 56, + "maxLength": 56, + "description": "The public key of the source account of the transaction." + }, + "fee": { + "type": "integer", + "nullable": false, + "minimum": 100, + "description": "The maximum base fee in stroops to be paid for the transaction." + }, + "timeout": { + "type": "integer", + "nullable": false, + "minimum": 0, + "description": "The maximum number of ledger close time in seconds that the transaction is valid for. '0' equals to no timeout." + } + } + }, + + "DeployContractV1Request": { + "type": "object", + "additionalProperties": false, + "required": ["transactionInvocation"], + "anyOf": [ + { + "required": ["wasmHash"] + }, + { + "required": ["wasmBuffer"] + } + ], + "properties": { + "wasmHash": { + "type": "string", + "pattern": "^[a-f0-9]{64}$", + "nullable": true, + "minLength": 64, + "maxLength": 64, + "description": "The hash of the wasm code installed in the ledger to be deployed into a new instance." + }, + "wasmBuffer": { + "type": "string", + "format": "byte", + "nullable": true, + "minLength": 100, + "maxLength": 87382, + "description": "A Base64-encoded string that contains the binary data of the WASM code. This buffer is used to deploy WebAssembly code to the ledger." + }, + "transactionInvocation": { + "$ref": "#/components/schemas/TransactionInvocation", + "nullable": true, + "description": "The transaction invocation that will be used to deploy the contract." + } + } + }, + "DeployContractV1Response": { + "type": "object", + "required": ["contractId", "wasmHash"], + "properties": { + "contractId": { + "type": "string", + "pattern": "^C[a-f0-9]{55}$", + "nullable": true, + "minLength": 56, + "maxLength": 56, + "description": "The ID of the contract that was deployed." + }, + "wasmHash": { + "type": "string", + "pattern": "^[a-f0-9]{64}$", + "nullable": true, + "minLength": 64, + "maxLength": 64, + "description": "The hash of the wasm code installed in the ledger." + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/get-open-api-spec": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/deploy-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/deploy-contract" + } + }, + "operationId": "deployContractV1", + "summary": "Deploys a smart contract to the Stellar ledger associated with the connector.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + } + } + } + }, + + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-stellar/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-cmd-api-server/src/main/json/openapi.tpl.json b/packages/cactus-cmd-api-server/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..380d2110d0 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/json/openapi.tpl.json @@ -0,0 +1,159 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus API", + "description": "Interact with a Cactus deployment through HTTP.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "WatchHealthcheckV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Subscribe", + "org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Next", + "org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Unsubscribe", + "org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Error", + "org.hyperledger.cactus.api.async.besu.WatchHealthcheckV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "MemoryUsage": { + "type": "object", + "properties": { + "rss": { + "title": "Resident Set Size", + "type": "number" + }, + "heapTotal": { + "title": "V8 memory usage - heap total", + "type": "number" + }, + "heapUsed": { + "title": "V8 memory usage - heap used", + "type": "number" + }, + "external": { + "title": "Memory usage of C++ objects bound to JavaScript objects managed by V8", + "type": "number" + }, + "arrayBuffers": { + "title": "Memory allocated for ArrayBuffers and SharedArrayBuffers, including all Node.js Buffers", + "type": "number" + } + } + }, + "HealthCheckResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "createdAt": { + "type": "string" + }, + "memoryUsage": { + "$ref": "#/components/schemas/MemoryUsage" + } + }, + "required": ["createdAt", "memoryUsage"] + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "GetOpenApiSpecV1EndpointResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/api-server/healthcheck": { + "get": { + "summary": "Can be used to verify liveness of an API server instance", + "description": "Returns the current timestamp of the API server as proof of health/liveness", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/api-server/healthcheck" + } + }, + "operationId": "getHealthCheckV1", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HealthCheckResponse" + } + } + } + } + } + } + }, + "/api/v1/api-server/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/api-server/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + }, + "/api/v1/api-server/get-open-api-spec": { + "get": { + "description": "Returns the openapi.json document of specific plugin.", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/api-server/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetOpenApiSpecV1EndpointResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-cmd-api-server/src/test/typescript/benchmark/run-cmd-api-server-benchmark.ts b/packages/cactus-cmd-api-server/src/test/typescript/benchmark/run-cmd-api-server-benchmark.ts index f44b2a6435..2babf8ff13 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/benchmark/run-cmd-api-server-benchmark.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/benchmark/run-cmd-api-server-benchmark.ts @@ -82,6 +82,7 @@ const createTestInfrastructure = async (opts: { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.grpcMtlsEnabled = false; apiSrvOpts.plugins = []; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authorization.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authorization.test.ts index d86a75704b..2e0d8c7e57 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authorization.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authorization.test.ts @@ -72,6 +72,7 @@ describe(testCase, () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; const config = await configService.newExampleConfigConvict(apiSrvOpts); diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authz-scope-enforcement.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authz-scope-enforcement.test.ts index 0f9c776d39..9efbda3329 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authz-scope-enforcement.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-endpoint-authz-scope-enforcement.test.ts @@ -72,6 +72,7 @@ describe(testCase, () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; const config = await configService.newExampleConfigConvict(apiSrvOpts); diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-socketio-endpoint-authorization.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-socketio-endpoint-authorization.test.ts index 52d65d9fda..38b636d7c4 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-socketio-endpoint-authorization.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-socketio-endpoint-authorization.test.ts @@ -64,6 +64,7 @@ describe("cmd-api-server:ApiServer", () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.logLevel = logLevel; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz-ops-confirm.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz-ops-confirm.test.ts index d19a1baaad..a21c3d2463 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz-ops-confirm.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz-ops-confirm.test.ts @@ -59,6 +59,7 @@ test(testCase, async () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; const config = await configService.newExampleConfigConvict(apiSrvOpts); diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz.test.ts index f58059f4a1..8b6c799e0e 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/jwt-unprotected-endpoint-authz.test.ts @@ -76,6 +76,7 @@ describe(testCase, () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.plugins = []; const config = await configService.newExampleConfigConvict(apiSrvOpts); diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-from-github.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-from-github.test.ts index a01a884574..4445c7aa68 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-from-github.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-from-github.test.ts @@ -34,6 +34,7 @@ test("can install plugins at runtime with specified version based on imports", a apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-without-install.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-without-install.test.ts index fdbb5b13b4..2aa05f66c3 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-without-install.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/plugin-import-without-install.test.ts @@ -37,6 +37,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test) apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const instanceId = uuidv4(); @@ -86,6 +87,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test) apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const versionToSendServer = "0.7.0"; @@ -183,6 +185,7 @@ test("can instantiate plugins at runtime without install them", async (t: Test) apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const versionToInstall = "0.8.0"; apiServerOptions.plugins = [ diff --git a/packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts index f8178adfb6..5792139b0b 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts @@ -79,6 +79,7 @@ test("NodeJS API server + Rust plugin work together", async (t: Test) => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts index 24a94e473d..5b44fa205a 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/get-open-api-spec-v1-endpoint.test.ts @@ -76,6 +76,7 @@ describe("cmd-api-server:getOpenApiSpecV1Endpoint", () => { apiSrvOpts.apiPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.apiTlsEnabled = false; apiSrvOpts.grpcMtlsEnabled = false; apiSrvOpts.plugins = []; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-js-proto-loader-client-healthcheck.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-js-proto-loader-client-healthcheck.test.ts index 8382d51e80..3e844bacd9 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-js-proto-loader-client-healthcheck.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-js-proto-loader-client-healthcheck.test.ts @@ -26,6 +26,7 @@ test(testCase, async (t: Test) => { apiSrvOpts.apiCorsDomainCsv = "*"; apiSrvOpts.apiPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcMtlsEnabled = false; apiSrvOpts.apiTlsEnabled = false; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts index 3de32ec2b0..b996e296a6 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-healthcheck.test.ts @@ -23,6 +23,7 @@ test(testCase, async (t: Test) => { apiSrvOpts.apiCorsDomainCsv = "*"; apiSrvOpts.apiPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcMtlsEnabled = false; apiSrvOpts.apiTlsEnabled = false; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts index 7e3a96da8d..c7b39a7120 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/grpc-proto-gen-ts-client-m-tls-enabled.test.ts @@ -34,6 +34,7 @@ test(testCase, async (t: Test) => { apiSrvOpts.apiTlsKeyPem = serverCert.privateKeyPem; apiSrvOpts.apiTlsClientCaPem = clientCert.certificatePem; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcMtlsEnabled = true; apiSrvOpts.apiTlsEnabled = false; diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-consortium-manual.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-consortium-manual.test.ts index e777a5be11..0bca605609 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-consortium-manual.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-consortium-manual.test.ts @@ -61,6 +61,7 @@ test("can install plugin-consortium-manual", async (t: Test) => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-keychain-memory.test.ts b/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-keychain-memory.test.ts index 888ac99e90..3661fe0589 100644 --- a/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-keychain-memory.test.ts +++ b/packages/cactus-cmd-api-server/src/test/typescript/unit/plugins/install-basic-plugin-keychain-memory.test.ts @@ -44,6 +44,7 @@ test("can import plugins at runtime (CLI)", async (t: Test) => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-core-api/src/main/json/openapi.json b/packages/cactus-core-api/src/main/json/openapi.json index dc1e45be8f..d0746fb402 100644 --- a/packages/cactus-core-api/src/main/json/openapi.json +++ b/packages/cactus-core-api/src/main/json/openapi.json @@ -186,7 +186,6 @@ "BESU_2X", "BURROW_0X", "CORDA_4X", - "FABRIC_14X", "FABRIC_2", "QUORUM_2X", "SAWTOOTH_1X" diff --git a/packages/cactus-core-api/src/main/json/openapi.tpl.json b/packages/cactus-core-api/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..d0746fb402 --- /dev/null +++ b/packages/cactus-core-api/src/main/json/openapi.tpl.json @@ -0,0 +1,811 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Core API", + "description": "Contains/describes the core API types for Cactus. Does not describe actual endpoints on its own as this is left to the implementing plugins who can import and re-use commonly needed type definitions from this specification. One example of said commonly used type definitions would be the types related to consortium management, cactus nodes, ledgers, etc..", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Constants": { + "type": "string", + "enum": ["/api/v1/async/socket-io/connect"], + "x-enum-varnames": ["SocketIoConnectionPathV1"] + }, + "PluginImport": { + "type": "object", + "required": ["packageName", "type", "action"], + "properties": { + "packageName": { + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "type": { + "nullable": false, + "description": "", + "$ref": "#/components/schemas/PluginImportType" + }, + "action": { + "nullable": false, + "description": "", + "$ref": "#/components/schemas/PluginImportAction" + }, + "options": {} + } + }, + "PluginImportType": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.plugin_import_type.LOCAL", + "org.hyperledger.cactus.plugin_import_type.REMOTE" + ] + }, + "PluginImportAction": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.plugin_import_action.INSTANTIATE", + "org.hyperledger.cactus.plugin_import_action.INSTALL" + ] + }, + "ConsensusAlgorithmFamily": { + "type": "string", + "description": "Enumerates a list of consensus algorithm families in existence. Does not intend to be an exhaustive list, just a practical one, meaning that we only include items here that are relevant to Hyperledger Cactus in fulfilling its own duties. This can be extended later as more sophisticated features of Cactus get implemented. This enum is meant to be first and foremost a useful abstraction for achieving practical tasks, not an encyclopedia and therefore we ask of everyone that this to be extended only in ways that serve a practical purpose for the runtime behavior of Cactus or Cactus plugins in general. The bottom line is that we can accept this enum being not 100% accurate as long as it 100% satisfies what it was designed to do.", + "enum": [ + "org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY", + "org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE", + "org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK" + ] + }, + "ConsensusAlgorithmFamiliesWithTxFinality": { + "type": "string", + "description": "Enumerates a list of consensus algorithm families that provide immediate finality", + "enum": [ + "org.hyperledger.cactus.consensusalgorithm.PROOF_OF_AUTHORITY", + "org.hyperledger.cactus.consensusalgorithm.PROOF_OF_STAKE" + ] + }, + "ConsensusAlgorithmFamiliesWithOutTxFinality": { + "description": "Enumerates a list of consensus algorithm families that do not provide immediate finality", + "type": "string", + "enum": ["org.hyperledger.cactus.consensusalgorithm.PROOF_OF_WORK"], + "x-enum-varnames": ["WORK"] + }, + "PrimaryKey": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "nullable": false + }, + "ConsortiumMemberId": { + "$ref": "#/components/schemas/PrimaryKey", + "description": "ID of Consortium member who operates the ledger (if any). Defined as an optional property in case the ledger is a permissionless and/or public one such as the Bitcoin or Ethereum mainnets." + }, + "CactusNodeId": { + "$ref": "#/components/schemas/PrimaryKey", + "description": "ID of a Cactus node that must uniquely distinguish it from all other Cactus nodes within a Consortium. Note that API server instances do not have their own identity the way a node does." + }, + "ConsortiumId": { + "$ref": "#/components/schemas/PrimaryKey" + }, + "LedgerId": { + "description": "String that uniquely identifies a ledger within a Cactus consortium so that transactions can be routed to the correct ledger.", + "$ref": "#/components/schemas/PrimaryKey" + }, + "PluginInstanceId": { + "description": "String that uniquely identifies a plugin instance within a Cactus consortium so that requests can be addressed/routed directly to individual plugins when necessary.", + "$ref": "#/components/schemas/PrimaryKey" + }, + "ConsortiumDatabase": { + "required": [ + "consortium", + "ledger", + "consortiumMember", + "cactusNode", + "pluginInstance" + ], + "properties": { + "consortium": { + "description": "A collection of Consortium entities. In practice this should only ever contain a single consortium, but we defined it as an array to keep the convention up with the rest of the collections defined in the Consortium data in general. Also, if we ever decide to somehow have some sort of consortium to consortium integration (which does not make much sense in the current frame of mind of the author in the year 2020) then having this as an array will have proven itself to be an excellent long term compatibility/extensibility decision indeed.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Consortium" + }, + "default": [], + "minItems": 0, + "maxItems": 2048 + }, + "ledger": { + "description": "The complete collection of all ledger entities in existence within the consortium.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Ledger" + }, + "default": [], + "minItems": 0, + "maxItems": 2048 + }, + "consortiumMember": { + "description": "The complete collection of all consortium member entities in existence within the consortium.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ConsortiumMember" + }, + "default": [], + "minItems": 0, + "maxItems": 2048 + }, + "cactusNode": { + "description": "The complete collection of all cactus nodes entities in existence within the consortium.", + "type": "array", + "items": { + "$ref": "#/components/schemas/CactusNode" + }, + "default": [], + "minItems": 0, + "maxItems": 2048 + }, + "pluginInstance": { + "description": "The complete collection of all plugin instance entities in existence within the consortium.", + "type": "array", + "items": { + "$ref": "#/components/schemas/PluginInstance" + }, + "default": [], + "minItems": 0, + "maxItems": 2048 + } + } + }, + "Ledger": { + "type": "object", + "required": ["id", "ledgerType"], + "properties": { + "id": { + "$ref": "#/components/schemas/LedgerId" + }, + "ledgerType": { + "$ref": "#/components/schemas/LedgerType", + "nullable": false + }, + "consortiumMemberId": { + "$ref": "#/components/schemas/ConsortiumMemberId" + } + } + }, + "LedgerType": { + "description": "Enumerates the different ledger vendors and their major versions encoded within the name of the LedgerType. For example \"BESU_1X\" involves all of the [1.0.0;2.0.0) where 1.0.0 is included and anything up until, but not 2.0.0. See: https://stackoverflow.com/a/4396303/698470 for further explanation.", + "type": "string", + "enum": [ + "BESU_1X", + "BESU_2X", + "BURROW_0X", + "CORDA_4X", + "FABRIC_2", + "QUORUM_2X", + "SAWTOOTH_1X" + ] + }, + "Consortium": { + "type": "object", + "required": ["id", "name", "mainApiHost", "memberIds"], + "properties": { + "id": { + "$ref": "#/components/schemas/ConsortiumId" + }, + "name": { + "type": "string" + }, + "mainApiHost": { + "type": "string" + }, + "memberIds": { + "description": "The collection (array) of primary keys of consortium member entities that belong to this Consortium.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ConsortiumMemberId" + }, + "default": [], + "minItems": 1, + "maxItems": 2048, + "nullable": false + } + } + }, + "ConsortiumMember": { + "type": "object", + "required": ["id", "name", "nodeIds"], + "properties": { + "id": { + "$ref": "#/components/schemas/ConsortiumMemberId" + }, + "name": { + "type": "string", + "description": "The human readable name a Consortium member can be referred to while making it easy for humans to distinguish this particular consortium member entity from any other ones.", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "nodeIds": { + "type": "array", + "default": [], + "nullable": false, + "minItems": 1, + "maxItems": 2048, + "items": { + "$ref": "#/components/schemas/CactusNodeId" + } + } + } + }, + "CactusNodeMeta": { + "description": "A Cactus node meta information", + "type": "object", + "required": ["nodeApiHost", "publicKeyPem"], + "properties": { + "nodeApiHost": { + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "publicKeyPem": { + "description": "The PEM encoded public key that was used to generate the JWS included in the response (the jws property)", + "type": "string", + "minLength": 1, + "maxLength": 65535, + "nullable": false, + "format": "Must only contain the public key, never include here the PEM that also contains a private key. See PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail" + } + } + }, + "CactusNode": { + "description": "A Cactus node can be a single server, or a set of servers behind a load balancer acting as one.", + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/CactusNodeMeta" + }, + { + "type": "object", + "required": [ + "id", + "consortiumId", + "nodeApiHost", + "memberId", + "publicKeyPem", + "pluginInstanceIds", + "ledgerIds" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/CactusNodeId", + "example": "809a76ba-cfb8-4045-a5c6-ed70a7314c25" + }, + "consortiumId": { + "$ref": "#/components/schemas/ConsortiumId", + "description": "ID of the Cactus Consortium this node is in.", + "example": "3e2670d9-2d14-45bd-96f5-33e2c4b4e3fb" + }, + "memberId": { + "$ref": "#/components/schemas/ConsortiumMemberId", + "example": "b3674a28-e442-4feb-b1f3-8cbe46c20e5e" + }, + "ledgerIds": { + "description": "Stores an array of Ledger entity IDs that are reachable (routable) via this Cactus Node. This information is used by the client side SDK API client to figure out at runtime where to send API requests that are specific to a certain ledger such as requests to execute transactions.", + "type": "array", + "nullable": false, + "minItems": 0, + "maxItems": 2048, + "default": [], + "items": { + "$ref": "#/components/schemas/LedgerId" + } + }, + "pluginInstanceIds": { + "type": "array", + "nullable": false, + "minItems": 0, + "maxItems": 2048, + "default": [], + "items": { + "$ref": "#/components/schemas/PluginInstanceId" + } + } + } + } + ] + }, + "PluginInstance": { + "type": "object", + "required": ["id", "packageName"], + "properties": { + "id": { + "$ref": "#/components/schemas/PluginInstanceId" + }, + "packageName": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + } + }, + "JWSCompact": { + "description": "A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for info about standard.", + "type": "string", + "minLength": 5, + "maxLength": 65535, + "pattern": "/^[a-zA-Z0-9-_]+?.[a-zA-Z0-9-_]+?.([a-zA-Z0-9-_]+)?$/", + "example": "eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjJ9.DOCNCqEMN7CQ_z-RMndiyldljXOk6WFIZxRzNF5Ylg4" + }, + "JWSRecipient": { + "description": "A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for info about standard.", + "type": "object", + "required": ["signature"], + "properties": { + "signature": { + "type": "string" + }, + "protected": { + "type": "string" + }, + "header": { + "type": "object", + "additionalProperties": true + } + } + }, + "JWSGeneral": { + "type": "object", + "required": ["payload", "signatures"], + "properties": { + "payload": { + "type": "string", + "minLength": 1, + "maxLength": 65535 + }, + "signatures": { + "type": "array", + "items": { + "$ref": "#/components/schemas/JWSRecipient" + } + } + } + }, + "GetObjectRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetObjectResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key in the object store as a string.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "HasObjectRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasObjectResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an object under 'key'.", + "nullable": false + } + } + }, + "SetObjectRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key in the object store.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetObjectResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value in the object store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "object_store_get_object_v1_request_body": { + "description": "Request body to obtain an object via its key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetObjectRequestV1" + } + } + } + }, + "object_store_set_object_v1_request_body": { + "description": "Request body to set an object under a key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetObjectRequestV1" + } + } + } + }, + "object_store_has_object_v1_request_body": { + "description": "Request body to check presence of an object under a key.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasObjectRequestV1" + } + } + } + }, + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "object_store_get_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetObjectResponseV1" + } + } + } + }, + "object_store_set_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetObjectResponseV1" + } + } + } + }, + "object_store_has_object_v1_response_body": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasObjectResponseV1" + } + } + } + }, + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_delete_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_delete_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_delete_entry_500": { + "description": "Unexpected error." + } + } + }, + "paths": {} +} diff --git a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt index c52055dea9..dabf585c0c 100644 --- a/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt +++ b/packages/cactus-core-api/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LedgerType.kt @@ -22,7 +22,7 @@ import com.squareup.moshi.JsonClass /** * Enumerates the different ledger vendors and their major versions encoded within the name of the LedgerType. For example \"BESU_1X\" involves all of the [1.0.0;2.0.0) where 1.0.0 is included and anything up until, but not 2.0.0. See: https://stackoverflow.com/a/4396303/698470 for further explanation. * - * Values: bESU1X,bESU2X,bURROW0X,cORDA4X,fABRIC14X,fABRIC2,qUORUM2X,sAWTOOTH1X + * Values: bESU1X,bESU2X,bURROW0X,cORDA4X,fABRIC2,qUORUM2X,sAWTOOTH1X */ @JsonClass(generateAdapter = false) @@ -40,9 +40,6 @@ enum class LedgerType(val value: kotlin.String) { @Json(name = "CORDA_4X") cORDA4X("CORDA_4X"), - @Json(name = "FABRIC_14X") - fABRIC14X("FABRIC_14X"), - @Json(name = "FABRIC_2") fABRIC2("FABRIC_2"), diff --git a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts index 34ce3b3146..59bf9f2cbf 100644 --- a/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts +++ b/packages/cactus-core-api/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -524,7 +524,6 @@ export const LedgerType = { Besu2X: 'BESU_2X', Burrow0X: 'BURROW_0X', Corda4X: 'CORDA_4X', - Fabric14X: 'FABRIC_14X', Fabric2: 'FABRIC_2', Quorum2X: 'QUORUM_2X', Sawtooth1X: 'SAWTOOTH_1X' diff --git a/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.json b/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.json index 4320b2fb1c..22308058b5 100644 --- a/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.json +++ b/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.json @@ -1,451 +1,477 @@ { - "openapi": "3.0.3", - "servers": [ - { - "url": "http://{host}:{port}/api/v1/@hyperledger/cactus-plugin-satp-hermes", - "description": "Development server", - "variables": { - "host": { - "default": "localhost" + "openapi": "3.0.3", + "servers": [ + { + "url": "http://{host}:{port}/api/v1/@hyperledger/cactus-plugin-satp-hermes", + "description": "Development server", + "variables": { + "host": { + "default": "localhost" + }, + "port": { + "default": "3000" + } + } + } + ], + "info": { + "title": "Hyperledger Cactus Plugin - BUNGEE-Hermes", + "description": "Can create blockchain views of different networks", + "version": "2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrivacyPolicyOpts": { + "description": "identifier of the policy used to process a view", + "type": "string", + "enum": ["pruneState"], + "x-enum-varnames": ["PruneState"] + }, + "MergePolicyOpts": { + "description": "identifier of the policy used to merge views (can be none)", + "type": "string", + "enum": ["pruneState", "pruneStateFromView", "NONE"], + "x-enum-varnames": ["PruneState", "PruneStateFromView", "NONE"] + }, + "CreateViewRequest": { + "type": "object", + "description": "Request object for createViewV1 endpoint", + "required": ["strategyId", "networkDetails"], + "properties": { + "stateIds": { + "type": "array", + "items": { + "type": "string", + "example": "id-of-asset-1" + }, + "example": ["id-of-asset-1", "id-of-asset-2"] + }, + "tI": { + "type": "string", + "example": "0" + }, + "tF": { + "type": "string", + "example": "999999999999" + }, + "viewID": { + "type": "string", + "example": "view-1" + }, + "strategyId": { + "type": "string", + "example": "fabric-strategy", + "nullable": false + }, + "networkDetails": { + "type": "object", + "nullable": false, + "required": ["connectorApiPath", "participant"], + "properties": { + "connectorApiPath": { + "type": "string", + "nullable": false, + "example": "http://localhost:3000" + }, + "participant": { + "type": "string", + "nullable": false, + "example": "participant-1" + } }, - "port": { - "default": "3000" + "example": { + "connectorApiPath": "http://localhost:3000", + "participant": "participant-1" } } + }, + "example": { + "strategyId": "fabric-strategy", + "networkDetails": { + "connectorApiPath": "http://localhost:3000", + "participant": "participant-1" + } } - ], - - "info": { - "title": "Hyperledger Cactus Plugin - BUNGEE-Hermes", - "description": "Can create blockchain views of different networks", - "version": "2.0.0-alpha.2", - "license": { - "name": "Apache-2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "CreateViewResponse": { + "type": "object", + "description": "This is the response for a CreateViewRequest or ProcessViewRequest", + "properties": { + "view": { + "type": "string", + "example": "Object" + }, + "signature": { + "type": "string", + "example": "signature of Object" + } + }, + "example": { + "view": "Object", + "signature": "signature of Object" } - }, - "components": { - "schemas": { - "PrivacyPolicyOpts":{ - "description": "identifier of the policy used to process a view", - "type": "string", - "enum": ["pruneState"], - "x-enum-varnames":["PruneState"] - }, - "MergePolicyOpts":{ - "description": "identifier of the policy used to merge views (can be none)", - "type": "string", - "enum": ["pruneState", "pruneStateFromView", "NONE"], - "x-enum-varnames":["PruneState", "PruneStateFromView", "NONE"] - }, - "CreateViewRequest":{ - "type":"object", - "description": "Request object for createViewV1 endpoint", - "required": ["strategyId", "networkDetails"], - "properties": { - "stateIds":{ - "type":"array", - "items":{ - "type": "string", - "example": "id-of-asset-1" - }, - "example": ["id-of-asset-1", "id-of-asset-2"] - }, - "tI":{ - "type":"string", - "example": "0" - }, - "tF": { - "type": "string", - "example": "999999999999" - }, - "viewID": { - "type": "string", - "example": "view-1" - - }, - "strategyId": { - "type": "string", - "example": "fabric-strategy", - "nullable": false - }, - "networkDetails": { - "type": "object", - "nullable": false, - "required": ["connectorApiPath", "participant"], - "properties": { - "connectorApiPath":{ - "type": "string", - "nullable": false, - "example": "http://localhost:3000" - }, - "participant": { - "type": "string", - "nullable": false, - "example": "participant-1" - } - }, - "example": {"connectorApiPath": "http://localhost:3000", "participant": "participant-1"} - } - }, - "example": {"strategyId": "fabric-strategy", "networkDetails":{"connectorApiPath": "http://localhost:3000", "participant": "participant-1"}} - }, - "CreateViewResponse":{ - "type":"object", - "description": "This is the response for a CreateViewRequest or ProcessViewRequest", - "properties": { - "view":{ - "type":"string", - "example": "Object" - }, - "signature":{ - "type": "string", - "example": "signature of Object" - } + }, + "GetPublicKeyResponse": { + "type": "object", + "description": "public key from bungee-hermes plugin instance", + "properties": { + "pubKey": { + "type": "string", + "example": "----BEGIN CERTIFICATE----random content...." + } + } + }, + "AvailableStrategiesResponse": { + "type": "array", + "description": "Array with available strategy ids", + "items": { + "type": "string", + "example": "strategy-fabric" + } + }, + "VerifyMerkleRootRequest": { + "type": "object", + "description": "Set of transaction or state proofs and merkle tree root for verification", + "properties": { + "input": { + "nullable": false, + "type": "array", + "items": { + "type": "string", + "example": "transactionProof stringified" + } + }, + "root": { + "nullable": false, + "type": "string" + } + } + }, + "VerifyMerkleRootResponse": { + "type": "object", + "description": "true or false, wether input matched provided root", + "properties": { + "result": { + "type": "boolean", + "example": "true" + } + } + }, + "MergeViewsResponse": { + "type": "object", + "description": "This is the response of a mergeViewRequest", + "properties": { + "integratedView": { + "type": "string", + "example": "Object" + }, + "signature": { + "type": "string", + "example": "signature of Object" + } + }, + "example": { + "integratedView": "Object", + "signature": "signature of Object" + } + }, + "MergeViewsRequest": { + "type": "object", + "description": "This is the input for a mergeViewRequest", + "required": ["serializedViews", "mergePolicy"], + "properties": { + "serializedViews": { + "nullable": false, + "type": "array", + "description": "Array of serialized views", + "items": { + "type": "string", + "nullable": false, + "example": "View object stringified" + } + }, + "mergePolicy": { + "$ref": "#/components/schemas/MergePolicyOpts" + }, + "policyArguments": { + "type": "array", + "description": "Arguments for the privacy policy function. Order is important", + "items": { + "type": "string" + } + } + }, + "example": { + "serializedViews": ["View 1", "View2"], + "mergePolicy": "undefined" + } + }, + "ProcessViewRequest": { + "type": "object", + "description": "This is the input for a mergeViewRequest", + "required": ["serializedView", "policyId", "policyArguments"], + "properties": { + "serializedView": { + "type": "string", + "nullable": false, + "example": "View object stringified" + }, + "policyId": { + "$ref": "#/components/schemas/PrivacyPolicyOpts" + }, + "policyArguments": { + "type": "array", + "description": "Arguments for the privacy policy function. Order is important", + "items": { + "type": "string" + } + } + }, + "example": { + "serializedView": "View 1", + "policyId": "policy 1", + "policyArguments": ["stateId"] + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view" + } + }, + "operationId": "createViewV1", + "summary": "Creates a Blockchain View.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewResponse" }, - "example": {"view": "Object", "signature":"signature of Object"} - }, - "GetPublicKeyResponse": { - "type": "object", - "description": "public key from bungee-hermes plugin instance", - "properties": { - "pubKey":{ - "type": "string", - "example": "----BEGIN CERTIFICATE----random content...." - } - } - }, - "AvailableStrategiesResponse":{ - "type": "array", - "description": "Array with available strategy ids", - "items":{ - "type": "string", - "example": "strategy-fabric" - } - }, - "VerifyMerkleRootRequest":{ - "type": "object", - "description": "Set of transaction or state proofs and merkle tree root for verification", - "properties": { - "input":{ - "nullable": false, - "type": "array", - "items":{ - "type": "string", - "example": "transactionProof stringified" - } - }, - "root":{ - "nullable": false, - "type": "string" - } + "example": { + "view": "Object", + "signature": "signature of Object" } - }, - "VerifyMerkleRootResponse": { - "type": "object", - "description": "true or false, wether input matched provided root", - "properties": { - "result":{ - "type": "boolean", - "example": "true" - } - } - }, - "MergeViewsResponse":{ - "type":"object", - "description": "This is the response of a mergeViewRequest", - "properties": { - "integratedView":{ - "type":"string", - "example": "Object" - }, - "signature":{ - "type": "string", - "example": "signature of Object" - } - }, - "example": {"integratedView": "Object", "signature":"signature of Object"} - }, - "MergeViewsRequest":{ - "type":"object", - "description": "This is the input for a mergeViewRequest", - "required": ["serializedViews", "mergePolicy"], - "properties": { - "serializedViews":{ - "nullable": false, - "type":"array", - "description": "Array of serialized views", - "items":{ - "type": "string", - "nullable": false, - "example": "View object stringified" - } - }, - "mergePolicy":{ - "$ref" : "#/components/schemas/MergePolicyOpts" - }, - "policyArguments":{ - "type": "array", - "description": "Arguments for the privacy policy function. Order is important", - "items":{ - "type": "string" - } - } - }, - "example": {"serializedViews": ["View 1", "View2"], "mergePolicy": "undefined" } - }, - "ProcessViewRequest":{ - "type":"object", - "description": "This is the input for a mergeViewRequest", - "required": ["serializedView", "policyId", "policyArguments"], - "properties": { - "serializedView":{ - "type": "string", - "nullable": false, - "example": "View object stringified" - }, - "policyId":{ - "$ref" : "#/components/schemas/PrivacyPolicyOpts" - }, - "policyArguments":{ - "type": "array", - "description": "Arguments for the privacy policy function. Order is important", - "items":{ - "type": "string" - } - } - }, - "example": {"serializedView": "View 1", "policyId": "policy 1", "policyArguments": ["stateId"]} + } } + }, + "404": { + "description": "Could not complete request." + } } + } }, - "paths": { - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view" - } - }, - "operationId": "createViewV1", - "summary": "Creates a Blockchain View.", - "description": "", - "parameters": [], - "requestBody": { - "required": true, - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateViewRequest" - } - } - } + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key" + } + }, + "operationId": "GetPublicKey", + "summary": "Queries plugin's public key", + "description": "", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPublicKeyResponse" }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateViewResponse" - }, - "example": {"view": "Object", "signature":"signature of Object"} - } - } - }, - "404": { - "description": "Could not complete request." - } + "example": { + "pubKey": "----BEGIN CERTIFICATE----random content...." } + } } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies" + } }, - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key" - } + "operationId": "GetAvailableStrategies", + "summary": "Queries plugin's available strategies for ledger capture", + "description": "", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AvailableStrategiesResponse" }, - "operationId": "GetPublicKey", - "summary": "Queries plugin's public key", - "description": "", - "parameters": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPublicKeyResponse" - }, - "example": {"pubKey": "----BEGIN CERTIFICATE----random content...."} - } - - } - }, - "404": { - "description": "Could not complete request." - } - } + "example": ["strategy-fabric"] + } + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root" + } + }, + "operationId": "verifyMerkleRoot", + "summary": "Checks validity of merkle tree root given an input", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyMerkleRootRequest" + } } + } }, - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies" - } + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyMerkleRootResponse" }, - "operationId": "GetAvailableStrategies", - "summary": "Queries plugin's available strategies for ledger capture", - "description": "", - "parameters": [], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AvailableStrategiesResponse" - }, - "example": ["strategy-fabric"] - } - - } - }, - "404": { - "description": "Could not complete request." - } + "example": { + "result": true } + } } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views" + } }, - - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root" - } - }, - "operationId": "verifyMerkleRoot", - "summary": "Checks validity of merkle tree root given an input", - "description": "", - "parameters": [], - "requestBody": { - "required": true, - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VerifyMerkleRootRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VerifyMerkleRootResponse" - }, - "example": {"result": true} - } - } - }, - "404": { - "description": "Could not complete request." - } - } + "operationId": "mergeViewsV1", + "summary": "Merges multiple views according to a privacy policy", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MergeViewsRequest" + } } + } }, - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views" - } - }, - "operationId": "mergeViewsV1", - "summary": "Merges multiple views according to a privacy policy", - "description": "", - "parameters": [], - "requestBody": { - "required": true, - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MergeViewsRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MergeViewsResponse" - } - } - } - }, - "404": { - "description": "Could not complete request." - } + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MergeViewsResponse" } + } } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view" + } }, - "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view": { - "get": { - "x-hyperledger-cacti": { - "http": { - "verbLowerCase": "get", - "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view" - } - }, - "operationId": "processViewV1", - "summary": "Creates a Blockchain View.", - "description": "", - "parameters": [], - "requestBody": { - "required": true, - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProcessViewRequest" - } - } - } + "operationId": "processViewV1", + "summary": "Creates a Blockchain View.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProcessViewRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewResponse" }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateViewResponse" - }, - "example": {"view": "Object", "signature":"signature of Object"} - } - } - }, - "404": { - "description": "Could not complete request." - } + "example": { + "view": "Object", + "signature": "signature of Object" } + } } + }, + "404": { + "description": "Could not complete request." + } } - + } } -} \ No newline at end of file + } +} diff --git a/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.tpl.json b/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..4320b2fb1c --- /dev/null +++ b/packages/cactus-plugin-bungee-hermes/src/main/json/openapi.tpl.json @@ -0,0 +1,451 @@ +{ + "openapi": "3.0.3", + "servers": [ + { + "url": "http://{host}:{port}/api/v1/@hyperledger/cactus-plugin-satp-hermes", + "description": "Development server", + "variables": { + "host": { + "default": "localhost" + }, + "port": { + "default": "3000" + } + } + } + ], + + "info": { + "title": "Hyperledger Cactus Plugin - BUNGEE-Hermes", + "description": "Can create blockchain views of different networks", + "version": "2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrivacyPolicyOpts":{ + "description": "identifier of the policy used to process a view", + "type": "string", + "enum": ["pruneState"], + "x-enum-varnames":["PruneState"] + }, + "MergePolicyOpts":{ + "description": "identifier of the policy used to merge views (can be none)", + "type": "string", + "enum": ["pruneState", "pruneStateFromView", "NONE"], + "x-enum-varnames":["PruneState", "PruneStateFromView", "NONE"] + }, + "CreateViewRequest":{ + "type":"object", + "description": "Request object for createViewV1 endpoint", + "required": ["strategyId", "networkDetails"], + "properties": { + "stateIds":{ + "type":"array", + "items":{ + "type": "string", + "example": "id-of-asset-1" + }, + "example": ["id-of-asset-1", "id-of-asset-2"] + }, + "tI":{ + "type":"string", + "example": "0" + }, + "tF": { + "type": "string", + "example": "999999999999" + }, + "viewID": { + "type": "string", + "example": "view-1" + + }, + "strategyId": { + "type": "string", + "example": "fabric-strategy", + "nullable": false + }, + "networkDetails": { + "type": "object", + "nullable": false, + "required": ["connectorApiPath", "participant"], + "properties": { + "connectorApiPath":{ + "type": "string", + "nullable": false, + "example": "http://localhost:3000" + }, + "participant": { + "type": "string", + "nullable": false, + "example": "participant-1" + } + }, + "example": {"connectorApiPath": "http://localhost:3000", "participant": "participant-1"} + } + }, + "example": {"strategyId": "fabric-strategy", "networkDetails":{"connectorApiPath": "http://localhost:3000", "participant": "participant-1"}} + }, + "CreateViewResponse":{ + "type":"object", + "description": "This is the response for a CreateViewRequest or ProcessViewRequest", + "properties": { + "view":{ + "type":"string", + "example": "Object" + }, + "signature":{ + "type": "string", + "example": "signature of Object" + } + }, + "example": {"view": "Object", "signature":"signature of Object"} + }, + "GetPublicKeyResponse": { + "type": "object", + "description": "public key from bungee-hermes plugin instance", + "properties": { + "pubKey":{ + "type": "string", + "example": "----BEGIN CERTIFICATE----random content...." + } + } + }, + "AvailableStrategiesResponse":{ + "type": "array", + "description": "Array with available strategy ids", + "items":{ + "type": "string", + "example": "strategy-fabric" + } + }, + "VerifyMerkleRootRequest":{ + "type": "object", + "description": "Set of transaction or state proofs and merkle tree root for verification", + "properties": { + "input":{ + "nullable": false, + "type": "array", + "items":{ + "type": "string", + "example": "transactionProof stringified" + } + }, + "root":{ + "nullable": false, + "type": "string" + } + } + }, + "VerifyMerkleRootResponse": { + "type": "object", + "description": "true or false, wether input matched provided root", + "properties": { + "result":{ + "type": "boolean", + "example": "true" + } + } + }, + "MergeViewsResponse":{ + "type":"object", + "description": "This is the response of a mergeViewRequest", + "properties": { + "integratedView":{ + "type":"string", + "example": "Object" + }, + "signature":{ + "type": "string", + "example": "signature of Object" + } + }, + "example": {"integratedView": "Object", "signature":"signature of Object"} + }, + "MergeViewsRequest":{ + "type":"object", + "description": "This is the input for a mergeViewRequest", + "required": ["serializedViews", "mergePolicy"], + "properties": { + "serializedViews":{ + "nullable": false, + "type":"array", + "description": "Array of serialized views", + "items":{ + "type": "string", + "nullable": false, + "example": "View object stringified" + } + }, + "mergePolicy":{ + "$ref" : "#/components/schemas/MergePolicyOpts" + }, + "policyArguments":{ + "type": "array", + "description": "Arguments for the privacy policy function. Order is important", + "items":{ + "type": "string" + } + } + }, + "example": {"serializedViews": ["View 1", "View2"], "mergePolicy": "undefined" } + }, + "ProcessViewRequest":{ + "type":"object", + "description": "This is the input for a mergeViewRequest", + "required": ["serializedView", "policyId", "policyArguments"], + "properties": { + "serializedView":{ + "type": "string", + "nullable": false, + "example": "View object stringified" + }, + "policyId":{ + "$ref" : "#/components/schemas/PrivacyPolicyOpts" + }, + "policyArguments":{ + "type": "array", + "description": "Arguments for the privacy policy function. Order is important", + "items":{ + "type": "string" + } + } + }, + "example": {"serializedView": "View 1", "policyId": "policy 1", "policyArguments": ["stateId"]} + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/create-view" + } + }, + "operationId": "createViewV1", + "summary": "Creates a Blockchain View.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewResponse" + }, + "example": {"view": "Object", "signature":"signature of Object"} + } + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-public-key" + } + }, + "operationId": "GetPublicKey", + "summary": "Queries plugin's public key", + "description": "", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPublicKeyResponse" + }, + "example": {"pubKey": "----BEGIN CERTIFICATE----random content...."} + } + + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/get-available-strategies" + } + }, + "operationId": "GetAvailableStrategies", + "summary": "Queries plugin's available strategies for ledger capture", + "description": "", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AvailableStrategiesResponse" + }, + "example": ["strategy-fabric"] + } + + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/verify-merkle-root" + } + }, + "operationId": "verifyMerkleRoot", + "summary": "Checks validity of merkle tree root given an input", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyMerkleRootRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VerifyMerkleRootResponse" + }, + "example": {"result": true} + } + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/merge-views" + } + }, + "operationId": "mergeViewsV1", + "summary": "Merges multiple views according to a privacy policy", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MergeViewsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MergeViewsResponse" + } + } + } + }, + "404": { + "description": "Could not complete request." + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-bungee-hermes/process-view" + } + }, + "operationId": "processViewV1", + "summary": "Creates a Blockchain View.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProcessViewRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateViewResponse" + }, + "example": {"view": "Object", "signature":"signature of Object"} + } + } + }, + "404": { + "description": "Could not complete request." + } + } + } + } + + } +} \ No newline at end of file diff --git a/packages/cactus-plugin-consortium-manual/src/main/json/openapi.json b/packages/cactus-plugin-consortium-manual/src/main/json/openapi.json index cfcb44bcef..a5d7a4d4f4 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/json/openapi.json +++ b/packages/cactus-plugin-consortium-manual/src/main/json/openapi.json @@ -17,7 +17,7 @@ "properties": { "jws": { "description": "The JSON Web Signature of the Cactus node.", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", + "$ref": "#/components/schemas/JWSGeneral", "nullable": false } } @@ -28,7 +28,7 @@ "properties": { "jws": { "description": "The JSON Web Signature of the Cactus consortium.", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", + "$ref": "#/components/schemas/JWSGeneral", "nullable": false, "format": "The general format which is a JSON object, not a string." } @@ -47,6 +47,40 @@ "type": "object", "additionalProperties": false, "properties": {} + }, + "JWSRecipient": { + "description": "A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for info about standard.", + "type": "object", + "required": ["signature"], + "properties": { + "signature": { + "type": "string" + }, + "protected": { + "type": "string" + }, + "header": { + "type": "object", + "additionalProperties": true + } + } + }, + "JWSGeneral": { + "type": "object", + "required": ["payload", "signatures"], + "properties": { + "payload": { + "type": "string", + "minLength": 1, + "maxLength": 65535 + }, + "signatures": { + "type": "array", + "items": { + "$ref": "#/components/schemas/JWSRecipient" + } + } + } } } }, diff --git a/packages/cactus-plugin-consortium-manual/src/main/json/openapi.tpl.json b/packages/cactus-plugin-consortium-manual/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..cfcb44bcef --- /dev/null +++ b/packages/cactus-plugin-consortium-manual/src/main/json/openapi.tpl.json @@ -0,0 +1,149 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Consortium Web Service", + "description": "Manage a Cactus consortium through the APIs. Needs administrative privileges.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "GetNodeJwsResponse": { + "type": "object", + "required": ["jws"], + "properties": { + "jws": { + "description": "The JSON Web Signature of the Cactus node.", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", + "nullable": false + } + } + }, + "GetConsortiumJwsResponse": { + "type": "object", + "required": ["jws"], + "properties": { + "jws": { + "description": "The JSON Web Signature of the Cactus consortium.", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/schemas/JWSGeneral", + "nullable": false, + "format": "The general format which is a JSON object, not a string." + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "GetNodeJwsRequest": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "GetConsortiumJwsRequest": { + "type": "object", + "additionalProperties": false, + "properties": {} + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws" + } + }, + "operationId": "getConsortiumJwsV1", + "summary": "Retrieves a consortium JWS", + "description": "The JWS asserting the consortium metadata (pub keys and hosts of nodes)", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConsortiumJwsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConsortiumJwsResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws" + } + }, + "operationId": "getNodeJwsV1", + "summary": "Retrieves the JWT of a Cactus Node", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetNodeJwsRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetNodeJwsResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/package.json b/packages/cactus-plugin-htlc-eth-besu-erc20/package.json index 20411336bc..4d72a700da 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/package.json +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/package.json @@ -51,8 +51,8 @@ "codegen": "run-p 'codegen:*'", "codegen:openapi": "npm run generate-sdk", "generate-sdk": "run-p 'generate-sdk:*'", - "generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", - "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --reserved-words-mappings type=type --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --reserved-words-mappings type=type --ignore-file-override ../../openapi-generator-ignore", "watch": "npm-watch", "webpack": "npm-run-all webpack:dev", "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json index 8c7f155a6b..bf4331e557 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json @@ -76,7 +76,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredentialType", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "connectorId": { @@ -118,7 +118,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredentialType", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "connectorId": { @@ -166,7 +166,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredentialType", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "connectorId": { @@ -208,7 +208,7 @@ } }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "connectorId": { "type": "string" @@ -232,7 +232,7 @@ "type": "string" }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "connectorId": { "type": "string" @@ -269,13 +269,184 @@ }, "web3SigningCredential": { "description": "Web3SigningCredential", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "gas": { "type": "number" } } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "number", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "number", + "nullable": false + }, + "gasUsed": { + "type": "number", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } } }, "responses": { @@ -333,7 +504,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/RunTransactionResponse" + "$ref": "#/components/schemas/RunTransactionResponse" } } } @@ -367,7 +538,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } @@ -453,7 +624,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } @@ -487,7 +658,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.tpl.json b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..8c7f155a6b --- /dev/null +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.tpl.json @@ -0,0 +1,499 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - HTLC ETH BESU ERC20", + "description": "Allows Cactus nodes to interact with HTLC contracts with ERC-20 Tokens", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "NewContractRequest": { + "type": "object", + "required": [ + "contractAddress", + "inputAmount", + "outputAmount", + "expiration", + "hashLock", + "tokenAddress", + "receiver", + "outputNetwork", + "outputAddress", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "contractAddress": { + "description": "Contract address", + "type": "string", + "nullable": false + }, + "inputAmount": { + "description": "Input amount to lock", + "type": "number", + "nullable": false + }, + "outputAmount": { + "description": "Output amount to lock", + "type": "number", + "nullable": false + }, + "expiration": { + "description": "Timestamp to expire the contract", + "type": "number", + "nullable": false + }, + "hashLock": { + "description": "Hashlock needed to refund the amount", + "type": "string", + "nullable": false + }, + "tokenAddress": { + "description": "The token address", + "type": "string", + "nullable": false + }, + "receiver": { + "description": "The receiver address", + "type": "string", + "nullable": false + }, + "outputNetwork": { + "description": "The output network id", + "type": "string", + "nullable": false + }, + "outputAddress": { + "description": "The output address to receive the tokens", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredentialType", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychian plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "RefundRequest": { + "type": "object", + "required": [ + "id", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "description": "Contract htlc id for refund", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredentialType", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "WithdrawRequest": { + "type": "object", + "required": [ + "id", + "secret", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "description": "Contract locked id", + "type": "string", + "nullable": false + }, + "secret": { + "description": "Secret need to unlock the contract", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredentialType", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "GetStatusRequest": { + "description": "Defines the parameters for retrieving the status of the HTLC swap.", + "required": [ + "ids", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "connectorId": { + "type": "string" + }, + "keychainId": { + "type": "string" + } + } + }, + "GetSingleStatusRequest": { + "description": "Defines the parameters for retrieving the single status of the HTLC swap.", + "required": [ + "id", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "connectorId": { + "type": "string" + }, + "keychainId": { + "type": "string" + } + } + }, + "InitializeRequest": { + "type": "object", + "required": [ + "connectorId", + "keychainId", + "constructorArgs", + "web3SigningCredential" + ], + "additionalProperties": false, + "properties": { + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "description": "Web3SigningCredential", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "type": "number" + } + } + } + }, + "responses": { + "GetStatusResponse": { + "description": "Array of status", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "uint256" + } + } + } + } + }, + "GetSingleStatusResponse": { + "description": "Status", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "uint256" + } + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/initialize": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/initialize" + } + }, + "operationId": "initializeV1", + "summary": "Initialize contract", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitializeRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/RunTransactionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/withdraw": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/withdraw" + } + }, + "operationId": "withdrawV1", + "summary": "Withdraw a hashtimelock contract", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WithdrawRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status" + } + }, + "operationId": "getStatusV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetStatusRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "$ref": "#/components/responses/GetStatusResponse" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status" + } + }, + "operationId": "getSingleStatusV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSingleStatusRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "$ref": "#/components/responses/GetSingleStatusResponse" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/refund": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/refund" + } + }, + "operationId": "refundV1", + "summary": "Refund a hashtimelock contract", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RefundRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/new-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/new-contract" + } + }, + "operationId": "newContractV1", + "summary": "Create a new hashtimelock contract", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewContractRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.json b/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.json index 2239c19ffc..4f7c91736c 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.json +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.json @@ -59,7 +59,7 @@ "nullable": false }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "keychainId": { "description": "keychainId for the keychian plugin", @@ -94,7 +94,7 @@ "nullable": false }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "connectorId": { "description": "connectorId for the connector besu plugin", @@ -141,7 +141,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredentialType", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "connectorId": { @@ -193,7 +193,7 @@ }, "web3SigningCredential": { "description": "Web3SigningCredential", - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "$ref": "#/components/schemas/Web3SigningCredential", "nullable": false }, "gas": { @@ -218,7 +218,7 @@ } }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "connectorId": { "type": "string" @@ -242,7 +242,7 @@ "type": "string" }, "web3SigningCredential": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + "$ref": "#/components/schemas/Web3SigningCredential" }, "connectorId": { "type": "string" @@ -251,6 +251,177 @@ "type": "string" } } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "number", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "number", + "nullable": false + }, + "gasUsed": { + "type": "number", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } } }, "responses": { @@ -306,7 +477,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } @@ -338,7 +509,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } @@ -371,7 +542,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + "$ref": "#/components/schemas/InvokeContractV1Response" } } } @@ -455,7 +626,7 @@ "content": { "application/json": { "schema": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/RunTransactionResponse" + "$ref": "#/components/schemas/RunTransactionResponse" } } } diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.tpl.json b/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..2239c19ffc --- /dev/null +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/json/openapi.tpl.json @@ -0,0 +1,467 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - HTLC-ETH Besu", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "NewContractObj": { + "type": "object", + "required": [ + "contractAddress", + "outputAmount", + "expiration", + "hashLock", + "outputNetwork", + "outputAddress", + "connectorId", + "web3SigningCredential", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "contractAddress": { + "description": "Contract address", + "type": "string", + "nullable": false + }, + "inputAmount": { + "type": "number" + }, + "outputAmount": { + "type": "number" + }, + "expiration": { + "type": "number" + }, + "hashLock": { + "type": "string" + }, + "receiver": { + "type": "string" + }, + "outputNetwork": { + "type": "string", + "nullable": false + }, + "outputAddress": { + "type": "string", + "nullable": false + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "keychainId": { + "description": "keychainId for the keychian plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "RefundReq": { + "type": "object", + "required": [ + "id", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "description": "Contract htlc id for refund", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "WithdrawReq": { + "type": "object", + "required": [ + "id", + "secret", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "description": "Contract locked id", + "type": "string", + "nullable": false + }, + "secret": { + "description": "Secret need to unlock the contract", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "description": "Web3SigningCredentialType", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "InitializeRequest": { + "type": "object", + "required": [ + "connectorId", + "keychainId", + "constructorArgs", + "web3SigningCredential" + ], + "additionalProperties": false, + "properties": { + "connectorId": { + "description": "connectorId for the connector besu plugin", + "type": "string", + "nullable": false + }, + "keychainId": { + "description": "keychainId for the keychain plugin", + "type": "string", + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "description": "Web3SigningCredential", + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "type": "number" + } + } + }, + "GetStatusRequest": { + "description": "Defines the parameters for retrieving the status of the HTLC swap.", + "required": [ + "ids", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "connectorId": { + "type": "string" + }, + "keychainId": { + "type": "string" + } + } + }, + "GetSingleStatusRequest": { + "description": "Defines the parameters for retrieving the single status of the HTLC swap.", + "required": [ + "id", + "web3SigningCredential", + "connectorId", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "web3SigningCredential": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential" + }, + "connectorId": { + "type": "string" + }, + "keychainId": { + "type": "string" + } + } + } + }, + "responses": { + "GetStatusResponse": { + "description": "Array of status", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "uint256" + } + } + } + } + }, + "GetSingleStatusResponse": { + "description": "Status", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "uint256" + } + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/new-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/new-contract" + } + }, + "operationId": "newContractV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewContractObj" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/withdraw": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/withdraw" + } + }, + "operationId": "withdrawV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WithdrawReq" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/refund": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/refund" + } + }, + "operationId": "refundV1", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RefundReq" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-status": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-status" + } + }, + "operationId": "getStatusV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetStatusRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "$ref": "#/components/responses/GetStatusResponse" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-single-status": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/get-single-status" + } + }, + "operationId": "getSingleStatusV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSingleStatusRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "$ref": "#/components/responses/GetSingleStatusResponse" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/initialize": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu/initialize" + } + }, + "operationId": "initializeV1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InitializeRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/RunTransactionResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.json b/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.json index d3e284d518..629cb810b6 100644 --- a/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.json @@ -23,6 +23,265 @@ "GetSecretResponse": { "type": "string", "nullable": false + }, + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_delete_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_delete_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_delete_entry_500": { + "description": "Unexpected error." + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." } } }, @@ -39,23 +298,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -72,20 +331,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } @@ -102,20 +361,20 @@ "summary": "Deletes an entry under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + "$ref": "#/components/requestBodies/keychain_delete_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + "$ref": "#/components/responses/keychain_delete_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + "$ref": "#/components/responses/keychain_delete_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + "$ref": "#/components/responses/keychain_delete_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + "$ref": "#/components/responses/keychain_delete_entry_500" } } } @@ -132,20 +391,20 @@ "summary": "Checks that an entry exists under a key on the keychain backend", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + "$ref": "#/components/requestBodies/keychain_has_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + "$ref": "#/components/responses/keychain_has_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + "$ref": "#/components/responses/keychain_has_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + "$ref": "#/components/responses/keychain_has_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + "$ref": "#/components/responses/keychain_has_entry_500" } } } diff --git a/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..d3e284d518 --- /dev/null +++ b/packages/cactus-plugin-keychain-aws-sm/src/main/json/openapi.tpl.json @@ -0,0 +1,179 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus - Keychain API", + "description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "GetSecretRequest": { + "type": "string", + "nullable": false, + "additionalProperties": false + }, + "GetSecretResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes an entry under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Checks that an entry exists under a key on the keychain backend", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-aws-sm/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.json b/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.json index e7b4cc5500..a27e38b805 100644 --- a/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.json @@ -18,6 +18,265 @@ "GetSecretResponse": { "type": "string", "nullable": false + }, + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_delete_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_delete_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_delete_entry_500": { + "description": "Unexpected error." + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." } } }, @@ -34,23 +293,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -67,20 +326,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } @@ -97,20 +356,20 @@ "summary": "Deletes a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + "$ref": "#/components/requestBodies/keychain_delete_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + "$ref": "#/components/responses/keychain_delete_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + "$ref": "#/components/responses/keychain_delete_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + "$ref": "#/components/responses/keychain_delete_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + "$ref": "#/components/responses/keychain_delete_entry_500" } } } @@ -127,20 +386,20 @@ "summary": "Checks that an entry exists under a key on the keychain backend", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + "$ref": "#/components/requestBodies/keychain_has_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + "$ref": "#/components/responses/keychain_has_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + "$ref": "#/components/responses/keychain_has_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + "$ref": "#/components/responses/keychain_has_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + "$ref": "#/components/responses/keychain_has_entry_500" } } } diff --git a/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..e7b4cc5500 --- /dev/null +++ b/packages/cactus-plugin-keychain-azure-kv/src/main/json/openapi.tpl.json @@ -0,0 +1,149 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus - Keychain API", + "description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "GetSecretRequest": { + "type": "string", + "nullable": false + }, + "GetSecretResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-azure-kv/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Checks that an entry exists under a key on the keychain backend", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.json b/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.json index 8527bb7933..f1eef66dae 100644 --- a/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.json @@ -10,7 +10,258 @@ } }, "components": { - "schemas": {} + "schemas": { + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." + } + } }, "paths": { "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/get-keychain-entry": { @@ -25,23 +276,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -58,20 +309,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } @@ -88,11 +339,11 @@ "summary": "Deletes an entry under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + "$ref": "#/components/requestBodies/keychain_delete_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + "$ref": "#/components/responses/keychain_delete_entry_200" } } } @@ -109,20 +360,20 @@ "summary": "Checks that an entry exists under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + "$ref": "#/components/requestBodies/keychain_has_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + "$ref": "#/components/responses/keychain_has_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + "$ref": "#/components/responses/keychain_has_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + "$ref": "#/components/responses/keychain_has_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + "$ref": "#/components/responses/keychain_has_entry_500" } } } diff --git a/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..8527bb7933 --- /dev/null +++ b/packages/cactus-plugin-keychain-google-sm/src/main/json/openapi.tpl.json @@ -0,0 +1,131 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus - Keychain API", + "description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": {} + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes an entry under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-google-sm/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Checks that an entry exists under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.json b/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.json index f3016308da..61c15afb5c 100644 --- a/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.json @@ -22,23 +22,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -55,20 +55,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } @@ -85,20 +85,20 @@ "summary": "Deletes an entry under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + "$ref": "#/components/requestBodies/keychain_delete_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + "$ref": "#/components/responses/keychain_delete_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + "$ref": "#/components/responses/keychain_delete_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + "$ref": "#/components/responses/keychain_delete_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + "$ref": "#/components/responses/keychain_delete_entry_500" } } } @@ -115,23 +115,286 @@ "summary": "Checks that an entry exists under a key on the keychain backend", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + "$ref": "#/components/requestBodies/keychain_has_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + "$ref": "#/components/responses/keychain_has_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + "$ref": "#/components/responses/keychain_has_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + "$ref": "#/components/responses/keychain_has_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + "$ref": "#/components/responses/keychain_has_entry_500" } } } } + }, + "components": { + "schemas": { + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_delete_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_delete_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_delete_entry_500": { + "description": "Unexpected error." + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." + } + } } } diff --git a/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..f3016308da --- /dev/null +++ b/packages/cactus-plugin-keychain-memory-wasm/src/main/json/openapi.tpl.json @@ -0,0 +1,137 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Keychain Memory WASM", + "description": "Contains/describes the Hyperledger Cactus Keychain Memory WASM plugin which is designed to help with testing and development and is implemented in Rust instead of Typescript.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes an entry under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory-wasm/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Checks that an entry exists under a key on the keychain backend", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-memory/src/main/json/openapi.json b/packages/cactus-plugin-keychain-memory/src/main/json/openapi.json index 3641dbb691..e3af0964e1 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-memory/src/main/json/openapi.json @@ -14,6 +14,265 @@ "PrometheusExporterMetricsResponse": { "type": "string", "nullable": false + }, + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to check the presence of on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the entry store.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + }, + "keychain_delete_entry_request_body": { + "description": "Request body to delete a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "keychain_has_entry_request_body": { + "description": "Request body for checking a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." + }, + "keychain_delete_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + }, + "keychain_delete_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_delete_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_delete_entry_500": { + "description": "Unexpected error." + }, + "keychain_has_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + }, + "keychain_has_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_has_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_has_entry_500": { + "description": "Unexpected error." } } }, @@ -30,23 +289,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -63,20 +322,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } @@ -93,20 +352,20 @@ "summary": "Deletes an entry under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + "$ref": "#/components/requestBodies/keychain_delete_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + "$ref": "#/components/responses/keychain_delete_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + "$ref": "#/components/responses/keychain_delete_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + "$ref": "#/components/responses/keychain_delete_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + "$ref": "#/components/responses/keychain_delete_entry_500" } } } @@ -123,20 +382,20 @@ "summary": "Checks that an entry exists under a key on the keychain backend", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + "$ref": "#/components/requestBodies/keychain_has_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + "$ref": "#/components/responses/keychain_has_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + "$ref": "#/components/responses/keychain_has_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + "$ref": "#/components/responses/keychain_has_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + "$ref": "#/components/responses/keychain_has_entry_500" } } } diff --git a/packages/cactus-plugin-keychain-memory/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-memory/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..3641dbb691 --- /dev/null +++ b/packages/cactus-plugin-keychain-memory/src/main/json/openapi.tpl.json @@ -0,0 +1,170 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Keychain Memory ", + "description": "Contains/describes the Hyperledger Cacti Keychain Memory plugin.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes an entry under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_delete_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_delete_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Checks that an entry exists under a key on the keychain backend", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_has_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_has_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-keychain-vault/src/main/json/openapi.json b/packages/cactus-plugin-keychain-vault/src/main/json/openapi.json index cf69bd9af3..42a91ab52c 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/json/openapi.json +++ b/packages/cactus-plugin-keychain-vault/src/main/json/openapi.json @@ -78,6 +78,141 @@ "nullable": false } } + }, + "GetKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to get from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "value"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to retrieve the value from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value associated with the requested key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryRequestV1": { + "type": "object", + "required": ["key", "value"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for the entry to set on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "value": { + "type": "string", + "description": "The value that will be associated with the key on the keychain.", + "minLength": 0, + "maxLength": 10485760, + "nullable": false + } + } + }, + "SetKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to set the value on the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + } + }, + "requestBodies": { + "keychain_get_entry_request_body": { + "description": "Request body to obtain a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryRequestV1" + } + } + } + }, + "keychain_set_entry_request_body": { + "description": "Request body to write/update a keychain entry via its key", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryRequestV1" + } + } + } + } + }, + "responses": { + "keychain_get_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetKeychainEntryResponseV1" + } + } + } + }, + "keychain_get_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_get_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_get_entry_404": { + "description": "A keychain item with the specified key was not found." + }, + "keychain_get_entry_500": { + "description": "Unexpected error." + }, + "keychain_set_entry_200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetKeychainEntryResponseV1" + } + } + } + }, + "keychain_set_entry_400": { + "description": "Bad request. Key must be a string and longer than 0, shorter than 1024 characters." + }, + "keychain_set_entry_401": { + "description": "Authorization information is missing or invalid." + }, + "keychain_set_entry_500": { + "description": "Unexpected error." } } }, @@ -94,23 +229,23 @@ "summary": "Retrieves the contents of a keychain entry from the backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + "$ref": "#/components/requestBodies/keychain_get_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + "$ref": "#/components/responses/keychain_get_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + "$ref": "#/components/responses/keychain_get_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + "$ref": "#/components/responses/keychain_get_entry_401" }, "404": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + "$ref": "#/components/responses/keychain_get_entry_404" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + "$ref": "#/components/responses/keychain_get_entry_500" } } } @@ -195,20 +330,20 @@ "summary": "Sets a value under a key on the keychain backend.", "parameters": [], "requestBody": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + "$ref": "#/components/requestBodies/keychain_set_entry_request_body" }, "responses": { "200": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + "$ref": "#/components/responses/keychain_set_entry_200" }, "400": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + "$ref": "#/components/responses/keychain_set_entry_400" }, "401": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + "$ref": "#/components/responses/keychain_set_entry_401" }, "500": { - "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + "$ref": "#/components/responses/keychain_set_entry_500" } } } diff --git a/packages/cactus-plugin-keychain-vault/src/main/json/openapi.tpl.json b/packages/cactus-plugin-keychain-vault/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..cf69bd9af3 --- /dev/null +++ b/packages/cactus-plugin-keychain-vault/src/main/json/openapi.tpl.json @@ -0,0 +1,242 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus - Keychain API", + "description": "Contains/describes the Keychain API types/paths for Hyperledger Cactus.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "HasKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key to check for presence in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "HasKeychainEntryResponseV1": { + "type": "object", + "required": ["key", "isPresent", "checkedAt"], + "properties": { + "key": { + "type": "string", + "description": "The key that was used to check the presence of the value in the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "checkedAt": { + "type": "string", + "description": "Date and time encoded as JSON when the presence check was performed by the plugin backend.", + "nullable": false + }, + "isPresent": { + "type": "boolean", + "description": "The boolean true or false indicating the presence or absence of an entry under 'key'.", + "nullable": false + } + } + }, + "DeleteKeychainEntryRequestV1": { + "type": "object", + "required": ["key"], + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key of the entry to delete from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "DeleteKeychainEntryResponseV1": { + "type": "object", + "required": ["key"], + "properties": { + "key": { + "type": "string", + "description": "The key of the entry that was deleted from the keychain.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "getKeychainEntryV1", + "summary": "Retrieves the contents of a keychain entry from the backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_get_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_401" + }, + "404": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_404" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_get_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/delete-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/delete-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "deleteKeychainEntryV1", + "summary": "Deletes an entry from the keychain stored under the provided key.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteKeychainEntryResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/has-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/has-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "hasKeychainEntryV1", + "summary": "Retrieves the information regarding a key being present on the keychain or not.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HasKeychainEntryResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/set-keychain-entry": { + "post": { + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/set-keychain-entry", + "verbLowerCase": "post" + } + }, + "operationId": "setKeychainEntryV1", + "summary": "Sets a value under a key on the keychain backend.", + "parameters": [], + "requestBody": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/requestBodies/keychain_set_entry_request_body" + }, + "responses": { + "200": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_200" + }, + "400": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_400" + }, + "401": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_401" + }, + "500": { + "$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v2.0.0-alpha.2/packages/cactus-core-api/src/main/json/openapi.json#/components/responses/keychain_set_entry_500" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-keychain-vault/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-aries/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-aries/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..40dc6a327d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-aries/src/main/json/openapi.tpl.json @@ -0,0 +1,745 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Aries", + "description": "Can communicate with other Aries agents and Cacti Aries connectors", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "WatchConnectionStateV1": { + "type": "string", + "description": "Websocket requests for monitoring connection change events.", + "enum": [ + "org.hyperledger.cactus.api.async.hlaries.WatchConnectionStateV1.Subscribe", + "org.hyperledger.cactus.api.async.hlaries.WatchConnectionStateV1.Next", + "org.hyperledger.cactus.api.async.hlaries.WatchConnectionStateV1.Unsubscribe", + "org.hyperledger.cactus.api.async.hlaries.WatchConnectionStateV1.Error", + "org.hyperledger.cactus.api.async.hlaries.WatchConnectionStateV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchConnectionStateOptionsV1": { + "type": "object", + "description": "Options passed when monitoring connection change events.", + "required": ["agentName"], + "properties": { + "agentName": { + "type": "string", + "nullable": false, + "description": "Aries agent label that will also be used as wallet id." + } + } + }, + "WatchConnectionStateProgressV1": { + "type": "object", + "description": "Values pushed on each connection state change.", + "required": ["connectionRecord", "previousState"], + "properties": { + "connectionRecord": { + "$ref": "#/components/schemas/AgentConnectionRecordV1", + "nullable": false + }, + "previousState": { + "type": "string", + "nullable": true + } + } + }, + "WatchProofStateV1": { + "type": "string", + "description": "Websocket requests for monitoring proof state change events.", + "enum": [ + "org.hyperledger.cactus.api.async.hlaries.WatchProofStateV1.Subscribe", + "org.hyperledger.cactus.api.async.hlaries.WatchProofStateV1.Next", + "org.hyperledger.cactus.api.async.hlaries.WatchProofStateV1.Unsubscribe", + "org.hyperledger.cactus.api.async.hlaries.WatchProofStateV1.Error", + "org.hyperledger.cactus.api.async.hlaries.WatchProofStateV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchProofStateOptionsV1": { + "type": "object", + "description": "Options passed when monitoring proof state change events.", + "required": ["agentName"], + "properties": { + "agentName": { + "type": "string", + "nullable": false, + "description": "Aries agent label that will also be used as wallet id." + } + } + }, + "WatchProofStateProgressV1": { + "type": "object", + "description": "Values pushed on each proof state change.", + "required": ["proofRecord", "previousState"], + "properties": { + "proofRecord": { + "$ref": "#/components/schemas/AriesProofExchangeRecordV1", + "nullable": false + }, + "previousState": { + "type": "string", + "nullable": true + } + } + }, + "CactiAcceptPolicyV1": { + "type": "string", + "description": "Credential / Proof requests acceptance policies for Aries agent", + "enum": ["always", "contentApproved", "never"], + "x-enum-varnames": ["Always", "ContentApproved", "Never"] + }, + "CactiProofRequestAttributeV1": { + "type": "object", + "description": "Credential attribute checks to be performed by a proof request.", + "required": ["name"], + "properties": { + "name": { + "type": "string", + "nullable": false, + "description": "Attribute name." + }, + "isValueEqual": { + "nullable": false, + "description": "Check if attribute has specified value" + }, + "isCredentialDefinitionIdEqual": { + "nullable": false, + "description": "Check if credentialDefinitionId has specified value" + } + } + }, + "AriesProofExchangeRecordV1": { + "type": "object", + "description": "Proof exchange record from Aries framework (simplified)", + "additionalProperties": true, + "required": ["id", "threadId", "state", "protocolVersion"], + "properties": { + "id": { + "type": "string", + "nullable": false + }, + "connectionId": { + "type": "string", + "nullable": false + }, + "threadId": { + "type": "string", + "nullable": false + }, + "state": { + "type": "string", + "nullable": false + }, + "protocolVersion": { + "type": "string", + "nullable": false + }, + "isVerified": { + "type": "boolean", + "nullable": false + }, + "errorMessage": { + "type": "string", + "nullable": false + } + } + }, + "AriesIndyVdrPoolConfigV1": { + "type": "object", + "description": "Indy VDR network configuration", + "required": ["genesisTransactions", "isProduction", "indyNamespace"], + "properties": { + "genesisTransactions": { + "type": "string", + "nullable": false, + "description": "Indy genesis transactions." + }, + "isProduction": { + "type": "boolean", + "nullable": false, + "description": "Flag to specify whether this is production or development ledger." + }, + "indyNamespace": { + "type": "string", + "nullable": false, + "description": "Indy namespace" + }, + "connectOnStartup": { + "type": "boolean", + "nullable": false, + "description": "Connect to the ledger on startup flag" + } + } + }, + "AriesAgentConfigV1": { + "type": "object", + "description": "Aries agent configuration to be setup and used by the connector.", + "required": ["name", "walletKey", "indyNetworks"], + "properties": { + "name": { + "type": "string", + "nullable": false, + "description": "Aries agent label that will also be used as wallet id." + }, + "walletKey": { + "type": "string", + "nullable": false, + "description": "Wallet private key - do not share with anyone." + }, + "walletPath": { + "type": "string", + "nullable": false, + "description": "Path to wallet sqlite database to use. If not provided, the connector default path and agent name will be used." + }, + "indyNetworks": { + "type": "array", + "nullable": false, + "items": { + "$ref": "#/components/schemas/AriesIndyVdrPoolConfigV1", + "minItems": 1 + } + }, + "inboundUrl": { + "type": "string", + "nullable": false, + "description": "Inbound endpoint URL for this agent. Must be unique for this connector. Must contain port.", + "example": "http://127.0.0.1:1234", + "default": "undefined" + }, + "autoAcceptConnections": { + "type": "boolean", + "nullable": false, + "description": "Flag to accept new connection by default", + "default": "false" + }, + "autoAcceptCredentials": { + "$ref": "#/components/schemas/CactiAcceptPolicyV1", + "nullable": false, + "description": "Policy for accepting new credentials by this agent", + "default": "never" + }, + "autoAcceptProofs": { + "$ref": "#/components/schemas/CactiAcceptPolicyV1", + "nullable": false, + "description": "Policy for accepting new proof requests by this agent", + "default": "never" + } + } + }, + "AriesAgentSummaryV1": { + "type": "object", + "description": "Summary of an Aries Agent configured in the connector.", + "required": [ + "name", + "isAgentInitialized", + "isWalletInitialized", + "isWalletProvisioned", + "walletConfig", + "endpoints" + ], + "properties": { + "name": { + "type": "string", + "nullable": false, + "description": "Aries label of an agent" + }, + "isAgentInitialized": { + "type": "boolean", + "nullable": false, + "description": "True when Aries agent has been initialized properly." + }, + "isWalletInitialized": { + "type": "boolean", + "nullable": false, + "description": "True when this agents wallet has been initialized properly." + }, + "isWalletProvisioned": { + "type": "boolean", + "nullable": false, + "description": "True when this agents wallet has been provisioned properly." + }, + "walletConfig": { + "type": "object", + "nullable": false, + "required": ["id", "type"], + "properties": { + "id": { + "type": "string", + "nullable": false, + "description": "Wallet entry ID" + }, + "type": { + "type": "string", + "nullable": false, + "description": "Wallet storage type" + } + } + }, + "endpoints": { + "type": "array", + "nullable": false, + "description": "Aries agent endpoints configured", + "items": { + "type": "string", + "nullable": false + } + } + } + }, + "AgentConnectionsFilterV1": { + "type": "object", + "description": "Fields that can be used to filter agent connection list.", + "properties": { + "did": { + "type": "string", + "nullable": false + }, + "invitationDid": { + "type": "string", + "nullable": false + }, + "outOfBandId": { + "type": "string", + "nullable": false + }, + "role": { + "type": "string", + "nullable": false + }, + "state": { + "type": "string", + "nullable": false + }, + "theirDid": { + "type": "string", + "nullable": false + }, + "threadId": { + "type": "string", + "nullable": false + } + } + }, + "AgentConnectionRecordV1": { + "type": "object", + "description": "Aries agent connection information.", + "additionalProperties": true, + "required": ["state", "role", "isReady"], + "properties": { + "state": { + "type": "string", + "nullable": false + }, + "role": { + "type": "string", + "nullable": false + }, + "isReady": { + "type": "boolean", + "nullable": false + }, + "did": { + "type": "string", + "nullable": false + }, + "theirDid": { + "type": "string", + "nullable": false + }, + "theirLabel": { + "type": "string", + "nullable": false + }, + "alias": { + "type": "string", + "nullable": false + }, + "threadId": { + "type": "string", + "nullable": false + }, + "errorMessage": { + "type": "string", + "nullable": false + }, + "outOfBandId": { + "type": "string", + "nullable": false + }, + "invitationDid": { + "type": "string", + "nullable": false + } + } + }, + "GetConnectionsV1Request": { + "type": "object", + "description": "Request for GetConnections endpoint.", + "required": ["agentName"], + "properties": { + "agentName": { + "type": "string", + "nullable": false + }, + "filter": { + "$ref": "#/components/schemas/AgentConnectionsFilterV1", + "nullable": false + } + } + }, + "GetConnectionsV1Response": { + "type": "array", + "description": "Response for GetConnections endpoint.", + "default": [], + "items": { + "$ref": "#/components/schemas/AgentConnectionRecordV1" + } + }, + "GetAgentsV1Response": { + "type": "array", + "description": "Response for GetAgents endpoint.", + "default": [], + "items": { + "$ref": "#/components/schemas/AriesAgentSummaryV1" + } + }, + "CreateNewConnectionInvitationV1Request": { + "type": "object", + "description": "Request for CreateNewConnectionInvitation endpoint.", + "required": ["agentName"], + "properties": { + "agentName": { + "type": "string", + "description": "Aries label of an agent to use to generate an invitation", + "nullable": false + }, + "invitationDomain": { + "type": "string", + "description": "Invitation URL domain to use. If not specified, then connector default domain will be used", + "nullable": false + } + } + }, + "CreateNewConnectionInvitationV1Response": { + "type": "object", + "description": "Response for CreateNewConnectionInvitation endpoint.", + "required": ["invitationUrl", "outOfBandId"], + "properties": { + "invitationUrl": { + "type": "string", + "description": "Invitation URL that can be used by another aries agent to connect to us.", + "nullable": false + }, + "outOfBandId": { + "type": "string", + "description": "ID that can be used to track status of the connection", + "nullable": false + } + } + }, + "AcceptInvitationV1Request": { + "type": "object", + "description": "Request for AcceptInvitation endpoint.", + "required": ["agentName", "invitationUrl"], + "properties": { + "agentName": { + "type": "string", + "description": "Aries label of an agent to be used to connect using URL", + "nullable": false + }, + "invitationUrl": { + "type": "string", + "description": "Invitation URL generated by another aries agent.", + "nullable": false + } + } + }, + "AcceptInvitationV1Response": { + "type": "object", + "description": "Response for AcceptInvitation endpoint.", + "required": ["outOfBandId"], + "properties": { + "outOfBandId": { + "type": "string", + "description": "ID that can be used to track status of the connection", + "nullable": false + } + } + }, + "RequestProofV1Request": { + "type": "object", + "description": "Request for RequestProof endpoint.", + "required": ["agentName", "connectionId", "proofAttributes"], + "properties": { + "agentName": { + "type": "string", + "description": "Aries label of an agent to be used to connect using URL", + "nullable": false + }, + "connectionId": { + "type": "string", + "description": "Peer connection ID from which we want to request a proof.", + "nullable": false + }, + "proofAttributes": { + "type": "array", + "nullable": false, + "items": { + "$ref": "#/components/schemas/CactiProofRequestAttributeV1", + "minItems": 1 + } + } + } + }, + "ErrorExceptionV1Response": { + "type": "object", + "description": "Error response from the connector.", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "description": "Short error description message.", + "nullable": false + }, + "error": { + "type": "string", + "description": "Detailed error information.", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/get-agents": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/get-agents" + } + }, + "operationId": "getAgentsV1", + "summary": "Get all Aries agents configured in this connector plugin.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAgentsV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/get-connections": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/get-connections" + } + }, + "operationId": "getConnectionsV1", + "summary": "Get all connections of given aries agent.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConnectionsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConnectionsV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/create-new-connection-invitation": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/create-new-connection-invitation" + } + }, + "operationId": "createNewConnectionInvitationV1", + "summary": "Create new aries agent invitation that other agents can use to connect.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateNewConnectionInvitationV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateNewConnectionInvitationV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/accept-invitation": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/accept-invitation" + } + }, + "operationId": "acceptInvitationV1", + "summary": "Connect to another agent using it's invitation URL", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AcceptInvitationV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AcceptInvitationV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/request-proof": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-aries/request-proof" + } + }, + "operationId": "requestProofV1", + "summary": "Request proof matching provided requriements from connected peer agent.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestProofV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AriesProofExchangeRecordV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionV1Response" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..be809bc208 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.tpl.json @@ -0,0 +1,1322 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Besu", + "description": "Can perform basic tasks on a Besu ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "GetBalanceV1Response": { + "type": "object", + "required": ["balance"], + "properties": { + "balance": { + "type": "string" + } + } + }, + "GetBalanceV1Request": { + "type": "object", + "required": ["address"], + "additionalProperties": false, + "properties": { + "address": { + "type": "string" + }, + "defaultBlock": {} + } + }, + "EvmBlock": { + "type": "object", + "properties": { + "number": { + "type": "number" + }, + "hash": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "difficulty": { + "type": "number" + }, + "totalDifficulty": { + "type": "number" + }, + "extraData": { + "type": "string" + }, + "size": { + "type": "number" + }, + "gasLimit": { + "type": "number" + }, + "gasUsed": { + "type": "number" + }, + "timestamp": {}, + "transactions": { + "type": "array", + "items": {} + }, + "uncles": { + "type": "array", + "items": {} + } + } + }, + "GetBlockV1Response": { + "type": "object", + "required": ["block"], + "properties": { + "block": { + "$ref": "#/components/schemas/EvmBlock" + } + } + }, + "EvmTransaction": { + "type": "object", + "properties": { + "hash": { + "type": "string" + }, + "nonce": { + "type": "number" + }, + "blockHash": {}, + "blockNumber": {}, + "transactionIndex": {}, + "from": { + "type": "string" + }, + "to": {}, + "value": { + "type": "string" + }, + "gasPrice": { + "type": "string" + }, + "gas": { + "type": "number" + }, + "input": { + "type": "string" + } + } + }, + "GetTransactionV1Response": { + "type": "object", + "required": ["transaction"], + "properties": { + "transaction": { + "$ref": "#/components/schemas/EvmTransaction" + } + } + }, + "GetTransactionV1Request": { + "type": "object", + "required": ["transactionHash"], + "additionalProperties": false, + "properties": { + "transactionHash": { + "type": "string" + } + } + }, + "GetPastLogsV1Response": { + "type": "object", + "required": ["logs"], + "properties": { + "logs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EvmLog" + } + } + } + }, + "GetPastLogsV1Request": { + "type": "object", + "additionalProperties": false, + "properties": { + "toBlock": {}, + "fromBlock": {}, + "address": {}, + "topics": { + "type": "array", + "items": {} + } + } + }, + "EvmLog": { + "type": "object", + "required": [ + "address", + "data", + "blockHash", + "transactionHash", + "topics", + "logIndex", + "transactionIndex", + "blockNumber" + ], + "properties": { + "address": { + "type": "string" + }, + "data": { + "type": "string" + }, + "blockHash": { + "type": "string" + }, + "transactionHash": { + "type": "string" + }, + "topics": { + "type": "array", + "items": { + "type": "string" + } + }, + "logIndex": { + "type": "number" + }, + "transactionIndex": { + "type": "number" + }, + "blockNumber": { + "type": "number" + } + } + }, + "GetBlockV1Request": { + "required": ["blockHashOrBlockNumber"], + "additionalProperties": false, + "type": "object", + "properties": { + "blockHashOrBlockNumber": {} + } + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Request": { + "type": "object", + "required": ["event"], + "properties": { + "event": { + "$ref": "#/components/schemas/WatchBlocksV1" + } + } + }, + "Web3BlockHeader": { + "type": "object", + "required": [ + "number", + "hash", + "parentHash", + "nonce", + "sha3Uncles", + "logsBloom", + "transactionRoot", + "stateRoot", + "receiptRoot", + "miner", + "extraData", + "gasLimit", + "gasUsed", + "timestamp" + ], + "properties": { + "number": { + "type": "number" + }, + "hash": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "transactionRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "receiptRoot": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "extraData": { + "type": "string" + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "timestamp": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "required": ["blockHeader"], + "properties": { + "blockHeader": { + "$ref": "#/components/schemas/Web3BlockHeader" + } + } + }, + "ReceiptType": { + "description": "Enumerates the possible types of receipts that can be waited for by someone or something that has requested the execution of a transaction on a ledger.", + "type": "string", + "enum": ["NODE_TX_POOL_ACK", "LEDGER_BLOCK_ACK"] + }, + "ConsistencyStrategy": { + "type": "object", + "required": ["receiptType", "blockConfirmations"], + "properties": { + "receiptType": { + "$ref": "#/components/schemas/ReceiptType" + }, + "timeoutMs": { + "type": "integer", + "description": "The amount of milliseconds to wait for the receipt to arrive to the connector. Defaults to 0 which means to wait for an unlimited amount of time. Note that this wait may be interrupted still by other parts of the infrastructure such as load balancers cutting of HTTP requests after some time even if they are the type that is supposed to be kept alive. The question of re-entrance is a broader topic not in scope to discuss here, but it is important to mention it.", + "minimum": 0 + }, + "blockConfirmations": { + "type": "integer", + "minimum": 0, + "maximum": 20000, + "description": "The number of blocks to wait to be confirmed in addition to the block containing the transaction in question. Note that if the receipt type is set to only wait for node transaction pool ACK and this parameter is set to anything, but zero then the API will not accept the request due to conflicting parameters." + } + } + }, + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "EthContractInvocationType": { + "type": "string", + "enum": ["SEND", "CALL"] + }, + "SolidityContractJsonArtifact": { + "type": "object", + "required": ["contractName"], + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "metadata": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false + }, + "deployedBytecode": { + "type": "string", + "nullable": false + }, + "sourceMap": { + "type": "string", + "nullable": false + }, + "deployedSourceMap": { + "type": "string", + "nullable": false + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object", + "additionalProperties": true, + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "functionHashes": { + "type": "object", + "additionalProperties": true + }, + "gasEstimates": { + "properties": { + "creation": { + "type": "object", + "properties": { + "codeDepositCost": { + "type": "string" + }, + "executionCost": { + "type": "string" + }, + "totalCost": { + "type": "string" + } + } + }, + "external": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "BesuTransactionConfig": { + "type": "object", + "additionalProperties": true, + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + }, + "from": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "to": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "data": { + "oneOf": [ + { + "type": "string" + } + ] + } + } + }, + "BesuPrivateTransactionConfig": { + "type": "object", + "required": ["privateFrom", "privateFor"], + "properties": { + "privateFrom": { + "type": "string", + "nullable": false + }, + "privateFor": { + "type": "array", + "default": [], + "items": {}, + "nullable": false + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "number", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "number", + "nullable": false + }, + "gasUsed": { + "type": "number", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + } + } + }, + "RunTransactionRequest": { + "type": "object", + "required": [ + "web3SigningCredential", + "transactionConfig", + "consistencyStrategy" + ], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "transactionConfig": { + "$ref": "#/components/schemas/BesuTransactionConfig", + "nullable": false + }, + "consistencyStrategy": { + "$ref": "#/components/schemas/ConsistencyStrategy" + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/BesuPrivateTransactionConfig" + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "DeployContractSolidityBytecodeV1Request": { + "type": "object", + "required": [ + "contractName", + "contractAbi", + "bytecode", + "web3SigningCredential", + "keychainId", + "constructorArgs" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractAbi": { + "description": "The application binary interface of the solidity contract", + "type": "array", + "items": {}, + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/BesuPrivateTransactionConfig" + } + } + }, + "DeployContractSolidityBytecodeV1Response": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "InvokeContractV1Request": { + "type": "object", + "required": [ + "contractName", + "signingCredential", + "invocationType", + "methodName", + "params" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "signingCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "contractAbi": { + "description": "The application binary interface of the solidity contract, optional parameter", + "type": "array", + "items": {}, + "nullable": false + }, + "contractAddress": { + "description": "Address of the solidity contract, optional parameter", + "type": "string", + "nullable": false + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100 + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/BesuPrivateTransactionConfig" + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } + }, + "SignTransactionRequest": { + "type": "object", + "required": ["transactionHash", "keychainId", "keychainRef"], + "additionalProperties": false, + "properties": { + "keychainId": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "keychainRef": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "transactionHash": { + "description": "The transaction hash of ledger will be used to fetch the contain.", + "type": "string", + "minLength": 0, + "maxLength": 2048, + "nullable": false + } + } + }, + "SignTransactionResponse": { + "type": "object", + "required": ["signature"], + "properties": { + "signature": { + "description": "The signatures of ledger from the corresponding transaction hash.", + "type": "string", + "minLength": 0, + "maxLength": 2048, + "nullable": false + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "GetBesuRecordV1Request": { + "type": "object", + "additionalProperties": false, + "properties": { + "invokeCall": { + "$ref": "#/components/schemas/InvokeContractV1Request" + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + } + } + }, + "GetBesuRecordV1Response": { + "type": "object", + "properties": { + "ledgerId": { + "type": "string" + }, + "stateContract": { + "type": "string" + }, + "transactionInputData": {}, + "callOutput": {} + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-open-api-spec": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode" + } + }, + "operationId": "deployContractSolBytecodeV1", + "summary": "Deploys the bytecode of a Solidity contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-balance": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-balance" + } + }, + "operationId": "getBalanceV1", + "summary": "Return balance of an address of a given block", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBalanceV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBalanceV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-block": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-block" + } + }, + "operationId": "getBlockV1", + "summary": "Returns a block matching the block", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBlockV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBlockV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/run-transaction" + } + }, + "operationId": "runTransactionV1", + "summary": "Executes a transaction on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-transaction" + } + }, + "operationId": "getTransactionV1", + "summary": "Executes a transaction on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTransactionV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTransactionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-past-logs": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-past-logs" + } + }, + "operationId": "getPastLogsV1", + "summary": "Gets past logs, matching the given options.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPastLogsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPastLogsV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/invoke-contract" + } + }, + "operationId": "invokeContractV1", + "summary": "Invokes a contract on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/sign-transaction" + } + }, + "operationId": "signTransactionV1", + "summary": "Obtain signatures of ledger from the corresponding transaction hash.", + "description": "Obtain signatures of ledger from the corresponding transaction hash.", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignTransactionResponse" + } + } + } + }, + "404": { + "description": "Not able to find the corresponding tranaction from the transaction hash" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-besu-record": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/get-besu-record" + } + }, + "operationId": "getBesuRecordV1", + "summary": "Retrieves an arbitrary record (any piece of information) from the ledger. Ledger records can be call outputs, transaction input, etc.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBesuRecordV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/GetBesuRecordV1Response" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-cdl/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-cdl/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..ef34d85e70 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-cdl/src/main/json/openapi.tpl.json @@ -0,0 +1,505 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector CDL", + "description": "Can perform basic tasks on Fujitsu CDL service.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "GetLineageOptionDirectionV1": { + "type": "string", + "enum": ["backward", "forward", "both"], + "x-enum-varnames": ["Backward", "Forward", "Both"] + }, + "SearchLineageTypeV1": { + "type": "string", + "enum": ["exactmatch", "partialmatch", "regexpmatch"], + "x-enum-varnames": ["ExactMatch", "PartialMatch", "RegexMatch"] + }, + "GatewayConfigurationV1": { + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "description": "Gateway URL", + "nullable": false + }, + "userAgent": { + "type": "string", + "description": "Value of User-Agent header sent to CDL (to identify this client)", + "nullable": false + }, + "skipCertCheck": { + "type": "boolean", + "description": "Set to true to ignore self-signed and other rejected certificates", + "default": "false", + "nullable": false + }, + "caPath": { + "type": "string", + "description": "CA of CDL API gateway server in PEM format to use", + "nullable": false + }, + "serverName": { + "type": "string", + "description": "Overwrite server name from cdlApiGateway.url to match one specified in CA", + "nullable": false + } + } + }, + "AuthInfoAccessTokenV1": { + "type": "object", + "required": ["accessToken", "trustAgentId"], + "properties": { + "accessToken": { + "type": "string", + "nullable": false + }, + "trustAgentId": { + "type": "string", + "nullable": false + } + } + }, + "AuthInfoSubscriptionKeyV1": { + "type": "object", + "required": [ + "subscriptionKey", + "trustAgentId", + "trustAgentRole", + "trustUserId", + "trustUserRole" + ], + "properties": { + "subscriptionKey": { + "type": "string", + "nullable": false + }, + "trustAgentId": { + "type": "string", + "nullable": false + }, + "trustAgentRole": { + "type": "string", + "nullable": false + }, + "trustUserId": { + "type": "string", + "nullable": false + }, + "trustUserRole": { + "type": "string", + "nullable": false + } + } + }, + "AuthInfoV1": { + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/AuthInfoAccessTokenV1" + }, + { + "$ref": "#/components/schemas/AuthInfoSubscriptionKeyV1" + } + ] + }, + "EventLineageV1": { + "type": "object", + "description": "CDL event linage information (used to identify related events)", + "required": [ + "cdl:EventId", + "cdl:LineageId", + "cdl:DataModelMode", + "cdl:DataModelVersion", + "cdl:DataRegistrationTimeStamp", + "cdl:NextEventIdList", + "cdl:PreviousEventIdList" + ], + "properties": { + "cdl:EventId": { + "nullable": false, + "type": " string" + }, + "cdl:LineageId": { + "nullable": false, + "type": " string" + }, + "cdl:DataModelMode": { + "nullable": false, + "type": " string" + }, + "cdl:DataModelVersion": { + "nullable": false, + "type": " string" + }, + "cdl:DataRegistrationTimeStamp": { + "nullable": false, + "type": " string" + }, + "cdl:NextEventIdList": { + "type": "array", + "items": { + "nullable": false, + "type": " string" + } + }, + "cdl:PreviousEventIdList": { + "type": "array", + "items": { + "nullable": false, + "type": " string" + } + } + } + }, + "TrailEventDetailsV1": { + "type": "object", + "description": "Details of newly created CDL event.", + "required": ["cdl:Lineage", "cdl:Tags", "cdl:Verification"], + "properties": { + "cdl:Event": { + "nullable": false + }, + "cdl:Lineage": { + "$ref": "#/components/schemas/EventLineageV1", + "nullable": false + }, + "cdl:Tags": { + "nullable": false + }, + "cdl:Verification": { + "nullable": false + } + } + }, + "CDLCommonResponseV1": { + "type": "object", + "required": ["result"], + "properties": { + "detail": { + "nullable": false + }, + "result": { + "type": " string", + "nullable": false + } + } + }, + "RegisterHistoryDataRequestV1": { + "type": "object", + "required": ["authInfo"], + "properties": { + "authInfo": { + "$ref": "#/components/schemas/AuthInfoV1", + "nullable": false + }, + "eventId": { + "type": "string", + "nullable": false + }, + "lineageId": { + "type": "string", + "nullable": false + }, + "tags": { + "nullable": false + }, + "properties": { + "nullable": false + } + } + }, + "RegisterHistoryDataV1Response": { + "type": "object", + "required": ["detail", "result"], + "properties": { + "detail": { + "$ref": "#/components/schemas/TrailEventDetailsV1", + "nullable": false + }, + "result": { + "type": " string", + "nullable": false + } + } + }, + "GetLineageRequestV1": { + "type": "object", + "required": ["authInfo", "eventId"], + "properties": { + "authInfo": { + "$ref": "#/components/schemas/AuthInfoV1", + "nullable": false + }, + "eventId": { + "type": "string", + "nullable": false + }, + "direction": { + "$ref": "#/components/schemas/GetLineageOptionDirectionV1", + "default": "backward", + "nullable": false + }, + "depth": { + "type": "string", + "default": "-1", + "nullable": false + } + } + }, + "GetLineageResponseV1": { + "type": "object", + "required": ["detail", "result"], + "properties": { + "detail": { + "type": "array", + "items": { + "nullable": false, + "$ref": "#/components/schemas/TrailEventDetailsV1" + } + }, + "result": { + "type": " string", + "nullable": false + } + } + }, + "SearchLineageRequestV1": { + "type": "object", + "required": ["authInfo", "searchType", "fields"], + "properties": { + "authInfo": { + "$ref": "#/components/schemas/AuthInfoV1", + "nullable": false + }, + "searchType": { + "$ref": "#/components/schemas/SearchLineageTypeV1", + "nullable": false + }, + "fields": { + "nullable": false + } + } + }, + "SearchLineageResponseV1": { + "type": "object", + "required": ["detail", "result"], + "properties": { + "detail": { + "type": "array", + "items": { + "nullable": false, + "$ref": "#/components/schemas/TrailEventDetailsV1" + } + }, + "result": { + "type": " string", + "nullable": false + } + } + }, + "ErrorExceptionResponseV1": { + "type": "object", + "description": "Error response from the connector.", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "description": "Short error description message.", + "nullable": false + }, + "error": { + "type": "string", + "description": "Detailed error information.", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/register-history-data": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/register-history-data" + } + }, + "operationId": "registerHistoryDataV1", + "summary": "Register new data trail on CDL", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegisterHistoryDataRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RegisterHistoryDataV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/get-lineage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/get-lineage" + } + }, + "operationId": "getLineageV1", + "summary": "Get lineage trail from CDL.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetLineageRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetLineageResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/search-lineage-by-header": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/search-lineage-by-header" + } + }, + "operationId": "searchLineageByHeaderV1", + "summary": "Search lineage using header fields.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchLineageRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchLineageResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/search-lineage-by-globaldata": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-cdl/search-lineage-by-globaldata" + } + }, + "operationId": "searchLineageByGlobalDataV1", + "summary": "Search lineage using global data fields.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchLineageRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchLineageResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..05ba256ed3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/json/openapi.tpl.json @@ -0,0 +1,1215 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Corda", + "description": "Can perform basic tasks on a Corda ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "SHA256": { + "description": "SHA-256 is part of the SHA-2 hash function family. Generated hash is fixed size, 256-bits (32-bytes).", + "externalDocs": { + "description": "Official Corda documentation of the SHA256 class.", + "url": "https://api.corda.net/api/corda-os/4.6/html/api/kotlin/corda/net.corda.core.crypto/-secure-hash/-s-h-a256/index.html" + }, + "type": "object", + "required": ["bytes", "offset", "size"], + "properties": { + "bytes": { + "type": "string", + "example": "Vf9MllnrC7vrWxrlDE94OzPMZW7At1HhTETL/XjiAmc=" + }, + "offset": { + "type": "integer", + "example": 0 + }, + "size": { + "type": "integer", + "example": 32 + } + } + }, + "CordappInfo": { + "type": "object", + "externalDocs": { + "description": "Official Corda Documentation of the class CordappInfo", + "url": "https://api.corda.net/api/corda-os/4.6/html/api/kotlin/corda/net.corda.core.cordapp/-cordapp-info/index.html" + }, + "description": "A CordappInfo describes a single CorDapp currently installed on the node", + "required": [ + "jarHash", + "licence", + "minimumPlatformVersion", + "name", + "shortName", + "targetPlatformVersion", + "type", + "vendor", + "version" + ], + "properties": { + "jarHash": { + "type": "object", + "format": "SHA256", + "description": "The hash of the JAR file that defines this CorDapp", + "$ref": "#/components/schemas/SHA256" + }, + "licence": { + "type": "string", + "description": "The name of the licence this CorDapp is released under" + }, + "minimumPlatformVersion": { + "type": "integer", + "description": "The minimum platform version the node must be at for the CorDapp to run" + }, + "name": { + "type": "string", + "description": "The name of the JAR file that defines the CorDapp" + }, + "shortName": { + "type": "string", + "description": "The name of the CorDapp" + }, + "targetPlatformVersion": { + "type": "integer", + "description": "The target platform version this CorDapp has been tested against" + }, + "type": { + "type": "string", + "description": "A description of what sort of CorDapp this is - either a contract, workflow, or a combination." + }, + "vendor": { + "type": "string", + "description": "The vendor of this CorDapp" + }, + "version": { + "type": "string", + "description": "The version of this CorDapp" + } + } + }, + "NodeDiagnosticInfo": { + "type": "object", + "externalDocs": { + "description": "Official Corda Documentation of the class NodeDiagnosticInfo", + "url": "https://api.corda.net/api/corda-os/4.6/html/api/kotlin/corda/net.corda.core.node/-node-diagnostic-info/index.html" + }, + "description": "A NodeDiagnosticInfo holds information about the current node version.", + "required": [ + "cordapps", + "platformVersion", + "revision", + "vendor", + "version" + ], + "properties": { + "cordapps": { + "type": "array", + "description": "A list of CorDapps currently installed on this node", + "items": { + "$ref": "#/components/schemas/CordappInfo" + }, + "minItems": 0, + "maxItems": 4096 + }, + "platformVersion": { + "type": "integer", + "description": "The platform version of this node. This number represents a released API version, and should be used to make functionality decisions (e.g. enabling an app feature only if an underlying platform feature exists)" + }, + "revision": { + "type": "string", + "description": "The git commit hash this node was built from" + }, + "vendor": { + "type": "string", + "description": "The vendor of this node" + }, + "version": { + "type": "string", + "description": "The current node version string, e.g. 4.3, 4.4-SNAPSHOT. Note that this string is effectively freeform, and so should only be used for providing diagnostic information. It should not be used to make functionality decisions (the platformVersion is a better fit for this)." + } + } + }, + "FlowInvocationType": { + "type": "string", + "nullable": false, + "enum": ["TRACKED_FLOW_DYNAMIC", "FLOW_DYNAMIC"], + "description": "Determines which flow starting method will be used on the back-end when invoking the flow. Based on the value here the plugin back-end might invoke the rpc.startFlowDynamic() method or the rpc.startTrackedFlowDynamic() method. Streamed responses are aggregated and returned in a single response to HTTP callers who are not equipped to handle streams like WebSocket/gRPC/etc. do." + }, + "JarFile": { + "type": "object", + "required": ["filename", "contentBase64", "hasDbMigrations"], + "additionalProperties": true, + "properties": { + "filename": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 255 + }, + "hasDbMigrations": { + "description": "Indicates whether the cordapp jar in question contains any embedded migrations that Cactus can/should execute between copying the jar into the cordapp directory and starting the node back up.", + "type": "boolean", + "nullable": false + }, + "contentBase64": { + "type": "string", + "format": "base64", + "nullable": false, + "minLength": 1, + "maxLength": 1073741824 + } + } + }, + "JvmType": { + "type": "object", + "description": "Represents a reference to a JVM type (such as a Java class)", + "required": ["fqClassName"], + "properties": { + "fqClassName": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 65535 + }, + "constructorName": { + "type": "string", + "nullable": false, + "description": "This parameter is used to specify that the function used to construct this JvmType is not a constructor function but instead is a factory function. Setting this parameter will cause the plugin to look up methods of the class denoted by fqClassName instead of its constructors.", + "minLength": 1, + "maxLength": 65535 + }, + "invocationTarget": { + "$ref": "#/components/schemas/JvmObject" + } + } + }, + "JvmTypeKind": { + "type": "string", + "nullable": false, + "enum": ["PRIMITIVE", "REFERENCE"] + }, + "JvmObject": { + "description": "Can represent JVM primitive and reference types as well. The jvmTypeKind field indicates which one is being stored. If the jvmTypeKind field is set to REFERENCE then the jvmCtorArgs array is expected to be filled, otherwise (e.g. PRIMITIVE jvmTypeKind) it is expected that the primitiveValue property is filled with a primitive data type supported by the JSON standard such as strings, booleans, numbers, etc.", + "type": "object", + "required": ["jvmType", "jvmTypeKind"], + "properties": { + "jvmTypeKind": { + "$ref": "#/components/schemas/JvmTypeKind" + }, + "primitiveValue": { + "type": "object" + }, + "jvmCtorArgs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/JvmObject", + "nullable": false + }, + "minLength": 0, + "maxLength": 1024, + "nullable": false, + "default": [] + }, + "jvmType": { + "$ref": "#/components/schemas/JvmType" + } + } + }, + "CordappDeploymentConfig": { + "type": "object", + "required": [ + "sshCredentials", + "rpcCredentials", + "cordappDir", + "cordaNodeStartCmd", + "cordaJarPath", + "nodeBaseDirPath" + ], + "properties": { + "sshCredentials": { + "$ref": "#/components/schemas/CordaNodeSshCredentials" + }, + "rpcCredentials": { + "$ref": "#/components/schemas/CordaRpcCredentials" + }, + "cordaNodeStartCmd": { + "type": "string", + "description": "The shell command to execute in order to start back up a Corda node after having placed new jars in the cordapp directory of said node.", + "example": "./build/nodes/runNodes", + "minLength": 1, + "maxLength": 65535, + "nullable": false + }, + "cordappDir": { + "type": "string", + "description": "The absolute file system path where the Corda Node is expecting deployed Cordapp jar files to be placed.", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "cordaJarPath": { + "type": "string", + "description": "The absolute file system path where the corda.jar file of the node can be found. This is used to execute database schema migrations where applicable (H2 database in use in development environments).", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "nodeBaseDirPath": { + "type": "string", + "description": "The absolute file system path where the base directory of the Corda node can be found. This is used to pass in to corda.jar when being invoked for certain tasks such as executing database schema migrations for a deployed contract.", + "minLength": 1, + "maxLength": 2048, + "nullable": false + } + } + }, + "CordaRpcCredentials": { + "type": "object", + "required": ["hostname", "port", "username", "password"], + "properties": { + "hostname": { + "type": "string", + "minLength": 1, + "maxLength": 65535, + "nullable": false + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535, + "nullable": false + }, + "username": { + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "password": { + "type": "string", + "minLength": 1, + "maxLength": 65535, + "nullable": false + } + } + }, + "CordaNodeSshCredentials": { + "type": "object", + "required": [ + "username", + "password", + "hostname", + "port", + "hostKeyEntry" + ], + "properties": { + "hostKeyEntry": { + "type": "string", + "example": "localhost ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPmhSBtMctNa4hsZt8QGlsYSE5/gMkjeand69Vj4ir13", + "minLength": 1, + "maxLength": 65535, + "nullable": false + }, + "username": { + "type": "string", + "minLength": 1, + "maxLength": 32, + "nullable": false + }, + "password": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + }, + "hostname": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535, + "nullable": false + } + } + }, + "DeployContractJarsV1Request": { + "type": "object", + "required": ["jarFiles", "cordappDeploymentConfigs"], + "additionalProperties": false, + "properties": { + "cordappDeploymentConfigs": { + "type": "array", + "description": "The list of deployment configurations pointing to the nodes where the provided cordapp jar files are to be deployed .", + "minLength": 0, + "maxLength": 1024, + "default": [], + "items": { + "$ref": "#/components/schemas/CordappDeploymentConfig" + } + }, + "jarFiles": { + "type": "array", + "nullable": false, + "items": { + "minLength": 1, + "maxLength": 1024, + "$ref": "#/components/schemas/JarFile" + } + } + } + }, + "DeployContractJarsSuccessV1Response": { + "type": "object", + "required": ["deployedJarFiles"], + "properties": { + "deployedJarFiles": { + "type": "array", + "items": { + "type": "string", + "minItems": 1, + "nullable": false + } + } + } + }, + "DeployContractJarsBadRequestV1Response": { + "type": "object", + "required": ["errors"], + "properties": { + "errors": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 65535, + "minItems": 1, + "maxItems": 2048 + } + } + } + }, + "InvokeContractV1Request": { + "type": "object", + "required": [ + "flowFullClassName", + "flowInvocationType", + "params", + "signingCredential" + ], + "additionalProperties": false, + "properties": { + "flowFullClassName": { + "description": "The fully qualified name of the Corda flow to invoke", + "example": "net.corda.samples.obligation.flows.IOUIssueFlow", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "flowInvocationType": { + "$ref": "#/components/schemas/FlowInvocationType" + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": { + "$ref": "#/components/schemas/JvmObject", + "nullable": false + }, + "nullable": false + }, + "timeoutMs": { + "type": "integer", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success", "callOutput", "flowId"], + "properties": { + "success": { + "type": "boolean", + "nullable": false + }, + "callOutput": { + "type": "object", + "description": "Data returned from the JVM when no transaction is running" + }, + "transactionId": { + "type": "string", + "description": "The net.corda.core.flows.StateMachineRunId value returned by the flow execution.", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "progress": { + "type": "array", + "description": "An array of strings representing the aggregated stream of progress updates provided by a *tracked* flow invocation. If the flow invocation was not tracked, this array is still returned, but as empty.", + "items": { + "type": "string", + "minItems": 0, + "maxItems": 10000000 + }, + "default": [] + }, + "flowId": { + "type": "string", + "description": "The id for the flow handle" + } + } + }, + "StartMonitorV1Request": { + "type": "object", + "required": ["clientAppId", "stateFullClassName"], + "additionalProperties": false, + "properties": { + "clientAppId": { + "description": "ID of a client application that wants to monitor the state changes", + "example": "frond_v1_x_7Hdg6s", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "stateFullClassName": { + "description": "The fully qualified name of the Corda state to monitor", + "example": "net.corda.samples.example.states.IOUState", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "StartMonitorV1Response": { + "type": "object", + "required": ["success", "msg"], + "properties": { + "success": { + "type": "boolean", + "description": "Flag set to true if monitoring started correctly.", + "nullable": false + }, + "msg": { + "type": "string", + "description": "Message describing operation status or any errors that occurred.", + "nullable": false + } + } + }, + "GetMonitorTransactionsV1Request": { + "type": "object", + "required": ["clientAppId", "stateFullClassName"], + "additionalProperties": false, + "properties": { + "clientAppId": { + "description": "ID of a client application that wants to monitor the state changes", + "example": "frond_v1_x_7Hdg6s", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "stateFullClassName": { + "description": "The fully qualified name of the Corda state to monitor", + "example": "net.corda.samples.example.states.IOUState", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "GetMonitorTransactionsV1Response": { + "type": "object", + "required": ["success", "msg"], + "properties": { + "success": { + "type": "boolean", + "description": "Flag set to true if operation completed correctly.", + "nullable": false + }, + "msg": { + "type": "string", + "description": "Message describing operation status or any errors that occurred.", + "nullable": false + }, + "stateFullClassName": { + "description": "The fully qualified name of the Corda state to monitor", + "example": "net.corda.samples.example.states.IOUState", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "tx": { + "type": "array", + "default": [], + "items": { + "type": "object", + "properties": { + "index": { + "type": "string" + }, + "data": { + "type": "string", + "minItems": 0, + "maxItems": 10000000 + } + } + } + } + } + }, + "ClearMonitorTransactionsV1Request": { + "type": "object", + "required": ["clientAppId", "stateFullClassName", "txIndexes"], + "additionalProperties": false, + "properties": { + "clientAppId": { + "description": "ID of a client application that wants to monitor the state changes", + "example": "frond_v1_x_7Hdg6s", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "stateFullClassName": { + "description": "The fully qualified name of the Corda state to monitor", + "example": "net.corda.samples.example.states.IOUState", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "txIndexes": { + "type": "array", + "default": [], + "items": { + "type": "string" + } + } + } + }, + "ClearMonitorTransactionsV1Response": { + "type": "object", + "required": ["success", "msg"], + "additionalProperties": false, + "properties": { + "success": { + "type": "boolean", + "description": "Flag set to true if operation completed correctly.", + "nullable": false + }, + "msg": { + "type": "string", + "description": "Message describing operation status or any errors that occurred.", + "nullable": false + } + } + }, + "StopMonitorV1Request": { + "type": "object", + "required": ["clientAppId", "stateFullClassName"], + "additionalProperties": false, + "properties": { + "clientAppId": { + "description": "ID of a client application that wants to monitor the state changes", + "example": "frond_v1_x_7Hdg6s", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + }, + "stateFullClassName": { + "description": "The fully qualified name of the Corda state to monitor", + "example": "net.corda.samples.example.states.IOUState", + "type": "string", + "minLength": 1, + "maxLength": 1024, + "nullable": false + } + } + }, + "StopMonitorV1Response": { + "type": "object", + "required": ["success", "msg"], + "properties": { + "success": { + "type": "boolean", + "description": "Flag set to true if operation completed correctly.", + "nullable": false + }, + "msg": { + "type": "string", + "description": "Message describing operation status or any errors that occurred.", + "nullable": false + } + } + }, + "ListFlowsV1Request": { + "type": "object", + "additionalProperties": false, + "properties": { + "filter": { + "type": "string" + } + } + }, + "ListFlowsV1Response": { + "type": "object", + "required": ["flowNames"], + "properties": { + "flowNames": { + "type": "array", + "description": "An array of strings storing the names of the flows as returned by the flowList Corda RPC.", + "example": [ + "net.corda.finance.flows.CashExitFlow", + "net.corda.finance.flows.CashIssueAndPaymentFlow", + "net.corda.finance.flows.CashIssueFlow", + "net.corda.finance.flows.CashPaymentFlow", + "net.corda.finance.internal.CashConfigDataFlow", + "net.corda.samples.obligation.flows.IOUIssueFlow", + "net.corda.samples.obligation.flows.IOUSettleFlow", + "net.corda.samples.obligation.flows.IOUTransferFlow", + "net.corda.samples.obligation.flows.SelfIssueCashFlow" + ], + "items": { + "type": "string", + "minItems": 0, + "maxItems": 10000000 + }, + "default": [] + } + } + }, + "NetworkHostAndPort": { + "type": "object", + "required": ["host", "port"], + "properties": { + "host": { + "type": "string" + }, + "port": { + "type": "number" + } + } + }, + "PartyAndCertificate": { + "type": "object" + }, + "PublicKey": { + "type": "object", + "description": "An instance of a java.security.PublicKey (which is an interface) implementation such as org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", + "required": ["algorithm", "format", "encoded"], + "properties": { + "algorithm": { + "type": "string", + "example": "EdDSA" + }, + "format": { + "type": "string", + "example": "X.509" + }, + "encoded": { + "type": "string", + "example": "MCowBQYDK2VwAyEAac1p4wLsAh70VJOcudQppu7NnKxyoKxVN0DbfTxF+54=" + } + } + }, + "X500Principal": { + "type": "object", + "required": ["name", "encoded"], + "properties": { + "name": { + "example": "O=PartyA,L=London,C=GB", + "type": "string" + }, + "encoded": { + "type": "string", + "description": "Base64 encoded public key", + "example": "MC8xCzAJBgNVBAYTAkdCMQ8wDQYDVQQHDAZMb25kb24xDzANBgNVBAoMBlBhcnR5QQ==" + } + } + }, + "CordaX500Name": { + "type": "object", + "required": ["organisation", "locality", "country", "x500Principal"], + "properties": { + "commonName": { + "type": "string" + }, + "organisationUnit": { + "type": "string" + }, + "organisation": { + "type": "string", + "example": "PartyA" + }, + "locality": { + "type": "string", + "example": "London" + }, + "state": { + "type": "string" + }, + "country": { + "type": "string", + "example": "GB" + }, + "x500Principal": { + "$ref": "#/components/schemas/X500Principal" + } + } + }, + "Party": { + "type": "object", + "required": ["owningKey", "name"], + "properties": { + "name": { + "$ref": "#/components/schemas/CordaX500Name" + }, + "owningKey": { + "$ref": "#/components/schemas/PublicKey" + } + } + }, + "NodeInfo": { + "type": "object", + "required": [ + "addresses", + "legalIdentitiesAndCerts", + "platformVersion", + "serial", + "legalIdentities" + ], + "properties": { + "addresses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NetworkHostAndPort" + } + }, + "platformVersion": { + "type": "integer" + }, + "serial": { + "type": "number" + }, + "legalIdentities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Party" + } + }, + "legalIdentitiesAndCerts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PartyAndCertificate" + } + } + } + }, + "NetworkMapV1Request": { + "type": "object" + }, + "NetworkMapV1Response": { + "type": "array", + "minItems": 1, + "maxItems": 2048, + "nullable": false, + "items": { + "$ref": "#/components/schemas/NodeInfo" + } + }, + "DiagnoseNodeV1Request": { + "type": "object", + "additionalProperties": false, + "properties": { + "nodeIds": { + "type": "array", + "description": "Optional property specifying which Corda Node should be the one being diagnosed in case the Connector has multiple connections established for different nodes (which is not yet a supported feature, but we want to keep this possibility open for the future).", + "minItems": 0, + "maxItems": 1024, + "default": [], + "items": { + "type": "string", + "nullable": false + } + } + } + }, + "DiagnoseNodeV1Response": { + "type": "object", + "required": ["nodeDiagnosticInfo"], + "properties": { + "nodeDiagnosticInfo": { + "$ref": "#/components/schemas/NodeDiagnosticInfo" + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/deploy-contract-jars": { + "post": { + "operationId": "deployContractJarsV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/deploy-contract-jars", + "verbLowerCase": "post" + } + }, + "summary": "Deploys a set of jar files (Cordapps, e.g. the contracts in Corda speak).", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractJarsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractJarsSuccessV1Response" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractJarsBadRequestV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/invoke-contract": { + "post": { + "operationId": "invokeContractV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/invoke-contract", + "verbLowerCase": "post" + } + }, + "summary": "Invokes a contract on a Corda ledger (e.g. a flow)", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor": { + "post": { + "operationId": "startMonitorV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor", + "verbLowerCase": "post" + } + }, + "summary": "Start monitoring corda changes (transactions) of given state class", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartMonitorV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StartMonitorV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions": { + "get": { + "operationId": "GetMonitorTransactionsV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions", + "verbLowerCase": "get" + } + }, + "summary": "Get transactions for monitored state classes.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetMonitorTransactionsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetMonitorTransactionsV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/clear-monitor-transactions": { + "delete": { + "operationId": "ClearMonitorTransactionsV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/clear-monitor-transactions", + "verbLowerCase": "delete" + } + }, + "summary": "Clear transactions from internal store so they'll not be available by GetMonitorTransactionsV1 anymore.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClearMonitorTransactionsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClearMonitorTransactionsV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/stop-monitor": { + "delete": { + "operationId": "stopMonitorV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/stop-monitor", + "verbLowerCase": "delete" + } + }, + "summary": "Stop monitoring corda changes (transactions) of given state class", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StopMonitorV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StopMonitorV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/network-map": { + "post": { + "operationId": "networkMapV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/network-map", + "verbLowerCase": "post" + } + }, + "description": "Responds with a snapshot of the network map as provided by the Corda RPC call: net.corda.core.messaging.CordaRPCOps public abstract fun networkMapSnapshot(): List", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkMapV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NetworkMapV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows": { + "post": { + "operationId": "listFlowsV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows", + "verbLowerCase": "post" + } + }, + "description": "Responds with a list of the flows on the Corda node.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFlowsV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListFlowsV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/diagnose-node": { + "post": { + "operationId": "diagnoseNodeV1", + "x-hyperledger-cacti": { + "http": { + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/diagnose-node", + "verbLowerCase": "post" + } + }, + "description": "Responds with diagnostic information about the Corda node", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiagnoseNodeV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiagnoseNodeV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-ethereum/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-ethereum/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..0ce13c9492 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-ethereum/src/main/json/openapi.tpl.json @@ -0,0 +1,1179 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Ethereum", + "description": "Can perform basic tasks on a Ethereum ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialGethKeychainPassword" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialCactiKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialGethKeychainPassword": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "secret": { + "type": "string", + "description": "A geth keychain unlock password.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialCactiKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTI_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "EthContractInvocationType": { + "type": "string", + "enum": ["SEND", "CALL"] + }, + "EthContractInvocationWeb3Method": { + "type": "string", + "enum": ["send", "call", "encodeABI", "estimateGas"] + }, + "GasTransactionConfigLegacy": { + "type": "object", + "description": "Transaction gas settings in networks before EIP-1559 (London fork).", + "required": [], + "properties": { + "gas": { + "type": "string", + "description": "A maximum amount of gas a user is willing to provide for the execution of the transaction. (gasLimit)" + }, + "gasPrice": { + "type": "string", + "description": "A price (in Wei) a user is willing to pay for each unit of gas used during the execution of the transaction. In EIP-1559 (London fork) networks, it will be set as both maxFeePerGas and maxPriorityFeePerGas." + } + } + }, + "GasTransactionConfigEIP1559": { + "type": "object", + "description": "Transaction gas settings in networks after EIP-1559 (London fork).", + "required": [], + "properties": { + "gasLimit": { + "type": "string", + "description": "A maximum amount of gas a user is willing to provide for the execution of the transaction.", + "nullable": false + }, + "maxFeePerGas": { + "type": "string", + "description": "A maximum fee (including the base fee and the tip) a user is willing to pay per unit of gas.", + "nullable": false + }, + "maxPriorityFeePerGas": { + "type": "string", + "description": "A maximum tip amount a user is willing to pay per unit of gas.", + "nullable": false + } + } + }, + "GasTransactionConfig": { + "type": "object", + "description": "Transaction gas settings.", + "required": [], + "oneOf": [ + { + "$ref": "#/components/schemas/GasTransactionConfigLegacy" + }, + { + "$ref": "#/components/schemas/GasTransactionConfigEIP1559" + } + ] + }, + "EthereumTransactionConfig": { + "type": "object", + "required": [], + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + }, + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "value": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "data": { + "type": "string" + }, + "gasConfig": { + "$ref": "#/components/schemas/GasTransactionConfig", + "nullable": false + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "string", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "string", + "nullable": false + }, + "gasUsed": { + "type": "string", + "nullable": false + }, + "effectiveGasPrice": { + "type": "string", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + }, + "logs": { + "type": "array", + "default": [], + "items": {}, + "nullable": false + }, + "logsBloom": { + "type": "string", + "nullable": false + }, + "revertReason": { + "type": "string", + "nullable": false + }, + "output": { + "type": "string", + "nullable": false + }, + "commitmentHash": { + "type": "string", + "nullable": false + }, + "cumulativeGasUsed": { + "type": "string", + "nullable": false + }, + "type": { + "type": "string", + "nullable": false + } + } + }, + "ContractJSON": { + "type": "object", + "required": ["contractName", "bytecode", "abi"], + "additionalProperties": true, + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "abi": { + "description": "The application binary interface of the solidity contract, optional parameter", + "type": "array", + "items": {}, + "nullable": false + }, + "metadata": { + "type": "string" + }, + "deployedBytecode": { + "type": "string" + }, + "sourceMap": { + "type": "string" + }, + "deployedSourceMap": { + "type": "string" + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object" + }, + "networks": { + "type": "object" + }, + "ast": { + "type": "object" + }, + "functionHashes": { + "type": "object" + }, + "gasEstimates": { + "type": "object" + } + } + }, + "ContractJsonDefinition": { + "type": "object", + "required": ["contractJSON"], + "additionalProperties": false, + "properties": { + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "nullable": false + } + } + }, + "DeployedContractJsonDefinition": { + "type": "object", + "required": ["contractJSON", "contractAddress"], + "additionalProperties": false, + "properties": { + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": false + } + } + }, + "ContractKeychainDefinition": { + "type": "object", + "required": ["contractName", "keychainId"], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100, + "nullable": false + } + } + }, + "RunTransactionRequest": { + "type": "object", + "required": ["web3SigningCredential", "transactionConfig"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "transactionConfig": { + "$ref": "#/components/schemas/EthereumTransactionConfig", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with thehash of the transaction(which indicates successful execution) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "DeployContractV1Request": { + "type": "object", + "required": ["web3SigningCredential", "contract"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "contract": { + "oneOf": [ + { + "$ref": "#/components/schemas/ContractJsonDefinition", + "description": "Send contract ABI directly in the request." + }, + { + "$ref": "#/components/schemas/ContractKeychainDefinition", + "description": "Read contract definition from the keychain plugin." + } + ], + "nullable": false + }, + "constructorArgs": { + "description": "The list of arguments to pass in to the constructor of the contract being deployed.", + "type": "array", + "default": [], + "items": {} + }, + "gasConfig": { + "$ref": "#/components/schemas/GasTransactionConfig", + "nullable": false + }, + "value": { + "type": "string", + "description": "Ether balance to send on deployment.", + "nullable": false + } + } + }, + "InvokeContractV1Request": { + "type": "object", + "required": ["contract", "methodName", "params", "invocationType"], + "additionalProperties": false, + "properties": { + "contract": { + "oneOf": [ + { + "$ref": "#/components/schemas/DeployedContractJsonDefinition", + "description": "Send contract ABI and address directly in the request." + }, + { + "$ref": "#/components/schemas/ContractKeychainDefinition", + "description": "Read contract definition from the keychain plugin." + } + ], + "nullable": false + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gasConfig": { + "$ref": "#/components/schemas/GasTransactionConfig", + "nullable": false + }, + "value": { + "type": "string" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt before returning an error. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } + }, + "InvokeRawWeb3EthMethodV1Request": { + "type": "object", + "required": ["methodName"], + "additionalProperties": false, + "properties": { + "methodName": { + "description": "The name of the web3.eth method to invoke", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass to web3.eth method specified in methodName", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeRawWeb3EthMethodV1Response": { + "type": "object", + "required": ["status"], + "additionalProperties": false, + "properties": { + "status": { + "type": "number", + "nullable": false, + "description": "Status code of the operation" + }, + "data": { + "description": "Output of requested web3.eth method" + }, + "errorDetail": { + "type": "string", + "nullable": false, + "description": "Error details" + } + } + }, + "InvokeRawWeb3EthContractV1Request": { + "type": "object", + "required": ["abi", "address", "invocationType", "contractMethod"], + "additionalProperties": false, + "properties": { + "abi": { + "description": "The application binary interface of the solidity contract" + }, + "address": { + "description": "Deployed solidity contract address", + "type": "string" + }, + "invocationType": { + "description": "Contract invocation method to be performed (send, call, etc...)", + "$ref": "#/components/schemas/EthContractInvocationWeb3Method" + }, + "invocationParams": { + "description": "The list of arguments for contract invocation method (send, call, etc...)", + "type": "object", + "default": {} + }, + "contractMethod": { + "description": "Method of deployed solidity contract to execute", + "type": "string" + }, + "contractMethodArgs": { + "description": "The list of arguments for deployed solidity contract method", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeRawWeb3EthContractV1Response": { + "type": "object", + "required": ["status"], + "additionalProperties": false, + "properties": { + "status": { + "description": "Status code of the operation", + "type": "number" + }, + "data": { + "description": "Output of contract invocation method" + }, + "errorDetail": { + "description": "Error details", + "type": "string" + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cacti.api.async.ethereum.WatchBlocksV1.Subscribe", + "org.hyperledger.cacti.api.async.ethereum.WatchBlocksV1.Next", + "org.hyperledger.cacti.api.async.ethereum.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cacti.api.async.ethereum.WatchBlocksV1.Error", + "org.hyperledger.cacti.api.async.ethereum.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Options": { + "type": "object", + "properties": { + "getBlockData": { + "type": "boolean", + "description": "Include entire block data if flag is true, otherwise just a header is returned (default)", + "default": "false" + }, + "lastSeenBlock": { + "type": "number", + "description": "Block from which we want to start the monitoring process.", + "default": "latest" + }, + "httpPollInterval": { + "type": "number", + "description": "How often to poll ethereum node for new blocks. Not used if the node supports subscription based monitoring (i.e. WebSocket).", + "default": "5 seconds" + } + } + }, + "Web3BlockHeader": { + "type": "object", + "required": ["sha3Uncles", "transactionRoot", "gasLimit", "gasUsed"], + "properties": { + "number": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "receiptsRoot": { + "type": "string" + }, + "difficulty": { + "type": "string" + }, + "mixHash": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "gasLimit": { + "type": "string" + }, + "gasUsed": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "extraData": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "timestamp": { + "type": "string" + } + } + }, + "Web3Transaction": { + "type": "object", + "required": [ + "hash", + "nonce", + "blockHash", + "blockNumber", + "transactionIndex", + "from", + "to", + "value", + "gasPrice", + "gas", + "input", + "type", + "chainId" + ], + "properties": { + "hash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "blockHash": { + "type": "string" + }, + "blockNumber": { + "type": "string" + }, + "transactionIndex": { + "type": "string" + }, + "from": { + "type": "string" + }, + "to": { + "type": "string" + }, + "value": { + "type": "string" + }, + "gasPrice": { + "type": "string" + }, + "gas": { + "type": "string" + }, + "input": { + "type": "string" + }, + "type": { + "type": "string" + }, + "chainId": { + "type": "string" + }, + "v": { + "type": "string" + }, + "r": { + "type": "string" + }, + "s": { + "type": "string" + } + } + }, + "WatchBlocksV1BlockData": { + "type": "object", + "required": [ + "number", + "parentHash", + "nonce", + "sha3Uncles", + "transactionRoot", + "stateRoot", + "receiptRoot", + "miner", + "extraData", + "gasLimit", + "gasUsed", + "timestamp", + "size", + "totalDifficulty", + "uncles", + "transactions" + ], + "properties": { + "number": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "receiptsRoot": { + "type": "string" + }, + "difficulty": { + "type": "string" + }, + "mixHash": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "extraData": { + "type": "string" + }, + "gasLimit": { + "type": "string" + }, + "gasUsed": { + "type": "string" + }, + "timestamp": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "size": { + "type": "string" + }, + "totalDifficulty": { + "type": "string" + }, + "uncles": { + "type": "array", + "items": { + "type": "string" + } + }, + "baseFeePerGas": { + "type": "string" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Web3Transaction" + } + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "properties": { + "blockHeader": { + "$ref": "#/components/schemas/Web3BlockHeader" + }, + "blockData": { + "$ref": "#/components/schemas/WatchBlocksV1BlockData" + } + } + }, + "ErrorExceptionResponseV1": { + "type": "object", + "description": "Error response from the connector.", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "description": "Short error description message.", + "nullable": false + }, + "error": { + "type": "string", + "description": "Detailed error information.", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/deploy-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/deploy-contract" + } + }, + "operationId": "deployContract", + "summary": "Deploys the contract to ethereum ledger.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/run-transaction" + } + }, + "operationId": "runTransactionV1", + "summary": "Executes a transaction on a ethereum ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-contract" + } + }, + "operationId": "invokeContractV1", + "summary": "Invokes a contract on an ethereum ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-raw-web3eth-method": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-raw-web3eth-method" + } + }, + "operationId": "invokeWeb3EthMethodV1", + "summary": "Invoke any method from web3.eth (low-level)", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthMethodV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthMethodV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-raw-web3eth-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/invoke-raw-web3eth-contract" + } + }, + "operationId": "invokeRawWeb3EthContractV1", + "summary": "Low-level endpoint to invoke a method on deployed contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthContractV1Response" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-ethereum/json-rpc": { + "summary": "Proxy endpoint to pass JSON-RPC requests to remote ethereum node." + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/.gitignore b/packages/cactus-plugin-ledger-connector-fabric/.gitignore deleted file mode 100644 index 99a7101666..0000000000 --- a/packages/cactus-plugin-ledger-connector-fabric/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/hello-world-contract.go -src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/go.mod -src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/go.sum diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..5fbf93276c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/json/openapi.tpl.json @@ -0,0 +1,1646 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Fabric", + "description": "Can perform basic tasks on a fabric ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "TransactReceiptTransactionEndorsement": { + "type": "object", + "properties": { + "mspid": { + "type": "string" + }, + "endorserID": { + "type": "string" + }, + "signature": { + "type": "string" + } + } + }, + "TransactReceiptTransactionCreator": { + "type": "object", + "properties": { + "mspid": { + "type": "string" + }, + "creatorID": { + "type": "string" + } + } + }, + "TransactReceiptBlockMetaData": { + "type": "object", + "properties": { + "mspid": { + "type": "string" + }, + "blockCreatorID": { + "type": "string" + }, + "signature": { + "type": "string" + } + } + }, + "VaultTransitKey": { + "type": "object", + "nullable": false, + "required": ["keyName", "token"], + "properties": { + "keyName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false, + "description": "label of private key" + }, + "token": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false, + "description": "token for accessing private key" + } + }, + "description": "vault key details for signing fabric message with private key stored with transit engine." + }, + "WebSocketKey": { + "type": "object", + "nullable": false, + "required": ["sessionId", "signature"], + "properties": { + "sessionId": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false, + "description": "session Id to access client" + }, + "signature": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false, + "description": "signature of the session ID" + } + }, + "description": "web-socket key details for signing fabric message with private key stored with external client" + }, + "FabricSigningCredentialType": { + "type": "string", + "enum": ["X.509", "Vault-X.509", "WS-X.509"], + "nullable": false, + "description": "different type of identity provider for singing fabric messages supported by this package" + }, + "FabricSigningCredential": { + "type": "object", + "required": ["keychainId", "keychainRef"], + "properties": { + "keychainId": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "keychainRef": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "type": { + "$ref": "#/components/schemas/FabricSigningCredentialType", + "description": "singing identity type to be used for signing fabric message , by by default default is supported" + }, + "vaultTransitKey": { + "$ref": "#/components/schemas/VaultTransitKey", + "description": "vault key details , if Vault-X.509 identity provider to be used for singing fabric messages" + }, + "webSocketKey": { + "$ref": "#/components/schemas/WebSocketKey", + "description": "web-socket key details , if WS-X.509 identity provider to be used for singing fabric messages" + } + } + }, + "ChainCodeLifeCycleCommandResponses": { + "type": "object", + "required": [ + "queryInstalledList", + "approveForMyOrgList", + "installList" + ], + "properties": { + "packaging": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "installList": { + "items": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "minItems": 1 + }, + "queryInstalledList": { + "items": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "minItems": 1 + }, + "approveForMyOrgList": { + "items": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "minItems": 1 + }, + "commit": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "queryCommitted": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + }, + "init": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + } + } + }, + "ChainCodeProgrammingLanguage": { + "type": "string", + "description": "Enumerates the supported source code programming languages of Hyperledger Fabric", + "enum": ["golang", "javascript", "typescript", "java"] + }, + "ChainCodeLanguageRuntime": { + "type": "string", + "description": "Enumerates the supported programming language runtimes of Hyperledger Fabric", + "enum": ["golang", "node", "java"] + }, + "ConnectionProfile": { + "type": "object", + "required": ["name", "version", "organizations", "peers"], + "additionalProperties": true, + "properties": { + "name": { + "type": "string", + "example": "basic-network", + "minLength": 1, + "maxLength": 1024 + }, + "x-type": { + "type": "string", + "minLength": 1, + "example": "hlfv1" + }, + "description": { + "type": "string", + "example": "The basic network" + }, + "version": { + "type": "string", + "example": "1.0" + }, + "client": { + "type": "object", + "properties": { + "organization": { + "type": "string", + "example": "Org1" + } + } + }, + "channels": { + "type": "object", + "additionalProperties": true + }, + "organizations": { + "type": "object", + "additionalProperties": true + }, + "orderers": { + "type": "object", + "additionalProperties": true + }, + "peers": { + "type": "object", + "additionalProperties": true + }, + "certificateAuthorities": { + "type": "object", + "additionalProperties": true + } + } + }, + "GatewayDiscoveryOptions": { + "type": "object", + "additionalProperties": false, + "properties": { + "asLocalhost": { + "type": "boolean", + "nullable": false + }, + "enabled": { + "type": "boolean", + "nullable": false + } + } + }, + "GatewayOptions": { + "type": "object", + "required": ["identity", "wallet"], + "properties": { + "connectionProfile": { + "$ref": "#/components/schemas/ConnectionProfile" + }, + "discovery": { + "$ref": "#/components/schemas/GatewayDiscoveryOptions", + "nullable": false + }, + "eventHandlerOptions": { + "$ref": "#/components/schemas/GatewayEventHandlerOptions", + "nullable": false + }, + "identity": { + "type": "string" + }, + "wallet": { + "type": "object", + "minProperties": 1, + "maxProperties": 1, + "properties": { + "keychain": { + "$ref": "#/components/schemas/FabricSigningCredential" + }, + "json": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 65535 + } + } + } + } + }, + "DefaultEventHandlerStrategy": { + "type": "string", + "enum": [ + "MSPID_SCOPE_ALLFORTX", + "MSPID_SCOPE_ANYFORTX", + "NETWORK_SCOPE_ALLFORTX", + "NETWORK_SCOPE_ANYFORTX" + ] + }, + "GatewayEventHandlerOptions": { + "type": "object", + "required": ["strategy"], + "additionalProperties": false, + "properties": { + "commitTimeout": { + "type": "number", + "nullable": false + }, + "endorseTimeout": { + "type": "number", + "nullable": false + }, + "strategy": { + "description": "The name of the strategy to be used when looking up the TxEventHandlerFactory to pass in to the Fabric Gateway as the strategy property of the discovery options.", + "$ref": "#/components/schemas/DefaultEventHandlerStrategy" + } + } + }, + "FileBase64": { + "description": "Represents a file-system file that has a name and a body which holds the file contents as a Base64 encoded string", + "type": "object", + "required": ["body", "filename"], + "properties": { + "body": { + "description": "The file's contents encoded as a Base64 string.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 104857600 + }, + "filename": { + "description": "The name as referred to on a file system", + "example": "my-cool-file-full-of-wonders-and-fun-stuff.go", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 255 + }, + "filepath": { + "description": "The relative path of the file, if it should be placed in a sub-directory", + "example": "./my/sub-folder/structure/", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 512 + } + } + }, + "FabricContractInvocationType": { + "type": "string", + "enum": [ + "FabricContractInvocationType.SEND", + "FabricContractInvocationType.CALL", + "FabricContractInvocationType.SENDPRIVATE" + ] + }, + "SSHExecCommandResponse": { + "type": "object", + "required": ["stdout", "stderr", "code", "signal"], + "properties": { + "stdout": { + "type": "string", + "nullable": false + }, + "stderr": { + "type": "string", + "nullable": false + }, + "code": { + "type": "integer", + "nullable": true + }, + "signal": { + "type": "string", + "nullable": true + } + } + }, + "RunTransactionResponseType": { + "type": "string", + "description": "Response format from transaction / query execution", + "enum": [ + "org.hyperledger.cacti.api.hlfabric.RunTransactionResponseType.JSON", + "org.hyperledger.cacti.api.hlfabric.RunTransactionResponseType.UTF8" + ], + "x-enum-varnames": ["JSON", "UTF8"] + }, + "RunTransactionRequest": { + "type": "object", + "required": [ + "signingCredential", + "channelName", + "contractName", + "invocationType", + "methodName", + "params" + ], + "additionalProperties": false, + "properties": { + "endorsingPeers": { + "description": "An array of endorsing peers (name or url) for the transaction.", + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + }, + "endorsingOrgs": { + "description": "An array of endorsing organizations (by mspID or issuer org name on certificate) for the transaction.", + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + }, + "transientData": { + "type": "object", + "nullable": true + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "nullable": false + }, + "signingCredential": { + "$ref": "#/components/schemas/FabricSigningCredential", + "nullable": false + }, + "channelName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/FabricContractInvocationType", + "nullable": false, + "description": "Indicates if it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "params": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "type": "string", + "nullable": true + } + }, + "responseType": { + "$ref": "#/components/schemas/RunTransactionResponseType" + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["functionOutput", "transactionId"], + "properties": { + "functionOutput": { + "type": "string", + "nullable": false + }, + "transactionId": { + "type": "string", + "nullable": false + } + } + }, + "RunDelegatedSignTransactionRequest": { + "type": "object", + "required": [ + "signerCertificate", + "signerMspID", + "channelName", + "contractName", + "invocationType", + "methodName", + "params" + ], + "additionalProperties": false, + "properties": { + "endorsingPeers": { + "description": "An array of endorsing peers (name or url) for the transaction.", + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + }, + "endorsingOrgs": { + "description": "An array of endorsing organizations (by mspID or issuer org name on certificate) for the transaction.", + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + }, + "transientData": { + "type": "object", + "nullable": true + }, + "signerCertificate": { + "type": "string", + "nullable": false + }, + "signerMspID": { + "type": "string", + "nullable": false + }, + "uniqueTransactionData": { + "description": "Can be used to uniquely identify and authorize signing request", + "nullable": false + }, + "channelName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/FabricContractInvocationType", + "nullable": false, + "description": "Indicates if it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "params": { + "type": "array", + "nullable": false, + "default": [], + "items": { + "type": "string", + "nullable": true + } + }, + "responseType": { + "$ref": "#/components/schemas/RunTransactionResponseType" + } + } + }, + "GetTransactionReceiptResponse": { + "type": "object", + "properties": { + "blockNumber": { + "type": "string" + }, + "channelID": { + "type": "string" + }, + "transactionCreator": { + "$ref": "#/components/schemas/TransactReceiptTransactionCreator" + }, + "transactionEndorsement": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactReceiptTransactionEndorsement" + } + }, + "blockMetaData": { + "$ref": "#/components/schemas/TransactReceiptBlockMetaData" + }, + "chainCodeName": { + "type": "string" + }, + "chainCodeVersion": { + "type": "string" + }, + "responseStatus": { + "type": "string" + }, + "rwsetKey": { + "type": "string" + }, + "rwsetWriteData": { + "type": "string" + } + } + }, + "DeploymentTargetOrganization": { + "type": "object", + "required": [ + "CORE_PEER_LOCALMSPID", + "CORE_PEER_ADDRESS", + "CORE_PEER_MSPCONFIGPATH", + "CORE_PEER_TLS_ROOTCERT_FILE", + "ORDERER_TLS_ROOTCERT_FILE" + ], + "properties": { + "CORE_PEER_LOCALMSPID": { + "type": "string", + "example": "Org1MSP", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_ADDRESS": { + "type": "string", + "example": "peer0.org1.example.com:7051", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_MSPCONFIGPATH": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_TLS_ROOTCERT_FILE": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "ORDERER_TLS_ROOTCERT_FILE": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + } + } + }, + "DeploymentTargetOrgFabric2x": { + "type": "object", + "required": [ + "CORE_PEER_LOCALMSPID", + "CORE_PEER_ADDRESS", + "CORE_PEER_MSPCONFIGPATH", + "CORE_PEER_TLS_ROOTCERT_FILE", + "ORDERER_TLS_ROOTCERT_FILE" + ], + "properties": { + "transient": { + "type": "string", + "description": "Transient map of arguments in JSON encoding", + "example": "orderer.example.com:7050", + "minLength": 1, + "maxLength": 1073741824 + }, + "CORE_PEER_LOCALMSPID": { + "type": "string", + "example": "Org1MSP", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_ADDRESS": { + "type": "string", + "example": "peer0.org1.example.com:7051", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_MSPCONFIGPATH": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "CORE_PEER_TLS_ROOTCERT_FILE": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + }, + "ORDERER_TLS_ROOTCERT_FILE": { + "type": "string", + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", + "nullable": false, + "minLength": 1, + "maxLength": 1024, + "description": "Mapped to environment variables of the Fabric CLI container." + } + } + }, + "DeployContractGoSourceV1Request": { + "type": "object", + "required": [ + "goSource", + "targetOrganizations", + "chainCodeVersion", + "channelId", + "policyDslSource", + "targetPeerAddresses", + "tlsRootCertFiles" + ], + "additionalProperties": false, + "properties": { + "policyDslSource": { + "type": "string", + "minLength": 1, + "maxLength": 65535, + "nullable": false, + "example": "AND('Org1MSP.member','Org2MSP.member')" + }, + "tlsRootCertFiles": { + "type": "string", + "description": "The TLS root cert files that will be passed to the chaincode instantiation command.", + "minLength": 1, + "maxLength": 65535, + "nullable": false, + "example": "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "channelId": { + "type": "string", + "description": "The name of the Fabric channel where the contract will get instantiated.", + "example": "mychannel", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "targetOrganizations": { + "type": "array", + "minItems": 1, + "nullable": false, + "maxItems": 1024, + "items": { + "$ref": "#/components/schemas/DeploymentTargetOrganization" + } + }, + "targetPeerAddresses": { + "type": "array", + "description": "An array of peer addresses where the contract will be instantiated. Note that at present only the first item from this array will be used which is the behavior taken from the official Fabric samples repository and therefore it is assumed to be correct usage.", + "example": ["peer0.org1.example.com:7051"], + "minItems": 1, + "maxItems": 2048, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 4096 + } + }, + "constructorArgs": { + "type": "object", + "example": "{} - An empty object literal can be sufficient if your contract does not have parameters.", + "nullable": false, + "properties": { + "Args": { + "type": "array", + "minLength": 0, + "maxLength": 2048, + "items": {} + } + } + }, + "chainCodeVersion": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "example": "1.0.0", + "nullable": false + }, + "goSource": { + "description": "The your-smart-contract.go file where the functionality of your contract is implemented.", + "$ref": "#/components/schemas/FileBase64", + "nullable": false + }, + "goMod": { + "description": "The go.mod file that declares the dependencies of the chaincode go contract that is being deployed as part of this request.", + "$ref": "#/components/schemas/FileBase64", + "nullable": false + }, + "moduleName": { + "description": "The go module name that will be used for the go compilation process.", + "example": "hello-world-contract", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 255 + }, + "pinnedDeps": { + "type": "array", + "minItems": 0, + "maxItems": 1024, + "items": { + "type": "string", + "nullable": false, + "example": "github.com/hyperledger/fabric@v1.4.8" + } + }, + "modTidyOnly": { + "description": "Indicates to the go chaincode compiler of Cactus if it should do an actual go compilation with the contact source or if it should just execute the go mod tidy command.", + "type": "boolean", + "nullable": true + } + } + }, + "DeployContractGoSourceV1Response": { + "type": "object", + "required": [ + "success", + "installationCommandResponses", + "instantiationCommandResponse" + ], + "properties": { + "success": { + "type": "boolean" + }, + "installationCommandResponses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + } + }, + "instantiationCommandResponse": { + "$ref": "#/components/schemas/SSHExecCommandResponse" + } + } + }, + "DeployContractV1Request": { + "type": "object", + "required": [ + "caFile", + "sourceFiles", + "targetOrganizations", + "ccName", + "ccLabel", + "ccVersion", + "ccSequence", + "channelId", + "ccLang", + "orderer", + "ordererTLSHostnameOverride" + ], + "additionalProperties": false, + "properties": { + "ccLang": { + "$ref": "#/components/schemas/ChainCodeProgrammingLanguage" + }, + "caFile": { + "type": "string", + "description": "File-system path pointing at the CA file.", + "example": "${orgCfgDir}ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", + "minLength": 1, + "maxLength": 4096 + }, + "orderer": { + "type": "string", + "description": "Ordering service endpoint specified as :", + "example": "orderer.example.com:7050", + "minLength": 1, + "maxLength": 65535 + }, + "ordererTLSHostnameOverride": { + "type": "string", + "description": "The hostname override to use when validating the TLS connection to the orderer", + "example": "orderer.example.com:7050", + "minLength": 1, + "maxLength": 65535 + }, + "connTimeout": { + "type": "integer", + "description": "Timeout for client to connect (default 3s)", + "nullable": false + }, + "signaturePolicy": { + "type": "string", + "description": "Passed in to the peer via the --signature-policy argument on the command line. See also: https://hyperledger-fabric.readthedocs.io/en/release-2.2/endorsement-policies.html#setting-chaincode-level-endorsement-policies", + "minLength": 1, + "maxLength": 65535, + "nullable": false, + "example": "AND('Org1MSP.member','Org2MSP.member')" + }, + "collectionsConfigFile": { + "type": "string", + "description": "Name of the collections config file as present in the sourceFiles array of the request.", + "nullable": false, + "minLength": 1, + "maxLength": 255 + }, + "channelId": { + "type": "string", + "description": "The name of the Fabric channel where the contract will get instantiated.", + "example": "mychannel", + "minLength": 1, + "maxLength": 2048, + "nullable": false + }, + "targetOrganizations": { + "type": "array", + "minItems": 1, + "nullable": false, + "maxItems": 1024, + "items": { + "$ref": "#/components/schemas/DeploymentTargetOrganization" + } + }, + "constructorArgs": { + "type": "object", + "example": "{} - An empty object literal can be sufficient if your contract does not have parameters.", + "nullable": false, + "properties": { + "Args": { + "type": "array", + "minLength": 0, + "maxLength": 2048, + "items": {} + } + } + }, + "ccSequence": { + "type": "number", + "example": 1, + "nullable": false + }, + "ccVersion": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "example": "1.0.0", + "nullable": false + }, + "ccName": { + "type": "string", + "minLength": 1, + "maxLength": 128, + "example": "my-hello-world-contract", + "nullable": false + }, + "ccLabel": { + "description": "Human readable label to uniquely identify the contract. Recommended to include in this at least the contract name and the exact version in order to make it easily distinguishable from other deployments of the same contract.", + "example": "hello-world-contract", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 255 + }, + "sourceFiles": { + "description": "The your-smart-contract.go file where the functionality of your contract is implemented.", + "items": { + "$ref": "#/components/schemas/FileBase64" + }, + "type": "array", + "minItems": 1, + "maxItems": 65535, + "nullable": false + } + } + }, + "DeployContractV1Response": { + "type": "object", + "required": ["success", "packageIds", "lifecycle"], + "properties": { + "success": { + "type": "boolean" + }, + "packageIds": { + "type": "array", + "items": { + "type": "string", + "example": "f8c8e06bfc27771028c4bbc3564341887881e29b92a844c66c30bac0ff83966e", + "minLength": 1, + "maxLength": 4096, + "nullable": false + } + }, + "lifecycle": { + "$ref": "#/components/schemas/ChainCodeLifeCycleCommandResponses" + } + } + }, + "GetBlockRequestV1": { + "description": "Request for GetBlock endpoint.", + "type": "object", + "required": ["channelName", "gatewayOptions", "query"], + "properties": { + "channelName": { + "type": "string", + "description": "Fabric channel which we want to query.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "connectionChannelName": { + "type": "string", + "description": "Fabric channel we want to connect to. If not provided, then one from channelName parameter will be used", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "description": "Fabric SDK gateway options.", + "nullable": false + }, + "query": { + "description": "Query selector, caller must provide at least one of them. First found will be used, rest will be ignored, so it's recommended to pass single selector.", + "type": "object", + "properties": { + "blockNumber": { + "type": "string", + "description": "Select block by it's number.", + "nullable": false + }, + "blockHash": { + "type": "object", + "description": "Select block by it's hash.", + "required": ["buffer"], + "properties": { + "encoding": { + "type": "string", + "description": "NodeJS Buffer encoding (utf-8, hex, binary, base64, etc...). Passed directly to `Buffer.from()` call on hashBuffer. If not provided then JSON buffer format is assumed.", + "nullable": false + }, + "buffer": { + "type": "string", + "description": "Buffer of blockHash. It's encoding should be described in `encoding` parameter.", + "nullable": false + } + }, + "nullable": false + }, + "transactionId": { + "type": "string", + "description": "Select block by id of transaction that it contains.", + "nullable": false + } + } + }, + "skipDecode": { + "type": "boolean", + "description": "If true, encoded buffer will be returned. Otherwise, entire block object is returned.", + "default": false, + "nullable": false + } + } + }, + "FabricFullBlockDataV1": { + "description": "Full hyperledger fabric block data." + }, + "GetBlockResponseDecodedV1": { + "type": "object", + "description": "When skipDecode is false (default) then decoded block object is returned.", + "required": ["decodedBlock"], + "properties": { + "decodedBlock": { + "$ref": "#/components/schemas/FabricFullBlockDataV1", + "nullable": false + } + } + }, + "GetBlockResponseEncodedV1": { + "type": "object", + "description": "When skipDecode is true then encoded block Buffer is returned.", + "required": ["encodedBlock"], + "properties": { + "encodedBlock": { + "type": "string" + } + } + }, + "GetBlockResponseV1": { + "description": "Response from GetBlock endpoint.", + "oneOf": [ + { + "$ref": "#/components/schemas/GetBlockResponseDecodedV1" + }, + { + "$ref": "#/components/schemas/GetBlockResponseEncodedV1" + } + ] + }, + "ErrorExceptionResponseV1": { + "type": "object", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "nullable": false + }, + "error": { + "type": "string", + "nullable": false + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "WatchBlocksV1": { + "type": "string", + "description": "Websocket requests for monitoring new blocks.", + "enum": [ + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.SubscribeDelegatedSign", + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.hlfabric.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "SubscribeDelegatedSign", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksListenerTypeV1": { + "type": "string", + "description": "Response type from WatchBlocks. 'Cactus*' are custom views, others correspond to fabric SDK call.", + "enum": ["filtered", "full", "private", "cactus:transactions"], + "x-enum-varnames": ["Filtered", "Full", "Private", "CactusTransactions"] + }, + "WatchBlocksOptionsV1": { + "type": "object", + "description": "Options passed when subscribing to block monitoring.", + "required": ["channelName", "gatewayOptions", "type"], + "properties": { + "channelName": { + "type": "string", + "description": "Hyperledger Fabric channel to connect to.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gatewayOptions": { + "$ref": "#/components/schemas/GatewayOptions", + "description": "Options to Hyperledger Fabric Node SDK Gateway", + "nullable": false + }, + "type": { + "$ref": "#/components/schemas/WatchBlocksListenerTypeV1", + "description": "Type of response block to return.", + "nullable": false + }, + "startBlock": { + "type": "string", + "description": "From which block start monitoring. Defaults to latest.", + "minLength": 1, + "maxLength": 100, + "nullable": false + } + } + }, + "WatchBlocksDelegatedSignOptionsV1": { + "type": "object", + "description": "Options passed when subscribing to block monitoring with delegated signing.", + "required": ["type", "channelName", "signerCertificate", "signerMspID"], + "properties": { + "type": { + "$ref": "#/components/schemas/WatchBlocksListenerTypeV1", + "description": "Type of response block to return.", + "nullable": false + }, + "startBlock": { + "type": "string", + "description": "From which block start monitoring. Defaults to latest.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "channelName": { + "type": "string", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "signerCertificate": { + "type": "string", + "nullable": false + }, + "signerMspID": { + "type": "string", + "nullable": false + }, + "uniqueTransactionData": { + "description": "Can be used to uniquely identify and authorize signing request", + "nullable": false + } + } + }, + "WatchBlocksCactusTransactionsEventV1": { + "type": "object", + "description": "Transaction summary from commited block.", + "required": [ + "chaincodeId", + "transactionId", + "functionName", + "functionArgs" + ], + "properties": { + "chaincodeId": { + "description": "ChainCode containing function that was executed.", + "nullable": false, + "type": "string" + }, + "transactionId": { + "description": "Transaction identifier.", + "nullable": false, + "type": "string" + }, + "functionName": { + "description": "Function name that was executed.", + "nullable": false, + "type": "string" + }, + "functionArgs": { + "description": "List of function arguments.", + "type": "array", + "items": { + "type": "string", + "minLength": 0, + "nullable": false + } + } + } + }, + "WatchBlocksCactusTransactionsResponseV1": { + "type": "object", + "description": "Custom response containing block transactions summary. Compatible with legacy fabric-socketio connector monitoring.", + "required": ["cactusTransactionsEvents"], + "properties": { + "cactusTransactionsEvents": { + "description": "List of transactions summary", + "type": "array", + "items": { + "$ref": "#/components/schemas/WatchBlocksCactusTransactionsEventV1", + "nullable": false + } + } + } + }, + "WatchBlocksFullResponseV1": { + "type": "object", + "description": "Response that corresponds to Fabric SDK 'full' EventType.", + "required": ["fullBlock"], + "properties": { + "fullBlock": { + "description": "Full commited block.", + "nullable": false + } + } + }, + "WatchBlocksFilteredResponseV1": { + "type": "object", + "description": "Response that corresponds to Fabric SDK 'filtered' EventType.", + "required": ["filteredBlock"], + "properties": { + "filteredBlock": { + "description": "Filtered commited block.", + "nullable": false + } + } + }, + "WatchBlocksPrivateResponseV1": { + "type": "object", + "description": "Response that corresponds to Fabric SDK 'private' EventType.", + "required": ["privateBlock"], + "properties": { + "privateBlock": { + "description": "Private commited block.", + "nullable": false + } + } + }, + "WatchBlocksCactusErrorResponseV1": { + "type": "object", + "description": "Error response from WatchBlocks operation.", + "required": ["code", "errorMessage"], + "properties": { + "code": { + "description": "Error code.", + "type": "number" + }, + "errorMessage": { + "description": "Description of the error.", + "type": "string" + } + } + }, + "WatchBlocksResponseV1": { + "description": "Response block from WatchBlocks endpoint. Depends on 'type' passed in subscription options.", + "oneOf": [ + { + "$ref": "#/components/schemas/WatchBlocksCactusTransactionsResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksFullResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksFilteredResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksPrivateResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksCactusErrorResponseV1", + "nullable": false + } + ] + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-transaction" + } + }, + "operationId": "runTransactionV1", + "summary": "Runs a transaction on a Fabric ledger.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/run-delegated-sign-transaction" + } + }, + "operationId": "runDelegatedSignTransactionV1", + "summary": "Runs a transaction on a Fabric ledger using user-provided signing callback.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunDelegatedSignTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-transaction-receipt-by-txid" + } + }, + "operationId": "getTransactionReceiptByTxIDV1", + "summary": "get a transaction receipt by tx id on a Fabric ledger.", + "description": "", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTransactionReceiptResponse" + } + } + } + }, + "404": { + "description": "" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract-go-source": { + "post": { + "operationId": "deployContractGoSourceV1", + "summary": "Deploys a chaincode contract in the form of a go sources.", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract-go-source" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractGoSourceV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractGoSourceV1Response" + } + } + } + }, + "501": { + "description": "Not implemented", + "content": { + "text/plain": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + } + } + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract": { + "post": { + "operationId": "deployContractV1", + "summary": "Deploys a chaincode contract from a set of source files. Note: This endpoint only supports Fabric 2.x. The 'v1' suffix in the method name refers to the Cactus API version, not the supported Fabric ledger version.", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/deploy-contract" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + }, + "501": { + "description": "Not implemented", + "content": { + "text/plain": { + "schema": { + "type": "object", + "properties": { + "message": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + } + } + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block": { + "post": { + "operationId": "getBlockV1", + "summary": "Get block from the channel using one of selectors from the input. Works only on Fabric 2.x.", + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-block" + } + }, + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBlockRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetBlockResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/README.md b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/README.md deleted file mode 100644 index c17b5a72b2..0000000000 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Fabirc v1.4.x Hello World Contract - - -### Building Locally with v1.4.x ChainCode - -This is useful when you want to avoid having to deal with $GOPATH and friends -and instead just keep everything self-contained in a single directory which is -what we want from an ideal test case, so here's how to do it on the terminal: - -```sh - -# Make sure you are in the right working directory -cd packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14 - -# Export the go source code to the file system into an actual .go file -npx ts-node ./hello-world-contract-go-source.ts - -# Ensure the Go Modules feature is used -export GO111MODULE=on - -# If go.mod file is not present, -# otherwise this can be omitted -go mod init hello-world-contract - -# This will pin on the latest 1.4 commit -go get github.com/hyperledger/fabric@v1.4.8 - -go mod tidy -go mod vendor - -# Now you can just build it like any other go project -# and deploy the resulting binary as a chain code -# contract on a Fabric v.1.4.x ledger -go build -``` diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source.ts deleted file mode 100644 index afc3d63db4..0000000000 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source.ts +++ /dev/null @@ -1,105 +0,0 @@ -export const HELLO_WORLD_CONTRACT_GO_SOURCE = `package main - -import ( - "fmt" - - "github.com/hyperledger/fabric/core/chaincode/shim" - "github.com/hyperledger/fabric/protos/peer" -) - -// SimpleAsset implements a simple chaincode to manage an asset -type SimpleAsset struct { -} - -// Init is called during chaincode instantiation to initialize any -// data. Note that chaincode upgrade also calls this function to reset -// or to migrate data. -func (t *SimpleAsset) Init(stub shim.ChaincodeStubInterface) peer.Response { - // Get the args from the transaction proposal - args := stub.GetStringArgs() - if len(args) != 2 { - return shim.Error("Incorrect arguments. Expecting a key and a value") - } - - // Set up any variables or assets here by calling stub.PutState() - - // We store the key and the value on the ledger - err := stub.PutState(args[0], []byte(args[1])) - if err != nil { - return shim.Error(fmt.Sprintf("Failed to create asset: %s", args[0])) - } - return shim.Success(nil) -} - -// Invoke is called per transaction on the chaincode. Each transaction is -// either a 'get' or a 'set' on the asset created by Init function. The Set -// method may create a new asset by specifying a new key-value pair. -func (t *SimpleAsset) Invoke(stub shim.ChaincodeStubInterface) peer.Response { - // Extract the function and args from the transaction proposal - fn, args := stub.GetFunctionAndParameters() - - var result string - var err error - if fn == "set" { - result, err = set(stub, args) - } else { // assume 'get' even if fn is nil - result, err = get(stub, args) - } - if err != nil { - return shim.Error(err.Error()) - } - - // Return the result as success payload - return shim.Success([]byte(result)) -} - -// Set stores the asset (both key and value) on the ledger. If the key exists, -// it will override the value with the new one -func set(stub shim.ChaincodeStubInterface, args []string) (string, error) { - if len(args) != 2 { - return "", fmt.Errorf("Incorrect arguments. Expecting a key and a value") - } - - err := stub.PutState(args[0], []byte(args[1])) - if err != nil { - return "", fmt.Errorf("Failed to set asset: %s", args[0]) - } - return args[1], nil -} - -// Get returns the value of the specified asset key -func get(stub shim.ChaincodeStubInterface, args []string) (string, error) { - if len(args) != 1 { - return "", fmt.Errorf("Incorrect arguments. Expecting a key") - } - - value, err := stub.GetState(args[0]) - if err != nil { - return "", fmt.Errorf("Failed to get asset: %s with error: %s", args[0], err) - } - if value == nil { - return "", fmt.Errorf("Asset not found: %s", args[0]) - } - return string(value), nil -} - -// main function starts up the chaincode in the container during instantiate -func main() { - if err := shim.Start(new(SimpleAsset)); err != nil { - fmt.Printf("Error starting SimpleAsset chaincode: %s", err) - } -} - -`; - -const exportSourceToFs = async () => { - const path = await import("path"); - const fs = await import("fs"); - const fileName = "./hello-world-contract.go"; - const scriptPath = path.join(__dirname, fileName); - fs.writeFileSync(scriptPath, HELLO_WORLD_CONTRACT_GO_SOURCE); -}; - -if (require.main === module) { - exportSourceToFs(); -} diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts deleted file mode 100644 index fcdf0eeca5..0000000000 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/deploy-cc-from-golang-source.test.ts +++ /dev/null @@ -1,260 +0,0 @@ -import { AddressInfo } from "net"; -import http from "http"; - -import test, { Test } from "tape-promise/tape"; -import { v4 as uuidv4 } from "uuid"; - -import express from "express"; -import bodyParser from "body-parser"; - -import { - Containers, - FabricTestLedgerV1, - pruneDockerAllIfGithubAction, -} from "@hyperledger/cactus-test-tooling"; - -import { - IListenOptions, - LogLevelDesc, - Servers, -} from "@hyperledger/cactus-common"; -import { PluginRegistry } from "@hyperledger/cactus-core"; - -import { - DefaultEventHandlerStrategy, - FabricContractInvocationType, - PluginLedgerConnectorFabric, - SSHExecCommandResponse, -} from "../../../../main/typescript/public-api"; - -import { HELLO_WORLD_CONTRACT_GO_SOURCE } from "../../fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source"; - -import { - DefaultApi as FabricApi, - FabricSigningCredential, -} from "../../../../main/typescript/public-api"; - -import { IPluginLedgerConnectorFabricOptions } from "../../../../main/typescript/plugin-ledger-connector-fabric"; - -import { DiscoveryOptions } from "fabric-network"; -import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -const testCase = "deploys contract from go source"; -const logLevel: LogLevelDesc = "TRACE"; - -test("BEFORE " + testCase, async (t: Test) => { - const pruning = pruneDockerAllIfGithubAction({ logLevel }); - await t.doesNotReject(pruning, "Pruning didn't throw OK"); - t.end(); -}); - -test.skip(testCase, async (t: Test) => { - test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); - }); - const ledger = new FabricTestLedgerV1({ - emitContainerLogs: true, - logLevel, - publishAllPorts: true, - imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", - }); - - const tearDown = async () => { - await ledger.stop(); - await ledger.destroy(); - await pruneDockerAllIfGithubAction({ logLevel }); - }; - - test.onFinish(tearDown); - - await ledger.start(); - t.doesNotThrow(() => ledger.getContainer(), "Container is set OK"); - const ledgerContainer = ledger.getContainer(); - t.ok(ledgerContainer, "ledgerContainer truthy OK"); - t.ok(ledgerContainer.id, "ledgerContainer.id truthy OK"); - - const connectionProfile = await ledger.getConnectionProfileOrg1(); - t.ok(connectionProfile, "getConnectionProfileOrg1() out truthy OK"); - - const enrollAdminOut = await ledger.enrollAdmin(); - const adminWallet = enrollAdminOut[1]; - const [userIdentity] = await ledger.enrollUser(adminWallet); - const sshConfig = await ledger.getSshConfig(); - - const keychainInstanceId = uuidv4(); - const keychainId = uuidv4(); - const keychainEntryKey = "user2"; - const keychainEntryValue = JSON.stringify(userIdentity); - - const keychainPlugin = new PluginKeychainMemory({ - instanceId: keychainInstanceId, - keychainId, - logLevel, - backend: new Map([ - [keychainEntryKey, keychainEntryValue], - ["some-other-entry-key", "some-other-entry-value"], - ]), - }); - - const pluginRegistry = new PluginRegistry({ plugins: [keychainPlugin] }); - - const discoveryOptions: DiscoveryOptions = { - enabled: true, - asLocalhost: true, - }; - - // these below mirror how the fabric-samples sets up the configuration - const org1Env = { - CORE_PEER_LOCALMSPID: "Org1MSP", - CORE_PEER_ADDRESS: "peer0.org1.example.com:7051", - CORE_PEER_MSPCONFIGPATH: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp", - CORE_PEER_TLS_ROOTCERT_FILE: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - ORDERER_TLS_ROOTCERT_FILE: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", - }; - - // these below mirror how the fabric-samples sets up the configuration - const org2Env = { - CORE_PEER_LOCALMSPID: "Org2MSP", - CORE_PEER_ADDRESS: "peer0.org2.example.com:9051", - CORE_PEER_MSPCONFIGPATH: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp", - CORE_PEER_TLS_ROOTCERT_FILE: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt", - ORDERER_TLS_ROOTCERT_FILE: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem", - }; - - const pluginOptions: IPluginLedgerConnectorFabricOptions = { - instanceId: uuidv4(), - dockerBinary: "/usr/local/bin/docker", - pluginRegistry, - peerBinary: "/fabric-samples/bin/peer", - cliContainerEnv: org1Env, - sshConfig, - logLevel, - connectionProfile, - discoveryOptions, - eventHandlerOptions: { - strategy: DefaultEventHandlerStrategy.NetworkScopeAllfortx, - commitTimeout: 300, - }, - }; - const plugin = new PluginLedgerConnectorFabric(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - const { port } = addressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - const apiUrl = `http://127.0.0.1:${port}`; - - const config = new Configuration({ basePath: apiUrl }); - const apiClient = new FabricApi(config); - const res = await apiClient.deployContractGoSourceV1({ - targetPeerAddresses: ["peer0.org1.example.com:7051"], - tlsRootCertFiles: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - policyDslSource: "AND('Org1MSP.member','Org2MSP.member')", - channelId: "mychannel", - chainCodeVersion: "1.0.0", - constructorArgs: { Args: ["john", "99"] }, - goSource: { - body: Buffer.from(HELLO_WORLD_CONTRACT_GO_SOURCE).toString("base64"), - filename: "hello-world.go", - }, - moduleName: "hello-world", - targetOrganizations: [org1Env, org2Env], - pinnedDeps: [ - "github.com/Knetic/govaluate@v3.0.0+incompatible", - "github.com/Shopify/sarama@v1.27.0", - "github.com/fsouza/go-dockerclient@v1.6.5", - "github.com/grpc-ecosystem/go-grpc-middleware@v1.2.1", - "github.com/hashicorp/go-version@v1.2.1", - "github.com/hyperledger/fabric@v1.4.8", - "github.com/hyperledger/fabric-amcl@v0.0.0-20200424173818-327c9e2cf77a", - "github.com/miekg/pkcs11@v1.0.3", - "github.com/mitchellh/mapstructure@v1.3.3", - "github.com/onsi/ginkgo@v1.14.1", - "github.com/onsi/gomega@v1.10.2", - "github.com/op/go-logging@v0.0.0-20160315200505-970db520ece7", - "github.com/pkg/errors@v0.9.1", - "github.com/spf13/viper@v1.7.1", - "github.com/stretchr/testify@v1.6.1", - "github.com/sykesm/zap-logfmt@v0.0.3", - "go.uber.org/zap@v1.16.0", - "golang.org/x/crypto@v0.0.0-20200820211705-5c72a883971a", - "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", - "google.golang.org/grpc@v1.31.1", - ], - }); - - const { - installationCommandResponses: installations, - instantiationCommandResponse: instantiation, - success, - } = res.data; - - installations.forEach((icr: SSHExecCommandResponse, idx: number) => { - t.comment(`CC installation ${idx} out: ${icr.stdout}`); - t.comment(`CC installation ${idx} err: ${icr.stderr}`); - }); - - t.comment(`CC instantiation out: ${instantiation.stdout}`); - t.comment(`CC instantiation err: ${instantiation.stderr}`); - - t.equal(res.status, 200, "deployContractGoSourceV1 res.status === 200 OK"); - t.true(success, "deployContractGoSourceV1 res.data.success === true"); - - // FIXME - without this wait it randomly fails with an error claiming that - // the endorsement was impossible to be obtained. The fabric-samples script - // does the same thing, it just waits 10 seconds for good measure so there - // might not be a way for us to avoid doing this, but if there is a way we - // absolutely should not have timeouts like this, anywhere... - await new Promise((resolve) => setTimeout(resolve, 20000)); - - const testKey = uuidv4(); - const testValue = uuidv4(); - const signingCredential: FabricSigningCredential = { - keychainId, - keychainRef: keychainEntryKey, - }; - - const setRes = await apiClient.runTransactionV1({ - contractName: "hello-world", - channelName: "mychannel", - params: [testKey, testValue], - methodName: "set", - invocationType: FabricContractInvocationType.Send, - signingCredential, - }); - t.ok(setRes, "setRes truthy OK"); - t.true(setRes.status > 199 && setRes.status < 300, "setRes status 2xx OK"); - t.comment(`HelloWorld.set() ResponseBody: ${JSON.stringify(setRes.data)}`); - - const getRes = await apiClient.runTransactionV1({ - contractName: "hello-world", - channelName: "mychannel", - params: [testKey], - methodName: "get", - invocationType: FabricContractInvocationType.Call, - signingCredential, - }); - t.ok(getRes, "getRes truthy OK"); - t.true(getRes.status > 199 && setRes.status < 300, "getRes status 2xx OK"); - t.comment(`HelloWorld.get() ResponseBody: ${JSON.stringify(getRes.data)}`); - t.equal(getRes.data.functionOutput, testValue, "get returns UUID OK"); - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts deleted file mode 100644 index ae0764052a..0000000000 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v1-4-x/run-transaction-endpoint-v1.test.ts +++ /dev/null @@ -1,226 +0,0 @@ -import http from "http"; -import { AddressInfo } from "net"; - -import test, { Test } from "tape-promise/tape"; -import { v4 as uuidv4 } from "uuid"; - -import bodyParser from "body-parser"; -import express from "express"; - -import { - Containers, - FabricTestLedgerV1, - pruneDockerAllIfGithubAction, -} from "@hyperledger/cactus-test-tooling"; -import { PluginRegistry } from "@hyperledger/cactus-core"; - -import { - IListenOptions, - LogLevelDesc, - Servers, -} from "@hyperledger/cactus-common"; - -import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; - -import { - PluginLedgerConnectorFabric, - DefaultApi as FabricApi, - RunTransactionRequest, - FabricContractInvocationType, - DefaultEventHandlerStrategy, - FabricSigningCredential, -} from "../../../../main/typescript/public-api"; - -import { IPluginLedgerConnectorFabricOptions } from "../../../../main/typescript/plugin-ledger-connector-fabric"; -import { DiscoveryOptions } from "fabric-network"; -import { K_CACTUS_FABRIC_TOTAL_TX_COUNT } from "../../../../main/typescript/prometheus-exporter/metrics"; -import { Configuration } from "@hyperledger/cactus-core-api"; - -/** - * Use this to debug issues with the fabric node SDK - * ```sh - * export HFC_LOGGING='{"debug":"console","info":"console"}' - * ``` - */ - -const testCase = "runs tx on a Fabric v1.4.8 ledger"; -const logLevel: LogLevelDesc = "TRACE"; - -test.onFailure(async () => { - await Containers.logDiagnostics({ logLevel }); -}); - -test("BEFORE " + testCase, async (t: Test) => { - const pruning = pruneDockerAllIfGithubAction({ logLevel }); - await t.doesNotReject(pruning, "Pruning didn't throw OK"); - t.end(); -}); - -test.skip(testCase, async (t: Test) => { - const ledger = new FabricTestLedgerV1({ - publishAllPorts: true, - emitContainerLogs: true, - logLevel, - imageName: "ghcr.io/hyperledger/cactus-fabric-all-in-one", - envVars: new Map([ - ["FABRIC_VERSION", "1.4.8"], - ["CA_VERSION", "1.4.9"], - ]), - }); - - const tearDownLedger = async () => { - await ledger.stop(); - await ledger.destroy(); - await pruneDockerAllIfGithubAction({ logLevel }); - }; - test.onFinish(tearDownLedger); - - await ledger.start(); - - const enrollAdminOut = await ledger.enrollAdmin(); - const adminWallet = enrollAdminOut[1]; - const [userIdentity] = await ledger.enrollUser(adminWallet); - - const connectionProfile = await ledger.getConnectionProfileOrg1(); - - const sshConfig = await ledger.getSshConfig(); - - const keychainInstanceId = uuidv4(); - const keychainId = uuidv4(); - const keychainEntryKey = "user2"; - const keychainEntryValue = JSON.stringify(userIdentity); - - const keychainPlugin = new PluginKeychainMemory({ - instanceId: keychainInstanceId, - keychainId, - logLevel, - backend: new Map([ - [keychainEntryKey, keychainEntryValue], - ["some-other-entry-key", "some-other-entry-value"], - ]), - }); - - const pluginRegistry = new PluginRegistry({ plugins: [keychainPlugin] }); - - const discoveryOptions: DiscoveryOptions = { - enabled: true, - asLocalhost: true, - }; - - const pluginOptions: IPluginLedgerConnectorFabricOptions = { - instanceId: uuidv4(), - pluginRegistry, - peerBinary: "/fabric-samples/bin/peer", - sshConfig, - cliContainerEnv: {}, - logLevel, - connectionProfile, - discoveryOptions, - eventHandlerOptions: { - strategy: DefaultEventHandlerStrategy.NetworkScopeAllfortx, - commitTimeout: 300, - }, - }; - const plugin = new PluginLedgerConnectorFabric(pluginOptions); - - const expressApp = express(); - expressApp.use(bodyParser.json({ limit: "250mb" })); - const server = http.createServer(expressApp); - const listenOptions: IListenOptions = { - hostname: "127.0.0.1", - port: 0, - server, - }; - const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; - test.onFinish(async () => await Servers.shutdown(server)); - const { address, port } = addressInfo; - const apiHost = `http://${address}:${port}`; - t.comment( - `Metrics URL: ${apiHost}/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-fabric/get-prometheus-exporter-metrics`, - ); - - const apiConfig = new Configuration({ basePath: apiHost }); - const apiClient = new FabricApi(apiConfig); - - await plugin.getOrCreateWebServices(); - await plugin.registerWebServices(expressApp); - - const carId = "CAR277"; - const carOwner = uuidv4(); - const signingCredential: FabricSigningCredential = { - keychainId, - keychainRef: keychainEntryKey, - }; - - { - const res = await apiClient.runTransactionV1({ - signingCredential, - channelName: "mychannel", - contractName: "fabcar", - invocationType: FabricContractInvocationType.Call, - methodName: "queryAllCars", - params: [], - } as RunTransactionRequest); - t.ok(res); - t.ok(res.data); - t.equal(res.status, 200); - t.doesNotThrow(() => JSON.parse(res.data.functionOutput)); - } - - { - const req: RunTransactionRequest = { - signingCredential, - channelName: "mychannel", - invocationType: FabricContractInvocationType.Send, - contractName: "fabcar", - methodName: "createCar", - params: [carId, "Ford", "601", "Blue", carOwner], - }; - - const res = await apiClient.runTransactionV1(req); - t.ok(res); - t.ok(res.data); - t.equal(res.status, 200); - } - { - const res = await apiClient.runTransactionV1({ - signingCredential, - channelName: "mychannel", - contractName: "fabcar", - invocationType: FabricContractInvocationType.Call, - methodName: "queryAllCars", - params: [], - } as RunTransactionRequest); - t.ok(res); - t.ok(res.data); - t.equal(res.status, 200); - const cars = JSON.parse(res.data.functionOutput); - const car277 = cars.find((c: { Key: string }) => c.Key === carId); - t.ok(car277, "Located Car record by its ID OK"); - t.ok(car277.Record, `Car object has "Record" property OK`); - t.ok(car277.Record.owner, `Car object has "Record"."owner" property OK`); - t.equal(car277.Record.owner, carOwner, `Car has expected owner OK`); - } - { - const res = await apiClient.getPrometheusMetricsV1(); - const promMetricsOutput = - "# HELP " + - K_CACTUS_FABRIC_TOTAL_TX_COUNT + - " Total transactions executed\n" + - "# TYPE " + - K_CACTUS_FABRIC_TOTAL_TX_COUNT + - " gauge\n" + - K_CACTUS_FABRIC_TOTAL_TX_COUNT + - '{type="' + - K_CACTUS_FABRIC_TOTAL_TX_COUNT + - '"} 3'; - t.ok(res); - t.ok(res.data); - t.equal(res.status, 200); - t.true( - res.data.includes(promMetricsOutput), - "Total Transaction Count of 3 recorded as expected. RESULT OK", - ); - } - t.end(); -}); diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts index 365ae19f18..86cb932ed2 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/openapi/openapi-validation-go.test.ts @@ -21,8 +21,6 @@ import { DeployContractGoSourceV1Request, } from "../../../../main/typescript/public-api"; -import { HELLO_WORLD_CONTRACT_GO_SOURCE } from "../../fixtures/go/hello-world-contract-fabric-v14/hello-world-contract-go-source"; - import { DefaultApi as FabricApi } from "../../../../main/typescript/public-api"; import { IPluginLedgerConnectorFabricOptions } from "../../../../main/typescript/plugin-ledger-connector-fabric"; @@ -127,67 +125,11 @@ test(testCase, async (t: Test) => { const apiClient = new FabricApi(config); const fDeployGo = "deployContractGoSourceV1"; - const cOk = "without bad request error"; const cWithoutParams = "not sending all required parameters"; const cInvalidParams = "sending invalid parameters"; - test.skip(`${testCase} - ${fDeployGo} - ${cOk}`, async (t2: Test) => { - const parameters = { - targetPeerAddresses: ["peer0.org1.example.com:7051"], - tlsRootCertFiles: - "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - policyDslSource: "AND('Org1MSP.member','Org2MSP.member')", - channelId: "mychannel", - chainCodeVersion: "1.0.0", - constructorArgs: { Args: ["john", "99"] }, - goSource: { - body: Buffer.from(HELLO_WORLD_CONTRACT_GO_SOURCE).toString("base64"), - filename: "hello-world.go", - }, - moduleName: "hello-world", - targetOrganizations: [org1Env, org2Env], - pinnedDeps: [ - "github.com/Knetic/govaluate@v3.0.0+incompatible", - "github.com/Shopify/sarama@v1.27.0", - "github.com/fsouza/go-dockerclient@v1.6.5", - "github.com/grpc-ecosystem/go-grpc-middleware@v1.2.1", - "github.com/hashicorp/go-version@v1.2.1", - "github.com/hyperledger/fabric@v1.4.8", - "github.com/hyperledger/fabric-amcl@v0.0.0-20200424173818-327c9e2cf77a", - "github.com/miekg/pkcs11@v1.0.3", - "github.com/mitchellh/mapstructure@v1.3.3", - "github.com/onsi/ginkgo@v1.14.1", - "github.com/onsi/gomega@v1.10.2", - "github.com/op/go-logging@v0.0.0-20160315200505-970db520ece7", - "github.com/pkg/errors@v0.9.1", - "github.com/spf13/viper@v1.7.1", - "github.com/stretchr/testify@v1.6.1", - "github.com/sykesm/zap-logfmt@v0.0.3", - "go.uber.org/zap@v1.16.0", - "golang.org/x/crypto@v0.0.0-20200820211705-5c72a883971a", - "golang.org/x/net@v0.0.0-20210503060351-7fd8e65b6420", - "google.golang.org/grpc@v1.31.1", - ], - }; - - const res = await apiClient.deployContractGoSourceV1(parameters); - - t2.equal( - res.status, - 200, - `Endpoint ${fDeployGo}: response.status === 200 OK`, - ); - t2.true( - res.data.success, - "deployContractGoSourceV1 res.data.success === true", - ); - - t2.end(); - }); - test(`${testCase} - ${fDeployGo} - ${cWithoutParams}`, async (t2: Test) => { const parameters = { - // targetPeerAddresses: ["peer0.org1.example.com:7051"], tlsRootCertFiles: "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", policyDslSource: "AND('Org1MSP.member','Org2MSP.member')", @@ -195,7 +137,7 @@ test(testCase, async (t: Test) => { chainCodeVersion: "1.0.0", constructorArgs: { Args: ["john", "99"] }, goSource: { - body: Buffer.from(HELLO_WORLD_CONTRACT_GO_SOURCE).toString("base64"), + body: Buffer.from("some go source code").toString("base64"), filename: "hello-world.go", }, moduleName: "hello-world", @@ -256,7 +198,7 @@ test(testCase, async (t: Test) => { chainCodeVersion: "1.0.0", constructorArgs: { Args: ["john", "99"] }, goSource: { - body: Buffer.from(HELLO_WORLD_CONTRACT_GO_SOURCE).toString("base64"), + body: Buffer.from("some go source code").toString("base64"), filename: "hello-world.go", }, moduleName: "hello-world", diff --git a/packages/cactus-plugin-ledger-connector-iroha2/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-iroha2/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..5f0babaf69 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-iroha2/src/main/json/openapi.tpl.json @@ -0,0 +1,671 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Iroha V2", + "description": "Can perform basic tasks on a Iroha V2 ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "IrohaInstruction": { + "type": "string", + "description": "Command names that correspond to Iroha Special Instructions (https://hyperledger.github.io/iroha-2-docs/guide/advanced/isi.html)", + "enum": [ + "registerDomain", + "registerAssetDefinition", + "registerAsset", + "mintAsset", + "burnAsset", + "transferAsset", + "registerAccount" + ], + "x-enum-descriptions": [ + "Register new domain", + "Register new asset definition", + "Register new asset", + "Mint asset value", + "Burn asset value", + "Transfer asset between accounts", + "Register new account" + ], + "x-enum-varnames": [ + "RegisterDomain", + "RegisterAssetDefinition", + "RegisterAsset", + "MintAsset", + "BurnAsset", + "TransferAsset", + "RegisterAccount" + ] + }, + "IrohaQuery": { + "type": "string", + "description": "Command names that correspond to Iroha queries (https://hyperledger.github.io/iroha-2-docs/guide/advanced/queries.html)", + "enum": [ + "findAllDomains", + "findDomainById", + "findAssetDefinitionById", + "findAllAssetsDefinitions", + "findAssetById", + "findAllAssets", + "findAllPeers", + "findAllBlocks", + "findAccountById", + "findAllAccounts", + "findAllTransactions", + "findTransactionByHash" + ], + "x-enum-descriptions": [ + "Get list of all registered domains", + "Get domain with specified ID", + "Get asset definition with specified ID", + "Get list of all registered asset definition", + "Get asset with specified ID", + "Get list of all registered assets", + "Get list of all ledger peers", + "Get list of all ledger blocks", + "Get account with specified ID", + "Get list of all registered accounts", + "Get list of all transactions", + "Get transaction with specified hash" + ], + "x-enum-varnames": [ + "FindAllDomains", + "FindDomainById", + "FindAssetDefinitionById", + "FindAllAssetsDefinitions", + "FindAssetById", + "FindAllAssets", + "FindAllPeers", + "FindAllBlocks", + "FindAccountById", + "FindAllAccounts", + "FindAllTransactions", + "FindTransactionByHash" + ] + }, + "WatchBlocksV1": { + "type": "string", + "description": "Websocket requests for monitoring new blocks.", + "enum": [ + "org.hyperledger.cactus.api.async.hliroha2.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.hliroha2.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.hliroha2.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.hliroha2.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.hliroha2.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "BlockTypeV1": { + "type": "string", + "description": "Iroha V2 block response type.", + "enum": ["raw", "binary"], + "x-enum-descriptions": [ + "Default JSON-encoded string full block data.", + "Encoded format that must be decoded with Iroha SDK on client side before use" + ], + "x-enum-varnames": ["Raw", "Binary"] + }, + "TransactionStatusV1": { + "type": "string", + "description": "Status of Iroha V2 transaction.", + "enum": ["submitted", "committed", "rejected"], + "x-enum-descriptions": [ + "Transaction was submitted to the ledger - use other tools to check if it was accepted and committed.", + "Transaction was committed to the ledger.", + "Transaction was rejected." + ], + "x-enum-varnames": ["Submitted", "Committed", "Rejected"] + }, + "WatchBlocksOptionsV1": { + "type": "object", + "description": "Options passed when subscribing to block monitoring.", + "properties": { + "type": { + "$ref": "#/components/schemas/BlockTypeV1", + "description": "Type of response block to return.", + "default": "BlockTypeV1.Binary", + "nullable": false + }, + "startBlock": { + "type": "string", + "description": "Number of block to start monitoring from.", + "minLength": 1, + "nullable": false + }, + "baseConfig": { + "$ref": "#/components/schemas/Iroha2BaseConfig", + "description": "Iroha V2 connection configuration.", + "nullable": false + } + } + }, + "WatchBlocksRawResponseV1": { + "type": "object", + "description": "Default JSON-encoded string full block data.", + "required": ["blockData"], + "properties": { + "blockData": { + "type": "string", + "nullable": false + } + } + }, + "WatchBlocksBinaryResponseV1": { + "type": "object", + "description": "Binary encoded response of block data.", + "required": ["binaryBlock"], + "properties": { + "binaryBlock": { + "type": "string", + "nullable": false + } + } + }, + "WatchBlocksResponseV1": { + "oneOf": [ + { + "$ref": "#/components/schemas/WatchBlocksRawResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksBinaryResponseV1", + "nullable": false + }, + { + "$ref": "#/components/schemas/ErrorExceptionResponseV1", + "nullable": false + } + ] + }, + "Iroha2AccountId": { + "type": "object", + "description": "Iroha V2 account ID.", + "additionalProperties": false, + "nullable": false, + "required": ["name", "domainId"], + "properties": { + "name": { + "type": "string", + "nullable": false + }, + "domainId": { + "type": "string", + "nullable": false + } + } + }, + "Iroha2KeyJson": { + "type": "object", + "description": "Private/Public key JSON containing payload and digest function.", + "additionalProperties": false, + "nullable": false, + "required": ["digestFunction", "payload"], + "properties": { + "digestFunction": { + "type": "string", + "nullable": false + }, + "payload": { + "type": "string", + "nullable": false + } + } + }, + "KeychainReference": { + "type": "object", + "description": "Reference to entry stored in Cactus keychain plugin.", + "required": ["keychainId", "keychainRef"], + "properties": { + "keychainId": { + "type": "string", + "description": "Keychain plugin ID.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "keychainRef": { + "type": "string", + "description": "Key reference name.", + "minLength": 1, + "maxLength": 100, + "nullable": false + } + } + }, + "Iroha2KeyPair": { + "type": "object", + "description": "Pair of Iroha account private and public keys.", + "required": ["privateKey", "publicKey"], + "properties": { + "privateKey": { + "$ref": "#/components/schemas/Iroha2KeyJson", + "nullable": false + }, + "publicKey": { + "type": "string", + "nullable": false + } + } + }, + "Iroha2BaseConfigTorii": { + "type": "object", + "description": "Iroha V2 peer connection information.", + "additionalProperties": false, + "nullable": false, + "properties": { + "apiURL": { + "type": "string", + "nullable": false + }, + "telemetryURL": { + "type": "string", + "nullable": false + } + } + }, + "Iroha2BaseConfig": { + "type": "object", + "description": "Iroha V2 connection configuration.", + "additionalProperties": false, + "required": ["torii"], + "properties": { + "torii": { + "$ref": "#/components/schemas/Iroha2BaseConfigTorii", + "nullable": false + }, + "accountId": { + "$ref": "#/components/schemas/Iroha2AccountId", + "nullable": false + }, + "signingCredential": { + "oneOf": [ + { + "$ref": "#/components/schemas/Iroha2KeyPair", + "nullable": false + }, + { + "$ref": "#/components/schemas/KeychainReference", + "nullable": false + } + ] + } + } + }, + "IrohaInstructionRequestV1": { + "type": "object", + "description": "Single Iroha V2 instruction to be executed request.", + "required": ["name", "params"], + "additionalProperties": false, + "properties": { + "name": { + "type": "IrohaInstruction", + "description": "Iroha V2 instruction name.", + "nullable": false + }, + "params": { + "description": "The list of arguments to pass with specified instruction.", + "type": "array", + "items": {} + } + } + }, + "IrohaTransactionParametersV1": { + "type": "object", + "description": "Iroha V2 transaction payload parameters", + "additionalProperties": true, + "properties": { + "ttl": { + "type": "string", + "description": "BigInt time to live.", + "nullable": false + }, + "creationTime": { + "type": "string", + "description": "BigInt creation time", + "nullable": false + }, + "nonce": { + "type": "number", + "description": "Transaction nonce", + "nullable": false + } + } + }, + "IrohaTransactionDefinitionV1": { + "type": "object", + "description": "Iroha V2 transaction definition", + "required": ["instruction"], + "additionalProperties": false, + "properties": { + "instruction": { + "oneOf": [ + { + "$ref": "#/components/schemas/IrohaInstructionRequestV1", + "nullable": false + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/IrohaInstructionRequestV1" + } + } + ] + }, + "params": { + "$ref": "#/components/schemas/IrohaTransactionParametersV1", + "description": "Transaction parameters", + "nullable": false + } + } + }, + "IrohaQueryDefinitionV1": { + "type": "object", + "description": "Iroha V2 query definition.", + "required": ["query"], + "additionalProperties": false, + "properties": { + "query": { + "type": "IrohaQuery", + "description": "Name of the query to be executed.", + "nullable": false + }, + "params": { + "description": "The list of arguments to pass with the query.", + "type": "array", + "items": {} + } + } + }, + "IrohaSignedQueryDefinitionV1": { + "type": "object", + "description": "Iroha V2 signed query definition", + "required": ["query", "payload"], + "additionalProperties": false, + "properties": { + "query": { + "type": "IrohaQuery", + "description": "Name of the query to be executed.", + "nullable": false + }, + "payload": { + "description": "Signed query transaction binary data received from generate-transaction endpoint.", + "type": "string", + "nullable": false + } + } + }, + "TransactRequestV1": { + "type": "object", + "description": "Request to transact endpoint.", + "additionalProperties": false, + "properties": { + "signedTransaction": { + "description": "Signed transaction binary data received from generate-transaction endpoint.", + "type": "string", + "nullable": false + }, + "transaction": { + "$ref": "#/components/schemas/IrohaTransactionDefinitionV1", + "description": "New transaction definition. Caller must provide signing credential in `baseConfig`.", + "nullable": false + }, + "waitForCommit": { + "description": "Wait unitl transaction is sent and return the final status (committed / rejected)", + "type": "boolean", + "default": false, + "nullable": false + }, + "baseConfig": { + "$ref": "#/components/schemas/Iroha2BaseConfig", + "description": "Iroha V2 connection configuration.", + "nullable": false + } + } + }, + "TransactResponseV1": { + "type": "object", + "description": "Response from transaction endpoint with operation status.", + "required": ["hash", "status"], + "properties": { + "hash": { + "type": "string", + "description": "Hexadecimal hash of the transaction sent to the ledger.", + "nullable": false + }, + "status": { + "$ref": "#/components/schemas/TransactionStatusV1", + "description": "Status of the sent transaction.", + "nullable": false + }, + "rejectReason": { + "description": "When waitForCommit was suplied and the transaction was rejected, contains the reason of the rejection.", + "type": "string", + "nullable": false + } + } + }, + "QueryRequestV1": { + "type": "object", + "description": "Request to query endpoint.", + "additionalProperties": false, + "properties": { + "query": { + "$ref": "#/components/schemas/IrohaQueryDefinitionV1", + "description": "Query definition. Caller must provide signing credential in `baseConfig`", + "nullable": false + }, + "signedQuery": { + "$ref": "#/components/schemas/IrohaSignedQueryDefinitionV1", + "description": "Query payload signed on the client side.", + "nullable": false + }, + "baseConfig": { + "$ref": "#/components/schemas/Iroha2BaseConfig", + "description": "Iroha V2 connection configuration.", + "nullable": false + } + } + }, + "QueryResponseV1": { + "type": "object", + "description": "Response with the query results.", + "required": ["response"], + "properties": { + "response": { + "description": "Query response data that varies between different queries.", + "nullable": false + } + } + }, + "GenerateTransactionRequestV1": { + "type": "object", + "description": "Request for generating transaction or query payload that can be signed on the client side.", + "additionalProperties": false, + "required": ["request"], + "properties": { + "request": { + "oneOf": [ + { + "$ref": "#/components/schemas/IrohaTransactionDefinitionV1", + "description": "New transaction definition. Caller must provide signing credential in `baseConfig`.", + "nullable": false + }, + { + "$ref": "#/components/schemas/IrohaQueryDefinitionV1", + "description": "Query definition. Caller must provide signing credential in `baseConfig`.", + "nullable": false + } + ] + }, + "baseConfig": { + "$ref": "#/components/schemas/Iroha2BaseConfig", + "description": "Iroha V2 connection configuration.", + "nullable": false + } + } + }, + "ErrorExceptionResponseV1": { + "type": "object", + "description": "Error response from the connector.", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "description": "Short error description message.", + "nullable": false + }, + "error": { + "type": "string", + "description": "Detailed error information.", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/transact": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/transact" + } + }, + "operationId": "TransactV1", + "summary": "Executes a transaction on a Iroha V2 ledger (by sending some instructions)", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransactRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransactResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/generate-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/generate-transaction" + } + }, + "operationId": "generateTransactionV1", + "summary": "Generate transaction that can be signed locally.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateTransactionRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/query": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-iroha2/query" + } + }, + "operationId": "QueryV1", + "summary": "Executes a query on a Iroha V2 ledger and returns it's results.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRequestV1" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-polkadot/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-polkadot/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..8916f9cb83 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-polkadot/src/main/json/openapi.tpl.json @@ -0,0 +1,834 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Polkadot", + "description": "Can perform basic tasks on a Polkadot parachain", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "TransactionInfoRequest": { + "type": "object", + "required": ["accountAddress", "transactionExpiration"], + "additionalProperties": false, + "properties": { + "accountAddress": { + "type": "string", + "nullable": false + }, + "transactionExpiration": { + "type": "number", + "nullable": true + } + } + }, + "TransactionInfoResponseData": { + "type": "object", + "required": ["nonce", "blockHash", "era"], + "additionalProperties": false, + "properties": { + "nonce": { + "type": "object", + "nullable": false + }, + "blockHash": { + "type": "object", + "nullable": false + }, + "era": { + "type": "object", + "nullable": true + } + } + }, + "TransactionInfoResponse": { + "type": "object", + "required": ["responseContainer"], + "additionalProperties": false, + "properties": { + "responseContainer": { + "type": "object", + "required": ["response_data", "succeeded", "message", "error"], + "additionalProperties": false, + "properties": { + "response_data": { + "$ref": "#/components/schemas/TransactionInfoResponseData", + "nullable": false + }, + "succeeded": { + "type": "boolean", + "nullable": false + }, + "message": { + "type": "string", + "nullable": false + }, + "error": { + "type": "string", + "nullable": true + } + } + } + } + }, + "RawTransactionRequest": { + "type": "object", + "required": ["to", "value"], + "additionalProperties": false, + "properties": { + "to": { + "type": "string", + "nullable": false + }, + "value": { + "type": "number", + "nullable": false + } + } + }, + "RawTransactionResponseData": { + "type": "object", + "required": ["rawTransaction"], + "additionalProperties": false, + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + } + } + }, + "RawTransactionResponse": { + "type": "object", + "required": ["responseContainer"], + "additionalProperties": false, + "properties": { + "responseContainer": { + "type": "object", + "required": ["response_data", "succeeded", "message", "error"], + "additionalProperties": false, + "properties": { + "response_data": { + "$ref": "#/components/schemas/RawTransactionResponseData", + "nullable": false + }, + "succeeded": { + "type": "boolean", + "nullable": false + }, + "message": { + "type": "string", + "nullable": false + }, + "error": { + "type": "string", + "nullable": true + } + } + } + } + }, + "SignRawTransactionRequest": { + "type": "object", + "required": ["rawTransaction", "mnemonic"], + "additionalProperties": false, + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + }, + "mnemonic": { + "type": "string", + "nullable": false + }, + "signingOptions": { + "type": "object", + "nullable": false + } + } + }, + "SignRawTransactionResponse": { + "type": "object", + "required": ["success", "signedTransaction"], + "additionalProperties": false, + "properties": { + "success": { + "type": "boolean", + "nullable": false + }, + "signedTransaction": { + "type": "string", + "nullable": false + } + } + }, + "web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialMnemonicString" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialMnemonicString": { + "type": "object", + "required": ["type", "mnemonic"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "mnemonic": { + "type": "string", + "description": "The Polkadot account's seed phrase for signing transaction", + "nullable": false + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": ["CACTUS_KEYCHAIN_REF", "MNEMONIC_STRING", "NONE"] + }, + "PolkadotTransactionConfig": { + "type": "object", + "additionalProperties": true, + "properties": { + "transferSubmittable": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "to": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "value": { + "oneOf": [ + { + "type": "number" + } + ] + } + } + }, + "RunTransactionRequest": { + "type": "object", + "required": ["web3SigningCredential", "transactionConfig"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/web3SigningCredential", + "nullable": false + }, + "transactionConfig": { + "$ref": "#/components/schemas/PolkadotTransactionConfig", + "nullable": false + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["success"], + "additionalProperties": false, + "properties": { + "success": { + "type": "boolean", + "nullable": false + }, + "txHash": { + "type": "string", + "nullable": false + }, + "blockHash": { + "type": "string", + "nullable": false + } + } + }, + "DeployContractInkRequest": { + "type": "object", + "required": ["web3SigningCredential", "wasm", "metadata", "gasLimit"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/web3SigningCredential", + "nullable": false + }, + "wasm": { + "description": "raw wasm for the compiled contract in base64 format", + "type": "string", + "format": "byte", + "nullable": false + }, + "constructorMethod": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "metadata": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "gasLimit": { + "type": "object", + "required": ["refTime", "proofSize"], + "properties": { + "refTime": { + "type": "integer", + "minimum": 0 + }, + "proofSize": { + "type": "integer", + "minimum": 0 + } + } + }, + "storageDepositLimit": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer", + "minimum": 0 + } + ], + "nullable": true + }, + "params": { + "description": "The list of arguments to pass in to the contract method being deployed", + "type": "array", + "default": [], + "items": {} + }, + "balance": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer", + "minimum": 0 + } + ] + }, + "salt": { + "oneOf": [ + { + "type": "string" + } + ], + "nullable": true + } + } + }, + "DeployContractInkResponse": { + "type": "object", + "required": ["success"], + "additionalProperties": false, + "properties": { + "success": { + "type": "boolean", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": false + } + } + }, + "PolkadotContractInvocationType": { + "type": "string", + "enum": ["SEND", "QUERY"] + }, + "InvokeContractRequest": { + "type": "object", + "required": [ + "invocationType", + "metadata", + "contractAddress", + "methodName", + "gasLimit", + "accountAddress", + "web3SigningCredential" + ], + "additionalProperties": false, + "properties": { + "invocationType": { + "$ref": "#/components/schemas/PolkadotContractInvocationType", + "nullable": false, + "description": "Indicates whether it is a QUERY or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "accountAddress": { + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/web3SigningCredential", + "nullable": false + }, + "metadata": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "contractAddress": { + "type": "string", + "nullable": false + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "gasLimit": { + "type": "object", + "required": ["refTime", "proofSize"], + "properties": { + "refTime": { + "type": "integer", + "minimum": 0 + }, + "proofSize": { + "type": "integer", + "minimum": 0 + } + } + }, + "storageDepositLimit": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer", + "minimum": 0 + } + ], + "nullable": true + }, + "balance": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer", + "minimum": 0 + } + ] + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeContractResponse": { + "type": "object", + "required": ["success"], + "properties": { + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + }, + "txHash": { + "type": "string", + "nullable": false + }, + "blockHash": { + "type": "string", + "nullable": false + } + } + }, + "ErrorExceptionResponse": { + "type": "object", + "description": "Error response from the connector.", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "description": "Short error description message.", + "nullable": false + }, + "error": { + "type": "string", + "description": "Detailed error information.", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetrics", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-transaction-info": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-transaction-info" + } + }, + "operationId": "getTransactionInfo", + "summary": "Get the necessary Transaction Info for a account", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransactionInfoRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransactionInfoResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-raw-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/get-raw-transaction" + } + }, + "operationId": "getRawTransaction", + "summary": "Get raw unsigned transaction", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RawTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RawTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/sign-raw-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/sign-raw-transaction" + } + }, + "operationId": "signRawTransaction", + "summary": "sign the raw transaction", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignRawTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignRawTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/run-transaction" + } + }, + "operationId": "runTransaction", + "summary": "Executes a transaction on a Polkadot ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/deploy-contract-ink": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/deploy-contract-ink" + } + }, + "operationId": "deployContractInk", + "summary": "Deploys the ink! contract", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractInkRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractInkResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/invoke-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-polkadot/invoke-contract" + } + }, + "operationId": "invokeContract", + "summary": "Invokes a contract on a polkadot ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-quorum/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..09dd3b6054 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/json/openapi.tpl.json @@ -0,0 +1,1434 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Quorum", + "description": "Can perform basic tasks on a Quorum ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialGethKeychainPassword" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialGethKeychainPassword": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "secret": { + "type": "string", + "description": "A geth keychain unlock password.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 66, + "maxLength": 66, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "EthContractInvocationType": { + "type": "string", + "enum": ["SEND", "CALL"] + }, + "EthContractInvocationWeb3Method": { + "type": "string", + "enum": ["send", "call", "encodeABI", "estimateGas"] + }, + "SolidityContractJsonArtifact": { + "type": "object", + "required": ["contractName"], + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "metadata": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false + }, + "deployedBytecode": { + "type": "string", + "nullable": false + }, + "sourceMap": { + "type": "string", + "nullable": false + }, + "deployedSourceMap": { + "type": "string", + "nullable": false + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object", + "additionalProperties": true, + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "functionHashes": { + "type": "object", + "additionalProperties": true + }, + "gasEstimates": { + "properties": { + "creation": { + "type": "object", + "properties": { + "codeDepositCost": { + "type": "string" + }, + "executionCost": { + "type": "string" + }, + "totalCost": { + "type": "string" + } + } + }, + "external": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "QuorumTransactionConfig": { + "type": "object", + "required": [], + "additionalProperties": true, + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + }, + "from": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "to": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "data": { + "oneOf": [ + { + "type": "string" + } + ] + } + } + }, + "QuorumPrivateTransactionConfig": { + "type": "object", + "required": ["privateFor"], + "properties": { + "privateFrom": { + "type": "string", + "nullable": false + }, + "privateFor": { + "type": "array", + "default": [], + "items": {}, + "nullable": false + }, + "isPrivate": { + "type": "boolean", + "default": false, + "nullable": false + }, + "gasPrice": { + "type": "number", + "nullable": false + }, + "gasLimit": { + "type": "number", + "nullable": false + }, + "privateKey": { + "type": "string", + "nullable": false + }, + "privacyGroupId": { + "type": "string", + "nullable": false + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "number", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "number", + "nullable": false + }, + "gasUsed": { + "type": "number", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + }, + "logs": { + "type": "array", + "default": [], + "items": {}, + "nullable": false + }, + "logsBloom": { + "type": "string", + "nullable": false + }, + "revertReason": { + "type": "string", + "nullable": false + }, + "output": { + "type": "string", + "nullable": false + }, + "commitmentHash": { + "type": "string", + "nullable": false + }, + "cumulativeGasUSed": { + "type": "number", + "nullable": false + } + } + }, + "ContractJSON": { + "type": "object", + "required": ["contractName", "bytecode"], + "additionalProperties": true, + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "abi": { + "description": "The application binary interface of the solidity contract, optional parameter", + "type": "array", + "items": {}, + "nullable": false + }, + "metadata": { + "type": "string" + }, + "deployedBytecode": { + "type": "string" + }, + "sourceMap": { + "type": "string" + }, + "deployedSourceMap": { + "type": "string" + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object" + }, + "networks": { + "type": "object" + }, + "ast": { + "type": "object" + }, + "functionHashes": { + "type": "object" + }, + "gasEstimates": { + "type": "object" + } + } + }, + "RunTransactionRequest": { + "type": "object", + "required": ["web3SigningCredential", "transactionConfig"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "transactionConfig": { + "$ref": "#/components/schemas/QuorumTransactionConfig", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with thehash of the transaction(which indicates successful execution) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/QuorumPrivateTransactionConfig" + } + } + }, + "RunTransactionResponse": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "DeployContractSolidityBytecodeV1Request": { + "type": "object", + "required": ["contractName", "web3SigningCredential", "keychainId"], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractAbi": { + "description": "The application binary interface of the solidity contract", + "type": "array", + "items": {}, + "nullable": false + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "number", + "nullable": false + }, + "nonce": { + "type": "number", + "nullable": false + }, + "value": { + "type": "number", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "type": "object", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + }, + "constructorArgs": { + "description": "The list of arguments to pass in to the constructor of the contract being deployed.", + "type": "array", + "default": [], + "items": {} + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/QuorumPrivateTransactionConfig" + } + } + }, + "DeployContractSolidityBytecodeV1Response": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "DeployContractSolidityBytecodeJsonObjectV1Request": { + "type": "object", + "required": ["web3SigningCredential", "contractJSON"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + }, + "constructorArgs": { + "description": "The list of arguments to pass in to the constructor of the contract being deployed.", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeContractV1Request": { + "type": "object", + "required": [ + "web3SigningCredential", + "invocationType", + "methodName", + "params", + "contractName", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "description": "The contract name to find it in the keychain plugin", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100 + } + } + }, + "InvokeContractJsonObjectV1Request": { + "type": "object", + "required": [ + "web3SigningCredential", + "invocationType", + "methodName", + "params", + "contractJSON", + "contractAddress" + ], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "contractAddress": { + "description": "Address of the solidity contract", + "type": "string", + "nullable": false + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + }, + "privateTransactionConfig": { + "$ref": "#/components/schemas/QuorumPrivateTransactionConfig" + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } + }, + "InvokeRawWeb3EthMethodV1Request": { + "type": "object", + "required": ["methodName"], + "additionalProperties": false, + "properties": { + "methodName": { + "description": "The name of the web3.eth method to invoke", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass to web3.eth method specified in methodName", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeRawWeb3EthMethodV1Response": { + "type": "object", + "required": ["status"], + "additionalProperties": false, + "properties": { + "status": { + "type": "number", + "nullable": false, + "description": "Status code of the operation" + }, + "data": { + "description": "Output of requested web3.eth method" + }, + "errorDetail": { + "type": "string", + "nullable": false, + "description": "Error details" + } + } + }, + "InvokeRawWeb3EthContractV1Request": { + "type": "object", + "required": ["abi", "address", "invocationType", "contractMethod"], + "additionalProperties": false, + "properties": { + "abi": { + "description": "The application binary interface of the solidity contract", + "type": "array", + "items": {} + }, + "address": { + "description": "Deployed solidity contract address", + "type": "string" + }, + "invocationType": { + "description": "Contract invocation method to be performed (send, call, etc...)", + "$ref": "#/components/schemas/EthContractInvocationWeb3Method" + }, + "invocationParams": { + "description": "The list of arguments for contract invocation method (send, call, etc...)", + "type": "object", + "default": {} + }, + "contractMethod": { + "description": "Method of deployed solidity contract to execute", + "type": "string" + }, + "contractMethodArgs": { + "description": "The list of arguments for deployed solidity contract method", + "type": "array", + "default": [], + "items": {} + } + } + }, + "InvokeRawWeb3EthContractV1Response": { + "type": "object", + "required": ["status"], + "additionalProperties": false, + "properties": { + "status": { + "description": "Status code of the operation", + "type": "number" + }, + "data": { + "description": "Output of contract invocation method" + }, + "errorDetail": { + "description": "Error details", + "type": "string" + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.quorum.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Options": { + "type": "object", + "properties": { + "getBlockData": { + "type": "boolean" + } + } + }, + "Web3BlockHeader": { + "type": "object", + "required": [ + "number", + "hash", + "parentHash", + "nonce", + "sha3Uncles", + "logsBloom", + "transactionRoot", + "stateRoot", + "receiptRoot", + "miner", + "extraData", + "gasLimit", + "gasUsed", + "timestamp" + ], + "properties": { + "number": { + "type": "number" + }, + "hash": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "receiptsRoot": { + "type": "string" + }, + "difficulty": { + "type": "string" + }, + "mixHash": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "extraData": { + "type": "string" + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "timestamp": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + } + }, + "Web3Transaction": { + "type": "object", + "required": [ + "hash", + "nonce", + "blockHash", + "blockNumber", + "transactionIndex", + "from", + "to", + "value", + "gasPrice", + "gas", + "input" + ], + "properties": { + "hash": { + "type": "string" + }, + "nonce": { + "type": "number" + }, + "blockHash": { + "type": "string", + "nullable": true + }, + "blockNumber": { + "type": "number", + "nullable": true + }, + "transactionIndex": { + "type": "number", + "nullable": true + }, + "from": { + "type": "string" + }, + "to": { + "type": "string", + "nullable": true + }, + "value": { + "type": "string" + }, + "gasPrice": { + "type": "string" + }, + "gas": { + "type": "number" + }, + "input": { + "type": "string" + }, + "v": { + "type": "string" + }, + "r": { + "type": "string" + }, + "s": { + "type": "string" + } + } + }, + "WatchBlocksV1BlockData": { + "type": "object", + "required": [ + "number", + "hash", + "parentHash", + "nonce", + "sha3Uncles", + "logsBloom", + "transactionRoot", + "stateRoot", + "receiptRoot", + "miner", + "extraData", + "gasLimit", + "gasUsed", + "timestamp", + "size", + "totalDifficulty", + "uncles", + "transactions" + ], + "properties": { + "number": { + "type": "number" + }, + "hash": { + "type": "string" + }, + "parentHash": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "sha3Uncles": { + "type": "string" + }, + "logsBloom": { + "type": "string" + }, + "transactionsRoot": { + "type": "string" + }, + "stateRoot": { + "type": "string" + }, + "receiptsRoot": { + "type": "string" + }, + "difficulty": { + "type": "string" + }, + "mixHash": { + "type": "string" + }, + "miner": { + "type": "string" + }, + "extraData": { + "type": "string" + }, + "gasLimit": { + "type": "integer" + }, + "gasUsed": { + "type": "integer" + }, + "timestamp": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "size": { + "type": "number" + }, + "totalDifficulty": { + "type": "string" + }, + "uncles": { + "type": "array", + "items": { + "type": "string" + } + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Web3Transaction" + } + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "properties": { + "blockHeader": { + "$ref": "#/components/schemas/Web3BlockHeader" + }, + "blockData": { + "$ref": "#/components/schemas/WatchBlocksV1BlockData" + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode" + } + }, + "operationId": "deployContractSolBytecodeV1", + "summary": "Deploys the bytecode of a Solidity contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode-json-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/deploy-contract-solidity-bytecode-json-object" + } + }, + "operationId": "deployContractSolBytecodeJsonObjectV1", + "summary": "Deploys the bytecode of a Solidity contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeJsonObjectV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractSolidityBytecodeV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/run-transaction" + } + }, + "operationId": "runTransactionV1", + "summary": "Executes a transaction on a quorum ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract" + } + }, + "operationId": "invokeContractV1", + "summary": "Invokes a contract on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract-json-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-contract-json-object" + } + }, + "operationId": "invokeContractV1NoKeychain", + "summary": "Invokes a contract on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractJsonObjectV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-method": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-method" + } + }, + "operationId": "invokeWeb3EthMethodV1", + "summary": "Invoke any method from web3.eth (low-level)", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthMethodV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthMethodV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-quorum/invoke-raw-web3eth-contract" + } + }, + "operationId": "invokeRawWeb3EthContractV1", + "summary": "Low-level endpoint to invoke a method on deployed contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/InvokeRawWeb3EthContractV1Response" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-sawtooth/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-sawtooth/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..e408ca6534 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-sawtooth/src/main/json/openapi.tpl.json @@ -0,0 +1,363 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Sawtooth", + "description": "Can perform basic tasks on a Sawtooth ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "SawtoothTransactionHeaderV1": { + "required": [ + "batcher_public_key", + "dependencies", + "family_name", + "family_version", + "inputs", + "nonce", + "outputs", + "payload_sha512", + "signer_public_key" + ], + "properties": { + "batcher_public_key": { + "type": "string", + "example": "02d260a46457a064733153e09840c322bee1dff34445d7d49e19e60abd18fd0758" + }, + "dependencies": { + "type": "array", + "items": { + "type": "string", + "example": "1baee350bdb60bcee60e3d325d43283cf830b4c23b2cb17d3bb43935bd7af3761c2bee79847c72a9e396a9ae58f48add4e43f94eb83f84442c6085c1dd5d4dbe" + } + }, + "family_name": { + "type": "string", + "example": "intkey" + }, + "family_version": { + "type": "string", + "example": "1.0" + }, + "inputs": { + "type": "array", + "items": { + "type": "string", + "example": "1cf12650d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c" + } + }, + "nonce": { + "type": "string", + "example": "QAApS4L" + }, + "outputs": { + "type": "array", + "items": { + "type": "string", + "example": "1cf12650d858e0985ecc7f60418aaf0cc5ab587f42c2570a884095a9e8ccacd0f6545c" + } + }, + "payload_sha512": { + "type": "string", + "example": "fb6135ef73f4fe77367f9384b3bbbb158f4b8603c9d612157108e5c271868fce2242ee4abd7a29397ba63780c3ccab13783dfd4d9f0167beda03cdb0e37b87f4" + }, + "signer_public_key": { + "type": "string", + "example": "038bba5708acc262464c9fe30d3de9e905a9a5fa30cedd151dd9cd09ea26d46d00" + } + } + }, + "SawtoothTransactionV1": { + "required": ["header", "header_signature", "payload"], + "properties": { + "header": { + "$ref": "#/components/schemas/SawtoothTransactionHeaderV1" + }, + "header_signature": { + "type": "string", + "example": "540a6803971d1880ec73a96cb97815a95d374cbad5d865925e5aa0432fcf1931539afe10310c122c5eaae15df61236079abbf4f258889359c4d175516934484a" + }, + "payload": { + "type": "string" + } + } + }, + "SawtoothBatchHeaderV1": { + "required": ["signer_public_key", "transaction_ids"], + "properties": { + "signer_public_key": { + "type": "string", + "example": "038bba5708acc262464c9fe30d3de9e905a9a5fa30cedd151dd9cd09ea26d46d00" + }, + "transaction_ids": { + "type": "array", + "items": { + "type": "string", + "example": "540a6803971d1880ec73a96cb97815a95d374cbad5d865925e5aa0432fcf1931539afe10310c122c5eaae15df61236079abbf4f258889359c4d175516934484a" + } + } + } + }, + "SawtoothBatchV1": { + "required": ["header", "header_signature", "transactions"], + "properties": { + "header": { + "$ref": "#/components/schemas/SawtoothBatchHeaderV1" + }, + "header_signature": { + "type": "string", + "example": "89807bfc9089e37e00d87d97357de14cfbc455cd608438d426a625a30a0da9a31c406983803c4aa27e1f32a3ff61709e8ec4b56abbc553d7d330635b5d27029c" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SawtoothTransactionV1" + } + } + } + }, + "SawtoothBlockHeaderV1": { + "required": [ + "batch_ids", + "block_num", + "consensus", + "previous_block_id", + "signer_public_key", + "state_root_hash" + ], + "properties": { + "block_num": { + "type": "integer", + "example": 12345 + }, + "previous_block_id": { + "type": "string", + "example": "65cd3a3ce088b265b626f704b7f3db97b6f12e848dccb35d7806f3d0324c71b709ed360d602b8b658b94695374717e3bdb4b76f77886953777d5d008558247dd" + }, + "signer_public_key": { + "type": "string", + "example": "02d260a46457a064733153e09840c322bee1dff34445d7d49e19e60abd18fd0758" + }, + "batch_ids": { + "type": "array", + "items": { + "type": "string", + "example": "89807bfc9089e37e00d87d97357de14cfbc455cd608438d426a625a30a0da9a31c406983803c4aa27e1f32a3ff61709e8ec4b56abbc553d7d330635b5d27029c" + } + }, + "consensus": { + "type": "string" + }, + "state_root_hash": { + "type": "string", + "example": "708ca7fbb701799bb387f2e50deaca402e8502abe229f705693d2d4f350e1ad6" + } + } + }, + "SawtoothBlockV1": { + "required": ["header", "header_signature", "batches"], + "properties": { + "header": { + "$ref": "#/components/schemas/SawtoothBlockHeaderV1" + }, + "header_signature": { + "type": "string", + "example": "65cd3a3ce088b265b626f704b7f3db97b6f12e848dccb35d7806f3d0324c71b709ed360d602b8b658b94695374717e3bdb4b76f77886953777d5d008558247dd" + }, + "batches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SawtoothBatchV1" + } + } + } + }, + "CactiTransactionV1": { + "description": "Sawtooth transaction with additional fields filled by Cacti connector.", + "type": "object", + "allOf": [ + { + "$ref": "#/components/schemas/SawtoothTransactionV1" + }, + { + "type": "object", + "required": ["payload_decoded"], + "properties": { + "payload_decoded": { + "description": "Decoded payload of sawtooth transaction.", + "example": "[{'Verb':'inc','Name':'monitorTest3','Value':11}]}]" + } + } + } + ] + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cacti.api.async.sawtooth.WatchBlocksV1.Subscribe", + "org.hyperledger.cacti.api.async.sawtooth.WatchBlocksV1.Next", + "org.hyperledger.cacti.api.async.sawtooth.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cacti.api.async.sawtooth.WatchBlocksV1.Error", + "org.hyperledger.cacti.api.async.sawtooth.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1ListenerType": { + "type": "string", + "description": "Response type from WatchBlocks. 'Cacti*' are custom views, others correspond to plain sawtooth data.", + "enum": ["full", "cacti:transactions"], + "x-enum-varnames": ["Full", "CactiTransactions"] + }, + "WatchBlocksV1TransactionFilter": { + "type": "object", + "properties": { + "family_name": { + "type": "string" + } + } + }, + "WatchBlocksV1Options": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/WatchBlocksV1ListenerType", + "description": "Type of response block to return.", + "nullable": false + }, + "txFilterBy": { + "$ref": "#/components/schemas/WatchBlocksV1TransactionFilter", + "description": "Filter specification for transactions (only used when selected CactiTransactions response type).", + "nullable": false + } + } + }, + "WatchBlocksV1CactiTransactionsResponse": { + "type": "object", + "description": "Custom response containing block transactions summary.", + "required": ["cactiTransactionsEvents"], + "properties": { + "cactiTransactionsEvents": { + "description": "List of sawtooth transactions matching specifid (optional) filter", + "type": "array", + "items": { + "$ref": "#/components/schemas/CactiTransactionV1", + "nullable": false + } + } + } + }, + "WatchBlocksV1FullResponse": { + "type": "object", + "description": "Response that returns entire sawtooth block.", + "required": ["fullBlock"], + "properties": { + "fullBlock": { + "description": "Full commited block.", + "$ref": "#/components/schemas/SawtoothBlockV1", + "nullable": false + } + } + }, + "WatchBlocksV1Progress": { + "description": "Response block from WatchBlocks endpoint. Depends on 'type' passed in subscription options.", + "oneOf": [ + { + "$ref": "#/components/schemas/WatchBlocksV1CactiTransactionsResponse", + "nullable": false + }, + { + "$ref": "#/components/schemas/WatchBlocksV1FullResponse", + "nullable": false + } + ] + }, + "StatusResponseV1": { + "description": "Response with plugin and validator status report.", + "type": "object", + "required": ["instanceId"], + "properties": { + "instanceId": { + "type": "string", + "nullable": false, + "description": "Plugin instance id." + }, + "openApiSpecVersion": { + "type": "string", + "nullable": false, + "description": "Version of connectors Open API Spec." + }, + "initialized": { + "type": "boolean", + "nullable": false, + "description": "True if endpoints were created, false otherwise" + }, + "sawtoothStatus": { + "nullable": false, + "description": "Response from sawtooth Rest API status endpoint" + } + } + }, + "ErrorExceptionResponseV1": { + "type": "object", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "nullable": false + }, + "error": { + "type": "string", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-sawtooth/status": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-sawtooth/status" + } + }, + "operationId": "getStatusV1", + "summary": "Get the status of the connector and the sawtooth validator", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/StatusResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-xdai/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-xdai/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..c92639de5c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-xdai/src/main/json/openapi.tpl.json @@ -0,0 +1,1033 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Connector Xdai", + "description": "Can perform basic tasks on a Xdai ledger", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "ReceiptType": { + "description": "Enumerates the possible types of receipts that can be waited for by someone or something that has requested the execution of a transaction on a ledger.", + "type": "string", + "enum": ["NODE_TX_POOL_ACK", "LEDGER_BLOCK_ACK"] + }, + "ConsistencyStrategy": { + "type": "object", + "required": ["receiptType", "blockConfirmations"], + "properties": { + "receiptType": { + "$ref": "#/components/schemas/ReceiptType" + }, + "timeoutMs": { + "type": "integer", + "description": "The amount of milliseconds to wait for the receipt to arrive to the connector. Defaults to 0 which means to wait for an unlimited amount of time. Note that this wait may be interrupted still by other parts of the infrastructure such as load balancers cutting of HTTP requests after some time even if they are the type that is supposed to be kept alive. The question of re-entrance is a broader topic not in scope to discuss here, but it is important to mention it.", + "minimum": 0 + }, + "blockConfirmations": { + "type": "integer", + "minimum": 0, + "maximum": 20000, + "description": "The number of blocks to wait to be confirmed in addition to the block containing the transaction in question. Note that if the receipt type is set to only wait for node transaction pool ACK and this parameter is set to anything, but zero then the API will not accept the request due to conflicting parameters." + }, + "pollIntervalMs": { + "type": "integer", + "minimum": 0, + "description": "The amount of time (in milliseconds) connector will wait before making another confiramtion request to the network in case of previous confiramtion request fails" + } + } + }, + "Web3SigningCredential": { + "type": "object", + "required": ["type"], + "discriminator": { + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/Web3SigningCredentialCactusKeychainRef" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex" + }, + { + "$ref": "#/components/schemas/Web3SigningCredentialNone" + } + ], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialCactusKeychainRef": { + "type": "object", + "required": ["type", "ethAccount", "keychainId", "keychainEntryKey"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "keychainEntryKey": { + "type": "string", + "description": "The key to use when looking up the the keychain entry holding the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + }, + "keychainId": { + "type": "string", + "description": "The keychain ID to use when looking up the the keychain plugin instance that will be used to retrieve the secret pointed to by the keychainEntryKey parameter.", + "minLength": 0, + "maxLength": 1024 + } + } + }, + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + }, + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "Web3SigningCredentialNone": { + "type": "object", + "required": ["type"], + "description": "Using this denotes that there is no signing required because the transaction is pre-signed.", + "properties": { + "type": { + "$ref": "#/components/schemas/Web3SigningCredentialType" + } + } + }, + "Web3SigningCredentialType": { + "type": "string", + "enum": [ + "CACTUS_KEYCHAIN_REF", + "GETH_KEYCHAIN_PASSWORD", + "PRIVATE_KEY_HEX", + "NONE" + ] + }, + "EthContractInvocationType": { + "type": "string", + "enum": ["SEND", "CALL"] + }, + "SolidityContractJsonArtifact": { + "type": "object", + "required": ["contractName"], + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "metadata": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false + }, + "deployedBytecode": { + "type": "string", + "nullable": false + }, + "sourceMap": { + "type": "string", + "nullable": false + }, + "deployedSourceMap": { + "type": "string", + "nullable": false + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object", + "additionalProperties": true, + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "functionHashes": { + "type": "object", + "additionalProperties": true + }, + "gasEstimates": { + "properties": { + "creation": { + "type": "object", + "properties": { + "codeDepositCost": { + "type": "string" + }, + "executionCost": { + "type": "string" + }, + "totalCost": { + "type": "string" + } + } + }, + "external": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "XdaiTransactionConfig": { + "type": "object", + "additionalProperties": true, + "properties": { + "rawTransaction": { + "type": "string", + "nullable": false + }, + "from": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "to": { + "oneOf": [ + { + "type": "string" + } + ] + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "data": { + "oneOf": [ + { + "type": "string" + } + ] + } + } + }, + "Web3TransactionReceipt": { + "type": "object", + "required": [ + "blockHash", + "blockNumber", + "transactionHash", + "transactionIndex", + "status", + "from", + "to", + "gasUsed" + ], + "additionalProperties": true, + "properties": { + "status": { + "type": "boolean", + "nullable": false + }, + "transactionHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "transactionIndex": { + "type": "number", + "nullable": false + }, + "blockHash": { + "type": "string", + "minLength": 66, + "maxLength": 66, + "pattern": "^0x([A-Fa-f0-9]{64})$" + }, + "blockNumber": { + "type": "number", + "nullable": false + }, + "gasUsed": { + "type": "number", + "nullable": false + }, + "contractAddress": { + "type": "string", + "nullable": true + }, + "from": { + "type": "string", + "nullable": false + }, + "to": { + "type": "string", + "nullable": false + } + } + }, + "ContractJSON": { + "type": "object", + "required": ["contractName", "bytecode", "abi"], + "additionalProperties": true, + "properties": { + "contractName": { + "type": "string", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "abi": { + "description": "The application binary interface of the solidity contract, optional parameter", + "type": "array", + "items": {}, + "nullable": false + }, + "metadata": { + "type": "string" + }, + "deployedBytecode": { + "type": "string" + }, + "sourceMap": { + "type": "string" + }, + "deployedSourceMap": { + "type": "string" + }, + "sourcePath": { + "type": "string" + }, + "compiler": { + "type": "object" + }, + "networks": { + "type": "object" + }, + "ast": { + "type": "object" + }, + "functionHashes": { + "type": "object" + }, + "gasEstimates": { + "type": "object" + } + } + }, + "RunTransactionV1Request": { + "type": "object", + "required": [ + "web3SigningCredential", + "transactionConfig", + "consistencyStrategy" + ], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "transactionConfig": { + "$ref": "#/components/schemas/XdaiTransactionConfig", + "nullable": false + }, + "consistencyStrategy": { + "$ref": "#/components/schemas/ConsistencyStrategy" + } + } + }, + "RunTransactionV1Response": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "DeployContractV1Request": { + "type": "object", + "required": ["contractName", "web3SigningCredential", "keychainId"], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "DeployContractJsonObjectV1Request": { + "type": "object", + "required": ["web3SigningCredential", "contractJSON"], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + }, + "constructorArgs": { + "description": "The list of arguments to pass in to the constructor of the contract being deployed.", + "type": "array", + "default": [], + "items": {} + } + } + }, + "DeployContractV1Response": { + "type": "object", + "required": ["transactionReceipt"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + } + } + }, + "InvokeContractV1Request": { + "type": "object", + "required": [ + "contractName", + "web3SigningCredential", + "invocationType", + "methodName", + "params", + "keychainId" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "description": "The contract name to find it in the keychain plugin", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "keychainId": { + "type": "string", + "description": "The keychainId for retrieve the contracts json.", + "minLength": 1, + "maxLength": 100 + } + } + }, + "InvokeContractJsonObjectV1Request": { + "type": "object", + "required": [ + "web3SigningCredential", + "invocationType", + "methodName", + "params", + "contractJSON", + "contractAddress" + ], + "additionalProperties": false, + "properties": { + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "contractAddress": { + "description": "Address of the solidity contract", + "type": "string", + "nullable": false + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + } + } + }, + "InvokeContractV1Response": { + "type": "object", + "required": ["success"], + "properties": { + "transactionReceipt": { + "$ref": "#/components/schemas/Web3TransactionReceipt" + }, + "callOutput": {}, + "success": { + "type": "boolean", + "nullable": false + } + } + }, + "PrometheusExporterMetricsResponse": { + "type": "string", + "nullable": false + }, + "DeployRequestBaseV1": { + "type": "object", + "required": ["contractJSON", "web3SigningCredential"], + "properties": { + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "InvokeRequestBaseV1": { + "type": "object", + "required": [ + "contractAddress", + "web3SigningCredential", + "invocationType", + "methodName", + "params", + "contractJSON" + ], + "additionalProperties": false, + "properties": { + "contractAddress": { + "description": "Address of the solidity contract", + "type": "string", + "nullable": false + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredential", + "nullable": false + }, + "invocationType": { + "$ref": "#/components/schemas/EthContractInvocationType", + "nullable": false, + "description": "Indicates wether it is a CALL or a SEND type of invocation where only SEND ends up creating an actual transaction on the ledger." + }, + "methodName": { + "description": "The name of the contract method to invoke.", + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 2048 + }, + "params": { + "description": "The list of arguments to pass in to the contract method being invoked.", + "type": "array", + "default": [], + "items": {} + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gas": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "gasPrice": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + }, + "nonce": { + "type": "number" + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt beforegiving up and crashing. Only has any effect if the invocation type is SEND", + "minimum": 0, + "default": 60000, + "nullable": false + }, + "contractJSON": { + "$ref": "#/components/schemas/ContractJSON", + "description": "For use when not using keychain, pass the contract in as this variable", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/deploy-contract-solidity-bytecode": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/deploy-contract-solidity-bytecode" + } + }, + "operationId": "deployContractV1", + "summary": "Deploys the bytecode of a Solidity contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/deploy-contract-solidity-bytecode-json-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/deploy-contract-solidity-bytecode-json-object" + } + }, + "operationId": "deployContractJsonObjectV1", + "summary": "Deploys the bytecode of a Solidity contract.", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractJsonObjectV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/run-transaction": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/run-transaction" + } + }, + "operationId": "runTransactionV1", + "summary": "Executes a transaction on a xdai ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RunTransactionV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/invoke-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/invoke-contract" + } + }, + "operationId": "invokeContractV1", + "summary": "Invokes a contract on a xdai ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/invoke-contract-json-object": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/invoke-contract-json-object" + } + }, + "operationId": "invokeContractJsonObject", + "summary": "Invokes a contract on a besu ledger", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractJsonObjectV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InvokeContractV1Response" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/get-prometheus-exporter-metrics": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-xdai/get-prometheus-exporter-metrics" + } + }, + "operationId": "getPrometheusMetricsV1", + "summary": "Get the Prometheus Metrics", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/PrometheusExporterMetricsResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-persistence-ethereum/src/main/json/openapi.tpl.json b/packages/cactus-plugin-persistence-ethereum/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..8c6b2365b8 --- /dev/null +++ b/packages/cactus-plugin-persistence-ethereum/src/main/json/openapi.tpl.json @@ -0,0 +1,164 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Persistence Ethereum", + "description": "Synchronizes state of an ethereum ledger into a DB that can later be viewed in GUI", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "TokenTypeV1": { + "type": "string", + "enum": ["erc20", "erc721"], + "x-enum-descriptions": [ + "EIP-20: Token Standard", + "EIP-721: Non-Fungible Token Standard" + ], + "x-enum-varnames": ["ERC20", "ERC721"] + }, + "MonitoredToken": { + "description": "Ethereum tokens that are being monitored by the persistence plugin.", + "type": "object", + "required": ["type", "name", "symbol"], + "properties": { + "type": { + "$ref": "#/components/schemas/TokenTypeV1" + }, + "name": { + "type": "string", + "nullable": false, + "description": "Token name" + }, + "symbol": { + "type": "string", + "nullable": false, + "description": "Token symbol" + } + } + }, + "TrackedOperationV1": { + "description": "Persistence plugin operation that is tracked and returned in status report.", + "type": "object", + "required": ["startAt", "operation"], + "properties": { + "startAt": { + "type": "string", + "nullable": false, + "description": "Start time of the operation." + }, + "operation": { + "type": "string", + "nullable": false, + "description": "Operation name." + } + } + }, + "StatusResponseV1": { + "description": "Response with plugin status report.", + "type": "object", + "required": [ + "instanceId", + "connected", + "webServicesRegistered", + "monitoredTokensCount", + "operationsRunning", + "monitorRunning", + "lastSeenBlock" + ], + "properties": { + "instanceId": { + "type": "string", + "nullable": false, + "description": "Plugin instance id." + }, + "connected": { + "type": "boolean", + "nullable": false, + "description": "True if successfully connected to the database, false otherwise." + }, + "webServicesRegistered": { + "type": "boolean", + "nullable": false, + "description": "True if web services were correctly exported." + }, + "monitoredTokensCount": { + "type": "number", + "nullable": false, + "description": "Total number of tokens being monitored by the plugin." + }, + "operationsRunning": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TrackedOperationV1" + } + }, + "monitorRunning": { + "type": "boolean", + "nullable": false, + "description": "True if block monitoring is running, false otherwise." + }, + "lastSeenBlock": { + "type": "number", + "nullable": false, + "description": "Number of the last block seen by the block monitor." + } + } + }, + "ErrorExceptionResponseV1": { + "type": "object", + "required": ["message", "error"], + "properties": { + "message": { + "type": "string", + "nullable": false + }, + "error": { + "type": "string", + "nullable": false + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-persistence-ethereum/status": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-persistence-ethereum/status" + } + }, + "operationId": "getStatusV1", + "summary": "Get the status of persistence plugin for ethereum", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/StatusResponseV1" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorExceptionResponseV1" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-persistence-fabric/src/main/json/openapi.tpl.json b/packages/cactus-plugin-persistence-fabric/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..82b7b02cc5 --- /dev/null +++ b/packages/cactus-plugin-persistence-fabric/src/main/json/openapi.tpl.json @@ -0,0 +1,16 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Block Fabrick PErsistance", + "description": "Scrap fabric ledger into database. Needs administrative privileges.", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": {} + }, + "paths": {} +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/json/openapi.tpl.json b/packages/cactus-plugin-satp-hermes/src/main/json/openapi.tpl.json new file mode 100644 index 0000000000..55b9ee1f3f --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/json/openapi.tpl.json @@ -0,0 +1,1765 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cactus Plugin - Odap Hermes", + "description": "Implementation for Odap and Hermes", + "version": "v2.0.0-alpha.2", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "CredentialProfile": { + "type": "string", + "enum": ["SAML", "OAUTH", "X509"] + }, + "PayloadProfile": { + "type": "object", + "properties": { + "assetProfile": { + "$ref": "#/components/schemas/AssetProfile" + }, + "capabilities": { + "type": "string" + } + }, + "required": ["assetProfile"] + }, + "ApplicationProfile": { + "type": "object" + }, + "Payload": { + "type": "object" + }, + "AssetProfile": { + "type": "object", + "properties": { + "issuer": { + "type": "string" + }, + "assetCode": { + "type": "string" + }, + "assetCodeType": { + "type": "string" + }, + "issuanceDate": { + "type": "string" + }, + "expirationDate": { + "type": "string" + }, + "verificationEndPoint": { + "type": "string" + }, + "digitalSignature": { + "type": "string" + }, + "prospectusLink": { + "type": "string" + }, + "keyInformationLink": { + "type": "array", + "items": {} + }, + "keyWord": { + "type": "array", + "items": {} + }, + "transferRestriction": { + "type": "array", + "items": {} + }, + "ledgerRequirements": { + "type": "array", + "items": {} + } + }, + "required": ["expirationDate"] + }, + "LoggingProfile": { + "type": "array", + "items": { + "type": "string" + } + }, + "AccessControlProfile": { + "type": "array", + "items": { + "type": "string" + } + }, + "Permissions": { + "type": "object" + }, + "Transaction": { + "type": "object" + }, + "ActionCategory": { + "type": "object" + }, + "History": { + "type": "object", + "properties": { + "Transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Transaction" + } + }, + "Actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ActionCategory" + } + }, + "Origin": { + "type": "string" + }, + "Destination": { + "type": "string" + }, + "Balance": { + "type": "string" + }, + "CurrentStatus": { + "type": "object" + }, + "ApplicationSpecificParameters": { + "type": "object" + } + } + }, + "SenderDltSystem": { + "type": "object" + }, + "RecipientDltSystem": { + "type": "object" + }, + "LockEvidenceClaim": { + "type": "object" + }, + "LockClaimFormat": { + "type": "object" + }, + "CommitFinalClaim": { + "type": "object" + }, + "CommitFinalClaimFormat": { + "type": "object" + }, + "CommitAcknowledgementClaim": { + "type": "object" + }, + "CommitAcknowledgementClaimFormat": { + "type": "object" + }, + "SessionData": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "step": { + "type": "number" + }, + "version": { + "type": "string" + }, + "lastSequenceNumber": { + "type": "number" + }, + "loggingProfile": { + "type": "string" + }, + "accessControlProfile": { + "type": "string" + }, + "applicationProfile": { + "type": "string" + }, + "payloadProfile": { + "$ref": "#/components/schemas/PayloadProfile" + }, + "assetProfile": { + "$ref": "#/components/schemas/AssetProfile" + }, + "allowedSourceBackupGateways": { + "type": "array", + "items": { + "type": "string" + } + }, + "allowedRecipientBackupGateways": { + "type": "array", + "items": { + "type": "string" + } + }, + "sourceBasePath": { + "type": "string" + }, + "recipientBasePath": { + "type": "string" + }, + "originatorPubkey": { + "type": "string" + }, + "beneficiaryPubkey": { + "type": "string" + }, + "sourceGatewayPubkey": { + "type": "string" + }, + "sourceGatewayDltSystem": { + "type": "string" + }, + "recipientGatewayPubkey": { + "type": "string" + }, + "recipientGatewayDltSystem": { + "type": "string" + }, + "initializationRequestMessageHash": { + "type": "string" + }, + "initializationResponseMessageHash": { + "type": "string" + }, + "initializationRequestMessageRcvTimeStamp": { + "type": "string" + }, + "initializationRequestMessageProcessedTimeStamp": { + "type": "string" + }, + "clientSignatureInitializationRequestMessage": { + "type": "string" + }, + "serverSignatureInitializationResponseMessage": { + "type": "string" + }, + "transferCommenceMessageRequestHash": { + "type": "string" + }, + "transferCommenceMessageResponseHash": { + "type": "string" + }, + "clientSignatureTransferCommenceRequestMessage": { + "type": "string" + }, + "serverSignatureTransferCommenceResponseMessage": { + "type": "string" + }, + "lockEvidenceRequestMessageHash": { + "type": "string" + }, + "lockEvidenceResponseMessageHash": { + "type": "string" + }, + "clientSignatureLockEvidenceRequestMessage": { + "type": "string" + }, + "serverSignatureLockEvidenceResponseMessage": { + "type": "string" + }, + "lockEvidenceClaim": { + "type": "string" + }, + "commitPrepareRequestMessageHash": { + "type": "string" + }, + "commitPrepareResponseMessageHash": { + "type": "string" + }, + "clientSignatureCommitPreparationRequestMessage": { + "type": "string" + }, + "serverSignatureCommitPreparationResponseMessage": { + "type": "string" + }, + "commitFinalRequestMessageHash": { + "type": "string" + }, + "commitFinalResponseMessageHash": { + "type": "string" + }, + "commitFinalClaim": { + "type": "string" + }, + "commitFinalClaimFormat": { + "type": "string" + }, + "commitAcknowledgementClaim": { + "type": "string" + }, + "commitAcknowledgementClaimFormat": { + "type": "string" + }, + "clientSignatureCommitFinalRequestMessage": { + "type": "string" + }, + "serverSignatureCommitFinalResponseMessage": { + "type": "string" + }, + "transferCompleteMessageHash": { + "type": "string" + }, + "clientSignatureTransferCompleteMessage": { + "type": "string" + }, + "maxRetries": { + "type": "number" + }, + "recipientLedgerAssetID": { + "type": "string" + }, + "sourceLedgerAssetID": { + "type": "string" + }, + "maxTimeout": { + "type": "number" + }, + "lastLogEntryTimestamp": { + "type": "string" + }, + "unlockAssetClaim": { + "type": "string" + }, + "recreateAssetClaim": { + "type": "string" + }, + "deleteAssetClaim": { + "type": "string" + }, + "lastMessageReceivedTimestamp": { + "type": "string" + }, + "rollback": { + "type": "boolean" + }, + "rollbackMessageHash": { + "type": "string" + }, + "rollbackProofs": { + "type": "array", + "items": { + "type": "string" + } + }, + "rollbackActionsPerformed": { + "type": "array", + "items": { + "type": "string", + "enum": ["CREATE", "DELETE", "LOCK", "UNLOCK"] + } + } + } + }, + "TransferInitializationV1Request": { + "type": "object", + "properties": { + "messageType": { + "type": "string" + }, + "sessionID": { + "type": "string" + }, + "version": { + "type": "string" + }, + "developerURN": { + "type": "string" + }, + "credentialProfile": { + "$ref": "#/components/schemas/CredentialProfile" + }, + "payloadProfile": { + "$ref": "#/components/schemas/PayloadProfile" + }, + "applicationProfile": { + "type": "string" + }, + "loggingProfile": { + "type": "string" + }, + "accessControlProfile": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "sourceGatewayPubkey": { + "type": "string" + }, + "sourceGatewayDltSystem": { + "type": "string" + }, + "recipientGatewayPubkey": { + "type": "string" + }, + "recipientGatewayDltSystem": { + "type": "string" + }, + "escrowType": { + "type": "string", + "enum": [ + "FAUCET", + "TIMELOCK", + "HASHLOCK", + "HASHTIMELOCK", + "MULTICLAIMPC", + "DESTROY", + "BURN" + ] + }, + "expiryTime": { + "type": "string" + }, + "multipleClaimsAllowed": { + "type": "boolean" + }, + "multipleCancelsAllowed": { + "type": "boolean" + }, + "permissions": { + "$ref": "#/components/schemas/Permissions" + }, + "origin": { + "type": "string" + }, + "destination": { + "type": "string" + }, + "subsequentCalls": { + "type": "object" + }, + "histories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/History" + } + }, + "sequenceNumber": { + "type": "integer" + }, + "sourceBasePath": { + "type": "string" + }, + "recipientBasePath": { + "type": "string" + }, + "maxRetries": { + "type": "number" + }, + "maxTimeout": { + "type": "number" + }, + "backupGatewaysAllowed": { + "type": "array", + "items": { + "type": "string" + } + }, + "recipientLedgerAssetID": { + "type": "string" + }, + "sourceLedgerAssetID": { + "type": "string" + } + }, + "required": [ + "messageType", + "sessionID", + "loggingProfile", + "accessControlProfile", + "payloadProfile", + "applicationProfile", + "signature", + "sourceGatewayPubkey", + "sourceGatewayDltSystem", + "recipientGatewayPubkey", + "recipientGatewayDltSystem", + "sequenceNumber", + "sourceBasePath", + "recipientBasePath", + "maxRetries", + "maxTimeout", + "backupGatewaysAllowed", + "recipientLedgerAssetID", + "sourceLedgerAssetID" + ] + }, + "TransferInitializationV1Response": { + "type": "object", + "properties": { + "messageType": { + "type": "string" + }, + "sessionID": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + }, + "odapPhase": { + "type": "string", + "enum": [ + "TransferInitialization", + "LockEvidenceVerification", + "CommitmentEstablishment" + ] + }, + "initialRequestMessageHash": { + "type": "string" + }, + "destination": { + "type": "string" + }, + "timeStamp": { + "type": "string" + }, + "processedTimeStamp": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "backupGatewaysAllowed": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "messageType", + "initialRequestMessageHash", + "timeStamp", + "processedTimeStamp", + "sessionID", + "serverIdentityPubkey", + "sequenceNumber", + "signature", + "backupGatewaysAllowed" + ] + }, + "TransferCommenceV1Request": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "originatorPubkey": { + "type": "string" + }, + "beneficiaryPubkey": { + "type": "string" + }, + "senderDltSystem": { + "type": "string" + }, + "recipientDltSystem": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashAssetProfile": { + "type": "string" + }, + "assetUnit": { + "type": "integer" + }, + "hashPrevMessage": { + "type": "string" + }, + "clientTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "sequenceNumber": { + "type": "integer" + } + }, + "required": [ + "sessionID", + "messageType", + "originatorPubkey", + "beneficiaryPubkey", + "senderDltSystem", + "recipientDltSystem", + "clientIdentityPubkey", + "serverIdentityPubkey", + "hashAssetProfile", + "hashPrevMessage", + "signature", + "sequenceNumber" + ] + }, + "TransferCommenceV1Response": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashCommenceRequest": { + "type": "string" + }, + "serverTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "messageHash": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "serverIdentityPubkey", + "clientIdentityPubkey", + "hashCommenceRequest", + "signature", + "sequenceNumber" + ] + }, + "LockEvidenceV1Request": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "lockEvidenceClaim": { + "type": "string" + }, + "lockEvidenceFormat": { + "$ref": "#/components/schemas/LockClaimFormat", + "nullable": true + }, + "lockEvidenceExpiration": { + "type": "string" + }, + "hashCommenceAckRequest": { + "type": "string" + }, + "clientTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "messageHash": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "lockEvidenceClaim", + "lockEvidenceExpiration", + "hashCommenceAckRequest", + "signature", + "sequenceNumber" + ] + }, + "LockEvidenceV1Response": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashLockEvidenceRequest": { + "type": "string" + }, + "serverTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "hashLockEvidenceRequest", + "signature", + "sequenceNumber" + ] + }, + "CommitPreparationV1Request": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashLockEvidenceAck": { + "type": "string" + }, + "clientTransferNumber": { + "type": "integer" + }, + "signature": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "hashLockEvidenceAck", + "signature", + "sequenceNumber" + ] + }, + "CommitPreparationV1Response": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashCommitPrep": { + "type": "string" + }, + "serverTransferNumber": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "hashCommitPrep", + "signature", + "sequenceNumber" + ] + }, + "CommitFinalV1Request": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "commitFinalClaim": { + "type": "string" + }, + "commitFinalClaimFormat": { + "$ref": "#/components/schemas/CommitFinalClaimFormat" + }, + "hashCommitPrepareAck": { + "type": "string" + }, + "clientTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "commitFinalClaim", + "hashCommitPrepareAck", + "signature", + "sequenceNumber" + ] + }, + "CommitFinalV1Response": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "commitAcknowledgementClaim": { + "type": "string" + }, + "commitAcknowledgementClaimFormat": { + "$ref": "#/components/schemas/CommitAcknowledgementClaimFormat" + }, + "hashCommitFinal": { + "type": "string" + }, + "serverTransferNumber": { + "type": "integer" + }, + "signature": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "commitAcknowledgementClaim", + "hashCommitFinal", + "signature", + "sequenceNumber" + ] + }, + "TransferCompleteV1Request": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "messageType": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "hashCommitFinalAck": { + "type": "string" + }, + "clientTransferNumber": { + "type": "integer", + "nullable": true + }, + "signature": { + "type": "string" + }, + "hashTransferCommence": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + } + }, + "required": [ + "sessionID", + "messageType", + "clientIdentityPubkey", + "serverIdentityPubkey", + "hashCommitFinalAck", + "signature", + "hashTransferCommence", + "sequenceNumber" + ] + }, + "ClientV1Request": { + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "loggingProfile": { + "type": "string" + }, + "accessControlProfile": { + "type": "string" + }, + "assetControlProfile": { + "type": "string" + }, + "applicationProfile": { + "type": "string" + }, + "assetProfile": { + "$ref": "#/components/schemas/AssetProfile" + }, + "payloadProfile": { + "$ref": "#/components/schemas/PayloadProfile" + }, + "sourceGatewayDltSystem": { + "type": "string" + }, + "recipientGatewayDltSystem": { + "type": "string" + }, + "recipientGatewayPubkey": { + "type": "string" + }, + "originatorPubkey": { + "type": "string" + }, + "beneficiaryPubkey": { + "type": "string" + }, + "clientIdentityPubkey": { + "type": "string" + }, + "serverIdentityPubkey": { + "type": "string" + }, + "clientDltSystem": { + "type": "string" + }, + "serverDltSystem": { + "type": "string" + }, + "clientGatewayConfiguration": { + "type": "object", + "properties": { + "apiHost": { + "type": "string" + } + }, + "required": ["apiHost"] + }, + "serverGatewayConfiguration": { + "type": "object", + "properties": { + "apiHost": { + "type": "string" + } + }, + "required": ["apiHost"] + }, + "maxRetries": { + "type": "number" + }, + "maxTimeout": { + "type": "number" + }, + "sourceLedgerAssetID": { + "type": "string" + }, + "recipientLedgerAssetID": { + "type": "string" + } + }, + "required": [ + "version", + "loggingProfile", + "accessControlProfile", + "assetControlProfile", + "applicationProfile", + "assetProfile", + "payloadProfile", + "sourceGatewayDltSystem", + "recipientGatewayDltSystem", + "recipientGatewayPubkey", + "originatorPubkey", + "beneficiaryPubkey", + "clientIdentityPubkey", + "serverIdentityPubkey", + "clientDltSystem", + "serverDltSystem", + "clientGatewayConfiguration", + "serverGatewayConfiguration", + "maxRetries", + "maxTimeout", + "sourceLedgerAssetID", + "recipientLedgerAssetID" + ] + }, + "RecoverV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "odapPhase": { + "type": "string" + }, + "sequenceNumber": { + "type": "number" + }, + "lastLogEntryTimestamp": { + "type": "string" + }, + "isBackup": { + "type": "boolean" + }, + "newBasePath": { + "type": "string" + }, + "newGatewayPubKey": { + "type": "string" + }, + "signature": { + "type": "string" + } + }, + "required": [ + "sessionID", + "odapPhase", + "sequenceNumber", + "lastLogEntryTimestamp", + "isBackup", + "newBasePath", + "signature" + ] + }, + "RecoverUpdateV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "recoveredLogs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LocalLog" + } + }, + "signature": { + "type": "string" + } + }, + "required": ["sessionID", "recoveredLogs", "signature"] + }, + "RecoverUpdateAckV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "changedEntriesHash": { + "type": "array", + "items": { + "type": "string" + } + }, + "signature": { + "type": "string" + } + }, + "required": ["sessionID", "success", "changedEntriesHash", "signature"] + }, + "RecoverSuccessV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "signature": { + "type": "string" + } + }, + "required": ["sessionID", "success", "signature"] + }, + "RollbackV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "actionPerformed": { + "type": "array", + "items": { + "type": "string" + } + }, + "proofs": { + "type": "array", + "items": { + "type": "string" + } + }, + "signature": { + "type": "string" + } + }, + "required": [ + "sessionID", + "success", + "actionPerformed", + "proofs", + "signature" + ] + }, + "RollbackAckV1Message": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "signature": { + "type": "string" + } + }, + "required": ["sessionID", "success", "signature"] + }, + "LocalLog": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "sessionID": { + "type": "string" + }, + "data": { + "type": "string" + }, + "type": { + "type": "string" + }, + "operation": { + "type": "string" + }, + "timestamp": { + "type": "string" + } + }, + "required": ["sessionID", "type", "operation"] + }, + "SatpMessage": { + "type": "object", + "properties": { + "SequenceNumber": { + "type": "number" + }, + "Phase": { + "type": "string", + "enum": [ + "TransferInitialization", + "LockEvidenceVerification", + "CommitmentEstablishment" + ] + }, + "ResourceURL": { + "type": "string" + }, + "DeveloperURN": { + "type": "string" + }, + "ActionResponse": { + "type": "object", + "properties": { + "ResponseCode": { + "type": "string", + "enum": ["200", "404"], + "x-enum-varnames": ["OK", "RESOURCE_NOT_FOUND"] + }, + "Arguments": { + "type": "array", + "items": {} + } + } + }, + "CredentialProfile": { + "type": "string", + "enum": ["SAML", "OAuth", "X509"] + }, + "CredentialBlock": { + "type": "array", + "items": {} + }, + "CredentialsProfile": { + "$ref": "#/components/schemas/PayloadProfile" + }, + "ApplicationProfile": { + "$ref": "#/components/schemas/ApplicationProfile" + }, + "Payload": { + "$ref": "#/components/schemas/Payload" + }, + "PayloadHash": { + "type": "string" + }, + "MessageSignature": { + "type": "string" + } + } + } + } + }, + "paths": { + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationrequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationrequest" + } + }, + "operationId": "phase1TransferInitiationRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferInitializationV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommencerequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommencerequest" + } + }, + "operationId": "phase2TransferCommenceRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferCommenceV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidencerequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidencerequest" + } + }, + "operationId": "phase2LockEvidenceRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LockEvidenceV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationrequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationrequest" + } + }, + "operationId": "phase3CommitPreparationRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommitPreparationV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalrequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalrequest" + } + }, + "operationId": "phase3CommitFinalRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommitFinalV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/transfercompleterequest": { + "get": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/transfercompleterequest" + } + }, + "operationId": "phase3TransferCompleteRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferCompleteV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/clientrequest": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/clientrequest" + } + }, + "operationId": "clientRequestV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationresponse": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationresponse" + } + }, + "operationId": "phase1TransferInitiationResponseV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferInitializationV1Response" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommenceresponse": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommenceresponse" + } + }, + "operationId": "phase2TransferCommenceResponseV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferCommenceV1Response" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidenceresponse": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidenceresponse" + } + }, + "operationId": "phase2LockEvidenceResponseV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LockEvidenceV1Response" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationresponse": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationresponse" + } + }, + "operationId": "phase3CommitPreparationResponseV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommitPreparationV1Response" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalresponse": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalresponse" + } + }, + "operationId": "phase3CommitFinalResponseV1", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommitFinalV1Response" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recovermessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recovermessage" + } + }, + "operationId": "RecoverV1Message", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecoverV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdatemessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdatemessage" + } + }, + "operationId": "RecoverUpdateV1Message", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecoverUpdateV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdateackmessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdateackmessage" + } + }, + "operationId": "RecoverUpdateAckV1Message", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecoverUpdateAckV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoversuccessmessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoversuccessmessage" + } + }, + "operationId": "RecoverV1Success", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecoverSuccessV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackmessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackmessage" + } + }, + "operationId": "RollbackV1Message", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RollbackV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackackmessage": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackackmessage" + } + }, + "operationId": "RollbackAckV1Message", + "description": "", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RollbackAckV1Message" + } + } + } + }, + "responses": { + "200": { + "description": "OK" + } + } + } + } + } +} diff --git a/packages/cactus-test-api-client/src/test/typescript/integration/api-client-routing-node-to-node.test.ts b/packages/cactus-test-api-client/src/test/typescript/integration/api-client-routing-node-to-node.test.ts index 518f2b2980..49bea86fb8 100644 --- a/packages/cactus-test-api-client/src/test/typescript/integration/api-client-routing-node-to-node.test.ts +++ b/packages/cactus-test-api-client/src/test/typescript/integration/api-client-routing-node-to-node.test.ts @@ -203,6 +203,7 @@ describe(testCase, () => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.crpcPort = 0; const config = @@ -249,6 +250,7 @@ describe(testCase, () => { apiServerOptions.apiPort = addressInfo2.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = []; apiServerOptions.crpcPort = 0; diff --git a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts index 1a3be92c69..59988e1d42 100644 --- a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts +++ b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install-version-selection.test.ts @@ -35,6 +35,7 @@ test("can install plugins at runtime with specified version based on imports", a apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install.test.ts b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install.test.ts index 63404b0007..d5c25cbfee 100644 --- a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install.test.ts +++ b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/plugin-import-with-npm-install.test.ts @@ -52,6 +52,7 @@ describe(testcase, () => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts index 864409efca..068b0eed3e 100644 --- a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts +++ b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/remote-plugin-imports.test.ts @@ -80,6 +80,7 @@ describe(testCase, () => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = []; const config = diff --git a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/runtime-plugin-imports.test.ts b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/runtime-plugin-imports.test.ts index d89a4fdb1c..7a9e56fc91 100644 --- a/packages/cactus-test-cmd-api-server/src/test/typescript/integration/runtime-plugin-imports.test.ts +++ b/packages/cactus-test-cmd-api-server/src/test/typescript/integration/runtime-plugin-imports.test.ts @@ -38,6 +38,7 @@ describe(testCase, () => { apiServerOptions.apiPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = [ { diff --git a/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/get-consortium-jws-endpoint.test.ts b/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/get-consortium-jws-endpoint.test.ts index f359eb29ed..e85591c5bd 100644 --- a/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/get-consortium-jws-endpoint.test.ts +++ b/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/get-consortium-jws-endpoint.test.ts @@ -265,6 +265,7 @@ describe(testCase, () => { apiServerOptions.apiPort = addressInfo2.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = []; apiServerOptions.crpcPort = 0; @@ -317,6 +318,7 @@ describe(testCase, () => { apiServerOptions.apiPort = addressInfo3.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; apiServerOptions.plugins = []; apiServerOptions.crpcPort = 0; diff --git a/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/openapi/openapi-validation.test.ts b/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/openapi/openapi-validation.test.ts index 37a7263122..a622f4e008 100644 --- a/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/openapi/openapi-validation.test.ts +++ b/packages/cactus-test-plugin-consortium-manual/src/test/typescript/integration/plugin-consortium-manual/openapi/openapi-validation.test.ts @@ -160,8 +160,10 @@ test(testCase, async (t: Test) => { apiServerOptions.apiCorsDomainCsv = "*"; apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.cockpitPort = 0; apiServerOptions.apiTlsEnabled = false; + apiServerOptions.crpcPort = 0; const config = await configService.newExampleConfigConvict(apiServerOptions); @@ -198,7 +200,9 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo2.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; + apiServerOptions.crpcPort = 0; const config = await configService.newExampleConfigConvict(apiServerOptions); @@ -235,7 +239,9 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo3.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; + apiServerOptions.crpcPort = 0; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/grpc-services/connector-besu-grpc-services.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/grpc-services/connector-besu-grpc-services.test.ts index cf0954e9b6..e995cb0b6a 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/grpc-services/connector-besu-grpc-services.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/grpc-services/connector-besu-grpc-services.test.ts @@ -117,6 +117,7 @@ describe("BesuGrpcSvcOpenApi", () => { apiSrvOpts.apiPort = addressInfo.port; apiSrvOpts.cockpitPort = 0; apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; apiSrvOpts.grpcMtlsEnabled = false; apiSrvOpts.apiTlsEnabled = false; const cfg = await cfgSrv.newExampleConfigConvict(apiSrvOpts); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-balance-endpoint.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-balance-endpoint.test.ts index e32e834119..e92e60a8f8 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-balance-endpoint.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-balance-endpoint.test.ts @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-block-endpoint.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-block-endpoint.test.ts index 2c10383ca9..169a489910 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-block-endpoint.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-block-endpoint.test.ts @@ -104,6 +104,7 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-past-logs-endpoint.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-past-logs-endpoint.test.ts index 6ac37655f2..169265fe5a 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-past-logs-endpoint.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-past-logs-endpoint.test.ts @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-transaction-endpoint.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-transaction-endpoint.test.ts index 3c5f24b21b..14e1b79d45 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-transaction-endpoint.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/get-transaction-endpoint.test.ts @@ -106,6 +106,7 @@ test(testCase, async (t: Test) => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/sign-transaction-endpoint.test.ts b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/sign-transaction-endpoint.test.ts index 75c40ed146..db85b1d7d5 100644 --- a/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/sign-transaction-endpoint.test.ts +++ b/packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-validator-besu/sign-transaction-endpoint.test.ts @@ -112,6 +112,7 @@ describe(testCase, () => { apiServerOptions.apiPort = addressInfo1.port; apiServerOptions.cockpitPort = 0; apiServerOptions.grpcPort = 0; + apiServerOptions.crpcPort = 0; apiServerOptions.apiTlsEnabled = false; const config = await configService.newExampleConfigConvict(apiServerOptions); diff --git a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts index 8fba66f734..58033cec1a 100644 --- a/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts +++ b/packages/cactus-test-tooling/src/main/typescript/fabric/fabric-test-ledger-v1.ts @@ -375,17 +375,9 @@ export class FabricTestLedgerV1 implements ITestLedger { public async getConnectionProfileOrg1(): Promise { const cInfo = await this.getContainerInfo(); const container = this.getContainer(); - const CCP_JSON_PATH_FABRIC_V1 = - "/fabric-samples/first-network/connection-org1.json"; const CCP_JSON_PATH_FABRIC_V2 = "/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.json"; - const ccpJsonPath = compareVersions.compare( - this.getFabricVersion(), - "2.0", - "<", - ) - ? CCP_JSON_PATH_FABRIC_V1 - : CCP_JSON_PATH_FABRIC_V2; + const ccpJsonPath = CCP_JSON_PATH_FABRIC_V2; const ccpJson = await Containers.pullFile(container, ccpJsonPath); const ccp = JSON.parse(ccpJson); @@ -422,17 +414,11 @@ export class FabricTestLedgerV1 implements ITestLedger { const privatePort = 7050; const hostPort = await Containers.getPublicPort(privatePort, cInfo); const url = `grpcs://localhost:${hostPort}`; - const ORDERER_PEM_PATH_FABRIC_V1 = - "/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; + const ORDERER_PEM_PATH_FABRIC_V2 = "/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"; - const ordererPemPath = compareVersions.compare( - this.getFabricVersion(), - "2.0", - "<", - ) - ? ORDERER_PEM_PATH_FABRIC_V1 - : ORDERER_PEM_PATH_FABRIC_V2; + + const ordererPemPath = ORDERER_PEM_PATH_FABRIC_V2; const pem = await Containers.pullFile(container, ordererPemPath); ccp.orderers = { @@ -498,16 +484,8 @@ export class FabricTestLedgerV1 implements ITestLedger { const peer1Name = `peer1.${orgName}.example.com`; const cInfo = await this.getContainerInfo(); const container = this.getContainer(); - const CCP_JSON_PATH_FABRIC_V1 = - "/fabric-samples/first-network/connection-" + orgName + ".json"; const CCP_JSON_PATH_FABRIC_V2 = connectionProfilePath; - const ccpJsonPath = compareVersions.compare( - this.getFabricVersion(), - "2.0", - "<", - ) - ? CCP_JSON_PATH_FABRIC_V1 - : CCP_JSON_PATH_FABRIC_V2; + const ccpJsonPath = CCP_JSON_PATH_FABRIC_V2; try { const cId = container.id; this.log.debug(`${fnTag} Pull Fabric CP %s :: %s`, cId, ccpJsonPath); @@ -557,17 +535,9 @@ export class FabricTestLedgerV1 implements ITestLedger { const privatePort = 7050; const hostPort = await Containers.getPublicPort(privatePort, cInfo); const url = `grpcs://localhost:${hostPort}`; - const ORDERER_PEM_PATH_FABRIC_V1 = - "/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem"; const ORDERER_PEM_PATH_FABRIC_V2 = "/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"; - const ordererPemPath = compareVersions.compare( - this.getFabricVersion(), - "2.0", - "<", - ) - ? ORDERER_PEM_PATH_FABRIC_V1 - : ORDERER_PEM_PATH_FABRIC_V2; + const ordererPemPath = ORDERER_PEM_PATH_FABRIC_V2; const pem = await Containers.pullFile(container, ordererPemPath); ccp.orderers = { "orderer.example.com": { diff --git a/tools/bundle-open-api-tpl-files.ts b/tools/bundle-open-api-tpl-files.ts new file mode 100644 index 0000000000..1c26683667 --- /dev/null +++ b/tools/bundle-open-api-tpl-files.ts @@ -0,0 +1,255 @@ +import { fileURLToPath } from "node:url"; +import path from "node:path"; +import debug from "debug"; +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; +import fs from "fs-extra"; +import { globby, Options as GlobbyOptions } from "globby"; +import { RuntimeError } from "run-time-error"; +import prettier from "prettier"; +import { OpenAPIV3_1 } from "openapi-types"; +import { bundle, loadConfig, NormalizedProblem } from "@redocly/openapi-core"; +import { BundleResult } from "@redocly/openapi-core/lib/bundle"; + +const TAG = "tools:bundle-open-api-tpl-files"; +const log = debug(TAG); + +export interface IBundleOpenApiTplFilesV1Request { + readonly argv: string[]; + readonly checkGitDiffDisabled: boolean; + readonly specTemplateGlobs: Readonly>; + readonly specTemplateIgnoreGlobs: string[]; + readonly workingDirectory: Readonly; +} + +export interface IBundleOpenApiTplFilesV1Response { + readonly request: Readonly; + readonly specFilePaths: Readonly>; + readonly bundleProblems: Readonly>; + readonly totalBundleProblemCount: number; + readonly timestamp: Readonly; +} + +const nodePath = path.resolve(process.argv[1]); +const modulePath = path.resolve(fileURLToPath(import.meta.url)); +const isRunningDirectlyViaCLI = nodePath === modulePath; + +const main = async (argv: string[], env: NodeJS.ProcessEnv) => { + const req = await createRequest(argv, env); + await bundleOpenApiTplFiles(req); +}; + +if (isRunningDirectlyViaCLI) { + main(process.argv, process.env).catch((ex: unknown) => { + console.error("Process crashed with unknown exception:", ex); + process.exit(1); + }); +} + +async function createRequest( + argv: string[], + env: NodeJS.ProcessEnv, +): Promise { + if (!argv) { + throw new RuntimeError(`Process argv cannot be falsy.`); + } + if (!env) { + throw new RuntimeError(`Process env cannot be falsy.`); + } + + const __filename = fileURLToPath(import.meta.url); + const __dirname = path.dirname(__filename); + const SCRIPT_DIR = __dirname; + const DEFAULT_WORKING_DIRECTORY = path.join(SCRIPT_DIR, "../"); + + const DEFAULT_GLOB = "**/src/main/json/openapi.tpl.json"; + + const DEFAULT_IGNORE_GLOB = "**/node_modules"; + + const optCheckGitDiffDisabled = + "This feature is not yet implemented. Check back later!"; + + const optDescriptionSpecTemplateGlobs = + "The GLOB pattern(s) to use when locating the openapi.tpl.json " + + "files from which to render the bundled final output with " + + "the filename of openapi.json. Defaults to: [" + + DEFAULT_GLOB + + "]"; + + const optDescriptionSpecTemplateIgnoreGlobs = + "The **IGNORE** GLOB pattern(s) to use when locating the " + + "openapi.tpl.json files from which to render the bundled final output " + + "with the filename of openapi.json. Defaults to: [" + + DEFAULT_IGNORE_GLOB + + "]"; + + const parsedCfg = await yargs(hideBin(argv)) + .env("CACTI_") + .usage("Usage examples:") + .usage("---------------") + .usage("1. Run with no debug logs:") + .usage(" yarn tools:bundle-open-api-tpl-files") + .usage("") + .usage("2. Enable debug logging during execution:") + .usage(" DEBUG=tools:* yarn tools:bundle-open-api-tpl-files") + .option("working-directory", { + alias: "d", + type: "string", + description: + "The current working directory to search for openapi.tpl.json files for.", + default: DEFAULT_WORKING_DIRECTORY, + }) + .option("check-git-diff-disbled", { + alias: "c", + type: "boolean", + description: optCheckGitDiffDisabled, + default: true, + }) + .option("spec-template-globs", { + alias: "s", + type: "array", + string: true, + description: optDescriptionSpecTemplateGlobs, + default: [DEFAULT_GLOB], + }) + .option("spec-template-ignore-globs", { + alias: "i", + type: "array", + string: true, + description: optDescriptionSpecTemplateIgnoreGlobs, + default: [DEFAULT_IGNORE_GLOB], + }) + .version("v0.0.1") + .parse(); + + const req: IBundleOpenApiTplFilesV1Request = { + argv, + checkGitDiffDisabled: parsedCfg.checkGitDiffDisbled, + specTemplateGlobs: parsedCfg.specTemplateGlobs, + specTemplateIgnoreGlobs: parsedCfg.specTemplateIgnoreGlobs, + workingDirectory: parsedCfg.workingDirectory, + }; + + return req; +} + +async function bundleOpenApiTplFilesOneFile( + req: Readonly, + templatePathAbsolute: string, + templatePathRelative: string, +): Promise { + const openApiJson: OpenAPIV3_1.Document = + await fs.readJSON(templatePathAbsolute); + if (!openApiJson) { + throw new RuntimeError(`Expected ${templatePathRelative} to be truthy.`); + } + if (typeof openApiJson !== "object") { + throw new RuntimeError(`Expected ${templatePathRelative} to be an object`); + } + + const templateDirPath = path.dirname(templatePathAbsolute); + log("%s templateDirPath=%s", TAG, templateDirPath); + + const outputPathAbsolute = path.join(templateDirPath, "openapi.json"); + log("%s outputPathAbsolute=%s", TAG, outputPathAbsolute); + + log("%s Bundling %s ...", TAG, templatePathAbsolute); + const config = await loadConfig({}); + const bundleResult = await bundle({ ref: templatePathAbsolute, config }); + + if (bundleResult.problems) { + bundleResult.problems.forEach((p) => { + console.error("%s - %s - WARNING: %o", TAG, templatePathAbsolute, p); + }); + } + log("%s Bundled %s OK", TAG, templatePathAbsolute); + if (!openApiJson.info) { + openApiJson.info = { title: templatePathRelative, version: "0.0.0" }; + } + + // We have to format the JSON string first in order to make it consistent + // with the input that the CLI invocations of prettier receive, otherwise + // the end result of the library call here and the CLI call there can vary. + const specAsJsonString = JSON.stringify(bundleResult.bundle.parsed, null, 2); + + // Format the updated JSON object + const prettierCfg = await prettier.resolveConfig(".prettierrc.js"); + if (!prettierCfg) { + throw new RuntimeError(`Could not locate .prettierrc.js in project dir`); + } + const prettierOpts = { ...prettierCfg, parser: "json" }; + const prettyJson = await prettier.format(specAsJsonString, prettierOpts); + + log(`${TAG} writing changes to disk or ${outputPathAbsolute}`); + await fs.writeFile(outputPathAbsolute, prettyJson); + return bundleResult; +} + +export async function bundleOpenApiTplFiles( + req: IBundleOpenApiTplFilesV1Request, +): Promise { + if (!req) { + throw new RuntimeError(`req parameter cannot be falsy.`); + } + if (!req.argv) { + throw new RuntimeError(`req.argv cannot be falsy.`); + } + const cwdExists = await fs.pathExists(req.workingDirectory); + if (!cwdExists) { + const errorMessage = + `req.workingDirectory ${req.workingDirectory} does not exist on the ` + + `file-system. Could also be a permission issue where you just do not ` + + `have access to that directory.`; + throw new RuntimeError(errorMessage); + } + + const globbyOpts: GlobbyOptions = { + cwd: req.workingDirectory, + ignore: req.specTemplateIgnoreGlobs, + }; + + const specTemplateGlobs = req.specTemplateGlobs; + + const oasPaths = await globby(specTemplateGlobs, globbyOpts); + + log(`${TAG} Globbing openapi.tpl.json files %o ${specTemplateGlobs}`); + log(`${TAG} Detected ${oasPaths.length} openapi.tpl.json spec files`); + log(`${TAG} Git diff check disabled: ${req.checkGitDiffDisabled}`); + log(`${TAG} File paths found:`, JSON.stringify(oasPaths, null, 4)); + + let totalBundleProblemCount = 0; + const bundleProblems: Record = {}; + for (const idx in oasPaths) { + const aPath = oasPaths[idx]; + const filePathAbs = path.join(req.workingDirectory, aPath); + const bundleResult = await bundleOpenApiTplFilesOneFile( + req, + filePathAbs, + aPath, + ); + bundleProblems[aPath] = bundleResult.problems; + totalBundleProblemCount += bundleResult.problems.length; + } + + const report: IBundleOpenApiTplFilesV1Response = { + timestamp: new Date().toISOString(), + totalBundleProblemCount, + request: req, + bundleProblems, + specFilePaths: oasPaths, + }; + + const reportJson = JSON.stringify(report, null, 4); + + const rootDistDirPath = path.join(req.workingDirectory, "./build/"); + await fs.mkdirp(rootDistDirPath); + + const dateAndTime = new Date().toJSON().slice(0, 24).replaceAll(":", "-"); + const filename = `cacti_bundle_open_api_tpl_files_${dateAndTime}.json`; + const reportPath = path.join(req.workingDirectory, "./build/", filename); + + log(`${TAG} Saving final report to: ${reportPath}`); + await fs.writeFile(reportPath, reportJson); + + return report; +} diff --git a/tools/docker/fabric-all-in-one/README.md b/tools/docker/fabric-all-in-one/README.md index fe3df03156..09e6ebaf9c 100644 --- a/tools/docker/fabric-all-in-one/README.md +++ b/tools/docker/fabric-all-in-one/README.md @@ -12,10 +12,6 @@ An all in one fabric docker image with the `fabric-samples` repo fully embedded. From the project root: ```sh -# Fabric 1.4.X -DOCKER_BUILDKIT=1 docker build ./tools/docker/fabric-all-in-one/ -f ./tools/docker/fabric-all-in-one/Dockerfile_v1.4.x -t faio14x -docker run --detach --privileged --publish-all --name faio14x-testnet faio14x - # Fabric 2.X DOCKER_BUILDKIT=1 docker build ./tools/docker/fabric-all-in-one/ -f ./tools/docker/fabric-all-in-one/Dockerfile_v2.x -t faio2x docker run --detach --privileged --publish-all --name faio2x-testnet faio2x @@ -37,11 +33,6 @@ Example `.vscode/tasks.json` file for building/running the image: { "version": "2.0.0", "tasks": [ - { - "label": "Docker - BUILD and TAG: 1.4.x", - "type": "shell", - "command": "docker build . -f Dockerfile_v1.4.x -t hyperledger/cactus-fabric-all-in-one:1.4.8" - }, { "label": "Docker - BUILD and TAG: 2.x", "type": "shell", @@ -78,28 +69,9 @@ docker cp db676059b79e:/etc/hyperledger/cactus/fabric-aio-image.key ./fabric-aio ssh root@localhost -p 32924 -i fabric-aio-image.key ``` -```sh -DOCKER_BUILDKIT=1 docker build ./tools/docker/fabric-all-in-one/ -f ./tools/docker/fabric-all-in-one/Dockerfile_v1.4.x -t faio14x -docker run --detach --privileged --publish-all --env FABRIC_VERSION=1.4.8 faio14x - -docker ps - -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -c09eb94d94d3 faio14x "/usr/bin/supervisor…" 5 seconds ago Up 4 seconds (health: starting) 0.0.0.0:32990->22/tcp, 0.0.0.0:32989->2375/tcp, 0.0.0.0:32988->2376/tcp, 0.0.0.0:32987->5984/tcp, 0.0.0.0:32986->6984/tcp, 0.0.0.0:32985->7050/tcp, 0.0.0.0:32984->7051/tcp, 0.0.0.0:32983->7054/tcp, 0.0.0.0:32982->7984/tcp, 0.0.0.0:32981->8051/tcp, 0.0.0.0:32980->8054/tcp, 0.0.0.0:32979->8984/tcp, 0.0.0.0:32978->9001/tcp, 0.0.0.0:32977->9051/tcp, 0.0.0.0:32976->10051/tcp funny_jepsen - - -docker cp c09eb94d94d3:/etc/hyperledger/cactus/fabric-aio-image.key ./fabric-aio-image.key -ssh root@localhost -p 32990 -i fabric-aio-image.key -``` ### Running Fabric CLI Container Commands -For Fabric 1.4.x - -```sh -$ docker exec -it --workdir /fabric-samples/fabcar/ dindy docker exec cli peer chaincode query --channelID mychannel --name fabcar --ctor '{"Args": [], "Function": "queryAllCars"}' -[{"Key":"CAR0", "Record":{"colour":"blue","make":"Toyota","model":"Prius","owner":"Tom"}},{"Key":"CAR1", "Record":{"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}},{"Key":"CAR2", "Record":{"colour":"green","make":"Hyundai","model":"Tucson","owner":"Jin Soo"}},{"Key":"CAR3", "Record":{"colour":"yellow","make":"Volkswagen","model":"Passat","owner":"Max"}},{"Key":"CAR4", "Record":{"colour":"black","make":"Tesla","model":"S","owner":"Adriana"}},{"Key":"CAR5", "Record":{"colour":"purple","make":"Peugeot","model":"205","owner":"Michel"}},{"Key":"CAR6", "Record":{"colour":"white","make":"Chery","model":"S22L","owner":"Aarav"}},{"Key":"CAR7", "Record":{"colour":"violet","make":"Fiat","model":"Punto","owner":"Pari"}},{"Key":"CAR8", "Record":{"colour":"indigo","make":"Tata","model":"Nano","owner":"Valeria"}},{"Key":"CAR9", "Record":{"colour":"brown","make":"Holden","model":"Barina","owner":"Shotaro"}}] -``` For Fabric 2.x diff --git a/yarn.lock b/yarn.lock index 616fc8c2ff..aa63048f4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9433,8 +9433,10 @@ __metadata: "@lerna-lite/run": "npm:3.1.0" "@lerna-lite/version": "npm:3.1.0" "@openapitools/openapi-generator-cli": "npm:2.7.0" + "@redocly/openapi-core": "npm:1.15.0" "@types/adm-zip": "npm:0.5.0" "@types/benchmark": "npm:2.1.5" + "@types/debug": "npm:4.1.12" "@types/fs-extra": "npm:9.0.13" "@types/jest": "npm:29.5.3" "@types/node": "npm:18.11.9" @@ -9452,6 +9454,7 @@ __metadata: cross-env: "npm:7.0.3" crypto-browserify: "npm:3.12.0" cspell: "npm:5.21.2" + debug: "npm:4.3.5" del: "npm:7.1.0" del-cli: "npm:4.0.1" depcheck: "npm:1.4.7" @@ -12810,6 +12813,43 @@ __metadata: languageName: node linkType: hard +"@redocly/ajv@npm:^8.11.0": + version: 8.11.0 + resolution: "@redocly/ajv@npm:8.11.0" + dependencies: + fast-deep-equal: "npm:^3.1.1" + json-schema-traverse: "npm:^1.0.0" + require-from-string: "npm:^2.0.2" + uri-js: "npm:^4.2.2" + checksum: 10/ec2fca2c08715e5618c498ce55884f7703e296deebf93675e3c9ad124caf5fe36f4da04be6729575f80a75e3d09295f7072ce066ed58393ced289e43dd6eabd8 + languageName: node + linkType: hard + +"@redocly/config@npm:^0.6.0": + version: 0.6.0 + resolution: "@redocly/config@npm:0.6.0" + checksum: 10/bde6c0f32e85bf70d7645fccd5332ddee6a4bbb07893bd61cd3c8067eee7b339edb1c1de3cb8b1bbd982ba461ac6e70837a4b9eafb20993cc0fd44dd8e500312 + languageName: node + linkType: hard + +"@redocly/openapi-core@npm:1.15.0": + version: 1.15.0 + resolution: "@redocly/openapi-core@npm:1.15.0" + dependencies: + "@redocly/ajv": "npm:^8.11.0" + "@redocly/config": "npm:^0.6.0" + colorette: "npm:^1.2.0" + js-levenshtein: "npm:^1.1.6" + js-yaml: "npm:^4.1.0" + lodash.isequal: "npm:^4.5.0" + minimatch: "npm:^5.0.1" + node-fetch: "npm:^2.6.1" + pluralize: "npm:^8.0.0" + yaml-ast-parser: "npm:0.0.43" + checksum: 10/7234f23d324999fcac38a7a78530cb3c88dcf9289ac331123324f7029ec79b701507de43137d86293273ef6be094ca1b818cf0e0bf0404509bccc1e575589655 + languageName: node + linkType: hard + "@redux-saga/core@npm:^1.0.0": version: 1.2.3 resolution: "@redux-saga/core@npm:1.2.3" @@ -14645,6 +14685,15 @@ __metadata: languageName: node linkType: hard +"@types/debug@npm:4.1.12": + version: 4.1.12 + resolution: "@types/debug@npm:4.1.12" + dependencies: + "@types/ms": "npm:*" + checksum: 10/47876a852de8240bfdaf7481357af2b88cb660d30c72e73789abf00c499d6bc7cd5e52f41c915d1b9cd8ec9fef5b05688d7b7aef17f7f272c2d04679508d1053 + languageName: node + linkType: hard + "@types/debug@npm:4.1.8": version: 4.1.8 resolution: "@types/debug@npm:4.1.8" @@ -21056,7 +21105,7 @@ __metadata: languageName: node linkType: hard -"colorette@npm:^1.4.0": +"colorette@npm:^1.2.0, colorette@npm:^1.4.0": version: 1.4.0 resolution: "colorette@npm:1.4.0" checksum: 10/c8d6c8c3ef5a99acfc3dd9a68f48019f1479ec347551387e4a1762e40f69e98ce19d4dc321ffb4919d1f28a7bdc90c39d4e9a901f4c474fd2124ad93a00c0454 @@ -22848,6 +22897,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:4.3.5": + version: 4.3.5 + resolution: "debug@npm:4.3.5" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10/cb6eab424c410e07813ca1392888589972ce9a32b8829c6508f5e1f25f3c3e70a76731610ae55b4bbe58d1a2fffa1424b30e97fa8d394e49cd2656a9643aedd2 + languageName: node + linkType: hard + "debug@npm:^3.0.1, debug@npm:^3.1.0, debug@npm:^3.2.6, debug@npm:^3.2.7": version: 3.2.7 resolution: "debug@npm:3.2.7" @@ -33610,6 +33671,13 @@ __metadata: languageName: node linkType: hard +"js-levenshtein@npm:^1.1.6": + version: 1.1.6 + resolution: "js-levenshtein@npm:1.1.6" + checksum: 10/bb034043fdebab606122fe5b5c0316036f1bb0ea352038af8b0ba4cda4b016303b24f64efb59d9918f66e3680eea97ff421396ff3c153cb00a6f982908f61f8a + languageName: node + linkType: hard + "js-sdsl@npm:^4.1.4": version: 4.4.0 resolution: "js-sdsl@npm:4.4.0" @@ -35346,6 +35414,13 @@ __metadata: languageName: node linkType: hard +"lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: 10/82fc58a83a1555f8df34ca9a2cd300995ff94018ac12cc47c349655f0ae1d4d92ba346db4c19bbfc90510764e0c00ddcc985a358bdcd4b3b965abf8f2a48a214 + languageName: node + linkType: hard + "lodash.isfunction@npm:^3.0.9": version: 3.0.9 resolution: "lodash.isfunction@npm:3.0.9" @@ -54082,6 +54157,13 @@ __metadata: languageName: node linkType: hard +"yaml-ast-parser@npm:0.0.43": + version: 0.0.43 + resolution: "yaml-ast-parser@npm:0.0.43" + checksum: 10/a54d00c8e0716a392c6e76eee965b3b4bba434494196490946e416fc47f20a1d89820461afacd9431edbb8209e28fce33bcff1fb42dd83f90e51fc31e80251c9 + languageName: node + linkType: hard + "yaml@npm:^1.10.0, yaml@npm:^1.10.2, yaml@npm:^1.5.0, yaml@npm:^1.7.2": version: 1.10.2 resolution: "yaml@npm:1.10.2"