From 36ea043af224996dd4227113467ed3581161fce1 Mon Sep 17 00:00:00 2001 From: Rafael Belchior Date: Tue, 30 Jan 2024 16:55:02 +0000 Subject: [PATCH] feat(SATP-Hermes): add gateway coordinator WIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafael Belchior feat(bungee): add skeleton for bungee Signed-off-by: André Augusto refactor(plugin-satp-hermes): update messages formats SATP core version 2.0.0 OpenAPI * created new messages in openAPI definition feat(bungee): fix bungee dependencies Signed-off-by: André Augusto feat(SATP-Hermes): gateway coordinator feat(SATP-Hermes): gateway coordinator feat(SATP-Hermes): gateway coordinator WIP Signed-off-by: Rafael Belchior test(SATP-Hermes): enable decorators needed for gateway coordinator checks Signed-off-by: Rafael Belchior docs(SATP-Hermes): update package.json Signed-off-by: Rafael Belchior refactor(SATP-Hermes): re-estructure project Signed-off-by: Rafael Belchior refactor(SATP-Hermes): re-estructure project Signed-off-by: Rafael Belchior refactor(SATP-Hermes): re-estructure project Signed-off-by: Rafael Belchior refactor(SATP-Hermes): remove kotlin sdk, add protobuffer Signed-off-by: Rafael Belchior feat(SATP-Hermes): protobuf structure Signed-off-by: Rafael Belchior feat(SATP-Hermes): protobuf structure Signed-off-by: Rafael Belchior refactor(SATP-Hermes): refactor naming Signed-off-by: Rafael Belchior feat(SATP-Hermes): protobuf structure improvements Signed-off-by: Rafael Belchior feat(SATP-Hermes): update yarn.lock and clean up Signed-off-by: André Augusto refactor(test-tooling): fix types of streams: use NodeJS.ReadableStream 1. The container management library that we use in the test infrastructure (called dockerode) is expecting streams that are defined in the global namespace of the `@types/node` library, e.g. the standard library of NodeJS itself. 2. Previously we were using the "streams" package to provide type information to the streams that we were passing around to dockerode and it was working fine, but after some changes that seem unrelated this has broken the compilation process. 3. The mentioned changes are not yet on the main branch, but we expect them to be there soon and so this change is laying the groundwork for that by pre-emptively fixing the broken build's root cause which is that the test-tooling package does not declare it's typings related dependencies correctly: It implicitly uses the NodeJS standard library's types but so far had not declared them on the package level. 4. This change is therefore to rectify the issue of the `@types/node` dependency missing from the test-tooling package and also the refactoring of some of the test ledger classes which were relying on the `streams` builtin package instead of correctly using the NodeJS.ReadableStream global. 5. Earlier the reasoning for this was that we try to avoid pulling in types from the global scope because we try to avoid any sort of dependency on the global scope in general. Once we have proof though that this is causing issues with the build, then we must give up the principle for practical reasons (and only in the minimum viable scope, e.g. this does not change the fact that everywhere else in the codebase we should still do our best to avoid using the global scoped classes, types, functions, etc..). Thank you to @AndreAugusto11 and @RafaelAPB for pointing out this issue through the pull request of his that is currently being worked on at the time of this writing: https://github.com/RafaelAPB/blockchain-integration-framework/pull/72 Related to but does not address #2811 Signed-off-by: Peter Somogyvari refactor(SATP-Hermes): remove unused packages * updated openapi version * updated bungee plugin version to 2.0.0-alpha.2 Co-authored-by: Peter Somogyvari Signed-off-by: André Augusto Signed-off-by: Peter Somogyvari --- .gitignore | 3 +- .../src/main/typescript/cbdc-bridging-app.ts | 20 +- .../cbdc-bridging-app-dummy-infrastructure.ts | 12 +- .../satp-extension/besu-satp-gateway.ts | 10 +- .../satp-extension/client-helper.ts | 16 +- .../satp-extension/fabric-satp-gateway.ts | 10 +- .../satp-extension/server-helper.ts | 8 +- jest.config.js | 3 + packages/cactus-plugin-bungee/package.json | 4 +- .../src/main/json/openapi.json | 4 +- .../typescript/plugin-bungee-benchmark.ts | 171 ++- .../src/main/typescript/plugin-bungee.ts | 154 +- .../src/main/typescript/public-api.ts | 15 +- .../web-services/client-endpoint.ts | 1 - .../fabric-v2-2-x/get-snapshot.test.ts | 2 +- packages/cactus-plugin-satp-hermes/README.md | 54 +- .../cactus-plugin-satp-hermes/package.json | 45 +- .../kotlin-client/.openapi-generator/FILES | 50 - .../kotlin-client/.openapi-generator/VERSION | 1 - .../generated/openapi/kotlin-client/README.md | 103 -- .../openapi/kotlin-client/build.gradle | 38 - .../generated/openapi/kotlin-client/gradlew | 245 --- .../openapi/kotlin-client/gradlew.bat | 92 -- .../openapi/kotlin-client/settings.gradle | 2 - .../openapitools/client/apis/DefaultApi.kt | 1313 ----------------- .../client/infrastructure/ApiAbstractions.kt | 23 - .../client/infrastructure/ApiClient.kt | 245 --- .../client/infrastructure/ApiResponse.kt | 43 - .../infrastructure/BigDecimalAdapter.kt | 17 - .../infrastructure/BigIntegerAdapter.kt | 17 - .../client/infrastructure/ByteArrayAdapter.kt | 12 - .../client/infrastructure/Errors.kt | 18 - .../client/infrastructure/LocalDateAdapter.kt | 19 - .../infrastructure/LocalDateTimeAdapter.kt | 19 - .../infrastructure/OffsetDateTimeAdapter.kt | 19 - .../client/infrastructure/PartConfig.kt | 11 - .../client/infrastructure/RequestConfig.kt | 18 - .../client/infrastructure/RequestMethod.kt | 8 - .../infrastructure/ResponseExtensions.kt | 24 - .../client/infrastructure/Serializer.kt | 23 - .../client/infrastructure/URIAdapter.kt | 13 - .../client/infrastructure/UUIDAdapter.kt | 13 - .../client/models/AssetProfile.kt | 79 - .../client/models/ClientV1Request.kt | 122 -- ...ientV1RequestClientGatewayConfiguration.kt | 35 - .../client/models/CommitFinalV1Request.kt | 71 - .../client/models/CommitFinalV1Response.kt | 71 - .../models/CommitPreparationV1Request.kt | 63 - .../models/CommitPreparationV1Response.kt | 63 - .../client/models/CredentialProfile.kt | 66 - .../org/openapitools/client/models/History.kt | 59 - .../openapitools/client/models/LocalLog.kt | 55 - .../client/models/LockEvidenceV1Request.kt | 79 - .../client/models/LockEvidenceV1Response.kt | 63 - .../client/models/PayloadProfile.kt | 40 - .../client/models/RecoverSuccessV1Message.kt | 43 - .../models/RecoverUpdateAckV1Message.kt | 47 - .../client/models/RecoverUpdateV1Message.kt | 44 - .../client/models/RecoverV1Message.kt | 63 - .../client/models/RollbackAckV1Message.kt | 43 - .../client/models/RollbackV1Message.kt | 51 - .../openapitools/client/models/SatpMessage.kt | 105 -- .../models/SatpMessageActionResponse.kt | 51 - .../openapitools/client/models/SessionData.kt | 291 ---- .../models/TransferCommenceV1Request.kt | 87 -- .../models/TransferCommenceV1Response.kt | 67 - .../models/TransferCompleteV1Request.kt | 67 - .../models/TransferInitializationV1Request.kt | 175 --- .../src/main/proto/LICENSE | 201 +++ .../src/main/proto/buf.gen.yaml | 12 + .../src/main/proto/buf.yaml | 24 + .../proto/cacti/satp/v02/common/message.proto | 22 + .../proto/cacti/satp/v02/common/session.proto | 30 + .../proto/cacti/satp/v02/crash_recovery.proto | 13 + .../main/proto/cacti/satp/v02/stage_0.proto | 34 + .../main/proto/cacti/satp/v02/stage_1.proto | 13 + .../main/proto/cacti/satp/v02/stage_2.proto | 13 + .../main/proto/cacti/satp/v02/stage_3.proto | 12 + .../proto/cacti/satp/v02/view/bungee.proto | 9 + .../src/main/proto/test/message.proto | 27 + .../{gateway => core}/besu-satp-gateway.ts | 12 +- .../{gateway/client => core}/client-helper.ts | 52 +- .../src/main/typescript/core/errors.ts | 15 + .../{gateway => core}/fabric-satp-gateway.ts | 12 +- .../{gateway/server => core}/server-helper.ts | 50 +- .../typescript/core/stage-services/stage0.ts | 0 .../typescript/core/stage-services/stage1.ts | 0 .../typescript/core/stage-services/stage2.ts | 0 .../typescript/core/stage-services/stage3.ts | 1 + .../core/stage-services/test-services.ts | 15 + .../src/main/typescript/core/types.ts | 66 + .../plugin-factory-besu-satp-gateway.ts | 20 + .../plugin-factory-fabric-satp-gateway.ts | 20 + .../plugin-factory-gateway-orchestrator.ts | 31 + .../src/main/typescript/gateway-refactor.ts | 320 ++++ .../plugin-factory-besu-satp-gateway.ts | 20 - .../plugin-factory-fabric-satp-gateway.ts | 20 - .../proto/cacti/satp/v02/common/message_pb.ts | 149 ++ .../cacti/satp/v02/common/session_connect.ts | 74 + .../proto/cacti/satp/v02/common/session_pb.ts | 94 ++ .../cacti/satp/v02/crash_recovery_connect.ts | 18 + .../proto/cacti/satp/v02/stage_0_connect.ts | 30 + .../proto/cacti/satp/v02/stage_0_pb.ts | 156 ++ .../proto/cacti/satp/v02/stage_1_connect.ts | 16 + .../proto/cacti/satp/v02/stage_2_connect.ts | 16 + .../proto/cacti/satp/v02/stage_3_connect.ts | 16 + .../proto/cacti/satp/v02/view/bungee_pb.ts | 45 + .../generated/proto/test/message_connect.ts | 62 + .../generated/proto/test/message_pb.ts | 119 ++ .../src/main/typescript/gol/config-service.ts | 0 .../typescript/gol/gateway-orchestrator.ts | 103 ++ .../{gateway => }/plugin-satp-gateway.ts | 61 +- .../src/main/typescript/public-api.ts | 22 +- .../{gateway => }/recovery/recover-success.ts | 12 +- .../recovery/recover-update-ack.ts | 12 +- .../{gateway => }/recovery/recover-update.ts | 12 +- .../{gateway => }/recovery/recover.ts | 12 +- .../{gateway => }/recovery/rollback-ack.ts | 12 +- .../{gateway => }/recovery/rollback.ts | 12 +- .../repository/interfaces/repository.ts | 0 .../repository/ipfs-remote-log-repository.ts | 0 .../repository/knex-local-log-repository.ts | 2 +- .../repository/knex-remote-log-repository.ts | 2 +- .../client-side/client-request-endpoint.ts | 4 +- .../commit-final-response-endpoint.ts | 4 +- .../commit-prepare-response-endpoint.ts | 4 +- .../lock-evidence-response-endpoint.ts | 4 +- .../transfer-commence-response-endpoint.ts | 4 +- .../transfer-initiation-response-endpoint.ts | 4 +- .../recovery/recover-message-endpoint.ts | 4 +- .../recover-success-message-endpoint.ts | 4 +- .../recover-update-ack-message-endpoint.ts | 4 +- .../recover-update-message-endpoint.ts | 4 +- .../recovery/rollback-ack-message-endpoint.ts | 4 +- .../recovery/rollback-message-endpoint.ts | 4 +- .../main/typescript/web-services/router.ts | 12 + .../commit-final-request-endpoint.ts | 4 +- .../commite-prepare-request-endpoint.ts | 4 +- .../lock-evidence-request-endpoint.ts | 4 +- .../transfer-commence-request-endpoint.ts | 4 +- .../transfer-complete-request-endpoint.ts | 4 +- .../transfer-initiation-request-endpoint.ts | 4 +- .../web-services/stage-0/dummy-step.ts | 0 .../stage-0/identity-verification.ts | 0 .../main/typescript/web-services/test/test.ts | 36 + .../typescript/web-services/test/test2.ts | 12 + .../backup-gateway-after-client-crash.test.ts | 34 +- .../client-crash-after-delete-asset.test.ts | 30 +- .../client-crash-after-lock-asset.test.ts | 30 +- ...nt-crash-after-transfer-initiation.test.ts | 22 +- .../gateway-coordinator-init.test.ts | 157 ++ ...dap-api-call-with-ledger-connector.test.ts | 28 +- .../integration/odap-api-call.test.ts | 20 +- .../integration/odap-rollback.test.ts | 30 +- .../test/typescript/integration/odap.test.ts | 19 +- .../server-crash-after-create-asset.test.ts | 30 +- ...er-crash-after-transfer-initiation.test.ts | 30 +- .../src/test/typescript/make-checks.ts | 52 +- .../unit/client/commit-final.test.ts | 26 +- .../unit/client/commit-preparation.test.ts | 26 +- .../unit/client/lock-evidence.test.ts | 26 +- .../unit/client/transfer-commence.test.ts | 26 +- .../client/transfer-initialization.test.ts | 26 +- .../typescript/unit/recovery/logging.test.ts | 40 +- .../unit/recovery/recover-success.test.ts | 24 +- .../unit/recovery/recover-update-ack.test.ts | 24 +- .../unit/recovery/recover-update.test.ts | 26 +- .../typescript/unit/recovery/recover.test.ts | 26 +- .../unit/server/commit-final.test.ts | 28 +- .../unit/server/commit-preparation.test.ts | 28 +- .../unit/server/lock-evidence.test.ts | 30 +- .../unit/server/transfer-commence.test.ts | 32 +- .../unit/server/transfer-complete.test.ts | 22 +- .../server/transfer-initialization.test.ts | 26 +- .../cactus-plugin-satp-hermes/tsconfig.json | 2 +- tsconfig.json | 4 +- yarn.lock | 315 +++- 177 files changed, 3164 insertions(+), 5246 deletions(-) delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LocalLog.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessage.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessageActionResponse.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/LICENSE create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/buf.gen.yaml create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/buf.yaml create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/message.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/session.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/crash_recovery.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_0.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_1.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_2.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_3.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/view/bungee.proto create mode 100644 packages/cactus-plugin-satp-hermes/src/main/proto/test/message.proto rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => core}/besu-satp-gateway.ts (98%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway/client => core}/client-helper.ts (96%) create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors.ts rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => core}/fabric-satp-gateway.ts (98%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway/server => core}/server-helper.ts (96%) create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage0.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/test-services.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-besu-satp-gateway.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-fabric-satp-gateway.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-gateway-orchestrator.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-besu-satp-gateway.ts delete mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-fabric-satp-gateway.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/message_pb.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_pb.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/crash_recovery_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_pb.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/view/bungee_pb.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_connect.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_pb.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/gol/config-service.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/gol/gateway-orchestrator.ts rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/plugin-satp-gateway.ts (93%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/recover-success.ts (89%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/recover-update-ack.ts (89%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/recover-update.ts (93%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/recover.ts (93%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/rollback-ack.ts (89%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/recovery/rollback.ts (89%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/repository/interfaces/repository.ts (100%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/repository/ipfs-remote-log-repository.ts (100%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/repository/knex-local-log-repository.ts (96%) rename packages/cactus-plugin-satp-hermes/src/main/typescript/{gateway => }/repository/knex-remote-log-repository.ts (93%) create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/router.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/dummy-step.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/identity-verification.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test2.ts create mode 100644 packages/cactus-plugin-satp-hermes/src/test/typescript/integration/gateway-coordinator-init.test.ts diff --git a/.gitignore b/.gitignore index 1f691faf22..94afcd5efd 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,5 @@ site/ tools/docker/geth-testnet/data-geth1/ .history/ -.manual-geth-artillery-config.yaml \ No newline at end of file +.manual-geth-artillery-config.yaml +packages/cactus-plugin-satp-hermes/.config diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/cbdc-bridging-app.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/cbdc-bridging-app.ts index a5b8009516..9872529bec 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/cbdc-bridging-app.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/cbdc-bridging-app.ts @@ -24,8 +24,8 @@ import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory import { CbdcBridgingAppDummyInfrastructure } from "./infrastructure/cbdc-bridging-app-dummy-infrastructure"; import { DefaultApi as FabricApi } from "@hyperledger/cactus-plugin-ledger-connector-fabric"; import { DefaultApi as BesuApi } from "@hyperledger/cactus-plugin-ledger-connector-besu"; -import { FabricSatpGateway } from "./satp-extension/fabric-satp-gateway"; -import { BesuSatpGateway } from "./satp-extension/besu-satp-gateway"; +import { FabricSATPGateway } from "./satp-extension/fabric-satp-gateway"; +import { BesuSATPGateway } from "./satp-extension/besu-satp-gateway"; import CryptoMaterial from "../../crypto-material/crypto-material.json"; export interface ICbdcBridgingApp { @@ -97,12 +97,12 @@ export class CbdcBridgingApp { const addressInfoB = httpApiB.address() as AddressInfo; const nodeApiHostB = `http://${this.options.apiHost}:${addressInfoB.port}`; - const fabricSatpGateway = await this.infrastructure.createClientGateway( + const FabricSATPGateway = await this.infrastructure.createClientGateway( nodeApiHostA, this.options.clientGatewayKeyPair, ); - const besuSatpGateway = await this.infrastructure.createServerGateway( + const BesuSATPGateway = await this.infrastructure.createServerGateway( nodeApiHostB, this.options.serverGatewayKeyPair, ); @@ -127,10 +127,10 @@ export class CbdcBridgingApp { }); clientPluginRegistry.add(fabricPlugin); - clientPluginRegistry.add(fabricSatpGateway); + clientPluginRegistry.add(FabricSATPGateway); serverPluginRegistry.add(besuPlugin); - serverPluginRegistry.add(besuSatpGateway); + serverPluginRegistry.add(BesuSATPGateway); const apiServer1 = await this.startNode(httpApiA, clientPluginRegistry); const apiServer2 = await this.startNode(httpApiB, serverPluginRegistry); @@ -166,8 +166,8 @@ export class CbdcBridgingApp { ), fabricApiClient, besuApiClient, - fabricSatpGateway, - besuSatpGateway, + FabricSATPGateway, + BesuSATPGateway, }; } @@ -227,6 +227,6 @@ export interface IStartInfo { readonly besuGatewayApi: SatpApi; readonly besuApiClient: BesuApi; readonly fabricApiClient: FabricApi; - readonly fabricSatpGateway: FabricSatpGateway; - readonly besuSatpGateway: BesuSatpGateway; + readonly FabricSATPGateway: FabricSATPGateway; + readonly BesuSATPGateway: BesuSATPGateway; } diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts index 9ea61010d4..fa24be9006 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/infrastructure/cbdc-bridging-app-dummy-infrastructure.ts @@ -37,8 +37,8 @@ import { PluginRegistry } from "@hyperledger/cactus-core"; import AssetReferenceContractJson from "../../../solidity/asset-reference-contract/AssetReferenceContract.json"; import CBDCcontractJson from "../../../solidity/cbdc-erc-20/CBDCcontract.json"; import { IKeyPair } from "@hyperledger/cactus-plugin-satp-hermes"; -import { FabricSatpGateway } from "../satp-extension/fabric-satp-gateway"; -import { BesuSatpGateway } from "../satp-extension/besu-satp-gateway"; +import { FabricSATPGateway } from "../satp-extension/fabric-satp-gateway"; +import { BesuSATPGateway } from "../satp-extension/besu-satp-gateway"; import { PluginImportType } from "@hyperledger/cactus-core-api"; import CryptoMaterial from "../../../crypto-material/crypto-material.json"; import { ClientHelper } from "../satp-extension/client-helper"; @@ -274,9 +274,9 @@ export class CbdcBridgingAppDummyInfrastructure { public async createClientGateway( nodeApiHost: string, keyPair: IKeyPair, - ): Promise { + ): Promise { this.log.info(`Creating Source Gateway...`); - const pluginSourceGateway = new FabricSatpGateway({ + const pluginSourceGateway = new FabricSATPGateway({ name: "cactus-plugin-source#satpGateway", dltIDs: ["DLT2"], instanceId: uuidv4(), @@ -301,9 +301,9 @@ export class CbdcBridgingAppDummyInfrastructure { public async createServerGateway( nodeApiHost: string, keyPair: IKeyPair, - ): Promise { + ): Promise { this.log.info(`Creating Recipient Gateway...`); - const pluginRecipientGateway = new BesuSatpGateway({ + const pluginRecipientGateway = new BesuSATPGateway({ name: "cactus-plugin-recipient#satpGateway", dltIDs: ["DLT1"], instanceId: uuidv4(), diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/besu-satp-gateway.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/besu-satp-gateway.ts index 5c3c0eb574..160220caad 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/besu-satp-gateway.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/besu-satp-gateway.ts @@ -8,11 +8,11 @@ import { } from "@hyperledger/cactus-plugin-ledger-connector-besu"; import { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, + PluginSATPGateway, } from "@hyperledger/cactus-plugin-satp-hermes"; import { SessionDataRollbackActionsPerformedEnum } from "@hyperledger/cactus-plugin-satp-hermes"; -export interface IBesuSatpGatewayConstructorOptions +export interface IBesuSATPGatewayConstructorOptions extends IPluginSatpGatewayConstructorOptions { besuContractName?: string; besuWeb3SigningCredential?: Web3SigningCredential; @@ -21,13 +21,13 @@ export interface IBesuSatpGatewayConstructorOptions besuPath?: string; } -export class BesuSatpGateway extends PluginSatpGateway { +export class BesuSATPGateway extends PluginSATPGateway { public besuApi?: BesuApi; public besuContractName?: string; public besuWeb3SigningCredential?: Web3SigningCredential; public besuKeychainId?: string; - public constructor(options: IBesuSatpGatewayConstructorOptions) { + public constructor(options: IBesuSATPGatewayConstructorOptions) { super({ name: options.name, dltIDs: options.dltIDs, @@ -45,7 +45,7 @@ export class BesuSatpGateway extends PluginSatpGateway { } private defineBesuConnection( - options: IBesuSatpGatewayConstructorOptions, + options: IBesuSATPGatewayConstructorOptions, ): void { const fnTag = `${this.className}#defineBesuConnection()`; diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/client-helper.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/client-helper.ts index 675e8de6a1..7e9649acb2 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/client-helper.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/client-helper.ts @@ -1,17 +1,17 @@ import { SHA256 } from "crypto-js"; import { - PluginSatpGateway, + PluginSATPGateway, TransferInitializationV1Request, ClientGatewayHelper, } from "@hyperledger/cactus-plugin-satp-hermes"; import { SatpMessageType } from "@hyperledger/cactus-plugin-satp-hermes"; -import { FabricSatpGateway } from "./fabric-satp-gateway"; -import { BesuSatpGateway } from "./besu-satp-gateway"; +import { FabricSATPGateway } from "./fabric-satp-gateway"; +import { BesuSATPGateway } from "./besu-satp-gateway"; export class ClientHelper extends ClientGatewayHelper { async sendTransferInitializationRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${this.className}#sendTransferInitializationRequest()`; @@ -82,7 +82,7 @@ export class ClientHelper extends ClientGatewayHelper { sourceLedgerAssetID: sessionData.sourceLedgerAssetID, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(initializationRequestMessage)), ); @@ -103,7 +103,7 @@ export class ClientHelper extends ClientGatewayHelper { data: JSON.stringify(sessionData), }); - if (gateway instanceof FabricSatpGateway) { + if (gateway instanceof FabricSATPGateway) { await gateway .isValidBridgeOutCBDC( sessionData.sourceLedgerAssetID, @@ -114,7 +114,7 @@ export class ClientHelper extends ClientGatewayHelper { .catch((err) => { throw new Error(`${err.response.data.error}`); }); - } else if (gateway instanceof BesuSatpGateway) { + } else if (gateway instanceof BesuSATPGateway) { await gateway .isValidBridgeBackCBDC( sessionData.sourceLedgerAssetID, @@ -134,7 +134,7 @@ export class ClientHelper extends ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase1TransferInitiationRequestV1(initializationRequestMessage), "TransferInitializationRequest", diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/fabric-satp-gateway.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/fabric-satp-gateway.ts index 1dd7f57e6d..3799d400aa 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/fabric-satp-gateway.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/fabric-satp-gateway.ts @@ -8,11 +8,11 @@ import { } from "@hyperledger/cactus-plugin-ledger-connector-fabric"; import { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, + PluginSATPGateway, } from "@hyperledger/cactus-plugin-satp-hermes"; import { SessionDataRollbackActionsPerformedEnum } from "@hyperledger/cactus-plugin-satp-hermes"; -export interface IFabricSatpGatewayConstructorOptions +export interface IFabricSATPGatewayConstructorOptions extends IPluginSatpGatewayConstructorOptions { fabricPath?: string; fabricSigningCredential?: FabricSigningCredential; @@ -20,13 +20,13 @@ export interface IFabricSatpGatewayConstructorOptions fabricContractName?: string; } -export class FabricSatpGateway extends PluginSatpGateway { +export class FabricSATPGateway extends PluginSATPGateway { public fabricApi?: FabricApi; public fabricSigningCredential?: FabricSigningCredential; public fabricChannelName?: string; public fabricContractName?: string; - public constructor(options: IFabricSatpGatewayConstructorOptions) { + public constructor(options: IFabricSATPGatewayConstructorOptions) { super({ name: options.name, dltIDs: options.dltIDs, @@ -44,7 +44,7 @@ export class FabricSatpGateway extends PluginSatpGateway { } private defineFabricConnection( - options: IFabricSatpGatewayConstructorOptions, + options: IFabricSATPGatewayConstructorOptions, ): void { const fnTag = `${this.className}#defineFabricConnection()`; diff --git a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/server-helper.ts b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/server-helper.ts index c6dee4d1e7..cb283c6c01 100644 --- a/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/server-helper.ts +++ b/examples/cactus-example-cbdc-bridging-backend/src/main/typescript/satp-extension/server-helper.ts @@ -5,11 +5,11 @@ import { } from "@hyperledger/cactus-plugin-satp-hermes"; import { SatpMessageType, - PluginSatpGateway, + PluginSATPGateway, ServerGatewayHelper, } from "@hyperledger/cactus-plugin-satp-hermes"; -import { FabricSatpGateway } from "./fabric-satp-gateway"; +import { FabricSATPGateway } from "./fabric-satp-gateway"; import { LogLevelDesc } from "@hyperledger/cactus-common"; export interface IServerHelperOptions { @@ -30,7 +30,7 @@ export class ServerHelper extends ServerGatewayHelper { async checkValidInitializationRequest( request: TransferInitializationV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidInitializationRequest()`; @@ -124,7 +124,7 @@ export class ServerHelper extends ServerGatewayHelper { gateway.sessions.set(request.sessionID, sessionData); - if (gateway instanceof FabricSatpGateway) { + if (gateway instanceof FabricSATPGateway) { await gateway .isValidBridgeBackCBDC( request.payloadProfile.assetProfile.keyInformationLink[1].toString(), // FabricID diff --git a/jest.config.js b/jest.config.js index 5e9cf83962..cde611ff46 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,9 @@ module.exports = { maxConcurrency: 1, setupFilesAfterEnv: ["jest-extended/all", "./jest.setup.console.logs.js"], testTimeout: 60 * 60 * 1000, + moduleNameMapper: { + "^(.+)/(.+)_pb\\.js$": "$1/$2_pb" + }, testMatch: [ `**/cactus-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`, `**/cacti-*/src/test/typescript/{unit,integration,benchmark}/**/*.test.ts`, diff --git a/packages/cactus-plugin-bungee/package.json b/packages/cactus-plugin-bungee/package.json index 510fb210a4..6b00b03d90 100644 --- a/packages/cactus-plugin-bungee/package.json +++ b/packages/cactus-plugin-bungee/package.json @@ -1,6 +1,6 @@ { "name": "@hyperledger/cactus-plugin-bungee", - "version": "1.0.0", + "version": "2.0.0-alpha.2", "description": "Proof of concept of bungee", "keywords": [ "Hyperledger", @@ -75,7 +75,7 @@ "@types/tape": "4.13.4", "@types/uuid": "9.0.6", "express": "4.18.2", - "fabric-network": "2.2.19" + "fabric-network": "2.2.20" }, "engines": { "node": ">=18", diff --git a/packages/cactus-plugin-bungee/src/main/json/openapi.json b/packages/cactus-plugin-bungee/src/main/json/openapi.json index 9477826d90..5701474630 100644 --- a/packages/cactus-plugin-bungee/src/main/json/openapi.json +++ b/packages/cactus-plugin-bungee/src/main/json/openapi.json @@ -3,9 +3,9 @@ "info": { "title": "Hyperledger Cactus Plugin - BUNGEE", "description": "Can create blockchain views of a fabric ledger", - "version": "0.0.1", + "version": "2.0.0-alpha.2", "license": { - "name": "Apache 2.0", + "name": "Apache-2.0", "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } }, diff --git a/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee-benchmark.ts b/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee-benchmark.ts index cd0dd54a5a..55ffb77c48 100644 --- a/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee-benchmark.ts +++ b/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee-benchmark.ts @@ -37,7 +37,7 @@ import { View } from "./view-creation/view"; import { Snapshot } from "./view-creation/snapshot"; import path from "path"; -export interface IPluginBUNGEEOptions extends ICactusPluginOptions{ +export interface IPluginBUNGEEOptions extends ICactusPluginOptions { instanceId: string; participant: string; @@ -70,20 +70,17 @@ export class PluginBUNGEEBenchmark { private ledgerAssetsKey: string[]; private ledgerStates: Map; //Key, state private states: State[]; - public fabricApi?: FabricApi; public fabricSigningCredential?: FabricSigningCredential; public fabricChannelName?: string; public fabricContractName?: string; public fabricAssetID?: string; public fabricAssetSize?: string; - private readonly instanceId: string; private readonly className: string; private level: LogLevelDesc; private logger: Logger; public pluginRegistry: PluginRegistry; - private tIgetAllAssetsKey: number; private tFgetAllAssetsKey: number; private tIgetAllTxByKey: number; @@ -117,13 +114,12 @@ export class PluginBUNGEEBenchmark { const label = this.getClassName(); const level = this.level; this.logger = LoggerProvider.getOrCreate({ label, level }); - - const keysRelPath ="../keys/"; + + const keysRelPath = "../keys/"; const pubKeyPath = path.join(__dirname, keysRelPath, "./bungee_pub.pem"); const privKeyPath = path.join(__dirname, keysRelPath, "./bungee_priv.pem"); this.pubKeyBungee = Utils.readKeyFromFile(pubKeyPath); this.privKeyBungee = Utils.readKeyFromFile(privKeyPath); - const bungeeSignerOptions: IJsObjectSignerOptions = { privateKey: this.privKeyBungee, logLevel: "debug", @@ -132,7 +128,6 @@ export class PluginBUNGEEBenchmark { this.instanceId = uuidv4(); this.participant = options.participant; - this.ledgerAssetsKey = []; this.ledgerStates = new Map(); this.states = []; @@ -161,9 +156,7 @@ export class PluginBUNGEEBenchmark { return; } - private defineFabricConnection(options: IPluginBUNGEEOptions): void { - this.logger.info(`OPTIONS:: ${options}`); const fnTag = `${this.className}#defineFabricConnection()`; @@ -189,69 +182,72 @@ export class PluginBUNGEEBenchmark { : "1"; } - /** - * + * * @abstract Create ledger state. Get all keys, iterate every key and get the respective transactions. For each transaction get the receipt * */ public async generateLedgerStates(): Promise { this.tIgenerateLedgerStates = performance.now(); this.logger.info(`Generating ledger snapshot`); - + const assetsKey = await this.getAllAssetsKey(); this.ledgerAssetsKey = assetsKey.split(","); - + //For each key in ledgerAssetsKey - for(const assetKey of this.ledgerAssetsKey){ - let assetValues: string[] = []; - let txWithTimeS: Transaction[] = []; + for (const assetKey of this.ledgerAssetsKey) { + const assetValues: string[] = []; + const txWithTimeS: Transaction[] = []; this.logger.info(assetKey); const txs = await this.getAllTxByKey(assetKey); //For each tx get receipt - for(const tx of txs){ + for (const tx of txs) { const endorsements: Proof[] = []; - const receipt = JSON.parse(await this.fabricGetTxReceiptByTxIDV1(tx.getId())); + const receipt = JSON.parse( + await this.fabricGetTxReceiptByTxIDV1(tx.getId()), + ); // Checks if tx was made by participant - if(receipt.transactionCreator.mspid != this.participant){ + if (receipt.transactionCreator.mspid != this.participant) { continue; } - + assetValues.push(JSON.parse(receipt.rwsetWriteData).Value.toString()); //Save endorsements of tx - for (const endorsement of receipt.transactionEndorsement) { - const signature64 = Buffer.from(endorsement.signature).toString('base64'); - endorsements.push(new Proof(endorsement.mspid, endorsement.endorserID, signature64)); + for (const endorsement of receipt.transactionEndorsement) { + const signature64 = Buffer.from(endorsement.signature).toString( + "base64", + ); + endorsements.push( + new Proof(endorsement.mspid, endorsement.endorserID, signature64), + ); } tx.defineTxProofs(endorsements); txWithTimeS.push(tx); } - const state = new State(assetKey, assetValues, txWithTimeS); this.ledgerStates.set(assetKey, state); this.states.push(state); } - + this.ledgerStates.forEach((state: State, keyId: string) => { console.log(keyId, state); const assetState = this.ledgerStates.get(keyId); - if(assetState != undefined) { + if (assetState != undefined) { this.logger.info(assetState); this.logger.info(JSON.parse(assetState.getStateJson())); - } - }); + }); // TESTS ONLY -> next receive ti tf const asset2 = this.ledgerStates.get("ASSET2"); - + if (asset2 != undefined) { this.tI = asset2.getInitialTime(); } - + const asset9 = this.ledgerStates.get("ASSET9"); if (asset9 != undefined) { // this.tF = asset9.getTimeForTxN(5); @@ -260,12 +256,11 @@ export class PluginBUNGEEBenchmark { this.tFgenerateLedgerStates = performance.now(); - return ""; + return ""; } - /** - * + * * @abstract Returns Snapshot * */ public generateSnapshot(): Snapshot { @@ -276,72 +271,69 @@ export class PluginBUNGEEBenchmark { return snapshot; } - /** - * + * * @abstract Returns view. Generate final view with signature - * + * * @param snapshot - Ledger Snapshot * */ public generateView(snapshot: Snapshot): string { this.tIgenerateView = performance.now(); - const crypto = require('crypto'); - + const crypto = require("crypto"); + this.logger.warn(this.pubKeyBungee); this.logger.warn(this.privKeyBungee); const view = new View(this.tI, this.tF, snapshot); - - const signer = crypto.createSign('SHA256'); + + const signer = crypto.createSign("SHA256"); signer.write(JSON.stringify(view)); signer.end(); this.logger.warn(view.getViewStr()); - - const signature = signer.sign(this.privKeyBungee, 'base64'); - + + const signature = signer.sign(this.privKeyBungee, "base64"); + // this.saveToFile(__dirname + "/../../view/signed.json", JSON.stringify(view)); - - const signedView = {View: view, Signature: signature}; - this.saveToFile(__dirname + "/../../view/viewFile_" + this.fileNameDate + ".json", JSON.stringify(signedView, null, 2)); - + const signedView = { View: view, Signature: signature }; + + this.saveToFile( + __dirname + "/../../view/viewFile_" + this.fileNameDate + ".json", + JSON.stringify(signedView, null, 2), + ); + this.tFgenerateView = performance.now(); return JSON.stringify(signedView); } - /** - * + * * @abstract Returns transaction receipt. - * + * * @param transactionId - Transaction id to return the receipt * */ async fabricGetTxReceiptByTxIDV1(transactionId: string): Promise { this.tIfabricGetTxReceiptByTxIDV1 = performance.now(); - - const receiptLockRes = await this.fabricApi?.getTransactionReceiptByTxIDV1( - { - signingCredential: this.fabricSigningCredential, - channelName: this.fabricChannelName, - contractName: "qscc", - invocationType: FabricContractInvocationType.Call, - methodName: "GetBlockByTxID", - params: [this.fabricChannelName, transactionId], - } as FabricRunTransactionRequest, - ); - + + const receiptLockRes = await this.fabricApi?.getTransactionReceiptByTxIDV1({ + signingCredential: this.fabricSigningCredential, + channelName: this.fabricChannelName, + contractName: "qscc", + invocationType: FabricContractInvocationType.Call, + methodName: "GetBlockByTxID", + params: [this.fabricChannelName, transactionId], + } as FabricRunTransactionRequest); + this.tFfabricGetTxReceiptByTxIDV1 = performance.now(); return JSON.stringify(receiptLockRes?.data); } - /** - * + * * @abstract Returns all assets key found in the world state. * */ async getAllAssetsKey(): Promise { this.tIgetAllAssetsKey = performance.now(); - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -350,8 +342,8 @@ export class PluginBUNGEEBenchmark { invocationType: FabricContractInvocationType.Call, params: [], } as FabricRunTransactionRequest); - - if (response != undefined){ + + if (response != undefined) { this.tFgetAllAssetsKey = performance.now(); return response.data.functionOutput; } @@ -359,16 +351,14 @@ export class PluginBUNGEEBenchmark { return "response undefined"; } - /** - * + * * @abstract Returns an array of all transactions for a specific key. * * @param key - Key used to get correspondent transactions * */ async getAllTxByKey(key: string): Promise { this.tIgetAllTxByKey = performance.now(); - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -377,9 +367,8 @@ export class PluginBUNGEEBenchmark { invocationType: FabricContractInvocationType.Call, params: [key], } as FabricRunTransactionRequest); - - if (response != undefined){ - + + if (response != undefined) { this.tFgetAllTxByKey = performance.now(); return Utils.txsStringToTxs(response.data.functionOutput); } @@ -387,15 +376,13 @@ export class PluginBUNGEEBenchmark { return []; } - /** - * + * * @abstract Returns all the transactions for a specific key in string format. * * @param key - Key (id) used to get correspondent transactions * */ async getAllTxByKeyString(key: string): Promise { - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -405,16 +392,26 @@ export class PluginBUNGEEBenchmark { params: [key], } as FabricRunTransactionRequest); - if (response != undefined){ - + if (response != undefined) { return response.data.functionOutput; } return ""; } - public generateBenchmarkReport(numberOfTransactions: number, tItotalTime: number, tFtotalTime: number, tItransactionsTime: number, tFtransactionsTime: number): void{ - const report = { tIgetAllAssetsKey: this.tIgetAllAssetsKey, tFgetAllAssetsKey: this.tFgetAllAssetsKey, tIgetAllTxByKey: this.tIgetAllTxByKey, tFgetAllTxByKey: this.tFgetAllTxByKey, tIfabricGetTxReceiptByTxIDV1: this.tIfabricGetTxReceiptByTxIDV1, + public generateBenchmarkReport( + numberOfTransactions: number, + tItotalTime: number, + tFtotalTime: number, + tItransactionsTime: number, + tFtransactionsTime: number, + ): void { + const report = { + tIgetAllAssetsKey: this.tIgetAllAssetsKey, + tFgetAllAssetsKey: this.tFgetAllAssetsKey, + tIgetAllTxByKey: this.tIgetAllTxByKey, + tFgetAllTxByKey: this.tFgetAllTxByKey, + tIfabricGetTxReceiptByTxIDV1: this.tIfabricGetTxReceiptByTxIDV1, numberOfTransactions: numberOfTransactions, tFfabricGetTxReceiptByTxIDV1: this.tFfabricGetTxReceiptByTxIDV1, tIgenerateLedgerStates: this.tIgenerateLedgerStates, @@ -427,14 +424,16 @@ export class PluginBUNGEEBenchmark { tFtotalTime: tFtotalTime, tItransactionsTime: tItransactionsTime, tFtransactionsTime: tFtransactionsTime, - }; + }; const reportString = JSON.stringify(report, null, 2); - this.saveToFile(__dirname + "/../../report/report_" + this.fileNameDate +".json", reportString); + this.saveToFile( + __dirname + "/../../report/report_" + this.fileNameDate + ".json", + reportString, + ); } - /** - * + * * @abstract Save view in json file. * * @param fileName - File name or path + file name @@ -442,7 +441,6 @@ export class PluginBUNGEEBenchmark { * */ public saveToFile(fileName: string, data: string): void { const fs = require("fs"); - fs.writeFileSync(fileName, data, function (err: boolean) { if (err) { return console.log("error"); @@ -450,4 +448,3 @@ export class PluginBUNGEEBenchmark { }); } } - diff --git a/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee.ts b/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee.ts index 28b25efbd9..a84db07157 100644 --- a/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee.ts +++ b/packages/cactus-plugin-bungee/src/main/typescript/plugin-bungee.ts @@ -58,12 +58,10 @@ export interface IPluginBUNGEEOptions extends ICactusPluginOptions { disableSignalHandlers?: true; } -export class PluginBUNGEE implements - ICactusPlugin, IPluginWebService -{ +export class PluginBUNGEE implements ICactusPlugin, IPluginWebService { public static readonly CLASS_NAME = "PluginBUNGEE"; private log: Logger; - + private bungeeSigner: JsObjectSigner; private privKeyBungee: string; private pubKeyBungee: string; @@ -75,14 +73,12 @@ export class PluginBUNGEE implements private ledgerAssetsKey: string[]; private ledgerStates: Map; //Key, state private states: State[]; - public fabricApi?: FabricApi; public fabricSigningCredential?: FabricSigningCredential; public fabricChannelName?: string; public fabricContractName?: string; public fabricAssetID?: string; public fabricAssetSize?: string; - private readonly instanceId: string; private level: LogLevelDesc; private endpoints: IWebServiceEndpoint[] | undefined; @@ -91,20 +87,18 @@ export class PluginBUNGEE implements const fnTag = `${this.className}#constructor()`; Checks.truthy(options, `${fnTag} arg options`); Checks.truthy(options.instanceId, `${fnTag} options.instanceId`); - this.level = options.logLevel || "INFO"; const label = this.className; const level = this.level; this.log = LoggerProvider.getOrCreate({ label, level }); - + this.instanceId = options.instanceId; - const keysRelPath ="../keys/"; + const keysRelPath = "../keys/"; const pubKeyPath = path.join(__dirname, keysRelPath, "./bungee_pub.pem"); const privKeyPath = path.join(__dirname, keysRelPath, "./bungee_priv.pem"); this.pubKeyBungee = Utils.readKeyFromFile(pubKeyPath); this.privKeyBungee = Utils.readKeyFromFile(privKeyPath); - const bungeeSignerOptions: IJsObjectSignerOptions = { privateKey: this.privKeyBungee, logLevel: "debug", @@ -112,7 +106,6 @@ export class PluginBUNGEE implements this.bungeeSigner = new JsObjectSigner(bungeeSignerOptions); this.participant = options.participant; - this.ledgerAssetsKey = []; this.ledgerStates = new Map(); this.states = []; @@ -134,7 +127,6 @@ export class PluginBUNGEE implements public async shutdown(): Promise { this.log.info(`Shutting down ${this.className}...`); - } public getPackageName(): string { @@ -160,9 +152,7 @@ export class PluginBUNGEE implements bungee: this, }); - this.endpoints = [ - clientEndpoint, - ]; + this.endpoints = [clientEndpoint]; return this.endpoints; } @@ -200,7 +190,7 @@ export class PluginBUNGEE implements : "1"; } - async onCreateView(request: CreateViewRequest): Promise { + async onCreateView(request: CreateViewRequest): Promise { //const fnTag = `${this.className}#onCreateView()`; const response = this.generateView(this.generateSnapshot()); return { @@ -209,59 +199,63 @@ export class PluginBUNGEE implements } /** - * + * * @abstract Create ledger state. Get all keys, iterate every key and get the respective transactions. For each transaction get the receipt * */ public async generateLedgerStates(): Promise { - this.log.info(`Generating ledger snapshot`); - + this.log.info(`Generating ledger snapshot`); + const assetsKey = await this.getAllAssetsKey(); this.ledgerAssetsKey = assetsKey.split(","); - + //For each key in ledgerAssetsKey - for(const assetKey of this.ledgerAssetsKey){ - let assetValues: string[] = []; - let txWithTimeS: Transaction[] = []; + for (const assetKey of this.ledgerAssetsKey) { + const assetValues: string[] = []; + const txWithTimeS: Transaction[] = []; - this.log.info(assetKey); + this.log.info(assetKey); const txs = await this.getAllTxByKey(assetKey); //For each tx get receipt - for(const tx of txs){ + for (const tx of txs) { const endorsements: Proof[] = []; - const receipt = JSON.parse(await this.fabricGetTxReceiptByTxIDV1(tx.getId())); + const receipt = JSON.parse( + await this.fabricGetTxReceiptByTxIDV1(tx.getId()), + ); // Checks if tx was made by participant - if(receipt.transactionCreator.mspid != this.participant){ + if (receipt.transactionCreator.mspid != this.participant) { continue; } - + assetValues.push(JSON.parse(receipt.rwsetWriteData).Value.toString()); //Save endorsements of tx - for (const endorsement of receipt.transactionEndorsement) { - const signature64 = Buffer.from(endorsement.signature).toString('base64'); - endorsements.push(new Proof(endorsement.mspid, endorsement.endorserID, signature64)); + for (const endorsement of receipt.transactionEndorsement) { + const signature64 = Buffer.from(endorsement.signature).toString( + "base64", + ); + endorsements.push( + new Proof(endorsement.mspid, endorsement.endorserID, signature64), + ); } tx.defineTxProofs(endorsements); txWithTimeS.push(tx); } - const state = new State(assetKey, assetValues, txWithTimeS); this.ledgerStates.set(assetKey, state); this.states.push(state); } - + this.ledgerStates.forEach((state: State, keyId: string) => { console.log(keyId, state); const assetState = this.ledgerStates.get(keyId); - if(assetState != undefined) { - this.log.info(assetState); - this.log.info(JSON.parse(assetState.getStateJson())); - + if (assetState != undefined) { + this.log.info(assetState); + this.log.info(JSON.parse(assetState.getStateJson())); } }); - + // TESTS ONLY -> next receive ti tf const car2 = this.ledgerStates.get("CAR2"); @@ -270,12 +264,11 @@ export class PluginBUNGEE implements this.tF = car2.getTimeForTxN(1); } - return ""; + return ""; } - /** - * + * * @abstract Returns Snapshot * */ public generateSnapshot(): Snapshot { @@ -284,66 +277,66 @@ export class PluginBUNGEE implements return snapshot; } - /** - * + * * @abstract Returns view. Generate final view with signature - * + * * @param snapshot - Ledger Snapshot * */ public generateView(snapshot: Snapshot): string { - const crypto = require('crypto'); + const crypto = require("crypto"); - this.log.warn(this.pubKeyBungee); - this.log.warn(this.privKeyBungee); + this.log.warn(this.pubKeyBungee); + this.log.warn(this.privKeyBungee); const view = new View(this.tI, this.tF, snapshot); - - const signer = crypto.createSign('SHA256'); + + const signer = crypto.createSign("SHA256"); signer.write(JSON.stringify(view)); signer.end(); - this.log.warn(view.getViewStr()); + this.log.warn(view.getViewStr()); - const signature = signer.sign(this.privKeyBungee, 'base64'); + const signature = signer.sign(this.privKeyBungee, "base64"); - this.saveToFile(__dirname + "/../../view/signed.json", JSON.stringify(view)); + this.saveToFile( + __dirname + "/../../view/signed.json", + JSON.stringify(view), + ); - const signedView = {View: view, Signature: signature}; + const signedView = { View: view, Signature: signature }; - this.saveToFile(__dirname + "/../../view/viewFile.json", JSON.stringify(signedView, null, 2)); + this.saveToFile( + __dirname + "/../../view/viewFile.json", + JSON.stringify(signedView, null, 2), + ); return JSON.stringify(signedView); } - /** - * + * * @abstract Returns transaction receipt. - * + * * @param transactionId - Transaction id to return the receipt * */ async fabricGetTxReceiptByTxIDV1(transactionId: string): Promise { - const receiptLockRes = await this.fabricApi?.getTransactionReceiptByTxIDV1( - { - signingCredential: this.fabricSigningCredential, - channelName: this.fabricChannelName, - contractName: "qscc", - invocationType: FabricContractInvocationType.Call, - methodName: "GetBlockByTxID", - params: [this.fabricChannelName, transactionId], - } as FabricRunTransactionRequest, - ); + const receiptLockRes = await this.fabricApi?.getTransactionReceiptByTxIDV1({ + signingCredential: this.fabricSigningCredential, + channelName: this.fabricChannelName, + contractName: "qscc", + invocationType: FabricContractInvocationType.Call, + methodName: "GetBlockByTxID", + params: [this.fabricChannelName, transactionId], + } as FabricRunTransactionRequest); return JSON.stringify(receiptLockRes?.data); } - /** - * + * * @abstract Returns all assets key found in the world state. * */ async getAllAssetsKey(): Promise { - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -353,22 +346,20 @@ export class PluginBUNGEE implements params: [], } as FabricRunTransactionRequest); - if (response != undefined){ + if (response != undefined) { return response.data.functionOutput; } return "response undefined"; } - /** - * + * * @abstract Returns an array of all transactions for a specific key. * * @param key - Key used to get correspondent transactions * */ async getAllTxByKey(key: string): Promise { - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -378,23 +369,20 @@ export class PluginBUNGEE implements params: [key], } as FabricRunTransactionRequest); - if (response != undefined){ - + if (response != undefined) { return Utils.txsStringToTxs(response.data.functionOutput); } return []; } - /** - * + * * @abstract Returns all the transactions for a specific key in string format. * * @param key - Key (id) used to get correspondent transactions * */ async getAllTxByKeyString(key: string): Promise { - const response = await this.fabricApi?.runTransactionV1({ signingCredential: this.fabricSigningCredential, channelName: this.fabricChannelName, @@ -404,17 +392,15 @@ export class PluginBUNGEE implements params: [key], } as FabricRunTransactionRequest); - if (response != undefined){ - + if (response != undefined) { return response.data.functionOutput; } return ""; } - /** - * + * * @abstract Save view in json file. * * @param fileName - File name or path + file name @@ -422,7 +408,6 @@ export class PluginBUNGEE implements * */ public saveToFile(fileName: string, data: string): void { const fs = require("fs"); - fs.writeFileSync(fileName, data, function (err: boolean) { if (err) { return console.log("error"); @@ -430,4 +415,3 @@ export class PluginBUNGEE implements }); } } - diff --git a/packages/cactus-plugin-bungee/src/main/typescript/public-api.ts b/packages/cactus-plugin-bungee/src/main/typescript/public-api.ts index 7ae6c25ded..db2130329d 100644 --- a/packages/cactus-plugin-bungee/src/main/typescript/public-api.ts +++ b/packages/cactus-plugin-bungee/src/main/typescript/public-api.ts @@ -1,15 +1,10 @@ import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api"; import { PluginFactoryBUNGEE } from "./plugin-factory-bungee"; -import * as OpenApiJson from "../json/openapi.json"; -export { - PluginBUNGEE, - IPluginBUNGEEOptions, -} from "./plugin-bungee"; +export { PluginBUNGEE, IPluginBUNGEEOptions } from "./plugin-bungee"; export async function createPluginFactory( - pluginFactoryOptions: IPluginFactoryOptions, - ): Promise { - return new PluginFactoryBUNGEE(pluginFactoryOptions); - } - \ No newline at end of file + pluginFactoryOptions: IPluginFactoryOptions, +): Promise { + return new PluginFactoryBUNGEE(pluginFactoryOptions); +} diff --git a/packages/cactus-plugin-bungee/src/main/typescript/web-services/client-endpoint.ts b/packages/cactus-plugin-bungee/src/main/typescript/web-services/client-endpoint.ts index e8e6c727e8..4df190f1f9 100644 --- a/packages/cactus-plugin-bungee/src/main/typescript/web-services/client-endpoint.ts +++ b/packages/cactus-plugin-bungee/src/main/typescript/web-services/client-endpoint.ts @@ -42,7 +42,6 @@ export class ClientEndpointV1 implements IWebServiceEndpoint { const label = this.className; this.log = LoggerProvider.getOrCreate({ level, label }); } - public getExpressRequestHandler(): IExpressRequestHandler { return this.handleRequest.bind(this); } diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/get-snapshot.test.ts b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/get-snapshot.test.ts index 231dbff266..2bd96daa8d 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/get-snapshot.test.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/test/typescript/integration/fabric-v2-2-x/get-snapshot.test.ts @@ -386,4 +386,4 @@ test(testCase, async (t: Test) => { await new Promise((resolve) => setTimeout(resolve, 10000)); t.end(); -}); \ No newline at end of file +}); diff --git a/packages/cactus-plugin-satp-hermes/README.md b/packages/cactus-plugin-satp-hermes/README.md index 6ab940d3ce..6643d02363 100644 --- a/packages/cactus-plugin-satp-hermes/README.md +++ b/packages/cactus-plugin-satp-hermes/README.md @@ -1,8 +1,9 @@ # @hyperledger/cactus-plugin-satp-hermes -The package provides `Cactus` a way to standardize cross-chain transactions between two ledgers (Fabric and Besu in this implementation). Using this we can perform: +The package provides `Hyperledger Cacti` a way to standardize cross-chain transactions between ledgers. Using this we can perform: - A unidirectional atomic asset transfer between 2 parties in different ledgers. - Lock of the asset in the source ledger and proof is sent to the counterparty. - Extinguishment of the asset in the source blockchain and regeneration of the asset in the recipient blockchain. +- This package implements [Hermes as defined in the paper](https://www.sciencedirect.com/science/article/abs/pii/S0167739X21004337), namely the gateway paradigm and crash recovery. At the moment, we assume a crash-fault environment under some assumptions detailed in section [Assumptions](#assumptions) ## Summary @@ -23,6 +24,8 @@ Regarding the crash recovery procedure in place, at the moment we only support c - Gateways do not have byzantine behavior - Gateways are assumed to always recover from a crash +We will be working on reducing these assumptions and making the system more resilient to faults. + ## Getting Started Clone the git repository on your local machine. Follow these instructions that will get you a copy of the project up and running on @@ -50,13 +53,16 @@ Firstly let us identify the different entities involved in the protocol and what - SQLite3 database: persistent log and proofs storage in each gateway. - IPFS connector: is exposed the API so that both gateways have access to the same structure. This is used to store the hashes and signatures of the logs and proofs, so that accountability is guaranteed. -The sequence diagram of ODAP is pictured below. +The sequence diagram of SATP is pictured below. + +![satp-sequence-diagram](https://i.imgur.com/SOdXFEt.png) -![odap-sequence-diagram](https://i.imgur.com/SOdXFEt.png) +### Application-to-Gateway API (API Type 1) +We -### API Endpoints +### Gateway-to-Gateway API (API Type 2) This plugin uses OpenAPI to generate the API paths. -There are Client and Server Endpoints for each type of message detailed in the ODAP protocol: +There are Client and Server Endpoints for each type of message detailed in the SATP protocol: - TransferInitializationV1Request - TransferInitializationV1Response @@ -79,31 +85,31 @@ There are also defined the endpoints for the crash recovery procedure (there is - RollbackV1Message ## Use case -Alice and Bob, in blockchains A and B, respectively, want to make a transfer of an asset from one to the other. Gateway A represents the gateway connected to Alice's blockchain. Gateway B represents the gateway connected to Bob's blockchain. Alice and Bob will run ODAP, which will execute the transfer of the asset from blockchain A to blockchain B. The above endpoints will be called in sequence. Notice that the asset will first be locked on blockchain A and a proof is sent to the server-side. Afterward, the asset on the original blockchain is extinguished, followed by its regeneration on blockchain B. +Alice and Bob, in blockchains A and B, respectively, want to make a transfer of an asset from one to the other. Gateway A represents the gateway connected to Alice's blockchain. Gateway B represents the gateway connected to Bob's blockchain. Alice and Bob will run SATP, which will execute the transfer of the asset from blockchain A to blockchain B. The above endpoints will be called in sequence. Notice that the asset will first be locked on blockchain A and a proof is sent to the server-side. Afterward, the asset on the original blockchain is extinguished, followed by its regeneration on blockchain B. ## Running the tests -[A test of the entire protocol with manual calls to the methods, i.e. without ledger connectors and Open API.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap.test.ts) +[A test of the entire protocol with manual calls to the methods, i.e. without ledger connectors and Open API.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/satp.test.ts) -[A test of the entire protocol using Open API but with no ledger connectors.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call.test.ts) +[A test of the entire protocol using Open API but with no ledger connectors.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/satp-api-call.test.ts) -[A test of the entire protocol with ledger connectors (Fabric and Besu) and Open API.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts) +[A test of the entire protocol with ledger connectors (Fabric and Besu) and Open API.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/satp-api-call-with-ledger-connector.test.ts) -[A test with a simulated crash of the client gateway after the transfer initiation flow.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts) +[A test with a simulated crash of the client gateway after the transfer initiation flow.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts) -[A test with a simulated crash of the client gateway after the lock of the asset in the source blockchain (Fabric).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts) +[A test with a simulated crash of the client gateway after the lock of the asset in the source blockchain (Fabric).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts) -[A test with a simulated crash of the client gateway after the deletion of the asset in the source blockchain (Fabric).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts) +[A test with a simulated crash of the client gateway after the deletion of the asset in the source blockchain (Fabric).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts) -[A test with a simulated crash of the server gateway after the creation of the the asset in the recipient blockchain (Besu).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts) +[A test with a simulated crash of the server gateway after the creation of the the asset in the recipient blockchain (Besu).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts) -[A test with a simulated crash of the server gateway after the transfer initiation flow.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts) +[A test with a simulated crash of the server gateway after the transfer initiation flow.](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts) -[A test with a rollback after a timeout (client crashed).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/odap-rollback.test.ts) +[A test with a rollback after a timeout (client crashed).](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/satp-rollback.test.ts) -[A test with a backup gateway resuming the protocol after the client gateway crashed.](https://github.com/hyperledger/cactus/tree/main/packages/cactus-plugin-odap-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts) +[A test with a backup gateway resuming the protocol after the client gateway crashed.](https://github.com/hyperledger/cactus/tree/main/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts) -For developers that want to test separate steps/phases of the ODAP protocol, please refer to [these](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-odap-hermes/src/test/typescript/unit/) test files (client and server side along with the recovery procedure). +For developers that want to test separate steps/phases of the SATP protocol, please refer to [these](https://github.com/hyperledger/cactus/blob/2e94ef8d3b34449c7b4d48e37d81245851477a3e/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/) test files (client and server side along with the recovery procedure). ## Usage @@ -112,12 +118,12 @@ Let us consider two gateways. The client gateway connected to Hyperledger Fabric - A Hyperledger Fabric API client on URL: http://localhost:8045 - A Hyperledger Besu API client on URL: http://localhost:8046 - An IPFS API client on URL: http://localhost:8047 - - The local databases configuration provided in the file [knex.config.ts](https://github.com/hyperledger/cactus/blob/main/packages/cactus-plugin-odap-hermes/src/test/typescript/knex.config.ts) + - The local databases configuration provided in the file [knex.config.ts](https://github.com/hyperledger/cactus/blob/main/packages/cactus-plugin-satp-hermes/src/test/typescript/knex.config.ts) -Then the ODAP gateways should be created as follows: +Then the SATP gateways should be created as follows: ```typescript -const clientGatewayOptions: IFabricSatpGatewayConstructorOptions = { +const clientGatewayOptions: IFabricSATPGatewayConstructorOptions = { name: "cactus-plugin#clientOdapGateway", dltIDs: ["DLT2"], instanceId: uuidv4(), @@ -130,7 +136,7 @@ const clientGatewayOptions: IFabricSatpGatewayConstructorOptions = { serverHelper: new ServerGatewayHelper(), }; -const serverGatewayOptions: IBesuSatpGatewayConstructorOptions = { +const serverGatewayOptions: IBesuSATPGatewayConstructorOptions = { name: "cactus-plugin#serverOdapGateway", dltIDs: ["DLT1"], instanceId: uuidv4(), @@ -143,11 +149,11 @@ const serverGatewayOptions: IBesuSatpGatewayConstructorOptions = { serverHelper: new ServerGatewayHelper(), }; - const clientGateway = new FabricSatpGateway(clientGatewayOptions); - const serverGateway = new BesuSatpGateway(serverGatewayOptions); + const clientGateway = new FabricSATPGateway(clientGatewayOptions); + const serverGateway = new BesuSATPGateway(serverGatewayOptions); ``` -Note that these gateways are extensions of the [default ODAP Gateway class](https://github.com/hyperledger/cactus/blob/main/packages/cactus-plugin-odap-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts), that implements the gateway functionality. Each of these extensions implements ledger-specific operations. +Note that these gateways are extensions of the [default SATP Gateway class](https://github.com/hyperledger/cactus/blob/main/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts), that implements the gateway functionality. Each of these extensions implements ledger-specific operations. ## Contributing We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do! diff --git a/packages/cactus-plugin-satp-hermes/package.json b/packages/cactus-plugin-satp-hermes/package.json index 8f1cdb6c17..6179abe0b8 100644 --- a/packages/cactus-plugin-satp-hermes/package.json +++ b/packages/cactus-plugin-satp-hermes/package.json @@ -1,14 +1,15 @@ { "name": "@hyperledger/cactus-plugin-satp-hermes", "version": "2.0.0-alpha.2", - "description": "Proof of concept of ODAP", + "description": "SATP-Hermes implementation of SATP.", "keywords": [ "Hyperledger", - "Cactus", "Integration", + "Interoperability", "Blockchain", "Distributed Ledger Technology", - "Open Digital Asset Protocol" + "IETF", + "Secure Asset Transfer Protocol" ], "repository": { "type": "git", @@ -16,7 +17,7 @@ }, "license": "Apache-2.0", "author": { - "name": "Hyperledger Cactus Contributors", + "name": "Hyperledger Cacti Contributors", "email": "cactus@lists.hyperledger.org", "url": "https://www.hyperledger.org/use/cacti" }, @@ -29,6 +30,10 @@ { "name": "Tzu-Shen, Wang", "url": "https://github.com/jscode017" + }, + { + "name": "Rafael Belchior", + "url": "https://github.com/RafaelAPB" } ], "main": "dist/lib/main/typescript/index.js", @@ -38,17 +43,31 @@ "dist/*" ], "scripts": { + "build": "run-p tsc codegen", + "build-proto": "buf build --path src/main/proto --verbose", "build:dev:backend:postbuild": "mkdir -p ./dist/lib/main/knex && cp -r ./knex/* ./dist/lib/main/knex", "codegen": "run-p 'codegen:*'", "codegen:openapi": "npm run generate-sdk", + "codegen:proto": "npm run generate-proto", + "generate-proto": "cd src/main/proto && buf generate --template buf.gen.yaml --config buf.yaml --verbose", "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", + "lint": "npm-run-all 'buf lint' eslint '*/*/src/**/*.{js,ts}' --quiet --fix && cspell \"*/*/src/**/*.{js,ts}\"", + "lint-protobuf": "buf lint --path src/main/proto --verbose", "pretsc": "npm run generate-sdk", "tsc": "tsc --project ./tsconfig.json", - "watch": "npm-watch" + "watch": "tsc --build --watch" + }, + "jest": { + "moduleNameMapper": { + "(.+)\\.js": "$1" + } }, "dependencies": { + "@connectrpc/connect": "1.3.0", + "@connectrpc/connect-express": "1.3.0", + "@connectrpc/connect-node": "1.3.0", + "@connectrpc/protoc-gen-connect-es": "1.3.0", "@hyperledger/cactus-cmd-api-server": "2.0.0-alpha.2", "@hyperledger/cactus-common": "2.0.0-alpha.2", "@hyperledger/cactus-core": "2.0.0-alpha.2", @@ -59,22 +78,34 @@ "@hyperledger/cactus-plugin-object-store-ipfs": "2.0.0-alpha.2", "@hyperledger/cactus-test-tooling": "2.0.0-alpha.2", "axios": "1.6.0", + "body-parser": "1.20.2", + "class-transformer": "0.5.1", + "class-validator": "0.14.1", "crypto-js": "4.2.0", + "express": "4.17.2", + "fabric-network": "2.2.19", "fs-extra": "11.1.1", "knex": "2.4.0", + "kubo-rpc-client": "3.0.1", "secp256k1": "4.0.3", "socket.io": "4.5.4", "sqlite3": "5.1.5", + "swagger-ui-express": "5.0.0", "typescript-optional": "2.0.1", "uuid": "9.0.1", "web3": "1.6.1", "web3-utils": "1.6.1" }, "devDependencies": { + "@bufbuild/buf": "1.29.0", + "@bufbuild/protobuf": "1.7.2", + "@bufbuild/protoc-gen-es": "1.7.2", "@types/body-parser": "1.19.4", "@types/crypto-js": "4.0.1", - "@types/express": "4.17.19", + "@types/express": "4.17.21", "@types/fs-extra": "11.0.3", + "@types/node": "18.18.2", + "@types/swagger-ui-express": "4.1.6", "@types/tape": "4.13.4", "@types/uuid": "9.0.8", "body-parser": "1.20.2", diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES deleted file mode 100644 index 4f5a990219..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES +++ /dev/null @@ -1,50 +0,0 @@ -README.md -build.gradle -gradlew -gradlew.bat -settings.gradle -src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt -src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt -src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt -src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt -src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt -src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt -src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt -src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt -src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt -src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt -src/main/kotlin/org/openapitools/client/models/AssetProfile.kt -src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt -src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt -src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt -src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt -src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt -src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt -src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt -src/main/kotlin/org/openapitools/client/models/History.kt -src/main/kotlin/org/openapitools/client/models/LocalLog.kt -src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt -src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt -src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt -src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt -src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt -src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt -src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt -src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt -src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt -src/main/kotlin/org/openapitools/client/models/SatpMessage.kt -src/main/kotlin/org/openapitools/client/models/SatpMessageActionResponse.kt -src/main/kotlin/org/openapitools/client/models/SessionData.kt -src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt -src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt -src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt -src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt -src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Response.kt diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION deleted file mode 100644 index cd802a1ec4..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -6.6.0 \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md deleted file mode 100644 index d4a3519e92..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# org.openapitools.client - Kotlin client library for Hyperledger Cactus Plugin - Odap Hermes - -Implementation for Odap and Hermes - -## Overview -This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. - -- API version: v2.0.0-alpha.2 -- Package version: -- Build package: org.openapitools.codegen.languages.KotlinClientCodegen - -## Requires - -* Kotlin 1.7.21 -* Gradle 7.5 - -## Build - -First, create the gradle wrapper script: - -``` -gradle wrapper -``` - -Then, run: - -``` -./gradlew check assemble -``` - -This runs all tests and packages the library. - -## Features/Implementation Notes - -* Supports JSON inputs/outputs, File inputs, and Form inputs. -* Supports collection formats for query parameters: csv, tsv, ssv, pipes. -* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. -* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. - - -## Documentation for API Endpoints - -All URIs are relative to *http://localhost* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*DefaultApi* | [**clientRequestV1**](docs/DefaultApi.md#clientrequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/clientrequest | -*DefaultApi* | [**phase1TransferInitiationRequestV1**](docs/DefaultApi.md#phase1transferinitiationrequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationrequest | -*DefaultApi* | [**phase1TransferInitiationResponseV1**](docs/DefaultApi.md#phase1transferinitiationresponsev1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationresponse | -*DefaultApi* | [**phase2LockEvidenceRequestV1**](docs/DefaultApi.md#phase2lockevidencerequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidencerequest | -*DefaultApi* | [**phase2LockEvidenceResponseV1**](docs/DefaultApi.md#phase2lockevidenceresponsev1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidenceresponse | -*DefaultApi* | [**phase2TransferCommenceRequestV1**](docs/DefaultApi.md#phase2transfercommencerequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommencerequest | -*DefaultApi* | [**phase2TransferCommenceResponseV1**](docs/DefaultApi.md#phase2transfercommenceresponsev1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommenceresponse | -*DefaultApi* | [**phase3CommitFinalRequestV1**](docs/DefaultApi.md#phase3commitfinalrequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalrequest | -*DefaultApi* | [**phase3CommitFinalResponseV1**](docs/DefaultApi.md#phase3commitfinalresponsev1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalresponse | -*DefaultApi* | [**phase3CommitPreparationRequestV1**](docs/DefaultApi.md#phase3commitpreparationrequestv1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationrequest | -*DefaultApi* | [**phase3CommitPreparationResponseV1**](docs/DefaultApi.md#phase3commitpreparationresponsev1) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationresponse | -*DefaultApi* | [**phase3TransferCompleteRequestV1**](docs/DefaultApi.md#phase3transfercompleterequestv1) | **GET** /api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/transfercompleterequest | -*DefaultApi* | [**recoverUpdateAckV1Message**](docs/DefaultApi.md#recoverupdateackv1message) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdateackmessage | -*DefaultApi* | [**recoverUpdateV1Message**](docs/DefaultApi.md#recoverupdatev1message) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdatemessage | -*DefaultApi* | [**recoverV1Message**](docs/DefaultApi.md#recoverv1message) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/recovermessage | -*DefaultApi* | [**recoverV1Success**](docs/DefaultApi.md#recoverv1success) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/recoversuccessmessage | -*DefaultApi* | [**rollbackAckV1Message**](docs/DefaultApi.md#rollbackackv1message) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackackmessage | -*DefaultApi* | [**rollbackV1Message**](docs/DefaultApi.md#rollbackv1message) | **POST** /api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackmessage | - - - -## Documentation for Models - - - [org.openapitools.client.models.AssetProfile](docs/AssetProfile.md) - - [org.openapitools.client.models.ClientV1Request](docs/ClientV1Request.md) - - [org.openapitools.client.models.ClientV1RequestClientGatewayConfiguration](docs/ClientV1RequestClientGatewayConfiguration.md) - - [org.openapitools.client.models.CommitFinalV1Request](docs/CommitFinalV1Request.md) - - [org.openapitools.client.models.CommitFinalV1Response](docs/CommitFinalV1Response.md) - - [org.openapitools.client.models.CommitPreparationV1Request](docs/CommitPreparationV1Request.md) - - [org.openapitools.client.models.CommitPreparationV1Response](docs/CommitPreparationV1Response.md) - - [org.openapitools.client.models.CredentialProfile](docs/CredentialProfile.md) - - [org.openapitools.client.models.History](docs/History.md) - - [org.openapitools.client.models.LocalLog](docs/LocalLog.md) - - [org.openapitools.client.models.LockEvidenceV1Request](docs/LockEvidenceV1Request.md) - - [org.openapitools.client.models.LockEvidenceV1Response](docs/LockEvidenceV1Response.md) - - [org.openapitools.client.models.PayloadProfile](docs/PayloadProfile.md) - - [org.openapitools.client.models.RecoverSuccessV1Message](docs/RecoverSuccessV1Message.md) - - [org.openapitools.client.models.RecoverUpdateAckV1Message](docs/RecoverUpdateAckV1Message.md) - - [org.openapitools.client.models.RecoverUpdateV1Message](docs/RecoverUpdateV1Message.md) - - [org.openapitools.client.models.RecoverV1Message](docs/RecoverV1Message.md) - - [org.openapitools.client.models.RollbackAckV1Message](docs/RollbackAckV1Message.md) - - [org.openapitools.client.models.RollbackV1Message](docs/RollbackV1Message.md) - - [org.openapitools.client.models.SatpMessage](docs/SatpMessage.md) - - [org.openapitools.client.models.SatpMessageActionResponse](docs/SatpMessageActionResponse.md) - - [org.openapitools.client.models.SessionData](docs/SessionData.md) - - [org.openapitools.client.models.TransferCommenceV1Request](docs/TransferCommenceV1Request.md) - - [org.openapitools.client.models.TransferCommenceV1Response](docs/TransferCommenceV1Response.md) - - [org.openapitools.client.models.TransferCompleteV1Request](docs/TransferCompleteV1Request.md) - - [org.openapitools.client.models.TransferInitializationV1Request](docs/TransferInitializationV1Request.md) - - [org.openapitools.client.models.TransferInitializationV1Response](docs/TransferInitializationV1Response.md) - - - -## Documentation for Authorization - -Endpoints do not require authorization. - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle deleted file mode 100644 index 66a3c68b89..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -group 'org.openapitools' -version '1.0.0' - -wrapper { - gradleVersion = '7.5' - distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" -} - -buildscript { - ext.kotlin_version = '1.7.21' - - repositories { - maven { url "https://repo1.maven.org/maven2" } - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -apply plugin: 'kotlin' -apply plugin: 'maven-publish' - -repositories { - maven { url "https://repo1.maven.org/maven2" } -} - -test { - useJUnitPlatform() -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - implementation "com.squareup.moshi:moshi-kotlin:1.13.0" - implementation "com.squareup.moshi:moshi-adapters:1.13.0" - implementation "com.squareup.okhttp3:okhttp:4.10.0" - testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew deleted file mode 100644 index aeb74cbb43..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat deleted file mode 100644 index 93e3f59f13..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle deleted file mode 100644 index 391dcea81d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ - -rootProject.name = 'kotlin-client' \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt deleted file mode 100644 index 35526c0a9a..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +++ /dev/null @@ -1,1313 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.apis - -import java.io.IOException -import okhttp3.OkHttpClient -import okhttp3.HttpUrl - -import org.openapitools.client.models.ClientV1Request -import org.openapitools.client.models.CommitFinalV1Request -import org.openapitools.client.models.CommitFinalV1Response -import org.openapitools.client.models.CommitPreparationV1Request -import org.openapitools.client.models.CommitPreparationV1Response -import org.openapitools.client.models.LockEvidenceV1Request -import org.openapitools.client.models.LockEvidenceV1Response -import org.openapitools.client.models.RecoverSuccessV1Message -import org.openapitools.client.models.RecoverUpdateAckV1Message -import org.openapitools.client.models.RecoverUpdateV1Message -import org.openapitools.client.models.RecoverV1Message -import org.openapitools.client.models.RollbackAckV1Message -import org.openapitools.client.models.RollbackV1Message -import org.openapitools.client.models.TransferCommenceV1Request -import org.openapitools.client.models.TransferCommenceV1Response -import org.openapitools.client.models.TransferCompleteV1Request -import org.openapitools.client.models.TransferInitializationV1Request -import org.openapitools.client.models.TransferInitializationV1Response - -import com.squareup.moshi.Json - -import org.openapitools.client.infrastructure.ApiClient -import org.openapitools.client.infrastructure.ApiResponse -import org.openapitools.client.infrastructure.ClientException -import org.openapitools.client.infrastructure.ClientError -import org.openapitools.client.infrastructure.ServerException -import org.openapitools.client.infrastructure.ServerError -import org.openapitools.client.infrastructure.MultiValueMap -import org.openapitools.client.infrastructure.PartConfig -import org.openapitools.client.infrastructure.RequestConfig -import org.openapitools.client.infrastructure.RequestMethod -import org.openapitools.client.infrastructure.ResponseType -import org.openapitools.client.infrastructure.Success -import org.openapitools.client.infrastructure.toMultiValue - -class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { - companion object { - @JvmStatic - val defaultBasePath: String by lazy { - System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") - } - } - - /** - * - * - * @param clientV1Request (optional) - * @return kotlin.Any - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun clientRequestV1(clientV1Request: ClientV1Request? = null) : kotlin.Any { - val localVarResponse = clientRequestV1WithHttpInfo(clientV1Request = clientV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.Any - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param clientV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Suppress("UNCHECKED_CAST") - @Throws(IllegalStateException::class, IOException::class) - fun clientRequestV1WithHttpInfo(clientV1Request: ClientV1Request?) : ApiResponse { - val localVariableConfig = clientRequestV1RequestConfig(clientV1Request = clientV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation clientRequestV1 - * - * @param clientV1Request (optional) - * @return RequestConfig - */ - fun clientRequestV1RequestConfig(clientV1Request: ClientV1Request?) : RequestConfig { - val localVariableBody = clientV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - localVariableHeaders["Accept"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/clientrequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param transferInitializationV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase1TransferInitiationRequestV1(transferInitializationV1Request: TransferInitializationV1Request? = null) : Unit { - val localVarResponse = phase1TransferInitiationRequestV1WithHttpInfo(transferInitializationV1Request = transferInitializationV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param transferInitializationV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase1TransferInitiationRequestV1WithHttpInfo(transferInitializationV1Request: TransferInitializationV1Request?) : ApiResponse { - val localVariableConfig = phase1TransferInitiationRequestV1RequestConfig(transferInitializationV1Request = transferInitializationV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase1TransferInitiationRequestV1 - * - * @param transferInitializationV1Request (optional) - * @return RequestConfig - */ - fun phase1TransferInitiationRequestV1RequestConfig(transferInitializationV1Request: TransferInitializationV1Request?) : RequestConfig { - val localVariableBody = transferInitializationV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationrequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param transferInitializationV1Response (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase1TransferInitiationResponseV1(transferInitializationV1Response: TransferInitializationV1Response? = null) : Unit { - val localVarResponse = phase1TransferInitiationResponseV1WithHttpInfo(transferInitializationV1Response = transferInitializationV1Response) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param transferInitializationV1Response (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase1TransferInitiationResponseV1WithHttpInfo(transferInitializationV1Response: TransferInitializationV1Response?) : ApiResponse { - val localVariableConfig = phase1TransferInitiationResponseV1RequestConfig(transferInitializationV1Response = transferInitializationV1Response) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase1TransferInitiationResponseV1 - * - * @param transferInitializationV1Response (optional) - * @return RequestConfig - */ - fun phase1TransferInitiationResponseV1RequestConfig(transferInitializationV1Response: TransferInitializationV1Response?) : RequestConfig { - val localVariableBody = transferInitializationV1Response - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase1/transferinitiationresponse", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param lockEvidenceV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2LockEvidenceRequestV1(lockEvidenceV1Request: LockEvidenceV1Request? = null) : Unit { - val localVarResponse = phase2LockEvidenceRequestV1WithHttpInfo(lockEvidenceV1Request = lockEvidenceV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param lockEvidenceV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase2LockEvidenceRequestV1WithHttpInfo(lockEvidenceV1Request: LockEvidenceV1Request?) : ApiResponse { - val localVariableConfig = phase2LockEvidenceRequestV1RequestConfig(lockEvidenceV1Request = lockEvidenceV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase2LockEvidenceRequestV1 - * - * @param lockEvidenceV1Request (optional) - * @return RequestConfig - */ - fun phase2LockEvidenceRequestV1RequestConfig(lockEvidenceV1Request: LockEvidenceV1Request?) : RequestConfig { - val localVariableBody = lockEvidenceV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidencerequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param lockEvidenceV1Response (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2LockEvidenceResponseV1(lockEvidenceV1Response: LockEvidenceV1Response? = null) : Unit { - val localVarResponse = phase2LockEvidenceResponseV1WithHttpInfo(lockEvidenceV1Response = lockEvidenceV1Response) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param lockEvidenceV1Response (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase2LockEvidenceResponseV1WithHttpInfo(lockEvidenceV1Response: LockEvidenceV1Response?) : ApiResponse { - val localVariableConfig = phase2LockEvidenceResponseV1RequestConfig(lockEvidenceV1Response = lockEvidenceV1Response) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase2LockEvidenceResponseV1 - * - * @param lockEvidenceV1Response (optional) - * @return RequestConfig - */ - fun phase2LockEvidenceResponseV1RequestConfig(lockEvidenceV1Response: LockEvidenceV1Response?) : RequestConfig { - val localVariableBody = lockEvidenceV1Response - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/lockevidenceresponse", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param transferCommenceV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2TransferCommenceRequestV1(transferCommenceV1Request: TransferCommenceV1Request? = null) : Unit { - val localVarResponse = phase2TransferCommenceRequestV1WithHttpInfo(transferCommenceV1Request = transferCommenceV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param transferCommenceV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase2TransferCommenceRequestV1WithHttpInfo(transferCommenceV1Request: TransferCommenceV1Request?) : ApiResponse { - val localVariableConfig = phase2TransferCommenceRequestV1RequestConfig(transferCommenceV1Request = transferCommenceV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase2TransferCommenceRequestV1 - * - * @param transferCommenceV1Request (optional) - * @return RequestConfig - */ - fun phase2TransferCommenceRequestV1RequestConfig(transferCommenceV1Request: TransferCommenceV1Request?) : RequestConfig { - val localVariableBody = transferCommenceV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommencerequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param transferCommenceV1Response (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase2TransferCommenceResponseV1(transferCommenceV1Response: TransferCommenceV1Response? = null) : Unit { - val localVarResponse = phase2TransferCommenceResponseV1WithHttpInfo(transferCommenceV1Response = transferCommenceV1Response) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param transferCommenceV1Response (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase2TransferCommenceResponseV1WithHttpInfo(transferCommenceV1Response: TransferCommenceV1Response?) : ApiResponse { - val localVariableConfig = phase2TransferCommenceResponseV1RequestConfig(transferCommenceV1Response = transferCommenceV1Response) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase2TransferCommenceResponseV1 - * - * @param transferCommenceV1Response (optional) - * @return RequestConfig - */ - fun phase2TransferCommenceResponseV1RequestConfig(transferCommenceV1Response: TransferCommenceV1Response?) : RequestConfig { - val localVariableBody = transferCommenceV1Response - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase2/transfercommenceresponse", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param commitFinalV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitFinalRequestV1(commitFinalV1Request: CommitFinalV1Request? = null) : Unit { - val localVarResponse = phase3CommitFinalRequestV1WithHttpInfo(commitFinalV1Request = commitFinalV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param commitFinalV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase3CommitFinalRequestV1WithHttpInfo(commitFinalV1Request: CommitFinalV1Request?) : ApiResponse { - val localVariableConfig = phase3CommitFinalRequestV1RequestConfig(commitFinalV1Request = commitFinalV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase3CommitFinalRequestV1 - * - * @param commitFinalV1Request (optional) - * @return RequestConfig - */ - fun phase3CommitFinalRequestV1RequestConfig(commitFinalV1Request: CommitFinalV1Request?) : RequestConfig { - val localVariableBody = commitFinalV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalrequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param commitFinalV1Response (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitFinalResponseV1(commitFinalV1Response: CommitFinalV1Response? = null) : Unit { - val localVarResponse = phase3CommitFinalResponseV1WithHttpInfo(commitFinalV1Response = commitFinalV1Response) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param commitFinalV1Response (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase3CommitFinalResponseV1WithHttpInfo(commitFinalV1Response: CommitFinalV1Response?) : ApiResponse { - val localVariableConfig = phase3CommitFinalResponseV1RequestConfig(commitFinalV1Response = commitFinalV1Response) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase3CommitFinalResponseV1 - * - * @param commitFinalV1Response (optional) - * @return RequestConfig - */ - fun phase3CommitFinalResponseV1RequestConfig(commitFinalV1Response: CommitFinalV1Response?) : RequestConfig { - val localVariableBody = commitFinalV1Response - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitfinalresponse", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param commitPreparationV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitPreparationRequestV1(commitPreparationV1Request: CommitPreparationV1Request? = null) : Unit { - val localVarResponse = phase3CommitPreparationRequestV1WithHttpInfo(commitPreparationV1Request = commitPreparationV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param commitPreparationV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase3CommitPreparationRequestV1WithHttpInfo(commitPreparationV1Request: CommitPreparationV1Request?) : ApiResponse { - val localVariableConfig = phase3CommitPreparationRequestV1RequestConfig(commitPreparationV1Request = commitPreparationV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase3CommitPreparationRequestV1 - * - * @param commitPreparationV1Request (optional) - * @return RequestConfig - */ - fun phase3CommitPreparationRequestV1RequestConfig(commitPreparationV1Request: CommitPreparationV1Request?) : RequestConfig { - val localVariableBody = commitPreparationV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationrequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param commitPreparationV1Response (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3CommitPreparationResponseV1(commitPreparationV1Response: CommitPreparationV1Response? = null) : Unit { - val localVarResponse = phase3CommitPreparationResponseV1WithHttpInfo(commitPreparationV1Response = commitPreparationV1Response) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param commitPreparationV1Response (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase3CommitPreparationResponseV1WithHttpInfo(commitPreparationV1Response: CommitPreparationV1Response?) : ApiResponse { - val localVariableConfig = phase3CommitPreparationResponseV1RequestConfig(commitPreparationV1Response = commitPreparationV1Response) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase3CommitPreparationResponseV1 - * - * @param commitPreparationV1Response (optional) - * @return RequestConfig - */ - fun phase3CommitPreparationResponseV1RequestConfig(commitPreparationV1Response: CommitPreparationV1Response?) : RequestConfig { - val localVariableBody = commitPreparationV1Response - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/commitpreparationresponse", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param transferCompleteV1Request (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun phase3TransferCompleteRequestV1(transferCompleteV1Request: TransferCompleteV1Request? = null) : Unit { - val localVarResponse = phase3TransferCompleteRequestV1WithHttpInfo(transferCompleteV1Request = transferCompleteV1Request) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param transferCompleteV1Request (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun phase3TransferCompleteRequestV1WithHttpInfo(transferCompleteV1Request: TransferCompleteV1Request?) : ApiResponse { - val localVariableConfig = phase3TransferCompleteRequestV1RequestConfig(transferCompleteV1Request = transferCompleteV1Request) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation phase3TransferCompleteRequestV1 - * - * @param transferCompleteV1Request (optional) - * @return RequestConfig - */ - fun phase3TransferCompleteRequestV1RequestConfig(transferCompleteV1Request: TransferCompleteV1Request?) : RequestConfig { - val localVariableBody = transferCompleteV1Request - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.GET, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/phase3/transfercompleterequest", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param recoverUpdateAckV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverUpdateAckV1Message(recoverUpdateAckV1Message: RecoverUpdateAckV1Message? = null) : Unit { - val localVarResponse = recoverUpdateAckV1MessageWithHttpInfo(recoverUpdateAckV1Message = recoverUpdateAckV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param recoverUpdateAckV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun recoverUpdateAckV1MessageWithHttpInfo(recoverUpdateAckV1Message: RecoverUpdateAckV1Message?) : ApiResponse { - val localVariableConfig = recoverUpdateAckV1MessageRequestConfig(recoverUpdateAckV1Message = recoverUpdateAckV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation recoverUpdateAckV1Message - * - * @param recoverUpdateAckV1Message (optional) - * @return RequestConfig - */ - fun recoverUpdateAckV1MessageRequestConfig(recoverUpdateAckV1Message: RecoverUpdateAckV1Message?) : RequestConfig { - val localVariableBody = recoverUpdateAckV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdateackmessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param recoverUpdateV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverUpdateV1Message(recoverUpdateV1Message: RecoverUpdateV1Message? = null) : Unit { - val localVarResponse = recoverUpdateV1MessageWithHttpInfo(recoverUpdateV1Message = recoverUpdateV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param recoverUpdateV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun recoverUpdateV1MessageWithHttpInfo(recoverUpdateV1Message: RecoverUpdateV1Message?) : ApiResponse { - val localVariableConfig = recoverUpdateV1MessageRequestConfig(recoverUpdateV1Message = recoverUpdateV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation recoverUpdateV1Message - * - * @param recoverUpdateV1Message (optional) - * @return RequestConfig - */ - fun recoverUpdateV1MessageRequestConfig(recoverUpdateV1Message: RecoverUpdateV1Message?) : RequestConfig { - val localVariableBody = recoverUpdateV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoverupdatemessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param recoverV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverV1Message(recoverV1Message: RecoverV1Message? = null) : Unit { - val localVarResponse = recoverV1MessageWithHttpInfo(recoverV1Message = recoverV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param recoverV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun recoverV1MessageWithHttpInfo(recoverV1Message: RecoverV1Message?) : ApiResponse { - val localVariableConfig = recoverV1MessageRequestConfig(recoverV1Message = recoverV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation recoverV1Message - * - * @param recoverV1Message (optional) - * @return RequestConfig - */ - fun recoverV1MessageRequestConfig(recoverV1Message: RecoverV1Message?) : RequestConfig { - val localVariableBody = recoverV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recovermessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param recoverSuccessV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun recoverV1Success(recoverSuccessV1Message: RecoverSuccessV1Message? = null) : Unit { - val localVarResponse = recoverV1SuccessWithHttpInfo(recoverSuccessV1Message = recoverSuccessV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param recoverSuccessV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun recoverV1SuccessWithHttpInfo(recoverSuccessV1Message: RecoverSuccessV1Message?) : ApiResponse { - val localVariableConfig = recoverV1SuccessRequestConfig(recoverSuccessV1Message = recoverSuccessV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation recoverV1Success - * - * @param recoverSuccessV1Message (optional) - * @return RequestConfig - */ - fun recoverV1SuccessRequestConfig(recoverSuccessV1Message: RecoverSuccessV1Message?) : RequestConfig { - val localVariableBody = recoverSuccessV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/recoversuccessmessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param rollbackAckV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun rollbackAckV1Message(rollbackAckV1Message: RollbackAckV1Message? = null) : Unit { - val localVarResponse = rollbackAckV1MessageWithHttpInfo(rollbackAckV1Message = rollbackAckV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param rollbackAckV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun rollbackAckV1MessageWithHttpInfo(rollbackAckV1Message: RollbackAckV1Message?) : ApiResponse { - val localVariableConfig = rollbackAckV1MessageRequestConfig(rollbackAckV1Message = rollbackAckV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation rollbackAckV1Message - * - * @param rollbackAckV1Message (optional) - * @return RequestConfig - */ - fun rollbackAckV1MessageRequestConfig(rollbackAckV1Message: RollbackAckV1Message?) : RequestConfig { - val localVariableBody = rollbackAckV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackackmessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - /** - * - * - * @param rollbackV1Message (optional) - * @return void - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - * @throws UnsupportedOperationException If the API returns an informational or redirection response - * @throws ClientException If the API returns a client error response - * @throws ServerException If the API returns a server error response - */ - @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) - fun rollbackV1Message(rollbackV1Message: RollbackV1Message? = null) : Unit { - val localVarResponse = rollbackV1MessageWithHttpInfo(rollbackV1Message = rollbackV1Message) - - return when (localVarResponse.responseType) { - ResponseType.Success -> Unit - ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") - ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") - ResponseType.ClientError -> { - val localVarError = localVarResponse as ClientError<*> - throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - ResponseType.ServerError -> { - val localVarError = localVarResponse as ServerError<*> - throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) - } - } - } - - /** - * - * - * @param rollbackV1Message (optional) - * @return ApiResponse - * @throws IllegalStateException If the request is not correctly configured - * @throws IOException Rethrows the OkHttp execute method exception - */ - @Throws(IllegalStateException::class, IOException::class) - fun rollbackV1MessageWithHttpInfo(rollbackV1Message: RollbackV1Message?) : ApiResponse { - val localVariableConfig = rollbackV1MessageRequestConfig(rollbackV1Message = rollbackV1Message) - - return request( - localVariableConfig - ) - } - - /** - * To obtain the request config of the operation rollbackV1Message - * - * @param rollbackV1Message (optional) - * @return RequestConfig - */ - fun rollbackV1MessageRequestConfig(rollbackV1Message: RollbackV1Message?) : RequestConfig { - val localVariableBody = rollbackV1Message - val localVariableQuery: MultiValueMap = mutableMapOf() - val localVariableHeaders: MutableMap = mutableMapOf() - localVariableHeaders["Content-Type"] = "application/json" - - return RequestConfig( - method = RequestMethod.POST, - path = "/api/v1/@hyperledger/cactus-plugin-satp-hermes/rollbackmessage", - query = localVariableQuery, - headers = localVariableHeaders, - requiresAuthentication = false, - body = localVariableBody - ) - } - - - private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = - HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt deleted file mode 100644 index ef7a8f1e1a..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -typealias MultiValueMap = MutableMap> - -fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { - "csv" -> "," - "tsv" -> "\t" - "pipe" -> "|" - "space" -> " " - else -> "" -} - -val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } - -fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) - = toMultiValue(items.asIterable(), collectionFormat, map) - -fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { - return when(collectionFormat) { - "multi" -> items.map(map) - else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) - } -} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt deleted file mode 100644 index ea4b7b6593..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +++ /dev/null @@ -1,245 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.OkHttpClient -import okhttp3.RequestBody -import okhttp3.RequestBody.Companion.asRequestBody -import okhttp3.RequestBody.Companion.toRequestBody -import okhttp3.FormBody -import okhttp3.HttpUrl.Companion.toHttpUrlOrNull -import okhttp3.ResponseBody -import okhttp3.MediaType.Companion.toMediaTypeOrNull -import okhttp3.Request -import okhttp3.Headers -import okhttp3.Headers.Companion.toHeaders -import okhttp3.MultipartBody -import okhttp3.Call -import okhttp3.Callback -import okhttp3.Response -import okhttp3.internal.EMPTY_REQUEST -import java.io.BufferedWriter -import java.io.File -import java.io.FileWriter -import java.io.IOException -import java.net.URLConnection -import java.time.LocalDate -import java.time.LocalDateTime -import java.time.LocalTime -import java.time.OffsetDateTime -import java.time.OffsetTime -import java.util.Locale -import com.squareup.moshi.adapter - -open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { - companion object { - protected const val ContentType = "Content-Type" - protected const val Accept = "Accept" - protected const val Authorization = "Authorization" - protected const val JsonMediaType = "application/json" - protected const val FormDataMediaType = "multipart/form-data" - protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" - protected const val XmlMediaType = "application/xml" - - val apiKey: MutableMap = mutableMapOf() - val apiKeyPrefix: MutableMap = mutableMapOf() - var username: String? = null - var password: String? = null - var accessToken: String? = null - const val baseUrlKey = "org.openapitools.client.baseUrl" - - @JvmStatic - val defaultClient: OkHttpClient by lazy { - builder.build() - } - - @JvmStatic - val builder: OkHttpClient.Builder = OkHttpClient.Builder() - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - protected fun guessContentTypeFromFile(file: File): String { - val contentType = URLConnection.guessContentTypeFromName(file.name) - return contentType ?: "application/octet-stream" - } - - protected inline fun requestBody(content: T, mediaType: String?): RequestBody = - when { - content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) - mediaType == FormDataMediaType -> - MultipartBody.Builder() - .setType(MultipartBody.FORM) - .apply { - // content's type *must* be Map> - @Suppress("UNCHECKED_CAST") - (content as Map>).forEach { (name, part) -> - if (part.body is File) { - val partHeaders = part.headers.toMutableMap() + - ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") - val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() - addPart( - partHeaders.toHeaders(), - part.body.asRequestBody(fileMediaType) - ) - } else { - val partHeaders = part.headers.toMutableMap() + - ("Content-Disposition" to "form-data; name=\"$name\"") - addPart( - partHeaders.toHeaders(), - parameterToString(part.body).toRequestBody(null) - ) - } - } - }.build() - mediaType == FormUrlEncMediaType -> { - FormBody.Builder().apply { - // content's type *must* be Map> - @Suppress("UNCHECKED_CAST") - (content as Map>).forEach { (name, part) -> - add(name, parameterToString(part.body)) - } - }.build() - } - mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> - if (content == null) { - EMPTY_REQUEST - } else { - Serializer.moshi.adapter(T::class.java).toJson(content) - .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) - } - mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") - // TODO: this should be extended with other serializers - else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") - } - - @OptIn(ExperimentalStdlibApi::class) - protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { - if(body == null) { - return null - } - if (T::class.java == File::class.java) { - // return tempFile - // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options - val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() - tempFile.deleteOnExit() - body.byteStream().use { inputStream -> - tempFile.outputStream().use { tempFileOutputStream -> - inputStream.copyTo(tempFileOutputStream) - } - } - return tempFile as T - } - val bodyContent = body.string() - if (bodyContent.isEmpty()) { - return null - } - return when { - mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> - Serializer.moshi.adapter().fromJson(bodyContent) - else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") - } - } - - - protected inline fun request(requestConfig: RequestConfig): ApiResponse { - val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") - - val url = httpUrl.newBuilder() - .addEncodedPathSegments(requestConfig.path.trimStart('/')) - .apply { - requestConfig.query.forEach { query -> - query.value.forEach { queryValue -> - addQueryParameter(query.key, queryValue) - } - } - }.build() - - // take content-type/accept from spec or set to default (application/json) if not defined - if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { - requestConfig.headers[ContentType] = JsonMediaType - } - if (requestConfig.headers[Accept].isNullOrEmpty()) { - requestConfig.headers[Accept] = JsonMediaType - } - val headers = requestConfig.headers - - if (headers[Accept].isNullOrEmpty()) { - throw kotlin.IllegalStateException("Missing Accept header. This is required.") - } - - val contentType = if (headers[ContentType] != null) { - // TODO: support multiple contentType options here. - (headers[ContentType] as String).substringBefore(";").lowercase(Locale.US) - } else { - null - } - - val request = when (requestConfig.method) { - RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) - RequestMethod.GET -> Request.Builder().url(url) - RequestMethod.HEAD -> Request.Builder().url(url).head() - RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) - RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) - RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) - RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) - }.apply { - headers.forEach { header -> addHeader(header.key, header.value) } - }.build() - - val response = client.newCall(request).execute() - - val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US) - - // TODO: handle specific mapping types. e.g. Map> - return when { - response.isRedirect -> Redirection( - response.code, - response.headers.toMultimap() - ) - response.isInformational -> Informational( - response.message, - response.code, - response.headers.toMultimap() - ) - response.isSuccessful -> Success( - responseBody(response.body, accept), - response.code, - response.headers.toMultimap() - ) - response.isClientError -> ClientError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - else -> ServerError( - response.message, - response.body?.string(), - response.code, - response.headers.toMultimap() - ) - } - } - - protected fun parameterToString(value: Any?): String = when (value) { - null -> "" - is Array<*> -> toMultiValue(value, "csv").toString() - is Iterable<*> -> toMultiValue(value, "csv").toString() - is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> - parseDateToQueryString(value) - else -> value.toString() - } - - protected inline fun parseDateToQueryString(value : T): String { - /* - .replace("\"", "") converts the json object string to an actual string for the query parameter. - The moshi or gson adapter allows a more generic solution instead of trying to use a native - formatter. It also easily allows to provide a simple way to define a custom date format pattern - inside a gson/moshi adapter. - */ - return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt deleted file mode 100644 index cf2cfaa95d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -package org.openapitools.client.infrastructure - -enum class ResponseType { - Success, Informational, Redirection, ClientError, ServerError -} - -interface Response - -abstract class ApiResponse(val responseType: ResponseType): Response { - abstract val statusCode: Int - abstract val headers: Map> -} - -class Success( - val data: T, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -): ApiResponse(ResponseType.Success) - -class Informational( - val statusText: String, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.Informational) - -class Redirection( - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.Redirection) - -class ClientError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> = mapOf() -) : ApiResponse(ResponseType.ClientError) - -class ServerError( - val message: String? = null, - val body: Any? = null, - override val statusCode: Int = -1, - override val headers: Map> -): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt deleted file mode 100644 index 064b57fc6b..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigDecimal - -class BigDecimalAdapter { - @ToJson - fun toJson(value: BigDecimal): String { - return value.toPlainString() - } - - @FromJson - fun fromJson(value: String): BigDecimal { - return BigDecimal(value) - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt deleted file mode 100644 index 7df6057b45..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.math.BigInteger - -class BigIntegerAdapter { - @ToJson - fun toJson(value: BigInteger): String { - return value.toString() - } - - @FromJson - fun fromJson(value: String): BigInteger { - return BigInteger(value) - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt deleted file mode 100644 index ff5e2a81ee..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +++ /dev/null @@ -1,12 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson - -class ByteArrayAdapter { - @ToJson - fun toJson(data: ByteArray): String = String(data) - - @FromJson - fun fromJson(data: String): ByteArray = data.toByteArray() -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt deleted file mode 100644 index b5310e71f1..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:Suppress("unused") -package org.openapitools.client.infrastructure - -import java.lang.RuntimeException - -open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 123L - } -} - -open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { - - companion object { - private const val serialVersionUID: Long = 456L - } -} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt deleted file mode 100644 index b2e1654479..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDate -import java.time.format.DateTimeFormatter - -class LocalDateAdapter { - @ToJson - fun toJson(value: LocalDate): String { - return DateTimeFormatter.ISO_LOCAL_DATE.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDate { - return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) - } - -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt deleted file mode 100644 index e082db9481..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -class LocalDateTimeAdapter { - @ToJson - fun toJson(value: LocalDateTime): String { - return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): LocalDateTime { - return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) - } - -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt deleted file mode 100644 index 87437871a3..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter - -class OffsetDateTimeAdapter { - @ToJson - fun toJson(value: OffsetDateTime): String { - return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) - } - - @FromJson - fun fromJson(value: String): OffsetDateTime { - return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) - } - -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt deleted file mode 100644 index be00e38fba..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given part of a multi-part request. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class PartConfig( - val headers: MutableMap = mutableMapOf(), - val body: T? = null -) diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt deleted file mode 100644 index 625a19002b..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +++ /dev/null @@ -1,18 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Defines a config object for a given request. - * NOTE: This object doesn't include 'body' because it - * allows for caching of the constructed object - * for many request definitions. - * NOTE: Headers is a Map because rfc2616 defines - * multi-valued headers as csv-only. - */ -data class RequestConfig( - val method: RequestMethod, - val path: String, - val headers: MutableMap = mutableMapOf(), - val query: MutableMap> = mutableMapOf(), - val requiresAuthentication: Boolean, - val body: T? = null -) \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt deleted file mode 100644 index 931b12b8bd..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.openapitools.client.infrastructure - -/** - * Provides enumerated HTTP verbs - */ -enum class RequestMethod { - GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT -} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt deleted file mode 100644 index 9bd2790dc1..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.openapitools.client.infrastructure - -import okhttp3.Response - -/** - * Provides an extension to evaluation whether the response is a 1xx code - */ -val Response.isInformational : Boolean get() = this.code in 100..199 - -/** - * Provides an extension to evaluation whether the response is a 3xx code - */ -@Suppress("EXTENSION_SHADOWED_BY_MEMBER") -val Response.isRedirect : Boolean get() = this.code in 300..399 - -/** - * Provides an extension to evaluation whether the response is a 4xx code - */ -val Response.isClientError : Boolean get() = this.code in 400..499 - -/** - * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code - */ -val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt deleted file mode 100644 index e22592e47d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.Moshi -import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory - -object Serializer { - @JvmStatic - val moshiBuilder: Moshi.Builder = Moshi.Builder() - .add(OffsetDateTimeAdapter()) - .add(LocalDateTimeAdapter()) - .add(LocalDateAdapter()) - .add(UUIDAdapter()) - .add(ByteArrayAdapter()) - .add(URIAdapter()) - .add(KotlinJsonAdapterFactory()) - .add(BigDecimalAdapter()) - .add(BigIntegerAdapter()) - - @JvmStatic - val moshi: Moshi by lazy { - moshiBuilder.build() - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt deleted file mode 100644 index 927522757d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.net.URI - -class URIAdapter { - @ToJson - fun toJson(uri: URI) = uri.toString() - - @FromJson - fun fromJson(s: String): URI = URI.create(s) -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt deleted file mode 100644 index 7ccf7dc25d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.openapitools.client.infrastructure - -import com.squareup.moshi.FromJson -import com.squareup.moshi.ToJson -import java.util.UUID - -class UUIDAdapter { - @ToJson - fun toJson(uuid: UUID) = uuid.toString() - - @FromJson - fun fromJson(s: String): UUID = UUID.fromString(s) -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt deleted file mode 100644 index d3c7e00fa7..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/AssetProfile.kt +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param expirationDate - * @param issuer - * @param assetCode - * @param assetCodeType - * @param issuanceDate - * @param verificationEndPoint - * @param digitalSignature - * @param prospectusLink - * @param keyInformationLink - * @param keyWord - * @param transferRestriction - * @param ledgerRequirements - */ - - -data class AssetProfile ( - - @Json(name = "expirationDate") - val expirationDate: kotlin.String, - - @Json(name = "issuer") - val issuer: kotlin.String? = null, - - @Json(name = "assetCode") - val assetCode: kotlin.String? = null, - - @Json(name = "assetCodeType") - val assetCodeType: kotlin.String? = null, - - @Json(name = "issuanceDate") - val issuanceDate: kotlin.String? = null, - - @Json(name = "verificationEndPoint") - val verificationEndPoint: kotlin.String? = null, - - @Json(name = "digitalSignature") - val digitalSignature: kotlin.String? = null, - - @Json(name = "prospectusLink") - val prospectusLink: kotlin.String? = null, - - @Json(name = "keyInformationLink") - val keyInformationLink: kotlin.collections.List? = null, - - @Json(name = "keyWord") - val keyWord: kotlin.collections.List? = null, - - @Json(name = "transferRestriction") - val transferRestriction: kotlin.collections.List? = null, - - @Json(name = "ledgerRequirements") - val ledgerRequirements: kotlin.collections.List? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt deleted file mode 100644 index bbf1fbb1a0..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1Request.kt +++ /dev/null @@ -1,122 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.AssetProfile -import org.openapitools.client.models.ClientV1RequestClientGatewayConfiguration -import org.openapitools.client.models.PayloadProfile - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param version - * @param loggingProfile - * @param accessControlProfile - * @param assetControlProfile - * @param applicationProfile - * @param assetProfile - * @param payloadProfile - * @param sourceGatewayDltSystem - * @param recipientGatewayDltSystem - * @param recipientGatewayPubkey - * @param originatorPubkey - * @param beneficiaryPubkey - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param clientDltSystem - * @param serverDltSystem - * @param clientGatewayConfiguration - * @param serverGatewayConfiguration - * @param maxRetries - * @param maxTimeout - * @param sourceLedgerAssetID - * @param recipientLedgerAssetID - */ - - -data class ClientV1Request ( - - @Json(name = "version") - val version: kotlin.String, - - @Json(name = "loggingProfile") - val loggingProfile: kotlin.String, - - @Json(name = "accessControlProfile") - val accessControlProfile: kotlin.String, - - @Json(name = "assetControlProfile") - val assetControlProfile: kotlin.String, - - @Json(name = "applicationProfile") - val applicationProfile: kotlin.String, - - @Json(name = "assetProfile") - val assetProfile: AssetProfile, - - @Json(name = "payloadProfile") - val payloadProfile: PayloadProfile, - - @Json(name = "sourceGatewayDltSystem") - val sourceGatewayDltSystem: kotlin.String, - - @Json(name = "recipientGatewayDltSystem") - val recipientGatewayDltSystem: kotlin.String, - - @Json(name = "recipientGatewayPubkey") - val recipientGatewayPubkey: kotlin.String, - - @Json(name = "originatorPubkey") - val originatorPubkey: kotlin.String, - - @Json(name = "beneficiaryPubkey") - val beneficiaryPubkey: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "clientDltSystem") - val clientDltSystem: kotlin.String, - - @Json(name = "serverDltSystem") - val serverDltSystem: kotlin.String, - - @Json(name = "clientGatewayConfiguration") - val clientGatewayConfiguration: ClientV1RequestClientGatewayConfiguration, - - @Json(name = "serverGatewayConfiguration") - val serverGatewayConfiguration: ClientV1RequestClientGatewayConfiguration, - - @Json(name = "maxRetries") - val maxRetries: java.math.BigDecimal, - - @Json(name = "maxTimeout") - val maxTimeout: java.math.BigDecimal, - - @Json(name = "sourceLedgerAssetID") - val sourceLedgerAssetID: kotlin.String, - - @Json(name = "recipientLedgerAssetID") - val recipientLedgerAssetID: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt deleted file mode 100644 index ef6b9f8314..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ClientV1RequestClientGatewayConfiguration.kt +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param apiHost - */ - - -data class ClientV1RequestClientGatewayConfiguration ( - - @Json(name = "apiHost") - val apiHost: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt deleted file mode 100644 index 502356b737..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Request.kt +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param commitFinalClaim - * @param hashCommitPrepareAck - * @param signature - * @param sequenceNumber - * @param commitFinalClaimFormat - * @param clientTransferNumber - */ - - -data class CommitFinalV1Request ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "commitFinalClaim") - val commitFinalClaim: kotlin.String, - - @Json(name = "hashCommitPrepareAck") - val hashCommitPrepareAck: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "commitFinalClaimFormat") - val commitFinalClaimFormat: kotlin.Any? = null, - - @Json(name = "clientTransferNumber") - val clientTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt deleted file mode 100644 index 727afa6a98..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitFinalV1Response.kt +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param commitAcknowledgementClaim - * @param hashCommitFinal - * @param signature - * @param sequenceNumber - * @param commitAcknowledgementClaimFormat - * @param serverTransferNumber - */ - - -data class CommitFinalV1Response ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "commitAcknowledgementClaim") - val commitAcknowledgementClaim: kotlin.String, - - @Json(name = "hashCommitFinal") - val hashCommitFinal: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "commitAcknowledgementClaimFormat") - val commitAcknowledgementClaimFormat: kotlin.Any? = null, - - @Json(name = "serverTransferNumber") - val serverTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt deleted file mode 100644 index 8373145314..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Request.kt +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashLockEvidenceAck - * @param signature - * @param sequenceNumber - * @param clientTransferNumber - */ - - -data class CommitPreparationV1Request ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashLockEvidenceAck") - val hashLockEvidenceAck: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "clientTransferNumber") - val clientTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt deleted file mode 100644 index fb5c974147..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CommitPreparationV1Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashCommitPrep - * @param signature - * @param sequenceNumber - * @param serverTransferNumber - */ - - -data class CommitPreparationV1Response ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashCommitPrep") - val hashCommitPrep: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "serverTransferNumber") - val serverTransferNumber: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt deleted file mode 100644 index 3d99d1cf90..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CredentialProfile.kt +++ /dev/null @@ -1,66 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * Values: sAML,oAUTH,x509 - */ - -@JsonClass(generateAdapter = false) -enum class CredentialProfile(val value: kotlin.String) { - - @Json(name = "SAML") - sAML("SAML"), - - @Json(name = "OAUTH") - oAUTH("OAUTH"), - - @Json(name = "X509") - x509("X509"); - - /** - * Override [toString()] to avoid using the enum variable name as the value, and instead use - * the actual value defined in the API spec file. - * - * This solves a problem when the variable name and its value are different, and ensures that - * the client sends the correct enum values to the server always. - */ - override fun toString(): String = value - - companion object { - /** - * Converts the provided [data] to a [String] on success, null otherwise. - */ - fun encode(data: kotlin.Any?): kotlin.String? = if (data is CredentialProfile) "$data" else null - - /** - * Returns a valid [CredentialProfile] for [data], null otherwise. - */ - fun decode(data: kotlin.Any?): CredentialProfile? = data?.let { - val normalizedData = "$it".lowercase() - values().firstOrNull { value -> - it == value || normalizedData == "$value".lowercase() - } - } - } -} - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt deleted file mode 100644 index 51eb5a02ad..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/History.kt +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param transactions - * @param actions - * @param origin - * @param destination - * @param balance - * @param currentStatus - * @param applicationSpecificParameters - */ - - -data class History ( - - @Json(name = "Transactions") - val transactions: kotlin.collections.List? = null, - - @Json(name = "Actions") - val actions: kotlin.collections.List? = null, - - @Json(name = "Origin") - val origin: kotlin.String? = null, - - @Json(name = "Destination") - val destination: kotlin.String? = null, - - @Json(name = "Balance") - val balance: kotlin.String? = null, - - @Json(name = "CurrentStatus") - val currentStatus: kotlin.Any? = null, - - @Json(name = "ApplicationSpecificParameters") - val applicationSpecificParameters: kotlin.Any? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LocalLog.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LocalLog.kt deleted file mode 100644 index 2e97f18138..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LocalLog.kt +++ /dev/null @@ -1,55 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param type - * @param operation - * @param key - * @param `data` - * @param timestamp - */ - - -data class LocalLog ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "type") - val type: kotlin.String, - - @Json(name = "operation") - val operation: kotlin.String, - - @Json(name = "key") - val key: kotlin.String? = null, - - @Json(name = "data") - val `data`: kotlin.String? = null, - - @Json(name = "timestamp") - val timestamp: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt deleted file mode 100644 index f16479bb7d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Request.kt +++ /dev/null @@ -1,79 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param lockEvidenceClaim - * @param lockEvidenceExpiration - * @param hashCommenceAckRequest - * @param signature - * @param messageType - * @param sequenceNumber - * @param lockEvidenceFormat - * @param clientTransferNumber - * @param messageHash - */ - - -data class LockEvidenceV1Request ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "lockEvidenceClaim") - val lockEvidenceClaim: kotlin.String, - - @Json(name = "lockEvidenceExpiration") - val lockEvidenceExpiration: kotlin.String, - - @Json(name = "hashCommenceAckRequest") - val hashCommenceAckRequest: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "lockEvidenceFormat") - val lockEvidenceFormat: kotlin.Any? = null, - - @Json(name = "clientTransferNumber") - val clientTransferNumber: kotlin.Int? = null, - - @Json(name = "messageHash") - val messageHash: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt deleted file mode 100644 index d9eb294a3c..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/LockEvidenceV1Response.kt +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashLockEvidenceRequest - * @param signature - * @param messageType - * @param sequenceNumber - * @param serverTransferNumber - */ - - -data class LockEvidenceV1Response ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashLockEvidenceRequest") - val hashLockEvidenceRequest: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "serverTransferNumber") - val serverTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt deleted file mode 100644 index fdf0abc5ff..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/PayloadProfile.kt +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.AssetProfile - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param assetProfile - * @param capabilities - */ - - -data class PayloadProfile ( - - @Json(name = "assetProfile") - val assetProfile: AssetProfile, - - @Json(name = "capabilities") - val capabilities: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt deleted file mode 100644 index 276b2c241d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverSuccessV1Message.kt +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param success - * @param signature - */ - - -data class RecoverSuccessV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "success") - val success: kotlin.Boolean, - - @Json(name = "signature") - val signature: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt deleted file mode 100644 index 067d8d4584..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateAckV1Message.kt +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param success - * @param changedEntriesHash - * @param signature - */ - - -data class RecoverUpdateAckV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "success") - val success: kotlin.Boolean, - - @Json(name = "changedEntriesHash") - val changedEntriesHash: kotlin.collections.List, - - @Json(name = "signature") - val signature: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt deleted file mode 100644 index 67ed45d0ce..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverUpdateV1Message.kt +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.LocalLog - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param recoveredLogs - * @param signature - */ - - -data class RecoverUpdateV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "recoveredLogs") - val recoveredLogs: kotlin.collections.List, - - @Json(name = "signature") - val signature: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt deleted file mode 100644 index cc371150fb..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RecoverV1Message.kt +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param odapPhase - * @param sequenceNumber - * @param lastLogEntryTimestamp - * @param isBackup - * @param newBasePath - * @param signature - * @param newGatewayPubKey - */ - - -data class RecoverV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "odapPhase") - val odapPhase: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "lastLogEntryTimestamp") - val lastLogEntryTimestamp: kotlin.String, - - @Json(name = "isBackup") - val isBackup: kotlin.Boolean, - - @Json(name = "newBasePath") - val newBasePath: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "newGatewayPubKey") - val newGatewayPubKey: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt deleted file mode 100644 index e797025122..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackAckV1Message.kt +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param success - * @param signature - */ - - -data class RollbackAckV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "success") - val success: kotlin.Boolean, - - @Json(name = "signature") - val signature: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt deleted file mode 100644 index ddfee9c37b..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/RollbackV1Message.kt +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param success - * @param actionPerformed - * @param proofs - * @param signature - */ - - -data class RollbackV1Message ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "success") - val success: kotlin.Boolean, - - @Json(name = "actionPerformed") - val actionPerformed: kotlin.collections.List, - - @Json(name = "proofs") - val proofs: kotlin.collections.List, - - @Json(name = "signature") - val signature: kotlin.String - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessage.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessage.kt deleted file mode 100644 index ac22e1499d..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessage.kt +++ /dev/null @@ -1,105 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.PayloadProfile -import org.openapitools.client.models.SatpMessageActionResponse - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sequenceNumber - * @param phase - * @param resourceURL - * @param developerURN - * @param actionResponse - * @param credentialProfile - * @param credentialBlock - * @param credentialsProfile - * @param applicationProfile - * @param payload - * @param payloadHash - * @param messageSignature - */ - - -data class SatpMessage ( - - @Json(name = "SequenceNumber") - val sequenceNumber: java.math.BigDecimal? = null, - - @Json(name = "Phase") - val phase: SatpMessage.Phase? = null, - - @Json(name = "ResourceURL") - val resourceURL: kotlin.String? = null, - - @Json(name = "DeveloperURN") - val developerURN: kotlin.String? = null, - - @Json(name = "ActionResponse") - val actionResponse: SatpMessageActionResponse? = null, - - @Json(name = "CredentialProfile") - val credentialProfile: SatpMessage.CredentialProfile? = null, - - @Json(name = "CredentialBlock") - val credentialBlock: kotlin.collections.List? = null, - - @Json(name = "CredentialsProfile") - val credentialsProfile: PayloadProfile? = null, - - @Json(name = "ApplicationProfile") - val applicationProfile: kotlin.Any? = null, - - @Json(name = "Payload") - val payload: kotlin.Any? = null, - - @Json(name = "PayloadHash") - val payloadHash: kotlin.String? = null, - - @Json(name = "MessageSignature") - val messageSignature: kotlin.String? = null - -) { - - /** - * - * - * Values: transferInitialization,lockEvidenceVerification,commitmentEstablishment - */ - @JsonClass(generateAdapter = false) - enum class Phase(val value: kotlin.String) { - @Json(name = "TransferInitialization") transferInitialization("TransferInitialization"), - @Json(name = "LockEvidenceVerification") lockEvidenceVerification("LockEvidenceVerification"), - @Json(name = "CommitmentEstablishment") commitmentEstablishment("CommitmentEstablishment"); - } - /** - * - * - * Values: sAML,oAuth,x509 - */ - @JsonClass(generateAdapter = false) - enum class CredentialProfile(val value: kotlin.String) { - @Json(name = "SAML") sAML("SAML"), - @Json(name = "OAuth") oAuth("OAuth"), - @Json(name = "X509") x509("X509"); - } -} - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessageActionResponse.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessageActionResponse.kt deleted file mode 100644 index a636e823f0..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SatpMessageActionResponse.kt +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param responseCode - * @param arguments - */ - - -data class SatpMessageActionResponse ( - - @Json(name = "ResponseCode") - val responseCode: SatpMessageActionResponse.ResponseCode? = null, - - @Json(name = "Arguments") - val arguments: kotlin.collections.List? = null - -) { - - /** - * - * - * Values: OK,RESOURCE_NOT_FOUND - */ - @JsonClass(generateAdapter = false) - enum class ResponseCode(val value: kotlin.String) { - @Json(name = "200") OK("200"), - @Json(name = "404") RESOURCE_NOT_FOUND("404"); - } -} - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt deleted file mode 100644 index a8602e662f..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/SessionData.kt +++ /dev/null @@ -1,291 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.AssetProfile -import org.openapitools.client.models.PayloadProfile - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param id - * @param step - * @param version - * @param lastSequenceNumber - * @param loggingProfile - * @param accessControlProfile - * @param applicationProfile - * @param payloadProfile - * @param assetProfile - * @param allowedSourceBackupGateways - * @param allowedRecipientBackupGateways - * @param sourceBasePath - * @param recipientBasePath - * @param originatorPubkey - * @param beneficiaryPubkey - * @param sourceGatewayPubkey - * @param sourceGatewayDltSystem - * @param recipientGatewayPubkey - * @param recipientGatewayDltSystem - * @param initializationRequestMessageHash - * @param initializationResponseMessageHash - * @param initializationRequestMessageRcvTimeStamp - * @param initializationRequestMessageProcessedTimeStamp - * @param clientSignatureInitializationRequestMessage - * @param serverSignatureInitializationResponseMessage - * @param transferCommenceMessageRequestHash - * @param transferCommenceMessageResponseHash - * @param clientSignatureTransferCommenceRequestMessage - * @param serverSignatureTransferCommenceResponseMessage - * @param lockEvidenceRequestMessageHash - * @param lockEvidenceResponseMessageHash - * @param clientSignatureLockEvidenceRequestMessage - * @param serverSignatureLockEvidenceResponseMessage - * @param lockEvidenceClaim - * @param commitPrepareRequestMessageHash - * @param commitPrepareResponseMessageHash - * @param clientSignatureCommitPreparationRequestMessage - * @param serverSignatureCommitPreparationResponseMessage - * @param commitFinalRequestMessageHash - * @param commitFinalResponseMessageHash - * @param commitFinalClaim - * @param commitFinalClaimFormat - * @param commitAcknowledgementClaim - * @param commitAcknowledgementClaimFormat - * @param clientSignatureCommitFinalRequestMessage - * @param serverSignatureCommitFinalResponseMessage - * @param transferCompleteMessageHash - * @param clientSignatureTransferCompleteMessage - * @param maxRetries - * @param recipientLedgerAssetID - * @param sourceLedgerAssetID - * @param maxTimeout - * @param lastLogEntryTimestamp - * @param unlockAssetClaim - * @param recreateAssetClaim - * @param deleteAssetClaim - * @param lastMessageReceivedTimestamp - * @param rollback - * @param rollbackMessageHash - * @param rollbackProofs - * @param rollbackActionsPerformed - */ - - -data class SessionData ( - - @Json(name = "id") - val id: kotlin.String? = null, - - @Json(name = "step") - val step: java.math.BigDecimal? = null, - - @Json(name = "version") - val version: kotlin.String? = null, - - @Json(name = "lastSequenceNumber") - val lastSequenceNumber: java.math.BigDecimal? = null, - - @Json(name = "loggingProfile") - val loggingProfile: kotlin.String? = null, - - @Json(name = "accessControlProfile") - val accessControlProfile: kotlin.String? = null, - - @Json(name = "applicationProfile") - val applicationProfile: kotlin.String? = null, - - @Json(name = "payloadProfile") - val payloadProfile: PayloadProfile? = null, - - @Json(name = "assetProfile") - val assetProfile: AssetProfile? = null, - - @Json(name = "allowedSourceBackupGateways") - val allowedSourceBackupGateways: kotlin.collections.List? = null, - - @Json(name = "allowedRecipientBackupGateways") - val allowedRecipientBackupGateways: kotlin.collections.List? = null, - - @Json(name = "sourceBasePath") - val sourceBasePath: kotlin.String? = null, - - @Json(name = "recipientBasePath") - val recipientBasePath: kotlin.String? = null, - - @Json(name = "originatorPubkey") - val originatorPubkey: kotlin.String? = null, - - @Json(name = "beneficiaryPubkey") - val beneficiaryPubkey: kotlin.String? = null, - - @Json(name = "sourceGatewayPubkey") - val sourceGatewayPubkey: kotlin.String? = null, - - @Json(name = "sourceGatewayDltSystem") - val sourceGatewayDltSystem: kotlin.String? = null, - - @Json(name = "recipientGatewayPubkey") - val recipientGatewayPubkey: kotlin.String? = null, - - @Json(name = "recipientGatewayDltSystem") - val recipientGatewayDltSystem: kotlin.String? = null, - - @Json(name = "initializationRequestMessageHash") - val initializationRequestMessageHash: kotlin.String? = null, - - @Json(name = "initializationResponseMessageHash") - val initializationResponseMessageHash: kotlin.String? = null, - - @Json(name = "initializationRequestMessageRcvTimeStamp") - val initializationRequestMessageRcvTimeStamp: kotlin.String? = null, - - @Json(name = "initializationRequestMessageProcessedTimeStamp") - val initializationRequestMessageProcessedTimeStamp: kotlin.String? = null, - - @Json(name = "clientSignatureInitializationRequestMessage") - val clientSignatureInitializationRequestMessage: kotlin.String? = null, - - @Json(name = "serverSignatureInitializationResponseMessage") - val serverSignatureInitializationResponseMessage: kotlin.String? = null, - - @Json(name = "transferCommenceMessageRequestHash") - val transferCommenceMessageRequestHash: kotlin.String? = null, - - @Json(name = "transferCommenceMessageResponseHash") - val transferCommenceMessageResponseHash: kotlin.String? = null, - - @Json(name = "clientSignatureTransferCommenceRequestMessage") - val clientSignatureTransferCommenceRequestMessage: kotlin.String? = null, - - @Json(name = "serverSignatureTransferCommenceResponseMessage") - val serverSignatureTransferCommenceResponseMessage: kotlin.String? = null, - - @Json(name = "lockEvidenceRequestMessageHash") - val lockEvidenceRequestMessageHash: kotlin.String? = null, - - @Json(name = "lockEvidenceResponseMessageHash") - val lockEvidenceResponseMessageHash: kotlin.String? = null, - - @Json(name = "clientSignatureLockEvidenceRequestMessage") - val clientSignatureLockEvidenceRequestMessage: kotlin.String? = null, - - @Json(name = "serverSignatureLockEvidenceResponseMessage") - val serverSignatureLockEvidenceResponseMessage: kotlin.String? = null, - - @Json(name = "lockEvidenceClaim") - val lockEvidenceClaim: kotlin.String? = null, - - @Json(name = "commitPrepareRequestMessageHash") - val commitPrepareRequestMessageHash: kotlin.String? = null, - - @Json(name = "commitPrepareResponseMessageHash") - val commitPrepareResponseMessageHash: kotlin.String? = null, - - @Json(name = "clientSignatureCommitPreparationRequestMessage") - val clientSignatureCommitPreparationRequestMessage: kotlin.String? = null, - - @Json(name = "serverSignatureCommitPreparationResponseMessage") - val serverSignatureCommitPreparationResponseMessage: kotlin.String? = null, - - @Json(name = "commitFinalRequestMessageHash") - val commitFinalRequestMessageHash: kotlin.String? = null, - - @Json(name = "commitFinalResponseMessageHash") - val commitFinalResponseMessageHash: kotlin.String? = null, - - @Json(name = "commitFinalClaim") - val commitFinalClaim: kotlin.String? = null, - - @Json(name = "commitFinalClaimFormat") - val commitFinalClaimFormat: kotlin.String? = null, - - @Json(name = "commitAcknowledgementClaim") - val commitAcknowledgementClaim: kotlin.String? = null, - - @Json(name = "commitAcknowledgementClaimFormat") - val commitAcknowledgementClaimFormat: kotlin.String? = null, - - @Json(name = "clientSignatureCommitFinalRequestMessage") - val clientSignatureCommitFinalRequestMessage: kotlin.String? = null, - - @Json(name = "serverSignatureCommitFinalResponseMessage") - val serverSignatureCommitFinalResponseMessage: kotlin.String? = null, - - @Json(name = "transferCompleteMessageHash") - val transferCompleteMessageHash: kotlin.String? = null, - - @Json(name = "clientSignatureTransferCompleteMessage") - val clientSignatureTransferCompleteMessage: kotlin.String? = null, - - @Json(name = "maxRetries") - val maxRetries: java.math.BigDecimal? = null, - - @Json(name = "recipientLedgerAssetID") - val recipientLedgerAssetID: kotlin.String? = null, - - @Json(name = "sourceLedgerAssetID") - val sourceLedgerAssetID: kotlin.String? = null, - - @Json(name = "maxTimeout") - val maxTimeout: java.math.BigDecimal? = null, - - @Json(name = "lastLogEntryTimestamp") - val lastLogEntryTimestamp: kotlin.String? = null, - - @Json(name = "unlockAssetClaim") - val unlockAssetClaim: kotlin.String? = null, - - @Json(name = "recreateAssetClaim") - val recreateAssetClaim: kotlin.String? = null, - - @Json(name = "deleteAssetClaim") - val deleteAssetClaim: kotlin.String? = null, - - @Json(name = "lastMessageReceivedTimestamp") - val lastMessageReceivedTimestamp: kotlin.String? = null, - - @Json(name = "rollback") - val rollback: kotlin.Boolean? = null, - - @Json(name = "rollbackMessageHash") - val rollbackMessageHash: kotlin.String? = null, - - @Json(name = "rollbackProofs") - val rollbackProofs: kotlin.collections.List? = null, - - @Json(name = "rollbackActionsPerformed") - val rollbackActionsPerformed: kotlin.collections.List? = null - -) { - - /** - * - * - * Values: cREATE,dELETE,lOCK,uNLOCK - */ - @JsonClass(generateAdapter = false) - enum class RollbackActionsPerformed(val value: kotlin.String) { - @Json(name = "CREATE") cREATE("CREATE"), - @Json(name = "DELETE") dELETE("DELETE"), - @Json(name = "LOCK") lOCK("LOCK"), - @Json(name = "UNLOCK") uNLOCK("UNLOCK"); - } -} - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt deleted file mode 100644 index a2884109eb..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Request.kt +++ /dev/null @@ -1,87 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param originatorPubkey - * @param beneficiaryPubkey - * @param senderDltSystem - * @param recipientDltSystem - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashAssetProfile - * @param hashPrevMessage - * @param signature - * @param sequenceNumber - * @param assetUnit - * @param clientTransferNumber - */ - - -data class TransferCommenceV1Request ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "originatorPubkey") - val originatorPubkey: kotlin.String, - - @Json(name = "beneficiaryPubkey") - val beneficiaryPubkey: kotlin.String, - - @Json(name = "senderDltSystem") - val senderDltSystem: kotlin.String, - - @Json(name = "recipientDltSystem") - val recipientDltSystem: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashAssetProfile") - val hashAssetProfile: kotlin.String, - - @Json(name = "hashPrevMessage") - val hashPrevMessage: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: kotlin.Int, - - @Json(name = "assetUnit") - val assetUnit: kotlin.Int? = null, - - @Json(name = "clientTransferNumber") - val clientTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt deleted file mode 100644 index 20487e8c4a..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCommenceV1Response.kt +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashCommenceRequest - * @param signature - * @param messageType - * @param sequenceNumber - * @param serverTransferNumber - * @param messageHash - */ - - -data class TransferCommenceV1Response ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashCommenceRequest") - val hashCommenceRequest: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "serverTransferNumber") - val serverTransferNumber: kotlin.Int? = null, - - @Json(name = "messageHash") - val messageHash: kotlin.String? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt deleted file mode 100644 index 29e7088a28..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferCompleteV1Request.kt +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param sessionID - * @param messageType - * @param clientIdentityPubkey - * @param serverIdentityPubkey - * @param hashCommitFinalAck - * @param signature - * @param hashTransferCommence - * @param sequenceNumber - * @param clientTransferNumber - */ - - -data class TransferCompleteV1Request ( - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "clientIdentityPubkey") - val clientIdentityPubkey: kotlin.String, - - @Json(name = "serverIdentityPubkey") - val serverIdentityPubkey: kotlin.String, - - @Json(name = "hashCommitFinalAck") - val hashCommitFinalAck: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "hashTransferCommence") - val hashTransferCommence: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: java.math.BigDecimal, - - @Json(name = "clientTransferNumber") - val clientTransferNumber: kotlin.Int? = null - -) - diff --git a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt b/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt deleted file mode 100644 index bb9cc888d7..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/TransferInitializationV1Request.kt +++ /dev/null @@ -1,175 +0,0 @@ -/** - * - * Please note: - * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit this file manually. - * - */ - -@file:Suppress( - "ArrayInDataClass", - "EnumEntryName", - "RemoveRedundantQualifierName", - "UnusedImport" -) - -package org.openapitools.client.models - -import org.openapitools.client.models.CredentialProfile -import org.openapitools.client.models.History -import org.openapitools.client.models.PayloadProfile - -import com.squareup.moshi.Json -import com.squareup.moshi.JsonClass - -/** - * - * - * @param messageType - * @param sessionID - * @param payloadProfile - * @param applicationProfile - * @param loggingProfile - * @param accessControlProfile - * @param signature - * @param sourceGatewayPubkey - * @param sourceGatewayDltSystem - * @param recipientGatewayPubkey - * @param recipientGatewayDltSystem - * @param sequenceNumber - * @param sourceBasePath - * @param recipientBasePath - * @param maxRetries - * @param maxTimeout - * @param backupGatewaysAllowed - * @param recipientLedgerAssetID - * @param sourceLedgerAssetID - * @param version - * @param developerURN - * @param credentialProfile - * @param escrowType - * @param expiryTime - * @param multipleClaimsAllowed - * @param multipleCancelsAllowed - * @param permissions - * @param origin - * @param destination - * @param subsequentCalls - * @param histories - */ - - -data class TransferInitializationV1Request ( - - @Json(name = "messageType") - val messageType: kotlin.String, - - @Json(name = "sessionID") - val sessionID: kotlin.String, - - @Json(name = "payloadProfile") - val payloadProfile: PayloadProfile, - - @Json(name = "applicationProfile") - val applicationProfile: kotlin.String, - - @Json(name = "loggingProfile") - val loggingProfile: kotlin.String, - - @Json(name = "accessControlProfile") - val accessControlProfile: kotlin.String, - - @Json(name = "signature") - val signature: kotlin.String, - - @Json(name = "sourceGatewayPubkey") - val sourceGatewayPubkey: kotlin.String, - - @Json(name = "sourceGatewayDltSystem") - val sourceGatewayDltSystem: kotlin.String, - - @Json(name = "recipientGatewayPubkey") - val recipientGatewayPubkey: kotlin.String, - - @Json(name = "recipientGatewayDltSystem") - val recipientGatewayDltSystem: kotlin.String, - - @Json(name = "sequenceNumber") - val sequenceNumber: kotlin.Int, - - @Json(name = "sourceBasePath") - val sourceBasePath: kotlin.String, - - @Json(name = "recipientBasePath") - val recipientBasePath: kotlin.String, - - @Json(name = "maxRetries") - val maxRetries: java.math.BigDecimal, - - @Json(name = "maxTimeout") - val maxTimeout: java.math.BigDecimal, - - @Json(name = "backupGatewaysAllowed") - val backupGatewaysAllowed: kotlin.collections.List, - - @Json(name = "recipientLedgerAssetID") - val recipientLedgerAssetID: kotlin.String, - - @Json(name = "sourceLedgerAssetID") - val sourceLedgerAssetID: kotlin.String, - - @Json(name = "version") - val version: kotlin.String? = null, - - @Json(name = "developerURN") - val developerURN: kotlin.String? = null, - - @Json(name = "credentialProfile") - val credentialProfile: CredentialProfile? = null, - - @Json(name = "escrowType") - val escrowType: TransferInitializationV1Request.EscrowType? = null, - - @Json(name = "expiryTime") - val expiryTime: kotlin.String? = null, - - @Json(name = "multipleClaimsAllowed") - val multipleClaimsAllowed: kotlin.Boolean? = null, - - @Json(name = "multipleCancelsAllowed") - val multipleCancelsAllowed: kotlin.Boolean? = null, - - @Json(name = "permissions") - val permissions: kotlin.Any? = null, - - @Json(name = "origin") - val origin: kotlin.String? = null, - - @Json(name = "destination") - val destination: kotlin.String? = null, - - @Json(name = "subsequentCalls") - val subsequentCalls: kotlin.Any? = null, - - @Json(name = "histories") - val histories: kotlin.collections.List? = null - -) { - - /** - * - * - * Values: fAUCET,tIMELOCK,hASHLOCK,hASHTIMELOCK,mULTICLAIMPC,dESTROY,bURN - */ - @JsonClass(generateAdapter = false) - enum class EscrowType(val value: kotlin.String) { - @Json(name = "FAUCET") fAUCET("FAUCET"), - @Json(name = "TIMELOCK") tIMELOCK("TIMELOCK"), - @Json(name = "HASHLOCK") hASHLOCK("HASHLOCK"), - @Json(name = "HASHTIMELOCK") hASHTIMELOCK("HASHTIMELOCK"), - @Json(name = "MULTICLAIMPC") mULTICLAIMPC("MULTICLAIMPC"), - @Json(name = "DESTROY") dESTROY("DESTROY"), - @Json(name = "BURN") bURN("BURN"); - } -} - diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/LICENSE b/packages/cactus-plugin-satp-hermes/src/main/proto/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/buf.gen.yaml b/packages/cactus-plugin-satp-hermes/src/main/proto/buf.gen.yaml new file mode 100644 index 0000000000..3a771edb7a --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/buf.gen.yaml @@ -0,0 +1,12 @@ +version: v1 +plugins: + - plugin: es + opt: target=ts + strategy: directory + out: ../typescript/generated/proto/ + - plugin: connect-es + opt: + - target=ts + - js_import_style=module + out: ../typescript/generated/proto/ + strategy: directory diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/buf.yaml b/packages/cactus-plugin-satp-hermes/src/main/proto/buf.yaml new file mode 100644 index 0000000000..1de3d3a888 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/buf.yaml @@ -0,0 +1,24 @@ +version: v1 +name: "buf.build/rafaelapb/cacti" +deps: [] +build: + excludes: [] +lint: + use: + - DEFAULT + except: [] + ignore: [] + ignore_only: {} + allow_comment_ignores: false + enum_zero_value_suffix: _UNSPECIFIED + rpc_allow_same_request_response: false + rpc_allow_google_protobuf_empty_requests: false + rpc_allow_google_protobuf_empty_responses: false + service_suffix: Service +breaking: + use: + - FILE + except: [] + ignore: [] + ignore_only: {} + ignore_unstable_packages: false \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/message.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/message.proto new file mode 100644 index 0000000000..c176ffe3af --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/message.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package cacti.satp.v02.common; + +// TODO: define the common parameters to every protocol message +message MessageCore { + string message = 1; +} + +// TODO: define the common parameters to every rollback message +message RollbackMessageCore { + string message = 1; +} + +enum STATUS { + STATUS_UNSPECIFIED = 0; + STATUS_OK = 1; + STATUS_ERROR = 2; +}; + +message Ack { + STATUS status = 1; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/session.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/session.proto new file mode 100644 index 0000000000..27b1b1af44 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/session.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package cacti.satp.v02.common; + +import "google/protobuf/empty.proto"; + +// TODO: requires fully qualified path from buf.gen.yaml +import "cacti/satp/v02/common/message.proto"; + +message SendStatusRequest { + string status = 1; + bool hasBackup = 2; +} + +message SendStatusResponse { + string status = 1; + bool hasBackup = 2; +} + + +service SessionStatusService { + rpc GetStatus(google.protobuf.Empty) returns (SendStatusResponse) {} + rpc SendStatus(SendStatusRequest) returns (google.protobuf.Empty) {} +} + +// TODO: define common RPC methods for each step. This is a draft +service CommonService { + rpc Ping(google.protobuf.Empty) returns (cacti.satp.v02.common.MessageCore) {} + rpc Rollback(google.protobuf.Empty) returns (cacti.satp.v02.common.RollbackMessageCore) {} + rpc GetStageVersion(google.protobuf.Empty) returns (cacti.satp.v02.common.Ack) {}; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/crash_recovery.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/crash_recovery.proto new file mode 100644 index 0000000000..7f6f71c15c --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/crash_recovery.proto @@ -0,0 +1,13 @@ + +syntax = "proto3"; +package cacti.satp.v02.crash; + +import "google/protobuf/empty.proto"; + +// TODO: Rollback and crash-recovery related +service CrashRecovery { + // util RPCs + + // step RPCs + +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_0.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_0.proto new file mode 100644 index 0000000000..6f675dc321 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_0.proto @@ -0,0 +1,34 @@ + +syntax = "proto3"; +package cacti.satp.v02.stage_0; + +import "google/protobuf/empty.proto"; + +service SATPStage0 { + // util RPCs + + // step RPCs + rpc TransferProposalClaims(TransferProposalClaimsRequest) returns (TransferProposalClaimsResponse) {}; + // todo other rpcs +} + +message TransferProposalClaimsRequest { + string message_type = 1; + string asset_asset_id = 2; + string asset_profile_id = 3; + string verified_originator_entity_id = 4; + string verified_beneficiary_entity_id = 5; + string originator_pubkey = 6; + string beneficiary_pubkey = 7; + string sender_gateway_network_id = 8; + string recipient_gateway_network_id = 9; + string client_identity_pubkey = 10; + string server_identity_pubkey = 11; + string sender_gateway_owner_id = 12; + string receiver_gateway_owner_id = 13; +} + +// TODO +message TransferProposalClaimsResponse { + string message_type = 1; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_1.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_1.proto new file mode 100644 index 0000000000..55ead8bcc6 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_1.proto @@ -0,0 +1,13 @@ + +syntax = "proto3"; +package cacti.satp.v02.stage_1; + +import "google/protobuf/empty.proto"; + + +service SATPStage1 { + // util RPCs + + // step RPCs + +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_2.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_2.proto new file mode 100644 index 0000000000..ac04ade64c --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_2.proto @@ -0,0 +1,13 @@ + +syntax = "proto3"; +package cacti.satp.v02.stage_2; + +import "google/protobuf/empty.proto"; + + +service SATPStage2 { + // util RPCs + + // step RPCs + +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_3.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_3.proto new file mode 100644 index 0000000000..1797bb8ca7 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/stage_3.proto @@ -0,0 +1,12 @@ + +syntax = "proto3"; +package cacti.satp.v02.stage_3; + +import "google/protobuf/empty.proto"; + +service SATPStage3 { + // util RPCs + + // step RPCs + +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/view/bungee.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/view/bungee.proto new file mode 100644 index 0000000000..211f3a63ce --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/view/bungee.proto @@ -0,0 +1,9 @@ + +syntax = "proto3"; +package cacti.satp.v02.view.bungee; + +import "google/protobuf/empty.proto"; + +message BungeeView { + string message = 1; +} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/proto/test/message.proto b/packages/cactus-plugin-satp-hermes/src/main/proto/test/message.proto new file mode 100644 index 0000000000..50c6b4fa8c --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/proto/test/message.proto @@ -0,0 +1,27 @@ + +syntax = "proto3"; +package test.message; + +import "google/protobuf/empty.proto"; + +message Message { + string content = 1; +} +message ModifyMessageResponse { + string content = 1; +} + +message ModifyMessageRequest { + string content = 1; +} + + +service TestService { + rpc GetMessage(google.protobuf.Empty) returns (Message) {} + rpc SendMessage(Message) returns (google.protobuf.Empty) {} + rpc ModifyMessage(ModifyMessageRequest) returns (ModifyMessageResponse) {} +} + +service TestService2 { + rpc GetMessage(google.protobuf.Empty) returns (Message) {} +} \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/besu-satp-gateway.ts similarity index 98% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/core/besu-satp-gateway.ts index 248b1b494a..7613681707 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/besu-satp-gateway.ts @@ -9,10 +9,10 @@ import { } from "@hyperledger/cactus-plugin-ledger-connector-besu"; import { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, -} from "./plugin-satp-gateway"; + PluginSATPGateway, +} from "../plugin-satp-gateway"; -export interface IBesuSatpGatewayConstructorOptions +export interface IBesuSATPGatewayConstructorOptions extends IPluginSatpGatewayConstructorOptions { besuPath?: string; besuContractName?: string; @@ -21,13 +21,13 @@ export interface IBesuSatpGatewayConstructorOptions besuAssetID?: string; } -export class BesuSatpGateway extends PluginSatpGateway { +export class BesuSATPGateway extends PluginSATPGateway { public besuApi?: BesuApi; public besuContractName?: string; public besuWeb3SigningCredential?: Web3SigningCredential; public besuKeychainId?: string; - public constructor(options: IBesuSatpGatewayConstructorOptions) { + public constructor(options: IBesuSATPGatewayConstructorOptions) { super({ name: options.name, dltIDs: options.dltIDs, @@ -45,7 +45,7 @@ export class BesuSatpGateway extends PluginSatpGateway { } private defineBesuConnection( - options: IBesuSatpGatewayConstructorOptions, + options: IBesuSATPGatewayConstructorOptions, ): void { const fnTag = `${this.className}#defineBesuConnection()`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/client/client-helper.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/client-helper.ts similarity index 96% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/client/client-helper.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/core/client-helper.ts index cd97907313..5d81f1a062 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/client/client-helper.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/client-helper.ts @@ -12,8 +12,8 @@ import { CommitFinalV1Request, CommitFinalV1Response, TransferCompleteV1Request, -} from "../../public-api"; -import { SatpMessageType, PluginSatpGateway } from "../plugin-satp-gateway"; +} from "../public-api"; +import { SatpMessageType, PluginSATPGateway } from "../plugin-satp-gateway"; export class ClientGatewayHelper { public static readonly CLASS_NAME = "ClientGatewayHelper"; @@ -35,7 +35,7 @@ export class ClientGatewayHelper { async sendTransferInitializationRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${this.className}#sendTransferInitializationRequest()`; @@ -104,7 +104,7 @@ export class ClientGatewayHelper { sourceLedgerAssetID: sessionData.sourceLedgerAssetID, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(initializationRequestMessage)), ); @@ -133,7 +133,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase1TransferInitiationRequestV1(initializationRequestMessage), "TransferInitializationRequest", @@ -142,7 +142,7 @@ export class ClientGatewayHelper { async checkValidInitializationResponse( response: TransferInitializationV1Response, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${this.className}#checkValidInitializationResponse`; @@ -208,7 +208,7 @@ export class ClientGatewayHelper { async sendTransferCommenceRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendTransferCommenceRequest()`; @@ -256,7 +256,7 @@ export class ClientGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(transferCommenceRequestMessage)), ); @@ -286,7 +286,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase2TransferCommenceRequestV1(transferCommenceRequestMessage), "TransferCommenceRequest", @@ -295,7 +295,7 @@ export class ClientGatewayHelper { async checkValidTransferCommenceResponse( response: TransferCommenceV1Response, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidTransferCommenceResponse`; @@ -362,7 +362,7 @@ export class ClientGatewayHelper { async sendLockEvidenceRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendLockEvidenceRequest()`; @@ -399,7 +399,7 @@ export class ClientGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); @@ -428,7 +428,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase2LockEvidenceRequestV1(lockEvidenceRequestMessage), "LockEvidenceRequest", @@ -437,7 +437,7 @@ export class ClientGatewayHelper { async checkValidLockEvidenceResponse( response: LockEvidenceV1Response, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidLockEvidenceResponse`; @@ -503,7 +503,7 @@ export class ClientGatewayHelper { async sendCommitPreparationRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendCommitPreparationRequest()`; @@ -534,7 +534,7 @@ export class ClientGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(commitPrepareRequestMessage)), ); @@ -564,7 +564,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase3CommitPreparationRequestV1(commitPrepareRequestMessage), "CommitPreparationRequest", @@ -573,7 +573,7 @@ export class ClientGatewayHelper { async checkValidCommitPreparationResponse( response: CommitPreparationV1Response, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidCommitPreparationResponse`; @@ -641,7 +641,7 @@ export class ClientGatewayHelper { async sendCommitFinalRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendCommitFinalRequest()`; @@ -675,7 +675,7 @@ export class ClientGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(commitFinalRequestMessage)), ); @@ -704,7 +704,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase3CommitFinalRequestV1(commitFinalRequestMessage), "CommitFinalRequest", @@ -713,7 +713,7 @@ export class ClientGatewayHelper { async checkValidCommitFinalResponse( response: CommitFinalV1Response, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidCommitFinalResponse`; @@ -767,7 +767,7 @@ export class ClientGatewayHelper { const claimHash = SHA256(response.commitAcknowledgementClaim).toString(); const retrievedClaim = await gateway.getLogFromRemote( - PluginSatpGateway.getSatpLogKey(sessionID, "proof", "create"), + PluginSATPGateway.getSatpLogKey(sessionID, "proof", "create"), ); if (claimHash != retrievedClaim.hash) { @@ -802,7 +802,7 @@ export class ClientGatewayHelper { async sendTransferCompleteRequest( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendTransferCompleteRequest()`; @@ -835,7 +835,7 @@ export class ClientGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - const messageSignature = PluginSatpGateway.bufArray2HexStr( + const messageSignature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(transferCompleteRequestMessage)), ); @@ -864,7 +864,7 @@ export class ClientGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.recipientBasePath, ).phase3TransferCompleteRequestV1(transferCompleteRequestMessage), "TransferCompleteRequest", diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors.ts new file mode 100644 index 0000000000..a2bd3c7f79 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/errors.ts @@ -0,0 +1,15 @@ +export class BootstrapError extends Error { + constructor() { + super("Bootstrap already called in this Gateway Manager"); + this.name = this.constructor.name; + Object.setPrototypeOf(this, BootstrapError.prototype); + } +} + +export class NonExistantGatewayIdentity extends Error { + constructor(id: string) { + super(`Gateway with id ${id} does not exist`); + this.name = this.constructor.name; + Object.setPrototypeOf(this, BootstrapError.prototype); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/fabric-satp-gateway.ts similarity index 98% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/core/fabric-satp-gateway.ts index 05a4233ee1..7e7c629cc9 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/fabric-satp-gateway.ts @@ -8,11 +8,11 @@ import { } from "@hyperledger/cactus-plugin-ledger-connector-fabric"; import { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, -} from "./plugin-satp-gateway"; + PluginSATPGateway, +} from "../plugin-satp-gateway"; import { SessionDataRollbackActionsPerformedEnum } from "../generated/openapi/typescript-axios"; -export interface IFabricSatpGatewayConstructorOptions +export interface IFabricSATPGatewayConstructorOptions extends IPluginSatpGatewayConstructorOptions { fabricPath?: string; fabricSigningCredential?: FabricSigningCredential; @@ -20,13 +20,13 @@ export interface IFabricSatpGatewayConstructorOptions fabricContractName?: string; } -export class FabricSatpGateway extends PluginSatpGateway { +export class FabricSATPGateway extends PluginSATPGateway { public fabricApi?: FabricApi; public fabricSigningCredential?: FabricSigningCredential; public fabricChannelName?: string; public fabricContractName?: string; - public constructor(options: IFabricSatpGatewayConstructorOptions) { + public constructor(options: IFabricSATPGatewayConstructorOptions) { super({ name: options.name, dltIDs: options.dltIDs, @@ -44,7 +44,7 @@ export class FabricSatpGateway extends PluginSatpGateway { } private defineFabricConnection( - options: IFabricSatpGatewayConstructorOptions, + options: IFabricSATPGatewayConstructorOptions, ): void { const fnTag = `${this.className}#defineFabricConnection()`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/server/server-helper.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/server-helper.ts similarity index 96% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/server/server-helper.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/core/server-helper.ts index 4a9a547cb3..2cd8353ced 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/server/server-helper.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/server-helper.ts @@ -13,8 +13,8 @@ import { CommitFinalV1Response, CommitFinalV1Request, TransferCompleteV1Request, -} from "../../public-api"; -import { SatpMessageType, PluginSatpGateway } from "../plugin-satp-gateway"; +} from "../public-api"; +import { SatpMessageType, PluginSATPGateway } from "../plugin-satp-gateway"; export class ServerGatewayHelper { public static readonly CLASS_NAME: string = "ServerGatewayHelper"; @@ -36,7 +36,7 @@ export class ServerGatewayHelper { async sendTransferInitializationResponse( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendTransferInitiationResponse()`; @@ -70,7 +70,7 @@ export class ServerGatewayHelper { }; transferInitializationResponse.signature = - PluginSatpGateway.bufArray2HexStr( + PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(transferInitializationResponse)), ); @@ -98,7 +98,7 @@ export class ServerGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.sourceBasePath, ).phase1TransferInitiationResponseV1(transferInitializationResponse), "TransferInitializationResponse", @@ -107,7 +107,7 @@ export class ServerGatewayHelper { async checkValidInitializationRequest( request: TransferInitializationV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidInitializationRequest()`; @@ -201,7 +201,7 @@ export class ServerGatewayHelper { async sendTransferCommenceResponse( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendTransferCommenceResponse()`; @@ -233,7 +233,7 @@ export class ServerGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - transferCommenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceResponse.signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(transferCommenceResponse)), ); @@ -259,7 +259,7 @@ export class ServerGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.sourceBasePath, ).phase2TransferCommenceResponseV1(transferCommenceResponse), "TransferCommenceResponse", @@ -268,7 +268,7 @@ export class ServerGatewayHelper { async checkValidtransferCommenceRequest( request: TransferCommenceV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidtransferCommenceRequest()`; @@ -362,7 +362,7 @@ export class ServerGatewayHelper { async sendLockEvidenceResponse( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendLockEvidenceResponse()`; @@ -394,7 +394,7 @@ export class ServerGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - lockEvidenceResponseMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceResponseMessage.signature = PluginSATPGateway.bufArray2HexStr( await gateway.sign(JSON.stringify(lockEvidenceResponseMessage)), ); @@ -420,7 +420,7 @@ export class ServerGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.sourceBasePath, ).phase2LockEvidenceResponseV1(lockEvidenceResponseMessage), "LockEvidenceResponse", @@ -429,7 +429,7 @@ export class ServerGatewayHelper { async checkValidLockEvidenceRequest( request: LockEvidenceV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidLockEvidenceRequest()`; @@ -498,7 +498,7 @@ export class ServerGatewayHelper { const claimHash = SHA256(request.lockEvidenceClaim).toString(); const retrievedClaim = await gateway.getLogFromRemote( - PluginSatpGateway.getSatpLogKey(sessionID, "proof", "lock"), + PluginSATPGateway.getSatpLogKey(sessionID, "proof", "lock"), ); if (claimHash != retrievedClaim.hash) { @@ -540,7 +540,7 @@ export class ServerGatewayHelper { async sendCommitPreparationResponse( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendCommitPrepareResponse()`; @@ -572,7 +572,7 @@ export class ServerGatewayHelper { }; commitPreparationResponseMessage.signature = - PluginSatpGateway.bufArray2HexStr( + PluginSATPGateway.bufArray2HexStr( await gateway.sign(JSON.stringify(commitPreparationResponseMessage)), ); @@ -598,7 +598,7 @@ export class ServerGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.sourceBasePath, ).phase3CommitPreparationResponseV1(commitPreparationResponseMessage), "CommitPreparationResponse", @@ -607,7 +607,7 @@ export class ServerGatewayHelper { async checkValidCommitPreparationRequest( request: CommitPreparationV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidCommitPrepareRequest()`; @@ -692,7 +692,7 @@ export class ServerGatewayHelper { async sendCommitFinalResponse( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendCommitFinalResponse()`; @@ -724,7 +724,7 @@ export class ServerGatewayHelper { sequenceNumber: ++sessionData.lastSequenceNumber, }; - commitFinalResponseMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalResponseMessage.signature = PluginSATPGateway.bufArray2HexStr( await gateway.sign(JSON.stringify(commitFinalResponseMessage)), ); @@ -752,7 +752,7 @@ export class ServerGatewayHelper { await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( sessionData.sourceBasePath, ).phase3CommitFinalResponseV1(commitFinalResponseMessage), "CommitFinalResponse", @@ -761,7 +761,7 @@ export class ServerGatewayHelper { async checkValidCommitFinalRequest( request: CommitFinalV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidCommitFinalRequest()`; @@ -826,7 +826,7 @@ export class ServerGatewayHelper { const claimHash = SHA256(request.commitFinalClaim).toString(); const retrievedClaim = await gateway.getLogFromRemote( - PluginSatpGateway.getSatpLogKey(sessionID, "proof", "delete"), + PluginSATPGateway.getSatpLogKey(sessionID, "proof", "delete"), ); if (claimHash != retrievedClaim.hash) { @@ -867,7 +867,7 @@ export class ServerGatewayHelper { async checkValidTransferCompleteRequest( request: TransferCompleteV1Request, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidTransferCompleteRequest()`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage0.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage0.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3.ts new file mode 100644 index 0000000000..991aa1a51e --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3.ts @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/test-services.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/test-services.ts new file mode 100644 index 0000000000..4be9bb5653 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/test-services.ts @@ -0,0 +1,15 @@ +import { ConnectRouter } from "@connectrpc/connect"; +import { Message } from "../../generated/proto/test/message_pb"; +import { TestService } from "../../generated/proto/test/message_connect"; + +export const testRouter = (router: ConnectRouter) => + // registers connectrpc.eliza.v1.ElizaService + router.service(TestService, { + // implements rpc Say + async sendMessage(req) { + return { + sentence: `You said: ${req}` + } + }, + }); + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts new file mode 100644 index 0000000000..956150b24d --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts @@ -0,0 +1,66 @@ +import { + Secp256k1Keys, + Logger, + Checks, + LoggerProvider, + JsObjectSigner, + IJsObjectSignerOptions, + LogLevelDesc, +} from "@hyperledger/cactus-common"; +import { ValidatorOptions } from "class-validator"; + +export enum CurrentDrafts { + Core = "Core", + Architecture = "Architecture", + Crash = "Crash", +} + +export type DraftVersions = { + [K in CurrentDrafts]: string; +}; +export type ShutdownHook = () => Promise; + +export enum SupportedGatewayImplementations { + FABRIC = "FabricSATPGateway", + BESU = "BesuSATPGateway", +} + +export type GatewayChannel = { + id: string; +}; + +export type GatewayIdentity = { + id: string; + name?: string; + version: DraftVersions[]; + supportedChains: SupportedGatewayImplementations[]; + proofID?: string; + port?: number; + address?: + | `http://${string}` + | `https://${string}` + | `${number}.${number}.${number}.${number}.`; +}; + +export interface SATPGatewayConfig { + gid?: GatewayIdentity; + logLevel?: LogLevelDesc; + keys?: Secp256k1Keys; + environment?: "development" | "production"; + enableOpenAPI?: boolean; + validationOptions?: ValidatorOptions; +} +export type Immutable = { + readonly [K in keyof T]: Immutable; +}; + +export interface keyable { + [key: string]: unknown; +} + +export function isOfType( + obj: any, + type: new (...args: any[]) => T, +): obj is T { + return obj instanceof type; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-besu-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-besu-satp-gateway.ts new file mode 100644 index 0000000000..b362a244b9 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-besu-satp-gateway.ts @@ -0,0 +1,20 @@ +import { + IPluginFactoryOptions, + PluginFactory, +} from "@hyperledger/cactus-core-api"; +import { + IBesuSATPGatewayConstructorOptions, + BesuSATPGateway, +} from "../core/besu-satp-gateway"; + +export class PluginFactoryBesuSATPGateway extends PluginFactory< + BesuSATPGateway, + IBesuSATPGatewayConstructorOptions, + IPluginFactoryOptions +> { + async create( + pluginOptions: IBesuSATPGatewayConstructorOptions, + ): Promise { + return new BesuSATPGateway(pluginOptions); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-fabric-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-fabric-satp-gateway.ts new file mode 100644 index 0000000000..1c4c48a657 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-fabric-satp-gateway.ts @@ -0,0 +1,20 @@ +import { + IPluginFactoryOptions, + PluginFactory, +} from "@hyperledger/cactus-core-api"; +import { + IFabricSATPGatewayConstructorOptions, + FabricSATPGateway, +} from "../core/fabric-satp-gateway"; + +export class PluginFactoryFabricSATPGateway extends PluginFactory< + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, + IPluginFactoryOptions +> { + async create( + pluginOptions: IFabricSATPGatewayConstructorOptions, + ): Promise { + return new FabricSATPGateway(pluginOptions); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-gateway-orchestrator.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-gateway-orchestrator.ts new file mode 100644 index 0000000000..e4b53d98e9 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/factory/plugin-factory-gateway-orchestrator.ts @@ -0,0 +1,31 @@ +import { + IPluginFactoryOptions, + PluginFactory, +} from "@hyperledger/cactus-core-api"; +import { + SATPGateway, + SATPGatewayConfig, +} from "../gateway-refactor"; +import { validateOrReject } from "class-validator"; + +export class PluginFactorySATPGateway extends PluginFactory< + SATPGateway, + SATPGatewayConfig, + IPluginFactoryOptions +> { + async create( + pluginOptions: SATPGatewayConfig, + ): Promise { + const coordinator = new SATPGateway(pluginOptions); + + try { + const validationOptions = pluginOptions.validationOptions; + await validateOrReject(coordinator, validationOptions); + return coordinator; + } catch (errors) { + throw new Error( + `Caught promise rejection (validation failed). Errors: ${errors}`, + ); + } + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts new file mode 100644 index 0000000000..2b3385119f --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts @@ -0,0 +1,320 @@ +import { + Secp256k1Keys, + Logger, + Checks, + LoggerProvider, + JsObjectSigner, + IJsObjectSignerOptions, + ILoggerOptions, +} from "@hyperledger/cactus-common"; +import { v4 as uuidv4 } from "uuid"; + +import { + ICactusPlugin, + IPluginWebService, + IWebServiceEndpoint, + Configuration, +} from "@hyperledger/cactus-core-api"; + +import { + MinLength, + MaxLength, + IsNotEmpty, + ValidateNested, + IsDefined, + IsNotEmptyObject, + IsObject, + IsString, + Contains, +} from "class-validator"; +import { Type } from "class-transformer"; + +import fs from "fs"; +import path from "path"; +import swaggerUi = require("swagger-ui-express"); +import { + IPluginSatpGatewayConstructorOptions, + PluginSATPGateway, +} from "./plugin-satp-gateway"; +import { Server } from "node:http"; +import { + CurrentDrafts, + DraftVersions, + SATPGatewayConfig, + GatewayIdentity, + ShutdownHook, + SupportedGatewayImplementations, +} from "./core/types"; +import { pass } from "jest-extended"; +import { GatewayOrchestrator } from "./gol/gateway-orchestrator"; +import { log } from "console"; +export { SATPGatewayConfig }; +import express, { Express, Request, Response } from 'express'; +import { expressConnectMiddleware } from "@connectrpc/connect-express"; +import http from "http"; +import { configureRoutes } from "./web-services/router"; + +export class SATPGateway { + // todo more checks; example port from config is between 3000 and 9000 + @IsDefined() + @IsNotEmptyObject() + @IsObject() + private readonly logger: Logger; + + @IsDefined() + @IsNotEmptyObject() + @IsObject() + // todo add decorators that check all fields are defined + private readonly config: SATPGatewayConfig; + + @IsString() + @Contains("Gateway") + public readonly label = "SATPGateway"; + + private gatewayConnectionManager: GatewayOrchestrator; + private readonly shutdownHooks: ShutdownHook[]; + private server: any | undefined; + // TODO!: add logic to manage sessions (parallelization, user input, freeze, unfreeze, rollback, recovery) + // private sessions: Map = new Map(); + + constructor(public readonly options: SATPGatewayConfig) { + const fnTag = `${this.label}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + this.config = SATPGateway.ProcessGatewayCoordinatorConfig(options); + this.shutdownHooks = []; + const level = options.logLevel || "INFO"; + const logOptions: ILoggerOptions = { + level: level, + label: this.label, + }; + this.logger = LoggerProvider.getOrCreate(logOptions); + this.logger.info("Initializing Gateway Coordinator"); + + if (options.enableOpenAPI) { + this.setupOpenAPI(); + } + this.logger.info("Gateway Coordinator initialized"); + const seedGateways = this.getGatewaySeeds(); + this.logger.info( + `Initializing gateway connection manager with ${seedGateways} seed gateways`, + ); + this.gatewayConnectionManager = new GatewayOrchestrator(seedGateways, { + logger: this.logger, + }); + } + + async startupServer(): Promise { + const fnTag = `${this.label}#startup()`; + this.logger.debug(`Entering ${fnTag}`); + if (!this.server) { + this.server = express(); + this.server.use(expressConnectMiddleware({ routes: configureRoutes })); + http.createServer(this.server).listen(this.options.gid?.port); + + } else { + this.logger.warn("Server already running"); + } + } +async shutdownServer(): Promise { + const fnTag = `${this.label}#shutdown()`; + this.logger.debug(`Entering ${fnTag}`); + if (this.server) { + try { + this.server.close(); + this.server = undefined; + this.logger.info("Server shut down"); + } catch (error) { + this.logger.error(`Error shutting down the server: ${error}`); + } + } else { + this.logger.warn("Server is not running."); + } +} + + + async addGateways(IDs: string[]): Promise { + const fnTag = `${this.label}#connectToGateway()`; + this.logger.debug(`Entering ${fnTag}`); + this.logger.info("Connecting to gateway"); + const gatewaysToAdd: GatewayIdentity[] = []; + const thisID = this.config.gid!.id; + const otherIDs = IDs.filter((id) => id !== thisID); + + for (const id of otherIDs) { + gatewaysToAdd.push(this.resolveGatewayID(id)); + } + + this.gatewayConnectionManager.addGateways(gatewaysToAdd); + + // todo connect to gateway + } + + // gets an ID, queries a repository, returns an address, port, and proof of identity + resolveGatewayID(ID: string): GatewayIdentity { + const fnTag = `${this.label}#resolveGatewayID()`; + this.logger.debug(`Entering ${fnTag}`); + this.logger.info(`Resolving gateway with ID: ${ID}`); + + const mockGatewayIdentity: GatewayIdentity[] = [ + { + id: "1", + name: "Gateway1", + version: [ + { + Core: "1.0", + Architecture: "1.0", + Crash: "1.0", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID1", + port: 3011, + address: "http://localhost", + }, + { + id: "2", + name: "Gateway2", + version: [ + { + Core: "1.0", + Architecture: "1.0", + Crash: "1.0", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID1", + port: 3012, + address: "http://localhost", + }, + ]; + return mockGatewayIdentity.filter((gateway) => gateway.id === ID)[0]; + } + + // todo load docs for gateway coordinator and expose them in a http server + setupOpenAPI(): void { + const fnTag = `${this.label}#setupOpenAPI()`; + this.logger.debug(`Entering ${fnTag}`); + + this.logger.error("OpenAPI setup not implemented"); + return; + const specPath = path.join(__dirname, "../../", "/json", "openapi.json"); + this.logger.debug(`Loading OpenAPI specification from ${specPath}`); + + const OpenAPISpec = JSON.parse(fs.readFileSync(specPath).toString()); + this.logger.info( + `OpenAPI docs and documentation set up at 📖: \n ${this.config.gid?.address}:${this.config.gid?.port}/api-docs`, + ); + + // todo bind to grpc gateway + // this._app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(OpenAPISpec)); + } + + getGatewaySeeds(): GatewayIdentity[] { + const fnTag = `${this.label}#getGatewaySeeds()`; + this.logger.debug(`Entering ${fnTag}`); + + const mockGatewayIdentity: GatewayIdentity[] = [ + { + id: "1", + name: "Gateway1", + version: [ + { + Core: "1.0", + Architecture: "1.0", + Crash: "1.0", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID1", + port: 3011, + address: "http://localhost", + }, + { + id: "2", + name: "Gateway2", + version: [ + { + Core: "1.0", + Architecture: "1.0", + Crash: "1.0", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID1", + port: 3012, + address: "http://localhost", + }, + ]; + return mockGatewayIdentity; + } + + static ProcessGatewayCoordinatorConfig( + pluginOptions: SATPGatewayConfig, + ): SATPGatewayConfig { + if (!pluginOptions.keys) { + pluginOptions.keys = Secp256k1Keys.generateKeyPairsBuffer(); + } + if (!pluginOptions.gid) { + const id = uuidv4(); + pluginOptions.gid = { + id: id, + name: id, + version: [ + { + Core: "v02", + Architecture: "v02", + Crash: "v02", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID1", + port: 3000, + address: "http://localhost", + }; + } + + if (!pluginOptions.logLevel) { + pluginOptions.logLevel = "DEBUG"; + } + + if (!pluginOptions.environment) { + pluginOptions.environment = "development"; + } + + if (!pluginOptions.enableOpenAPI) { + pluginOptions.enableOpenAPI = true; + } + + if (!pluginOptions.validationOptions) { + // do nothing + } + + return pluginOptions; + } + + // generate getter for identity + getIdentity(): GatewayIdentity { + return this.config.gid!; + } + + async shutdown(): Promise { + this.logger.info("Shutting down Gateway Coordinator"); + return await this.gatewayConnectionManager.disconnectAll(); + + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-besu-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-besu-satp-gateway.ts deleted file mode 100644 index 2ba9be6d17..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-besu-satp-gateway.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { - IPluginFactoryOptions, - PluginFactory, -} from "@hyperledger/cactus-core-api"; -import { - IBesuSatpGatewayConstructorOptions, - BesuSatpGateway, -} from "./besu-satp-gateway"; - -export class PluginFactoryBesuSatpGateway extends PluginFactory< - BesuSatpGateway, - IBesuSatpGatewayConstructorOptions, - IPluginFactoryOptions -> { - async create( - pluginOptions: IBesuSatpGatewayConstructorOptions, - ): Promise { - return new BesuSatpGateway(pluginOptions); - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-fabric-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-fabric-satp-gateway.ts deleted file mode 100644 index 30010f6ee6..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-factory-fabric-satp-gateway.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { - IPluginFactoryOptions, - PluginFactory, -} from "@hyperledger/cactus-core-api"; -import { - IFabricSatpGatewayConstructorOptions, - FabricSatpGateway, -} from "./fabric-satp-gateway"; - -export class PluginFactoryFabricSatpGateway extends PluginFactory< - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, - IPluginFactoryOptions -> { - async create( - pluginOptions: IFabricSatpGatewayConstructorOptions, - ): Promise { - return new FabricSatpGateway(pluginOptions); - } -} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/message_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/message_pb.ts new file mode 100644 index 0000000000..38f10e65cc --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/message_pb.ts @@ -0,0 +1,149 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/common/message.proto (package cacti.satp.v02.common, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum cacti.satp.v02.common.STATUS + */ +export enum STATUS { + /** + * @generated from enum value: STATUS_UNSPECIFIED = 0; + */ + STATUS_UNSPECIFIED = 0, + + /** + * @generated from enum value: STATUS_OK = 1; + */ + STATUS_OK = 1, + + /** + * @generated from enum value: STATUS_ERROR = 2; + */ + STATUS_ERROR = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(STATUS) +proto3.util.setEnumType(STATUS, "cacti.satp.v02.common.STATUS", [ + { no: 0, name: "STATUS_UNSPECIFIED" }, + { no: 1, name: "STATUS_OK" }, + { no: 2, name: "STATUS_ERROR" }, +]); + +/** + * TODO: define the common parameters to every protocol message + * + * @generated from message cacti.satp.v02.common.MessageCore + */ +export class MessageCore extends Message { + /** + * @generated from field: string message = 1; + */ + message = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MessageCore"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MessageCore { + return new MessageCore().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MessageCore { + return new MessageCore().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MessageCore { + return new MessageCore().fromJsonString(jsonString, options); + } + + static equals(a: MessageCore | PlainMessage | undefined, b: MessageCore | PlainMessage | undefined): boolean { + return proto3.util.equals(MessageCore, a, b); + } +} + +/** + * TODO: define the common parameters to every rollback message + * + * @generated from message cacti.satp.v02.common.RollbackMessageCore + */ +export class RollbackMessageCore extends Message { + /** + * @generated from field: string message = 1; + */ + message = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.RollbackMessageCore"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): RollbackMessageCore { + return new RollbackMessageCore().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): RollbackMessageCore { + return new RollbackMessageCore().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): RollbackMessageCore { + return new RollbackMessageCore().fromJsonString(jsonString, options); + } + + static equals(a: RollbackMessageCore | PlainMessage | undefined, b: RollbackMessageCore | PlainMessage | undefined): boolean { + return proto3.util.equals(RollbackMessageCore, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Ack + */ +export class Ack extends Message { + /** + * @generated from field: cacti.satp.v02.common.STATUS status = 1; + */ + status = STATUS.STATUS_UNSPECIFIED; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Ack"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "status", kind: "enum", T: proto3.getEnumType(STATUS) }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Ack { + return new Ack().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Ack { + return new Ack().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Ack { + return new Ack().fromJsonString(jsonString, options); + } + + static equals(a: Ack | PlainMessage | undefined, b: Ack | PlainMessage | undefined): boolean { + return proto3.util.equals(Ack, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_connect.ts new file mode 100644 index 0000000000..cd60e5eb81 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_connect.ts @@ -0,0 +1,74 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/common/session.proto (package cacti.satp.v02.common, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Empty, MethodKind } from "@bufbuild/protobuf"; +import { SendStatusRequest, SendStatusResponse } from "./session_pb.js"; +import { Ack, MessageCore, RollbackMessageCore } from "./message_pb.js"; + +/** + * @generated from service cacti.satp.v02.common.SessionStatusService + */ +export const SessionStatusService = { + typeName: "cacti.satp.v02.common.SessionStatusService", + methods: { + /** + * @generated from rpc cacti.satp.v02.common.SessionStatusService.GetStatus + */ + getStatus: { + name: "GetStatus", + I: Empty, + O: SendStatusResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.common.SessionStatusService.SendStatus + */ + sendStatus: { + name: "SendStatus", + I: SendStatusRequest, + O: Empty, + kind: MethodKind.Unary, + }, + } +} as const; + +/** + * TODO: define common RPC methods for each step. This is a draft + * + * @generated from service cacti.satp.v02.common.CommonService + */ +export const CommonService = { + typeName: "cacti.satp.v02.common.CommonService", + methods: { + /** + * @generated from rpc cacti.satp.v02.common.CommonService.Ping + */ + ping: { + name: "Ping", + I: Empty, + O: MessageCore, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.common.CommonService.Rollback + */ + rollback: { + name: "Rollback", + I: Empty, + O: RollbackMessageCore, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.common.CommonService.GetStageVersion + */ + getStageVersion: { + name: "GetStageVersion", + I: Empty, + O: Ack, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_pb.ts new file mode 100644 index 0000000000..7fa4974994 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/session_pb.ts @@ -0,0 +1,94 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/common/session.proto (package cacti.satp.v02.common, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message cacti.satp.v02.common.SendStatusRequest + */ +export class SendStatusRequest extends Message { + /** + * @generated from field: string status = 1; + */ + status = ""; + + /** + * @generated from field: bool hasBackup = 2; + */ + hasBackup = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.SendStatusRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "status", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "hasBackup", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SendStatusRequest { + return new SendStatusRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SendStatusRequest { + return new SendStatusRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SendStatusRequest { + return new SendStatusRequest().fromJsonString(jsonString, options); + } + + static equals(a: SendStatusRequest | PlainMessage | undefined, b: SendStatusRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(SendStatusRequest, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.SendStatusResponse + */ +export class SendStatusResponse extends Message { + /** + * @generated from field: string status = 1; + */ + status = ""; + + /** + * @generated from field: bool hasBackup = 2; + */ + hasBackup = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.SendStatusResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "status", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "hasBackup", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SendStatusResponse { + return new SendStatusResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SendStatusResponse { + return new SendStatusResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SendStatusResponse { + return new SendStatusResponse().fromJsonString(jsonString, options); + } + + static equals(a: SendStatusResponse | PlainMessage | undefined, b: SendStatusResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(SendStatusResponse, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/crash_recovery_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/crash_recovery_connect.ts new file mode 100644 index 0000000000..5989c0b6ba --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/crash_recovery_connect.ts @@ -0,0 +1,18 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/crash_recovery.proto (package cacti.satp.v02.crash, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +/** + * TODO: Rollback and crash-recovery related + * + * util RPCs + * + * @generated from service cacti.satp.v02.crash.CrashRecovery + */ +export const CrashRecovery = { + typeName: "cacti.satp.v02.crash.CrashRecovery", + methods: { + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_connect.ts new file mode 100644 index 0000000000..056b2b8058 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_connect.ts @@ -0,0 +1,30 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/stage_0.proto (package cacti.satp.v02.stage_0, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { TransferProposalClaimsRequest, TransferProposalClaimsResponse } from "./stage_0_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + +/** + * util RPCs + * + * @generated from service cacti.satp.v02.stage_0.SATPStage0 + */ +export const SATPStage0 = { + typeName: "cacti.satp.v02.stage_0.SATPStage0", + methods: { + /** + * step RPCs + * + * @generated from rpc cacti.satp.v02.stage_0.SATPStage0.TransferProposalClaims + */ + transferProposalClaims: { + name: "TransferProposalClaims", + I: TransferProposalClaimsRequest, + O: TransferProposalClaimsResponse, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_pb.ts new file mode 100644 index 0000000000..01bd2a9225 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_0_pb.ts @@ -0,0 +1,156 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/stage_0.proto (package cacti.satp.v02.stage_0, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message cacti.satp.v02.stage_0.TransferProposalClaimsRequest + */ +export class TransferProposalClaimsRequest extends Message { + /** + * @generated from field: string message_type = 1; + */ + messageType = ""; + + /** + * @generated from field: string asset_asset_id = 2; + */ + assetAssetId = ""; + + /** + * @generated from field: string asset_profile_id = 3; + */ + assetProfileId = ""; + + /** + * @generated from field: string verified_originator_entity_id = 4; + */ + verifiedOriginatorEntityId = ""; + + /** + * @generated from field: string verified_beneficiary_entity_id = 5; + */ + verifiedBeneficiaryEntityId = ""; + + /** + * @generated from field: string originator_pubkey = 6; + */ + originatorPubkey = ""; + + /** + * @generated from field: string beneficiary_pubkey = 7; + */ + beneficiaryPubkey = ""; + + /** + * @generated from field: string sender_gateway_network_id = 8; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: string recipient_gateway_network_id = 9; + */ + recipientGatewayNetworkId = ""; + + /** + * @generated from field: string client_identity_pubkey = 10; + */ + clientIdentityPubkey = ""; + + /** + * @generated from field: string server_identity_pubkey = 11; + */ + serverIdentityPubkey = ""; + + /** + * @generated from field: string sender_gateway_owner_id = 12; + */ + senderGatewayOwnerId = ""; + + /** + * @generated from field: string receiver_gateway_owner_id = 13; + */ + receiverGatewayOwnerId = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.stage_0.TransferProposalClaimsRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "message_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "asset_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "asset_profile_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "verified_originator_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "verified_beneficiary_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "originator_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "beneficiary_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "recipient_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "client_identity_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "server_identity_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "sender_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 13, name: "receiver_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferProposalClaimsRequest { + return new TransferProposalClaimsRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalClaimsRequest { + return new TransferProposalClaimsRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferProposalClaimsRequest { + return new TransferProposalClaimsRequest().fromJsonString(jsonString, options); + } + + static equals(a: TransferProposalClaimsRequest | PlainMessage | undefined, b: TransferProposalClaimsRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferProposalClaimsRequest, a, b); + } +} + +/** + * TODO + * + * @generated from message cacti.satp.v02.stage_0.TransferProposalClaimsResponse + */ +export class TransferProposalClaimsResponse extends Message { + /** + * @generated from field: string message_type = 1; + */ + messageType = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.stage_0.TransferProposalClaimsResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "message_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferProposalClaimsResponse { + return new TransferProposalClaimsResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalClaimsResponse { + return new TransferProposalClaimsResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferProposalClaimsResponse { + return new TransferProposalClaimsResponse().fromJsonString(jsonString, options); + } + + static equals(a: TransferProposalClaimsResponse | PlainMessage | undefined, b: TransferProposalClaimsResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferProposalClaimsResponse, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_connect.ts new file mode 100644 index 0000000000..c66c54ca67 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_connect.ts @@ -0,0 +1,16 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/stage_1.proto (package cacti.satp.v02.stage_1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +/** + * util RPCs + * + * @generated from service cacti.satp.v02.stage_1.SATPStage1 + */ +export const SATPStage1 = { + typeName: "cacti.satp.v02.stage_1.SATPStage1", + methods: { + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_connect.ts new file mode 100644 index 0000000000..d00165f0c4 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_connect.ts @@ -0,0 +1,16 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/stage_2.proto (package cacti.satp.v02.stage_2, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +/** + * util RPCs + * + * @generated from service cacti.satp.v02.stage_2.SATPStage2 + */ +export const SATPStage2 = { + typeName: "cacti.satp.v02.stage_2.SATPStage2", + methods: { + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_connect.ts new file mode 100644 index 0000000000..ee19d09258 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_connect.ts @@ -0,0 +1,16 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file cacti/satp/v02/stage_3.proto (package cacti.satp.v02.stage_3, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +/** + * util RPCs + * + * @generated from service cacti.satp.v02.stage_3.SATPStage3 + */ +export const SATPStage3 = { + typeName: "cacti.satp.v02.stage_3.SATPStage3", + methods: { + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/view/bungee_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/view/bungee_pb.ts new file mode 100644 index 0000000000..e3147a8629 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/view/bungee_pb.ts @@ -0,0 +1,45 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/view/bungee.proto (package cacti.satp.v02.view.bungee, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message cacti.satp.v02.view.bungee.BungeeView + */ +export class BungeeView extends Message { + /** + * @generated from field: string message = 1; + */ + message = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.view.bungee.BungeeView"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BungeeView { + return new BungeeView().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BungeeView { + return new BungeeView().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BungeeView { + return new BungeeView().fromJsonString(jsonString, options); + } + + static equals(a: BungeeView | PlainMessage | undefined, b: BungeeView | PlainMessage | undefined): boolean { + return proto3.util.equals(BungeeView, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_connect.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_connect.ts new file mode 100644 index 0000000000..3672917b75 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_connect.ts @@ -0,0 +1,62 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts,js_import_style=module" +// @generated from file test/message.proto (package test.message, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Empty, MethodKind } from "@bufbuild/protobuf"; +import { Message, ModifyMessageRequest, ModifyMessageResponse } from "./message_pb.js"; + +/** + * @generated from service test.message.TestService + */ +export const TestService = { + typeName: "test.message.TestService", + methods: { + /** + * @generated from rpc test.message.TestService.GetMessage + */ + getMessage: { + name: "GetMessage", + I: Empty, + O: Message, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc test.message.TestService.SendMessage + */ + sendMessage: { + name: "SendMessage", + I: Message, + O: Empty, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc test.message.TestService.ModifyMessage + */ + modifyMessage: { + name: "ModifyMessage", + I: ModifyMessageRequest, + O: ModifyMessageResponse, + kind: MethodKind.Unary, + }, + } +} as const; + +/** + * @generated from service test.message.TestService2 + */ +export const TestService2 = { + typeName: "test.message.TestService2", + methods: { + /** + * @generated from rpc test.message.TestService2.GetMessage + */ + getMessage: { + name: "GetMessage", + I: Empty, + O: Message, + kind: MethodKind.Unary, + }, + } +} as const; + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_pb.ts new file mode 100644 index 0000000000..1a1ea00f89 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/test/message_pb.ts @@ -0,0 +1,119 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file test/message.proto (package test.message, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message as Message$1, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from message test.message.Message + */ +export class Message extends Message$1 { + /** + * @generated from field: string content = 1; + */ + content = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "test.message.Message"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Message { + return new Message().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Message { + return new Message().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Message { + return new Message().fromJsonString(jsonString, options); + } + + static equals(a: Message | PlainMessage | undefined, b: Message | PlainMessage | undefined): boolean { + return proto3.util.equals(Message, a, b); + } +} + +/** + * @generated from message test.message.ModifyMessageResponse + */ +export class ModifyMessageResponse extends Message$1 { + /** + * @generated from field: string content = 1; + */ + content = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "test.message.ModifyMessageResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ModifyMessageResponse { + return new ModifyMessageResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ModifyMessageResponse { + return new ModifyMessageResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ModifyMessageResponse { + return new ModifyMessageResponse().fromJsonString(jsonString, options); + } + + static equals(a: ModifyMessageResponse | PlainMessage | undefined, b: ModifyMessageResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ModifyMessageResponse, a, b); + } +} + +/** + * @generated from message test.message.ModifyMessageRequest + */ +export class ModifyMessageRequest extends Message$1 { + /** + * @generated from field: string content = 1; + */ + content = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "test.message.ModifyMessageRequest"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "content", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ModifyMessageRequest { + return new ModifyMessageRequest().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ModifyMessageRequest { + return new ModifyMessageRequest().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ModifyMessageRequest { + return new ModifyMessageRequest().fromJsonString(jsonString, options); + } + + static equals(a: ModifyMessageRequest | PlainMessage | undefined, b: ModifyMessageRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(ModifyMessageRequest, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gol/config-service.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gol/config-service.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gol/gateway-orchestrator.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gol/gateway-orchestrator.ts new file mode 100644 index 0000000000..b1b3031c64 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gol/gateway-orchestrator.ts @@ -0,0 +1,103 @@ +// a helper class to manage connections to counteryparty gateways + +import { Logger } from "@hyperledger/cactus-common"; +import { GatewayIdentity, GatewayChannel } from "../core/types"; +import { NonExistantGatewayIdentity } from "../core/errors"; +interface GatewayOrchestratorOptions { + logger: Logger; +} + +export class GatewayOrchestrator { + public readonly label = "GatewayOrchestrator"; + private gatewayIDs: string[] = []; + private gateways: Map = new Map(); + private channels: Map = new Map(); + private readonly logger: Logger; + + constructor( + public readonly identities: GatewayIdentity[], + options: GatewayOrchestratorOptions, + ) { + const fnTag = `${this.label}#constructor()`; + // add checks + this.logger = options.logger; + this.logger.info("Initializing Gateway Connection Manager"); + for (const identity of identities) { + this.gatewayIDs.push(identity.id); + this.gateways.set(identity.id, identity); + } + this.logger.info( + `Gateway Connection Manager bootstrapped with ${identities.length} gateways`, + ); + } + + async connectToCounterPartyGateways(): Promise { + const fnTag = `${this.label}#connectToCounterPartyGateways()`; + // add checks + this.logger.info(`Connecting to ${this.gatewayIDs.length} gateways`); + let connected = 0; + try { + for (const id of this.gatewayIDs) { + const guid = this.gateways.get(id); + if (!guid) { + throw new NonExistantGatewayIdentity(id); + } else if (!this.alreadyConnected) { + await this.createChannel(guid); + connected++; + } + } + } catch (ex) { + this.logger.error(`Failed to connect to gateway`); + this.logger.error(ex); + } + return connected; + } + + async addGateways(gateways: GatewayIdentity[]): Promise { + const fnTag = `${this.label}#addGateways()`; + // add checks + this.logger.info(`Adding ${gateways.length} gateways`); + for (const gateway of gateways) { + const id = gateway.id; + if (this.gatewayIDs.includes(id)) { + this.logger.info(`Gateway with id ${id} already exists, igonoring`); + continue; + } + this.gatewayIDs.push(id); + this.gateways.set(id, gateway); + } + return this.connectToCounterPartyGateways(); + } + + alreadyConnected(ID: string): boolean { + return this.channels.has(ID); + } + // make singleton + async createChannels(): Promise { + const fnTag = `${this.label}#boostrapChannels()`; + // Add checks and the rest of your logic here + const channels: GatewayChannel[] = []; + this.gateways.forEach(async (identity) => { + channels.push(await this.createChannel(identity)); + }); + } + + async createChannel(identity: GatewayIdentity): Promise { + const fnTag = `${this.label}#createChannel()`; + // add checks + const channel: GatewayChannel = { + id: identity.id, + }; + return channel; + } + + async disconnectAll(): Promise { + let counter = 0; + this.channels.forEach(async (channel) => { + this.logger.info(`Disconnecting from ${channel.id}`); + this.logger.error("Not implemented") + counter++; + }); + return counter; + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts similarity index 93% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts index aa68b799a6..bf82655807 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts @@ -5,7 +5,7 @@ import { Optional } from "typescript-optional"; import type { Express } from "express"; import { v4 as uuidV4 } from "uuid"; import { Knex } from "knex"; -import OAS from "../../json/openapi.json"; +import OAS from "../json/openapi.json"; import { Secp256k1Keys, Logger, @@ -41,21 +41,21 @@ import { RecoverUpdateAckV1Message, RollbackV1Message, RollbackAckV1Message, -} from "../generated/openapi/typescript-axios"; -import { CommitFinalRequestEndpointV1 } from "../web-services/server-side/commit-final-request-endpoint"; -import { CommitFinalResponseEndpointV1 } from "../web-services/client-side/commit-final-response-endpoint"; -import { CommitPreparationResponseEndpointV1 } from "../web-services/client-side/commit-prepare-response-endpoint"; -import { LockEvidenceResponseEndpointV1 } from "../web-services/client-side/lock-evidence-response-endpoint"; -import { TransferCommenceResponseEndpointV1 } from "../web-services/client-side/transfer-commence-response-endpoint"; -import { TransferInitiationResponseEndpointV1 } from "../web-services/client-side/transfer-initiation-response-endpoint"; -import { LockEvidenceRequestEndpointV1 } from "../web-services/server-side/lock-evidence-request-endpoint"; -import { TransferCommenceRequestEndpointV1 } from "../web-services/server-side/transfer-commence-request-endpoint"; -import { TransferCompleteRequestEndpointV1 } from "../web-services/server-side/transfer-complete-request-endpoint"; -import { TransferInitiationRequestEndpointV1 } from "../web-services/server-side/transfer-initiation-request-endpoint"; -import { CommitPreparationRequestEndpointV1 } from "../web-services/server-side/commite-prepare-request-endpoint"; +} from "./generated/openapi/typescript-axios"; +import { CommitFinalRequestEndpointV1 } from "./web-services/server-side/commit-final-request-endpoint"; +import { CommitFinalResponseEndpointV1 } from "./web-services/client-side/commit-final-response-endpoint"; +import { CommitPreparationResponseEndpointV1 } from "./web-services/client-side/commit-prepare-response-endpoint"; +import { LockEvidenceResponseEndpointV1 } from "./web-services/client-side/lock-evidence-response-endpoint"; +import { TransferCommenceResponseEndpointV1 } from "./web-services/client-side/transfer-commence-response-endpoint"; +import { TransferInitiationResponseEndpointV1 } from "./web-services/client-side/transfer-initiation-response-endpoint"; +import { LockEvidenceRequestEndpointV1 } from "./web-services/server-side/lock-evidence-request-endpoint"; +import { TransferCommenceRequestEndpointV1 } from "./web-services/server-side/transfer-commence-request-endpoint"; +import { TransferCompleteRequestEndpointV1 } from "./web-services/server-side/transfer-complete-request-endpoint"; +import { TransferInitiationRequestEndpointV1 } from "./web-services/server-side/transfer-initiation-request-endpoint"; +import { CommitPreparationRequestEndpointV1 } from "./web-services/server-side/commite-prepare-request-endpoint"; import { randomInt } from "crypto"; -import { ClientGatewayHelper } from "./client/client-helper"; -import { ServerGatewayHelper } from "./server/server-helper"; +import { ClientGatewayHelper } from "./core/client-helper"; +import { ServerGatewayHelper } from "./core/server-helper"; import { checkValidRecoverMessage, sendRecoverMessage, @@ -73,11 +73,11 @@ import { sendRecoverSuccessMessage, } from "./recovery/recover-success"; import { SHA256 } from "crypto-js"; -import { RecoverMessageEndpointV1 } from "../web-services/recovery/recover-message-endpoint"; -import { RecoverUpdateMessageEndpointV1 } from "../web-services/recovery/recover-update-message-endpoint"; -import { RecoverUpdateAckMessageEndpointV1 } from "../web-services/recovery/recover-update-ack-message-endpoint"; -import { RecoverSuccessMessageEndpointV1 } from "../web-services/recovery/recover-success-message-endpoint"; -import { RollbackMessageEndpointV1 } from "../web-services/recovery/rollback-message-endpoint"; +import { RecoverMessageEndpointV1 } from "./web-services/recovery/recover-message-endpoint"; +import { RecoverUpdateMessageEndpointV1 } from "./web-services/recovery/recover-update-message-endpoint"; +import { RecoverUpdateAckMessageEndpointV1 } from "./web-services/recovery/recover-update-ack-message-endpoint"; +import { RecoverSuccessMessageEndpointV1 } from "./web-services/recovery/recover-success-message-endpoint"; +import { RollbackMessageEndpointV1 } from "./web-services/recovery/rollback-message-endpoint"; import { checkValidRollbackMessage, sendRollbackMessage, @@ -87,8 +87,8 @@ import { checkValidRollbackAckMessage, sendRollbackAckMessage, } from "./recovery/rollback-ack"; -import { ClientRequestEndpointV1 } from "../web-services/client-side/client-request-endpoint"; -import { RollbackAckMessageEndpointV1 } from "../web-services/recovery/rollback-ack-message-endpoint"; +import { ClientRequestEndpointV1 } from "./web-services/client-side/client-request-endpoint"; +import { RollbackAckMessageEndpointV1 } from "./web-services/recovery/rollback-ack-message-endpoint"; import { KnexLocalLogRepository as LocalLogRepository } from "./repository/knex-local-log-repository"; import { IPFSRemoteLogRepository } from "./repository/ipfs-remote-log-repository"; import { KnexRemoteLogRepository } from "./repository/knex-remote-log-repository"; @@ -147,10 +147,11 @@ export interface ILocalLog { timestamp?: string; } -export abstract class PluginSatpGateway +// todo implement factory +export abstract class PluginSATPGateway implements ICactusPlugin, IPluginWebService { - public static readonly CLASS_NAME = "SatpGateway"; + public static readonly CLASS_NAME = "SATPGateway"; private readonly instanceId: string; private readonly _log: Logger; @@ -190,8 +191,8 @@ export abstract class PluginSatpGateway const keyPairs = options.keyPair ? options.keyPair : Secp256k1Keys.generateKeyPairsBuffer(); - this._pubKey = PluginSatpGateway.bufArray2HexStr(keyPairs.publicKey); - this._privKey = PluginSatpGateway.bufArray2HexStr(keyPairs.privateKey); + this._pubKey = PluginSATPGateway.bufArray2HexStr(keyPairs.publicKey); + this._privKey = PluginSATPGateway.bufArray2HexStr(keyPairs.privateKey); const objectSignerOptions: IJsObjectSignerOptions = { privateKey: this._privKey, @@ -212,7 +213,7 @@ export abstract class PluginSatpGateway } public get className(): string { - return PluginSatpGateway.CLASS_NAME; + return PluginSATPGateway.CLASS_NAME; } public getOpenApiSpec(): unknown { @@ -485,7 +486,7 @@ export abstract class PluginSatpGateway signerPubKey: this.pubKey, }; - remoteLog.signature = PluginSatpGateway.bufArray2HexStr( + remoteLog.signature = PluginSATPGateway.bufArray2HexStr( this.sign(JSON.stringify(remoteLog)), ); @@ -501,7 +502,7 @@ export abstract class PluginSatpGateway } async storeLog(localLog: LocalLog): Promise { - localLog.key = PluginSatpGateway.getSatpLogKey( + localLog.key = PluginSATPGateway.getSatpLogKey( localLog.sessionID, localLog.type, localLog.operation, @@ -529,7 +530,7 @@ export abstract class PluginSatpGateway async storeProof(localLog: ILocalLog): Promise { if (localLog.data == undefined) return; - localLog.key = PluginSatpGateway.getSatpLogKey( + localLog.key = PluginSATPGateway.getSatpLogKey( localLog.sessionID, localLog.type, localLog.operation, diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/public-api.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/public-api.ts index 530de4eccc..3d3afb7425 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/public-api.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/public-api.ts @@ -2,26 +2,28 @@ export * from "./generated/openapi/typescript-axios/index"; export { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, + PluginSATPGateway, SatpMessageType, IKeyPair, -} from "./gateway/plugin-satp-gateway"; +} from "./plugin-satp-gateway"; import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api"; -import { PluginFactoryFabricSatpGateway } from "./gateway/plugin-factory-fabric-satp-gateway"; -import { PluginFactoryBesuSatpGateway } from "./gateway/plugin-factory-besu-satp-gateway"; +import { PluginFactoryFabricSATPGateway } from "./factory/plugin-factory-fabric-satp-gateway"; +import { PluginFactoryBesuSATPGateway } from "./factory/plugin-factory-besu-satp-gateway"; +import { fileURLToPath } from "url"; export async function createFabricPluginFactory( pluginFactoryOptions: IPluginFactoryOptions, -): Promise { - return new PluginFactoryFabricSatpGateway(pluginFactoryOptions); +): Promise { + return new PluginFactoryFabricSATPGateway(pluginFactoryOptions); } export async function createBesuPluginFactory( pluginFactoryOptions: IPluginFactoryOptions, -): Promise { - return new PluginFactoryBesuSatpGateway(pluginFactoryOptions); +): Promise { + return new PluginFactoryBesuSATPGateway(pluginFactoryOptions); } -export { ServerGatewayHelper } from "./gateway/server/server-helper"; -export { ClientGatewayHelper } from "./gateway/client/client-helper"; +export { ServerGatewayHelper } from "./core/server-helper"; +export { ClientGatewayHelper } from "./core/client-helper"; +// TODO! export new gateway diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-success.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-success.ts similarity index 89% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-success.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-success.ts index ce7fde8f88..0d01714677 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-success.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-success.ts @@ -1,6 +1,6 @@ -import { RecoverSuccessV1Message } from "../../generated/openapi/typescript-axios"; +import { RecoverSuccessV1Message } from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; const log = LoggerProvider.getOrCreate({ level: "INFO", @@ -9,7 +9,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRecoverSuccessMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendRecoverSuccessMessage()`; @@ -32,7 +32,7 @@ export async function sendRecoverSuccessMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(recoverSuccessMessage)), ); @@ -46,7 +46,7 @@ export async function sendRecoverSuccessMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -57,7 +57,7 @@ export async function sendRecoverSuccessMessage( export async function checkValidRecoverSuccessMessage( response: RecoverSuccessV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRecoverSuccessMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update-ack.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update-ack.ts similarity index 89% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update-ack.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update-ack.ts index b6233120fb..911f5b8495 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update-ack.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update-ack.ts @@ -1,6 +1,6 @@ -import { RecoverUpdateAckV1Message } from "../../generated/openapi/typescript-axios"; +import { RecoverUpdateAckV1Message } from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; // import { SHA256 } from "crypto-js"; const log = LoggerProvider.getOrCreate({ @@ -10,7 +10,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRecoverUpdateAckMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendRecoverUpdateAckMessage()`; @@ -35,7 +35,7 @@ export async function sendRecoverUpdateAckMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(recoverUpdateMessage)), ); @@ -49,7 +49,7 @@ export async function sendRecoverUpdateAckMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -60,7 +60,7 @@ export async function sendRecoverUpdateAckMessage( export async function checkValidRecoverUpdateAckMessage( response: RecoverUpdateAckV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRecoverUpdateAckMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update.ts similarity index 93% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update.ts index 82c1d5e7ed..b6a915ac55 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover-update.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover-update.ts @@ -1,9 +1,9 @@ import { LocalLog, RecoverUpdateV1Message, -} from "../../generated/openapi/typescript-axios"; +} from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; import { SHA256 } from "crypto-js"; const log = LoggerProvider.getOrCreate({ @@ -13,7 +13,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRecoverUpdateMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendRecoverUpdateMessage()`; @@ -43,7 +43,7 @@ export async function sendRecoverUpdateMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(recoverUpdateMessage)), ); @@ -57,7 +57,7 @@ export async function sendRecoverUpdateMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -68,7 +68,7 @@ export async function sendRecoverUpdateMessage( export async function checkValidRecoverUpdateMessage( response: RecoverUpdateV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRecoverUpdateMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover.ts similarity index 93% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover.ts index 1a0d0d4194..92263f424f 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/recover.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/recover.ts @@ -1,6 +1,6 @@ -import { RecoverV1Message } from "../../generated/openapi/typescript-axios"; +import { RecoverV1Message } from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; const log = LoggerProvider.getOrCreate({ level: "INFO", @@ -9,7 +9,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRecoverMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, backup: boolean, remote: boolean, ): Promise { @@ -40,7 +40,7 @@ export async function sendRecoverMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(recoverMessage)), ); @@ -54,7 +54,7 @@ export async function sendRecoverMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -65,7 +65,7 @@ export async function sendRecoverMessage( export async function checkValidRecoverMessage( response: RecoverV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRecoverMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback-ack.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback-ack.ts similarity index 89% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback-ack.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback-ack.ts index b1126388fd..24ab040cce 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback-ack.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback-ack.ts @@ -1,6 +1,6 @@ -import { RollbackAckV1Message } from "../../generated/openapi/typescript-axios"; +import { RollbackAckV1Message } from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; // import { SHA256 } from "crypto-js"; const log = LoggerProvider.getOrCreate({ @@ -10,7 +10,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRollbackAckMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendRollbackAckMessage()`; @@ -35,7 +35,7 @@ export async function sendRollbackAckMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(rollbackAckMessage)), ); @@ -49,7 +49,7 @@ export async function sendRollbackAckMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -60,7 +60,7 @@ export async function sendRollbackAckMessage( export async function checkValidRollbackAckMessage( response: RollbackAckV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRollbackAckMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback.ts similarity index 89% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback.ts index 75f9782a09..e9b573af1d 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/recovery/rollback.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/recovery/rollback.ts @@ -1,6 +1,6 @@ -import { RollbackV1Message } from "../../generated/openapi/typescript-axios"; +import { RollbackV1Message } from "../generated/openapi/typescript-axios"; import { LoggerProvider } from "@hyperledger/cactus-common"; -import { PluginSatpGateway } from "../plugin-satp-gateway"; +import { PluginSATPGateway } from "../plugin-satp-gateway"; // import { SHA256 } from "crypto-js"; const log = LoggerProvider.getOrCreate({ @@ -10,7 +10,7 @@ const log = LoggerProvider.getOrCreate({ export async function sendRollbackMessage( sessionID: string, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, remote: boolean, ): Promise { const fnTag = `${gateway.className}#sendRollbackMessage()`; @@ -37,7 +37,7 @@ export async function sendRollbackMessage( signature: "", }; - const signature = PluginSatpGateway.bufArray2HexStr( + const signature = PluginSATPGateway.bufArray2HexStr( gateway.sign(JSON.stringify(rollbackMessage)), ); @@ -51,7 +51,7 @@ export async function sendRollbackMessage( await gateway.makeRequest( sessionID, - PluginSatpGateway.getSatpAPI( + PluginSATPGateway.getSatpAPI( gateway.isClientGateway(sessionID) ? sessionData.recipientBasePath : sessionData.sourceBasePath, @@ -62,7 +62,7 @@ export async function sendRollbackMessage( export async function checkValidRollbackMessage( response: RollbackV1Message, - gateway: PluginSatpGateway, + gateway: PluginSATPGateway, ): Promise { const fnTag = `${gateway.className}#checkValidRollbackMessage`; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/interfaces/repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts similarity index 100% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/interfaces/repository.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/ipfs-remote-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts similarity index 100% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/ipfs-remote-log-repository.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts similarity index 96% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts index 65c07b10de..b977e3e111 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts @@ -7,7 +7,7 @@ export class KnexLocalLogRepository implements ILocalLogRepository { public constructor(config: Knex.Config | undefined) { // eslint-disable-next-line @typescript-eslint/no-var-requires - const configFile = require("../../../knex/knexfile.ts")[ + const configFile = require("../../../../knex/knexfile.ts")[ process.env.ENVIRONMENT || "development" ]; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts similarity index 93% rename from packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts rename to packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts index 8d064da275..9431076d0a 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts @@ -10,7 +10,7 @@ export class KnexRemoteLogRepository implements IRemoteLogRepository { // simulating a remote log storage public constructor(config: Knex.Config | undefined) { // eslint-disable-next-line @typescript-eslint/no-var-requires - const configFile = require("../../../knex/knexfile-remote.ts")[ + const configFile = require("../../../../knex/knexfile-remote.ts")[ process.env.ENVIRONMENT || "development" ]; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/client-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/client-request-endpoint.ts index 9ef597bf16..99a4124477 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/client-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/client-request-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IClientRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class ClientRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-final-response-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-final-response-endpoint.ts index c68f4864bd..e08e40a183 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-final-response-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-final-response-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ICommitFinalResponseEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class CommitFinalResponseEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-prepare-response-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-prepare-response-endpoint.ts index f7d9f0fa24..6d7066a2b0 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-prepare-response-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/commit-prepare-response-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ICommitPreparationResponseEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class CommitPreparationResponseEndpointV1 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/lock-evidence-response-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/lock-evidence-response-endpoint.ts index b59a2db14b..f61c7b6161 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/lock-evidence-response-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/lock-evidence-response-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ILockEvidenceResponseEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class LockEvidenceResponseEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-commence-response-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-commence-response-endpoint.ts index 4e0ab33676..0de0281eb2 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-commence-response-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-commence-response-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ITransferCommenceResponseEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class TransferCommenceResponseEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-initiation-response-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-initiation-response-endpoint.ts index b5155591de..dbe1929339 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-initiation-response-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/client-side/transfer-initiation-response-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ITransferInitiationResponseEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class TransferInitiationResponseEndpointV1 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-message-endpoint.ts index 39b167e403..f2416f4894 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRecoverMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RecoverMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-success-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-success-message-endpoint.ts index 9ce43e466a..09b5ad642e 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-success-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-success-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRecoverSuccessMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RecoverSuccessMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-ack-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-ack-message-endpoint.ts index a9808d4922..aa0a36029d 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-ack-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-ack-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRecoverUpdateAckMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RecoverUpdateAckMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-message-endpoint.ts index f10cff1b9f..a6d3aca96c 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/recover-update-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRecoverUpdateMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RecoverUpdateMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-ack-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-ack-message-endpoint.ts index 2857f12b5b..0e82229c07 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-ack-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-ack-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRollbackAckMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RollbackAckMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-message-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-message-endpoint.ts index 3e09838d58..d7da7f1991 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-message-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/recovery/rollback-message-endpoint.ts @@ -15,13 +15,13 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface IRollbackMessageEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class RollbackMessageEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/router.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/router.ts new file mode 100644 index 0000000000..9f0248e275 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/router.ts @@ -0,0 +1,12 @@ +import { ConnectRouter } from "@connectrpc/connect"; +import { TestService } from '../generated/proto/test/message_connect'; +import { TestService2 } from '../generated/proto/test/message_connect'; + +import { TestImplementation } from "./test/test"; +import { TestImplementation2 } from "./test/test2"; + +export const configureRoutes = (router: ConnectRouter): void => { + // TODO: add all services and respective implementations + router.service(TestService, TestImplementation); + router.service(TestService2, TestImplementation2); +}; \ No newline at end of file diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commit-final-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commit-final-request-endpoint.ts index cdf2004e8d..847d525a79 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commit-final-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commit-final-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ICommitFinalRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class CommitFinalRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commite-prepare-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commite-prepare-request-endpoint.ts index 4c87695844..79e468e21f 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commite-prepare-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/commite-prepare-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ICommitPreparationRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class CommitPreparationRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/lock-evidence-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/lock-evidence-request-endpoint.ts index 8265526059..e8b90a1344 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/lock-evidence-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/lock-evidence-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ILockEvidenceRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class LockEvidenceRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-commence-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-commence-request-endpoint.ts index 8853a65632..c3f9b2bb67 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-commence-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-commence-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ITransferCommenceRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class TransferCommenceRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-complete-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-complete-request-endpoint.ts index f2d57b398a..86c19ca18d 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-complete-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-complete-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ITransferCompleteRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class TransferCompleteRequestEndpointV1 implements IWebServiceEndpoint { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-initiation-request-endpoint.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-initiation-request-endpoint.ts index 68c9e29d37..deed90e247 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-initiation-request-endpoint.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/server-side/transfer-initiation-request-endpoint.ts @@ -15,12 +15,12 @@ import { import { registerWebServiceEndpoint } from "@hyperledger/cactus-core"; -import { PluginSatpGateway } from "../../gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../plugin-satp-gateway"; import OAS from "../../../json/openapi.json"; export interface ITransferInitiationRequestEndpointOptions { logLevel?: LogLevelDesc; - gateway: PluginSatpGateway; + gateway: PluginSATPGateway; } export class TransferInitiationRequestEndpointV1 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/dummy-step.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/dummy-step.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/identity-verification.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/stage-0/identity-verification.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test.ts new file mode 100644 index 0000000000..2ed4a41ecf --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test.ts @@ -0,0 +1,36 @@ +import { Empty } from "@bufbuild/protobuf"; +import { Message, ModifyMessageRequest, ModifyMessageResponse } from '../../generated/proto/test/message_pb'; +import { HandlerContext } from '@connectrpc/connect'; + +// TODO: investigate how we can get type security, without doing the following: +/* +interface ITestServiceImplementation { + getMessage(req: Empty): Promise; + sendMessage(req: Message): Promise; + modifyMessage(req: ModifyMessageRequest): Promise; +} + +const TestImplementation: ITestServiceImplementation = { + + */ + +// TODO: inject logger from gateway? + +export const TestImplementation: any = { + async getMessage(req: Empty, context: HandlerContext): Promise { + console.log("Received request", req); + return new Message({ + content: "Hello, SATP!" + }); + }, + async sendMessage(req: Message): Promise { + console.log("Received request", req); + return new Empty(); + }, + async modifyMessage(req: ModifyMessageRequest): Promise { + console.log("Received request", req); + return new ModifyMessageResponse({ + content: "You said " + req.content + }); + }, +}; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test2.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test2.ts new file mode 100644 index 0000000000..44d134d2ba --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/web-services/test/test2.ts @@ -0,0 +1,12 @@ +import { Empty } from "@bufbuild/protobuf"; +import { Message, ModifyMessageRequest, ModifyMessageResponse } from '../../generated/proto/test/message_pb'; +import { HandlerContext } from '@connectrpc/connect'; + +export const TestImplementation2: any = { + async getMessage(req: Empty, context: HandlerContext): Promise { + console.log("Received request", req); + return new Message({ + content: "Hello, SATP!" + "2" + }); + }, +}; diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts index 56b53352a8..b51eb5dd6d 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/backup-gateway-after-client-crash.test.ts @@ -30,7 +30,7 @@ import { PluginImportType, Constants, } from "@hyperledger/cactus-core-api"; -import { PluginSatpGateway } from "../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../main/typescript/plugin-satp-gateway"; import { ChainCodeProgrammingLanguage, DefaultEventHandlerStrategy, @@ -53,15 +53,15 @@ import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; import { - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/fabric-satp-gateway"; import { - BesuSatpGateway, - IBesuSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + BesuSATPGateway, + IBesuSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -91,10 +91,10 @@ let besuKeychainId: string; let fabricConnector: PluginLedgerConnectorFabric; let besuConnector: PluginLedgerConnectorBesu; -let clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let clientGatewayApiHost: string; let serverGatewayApiHost: string; @@ -509,7 +509,7 @@ beforeAll(async () => { // Gateways configuration const allowedGateways = []; allowedGateways.push( - PluginSatpGateway.bufArray2HexStr(backupGatewayKeys.publicKey), + PluginSATPGateway.bufArray2HexStr(backupGatewayKeys.publicKey), ); clientGatewayPluginOptions = { @@ -543,8 +543,8 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( @@ -767,7 +767,7 @@ test("client gateway crashes after lock fabric asset", async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); await pluginSourceGateway.getOrCreateWebServices(); await pluginSourceGateway.registerWebServices(expressApp); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts index fa5743855f..86c5984540 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-delete-asset.test.ts @@ -52,15 +52,15 @@ import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; import { - IFabricSatpGatewayConstructorOptions, - FabricSatpGateway, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; + IFabricSATPGatewayConstructorOptions, + FabricSATPGateway, +} from "../../../main/typescript/core/fabric-satp-gateway"; import { - IBesuSatpGatewayConstructorOptions, - BesuSatpGateway, -} from "../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + IBesuSATPGatewayConstructorOptions, + BesuSATPGateway, +} from "../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -97,10 +97,10 @@ let besuKeychainId: string; let fabricConnector: PluginLedgerConnectorFabric; let besuConnector: PluginLedgerConnectorBesu; -let clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let clientGatewayApiHost: string; let serverGatewayApiHost: string; @@ -540,8 +540,8 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( @@ -784,7 +784,7 @@ test("client gateway crashes after deleting fabric asset", async () => { await Servers.listen(listenOptions); - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); await pluginSourceGateway.registerWebServices(expressApp); // client gateway self-healed and is back online diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts index 8ce74cc602..d8dae07561 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-lock-asset.test.ts @@ -52,15 +52,15 @@ import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; import { - BesuSatpGateway, - IBesuSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/besu-satp-gateway"; + BesuSATPGateway, + IBesuSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/besu-satp-gateway"; import { - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -97,10 +97,10 @@ let besuKeychainId: string; let fabricConnector: PluginLedgerConnectorFabric; let besuConnector: PluginLedgerConnectorBesu; -let clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let clientGatewayApiHost: string; let serverGatewayApiHost: string; @@ -541,8 +541,8 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( @@ -721,7 +721,7 @@ test("client gateway crashes after lock fabric asset", async () => { await Servers.listen(listenOptions); - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); await pluginSourceGateway.registerWebServices(expressApp); // client gateway self-healed and is back online diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts index 7222bbffd7..60a3521d69 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/client-crash-after-transfer-initiation.test.ts @@ -11,18 +11,18 @@ import { } from "@hyperledger/cactus-common"; import { IPluginSatpGatewayConstructorOptions, - PluginSatpGateway, -} from "../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../main/typescript/plugin-satp-gateway"; import { AssetProfile, ClientV1Request, } from "../../../main/typescript/public-api"; import { makeSessionDataChecks } from "../make-checks"; -import { BesuSatpGateway } from "../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../main/typescript/gateway/fabric-satp-gateway"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; +import { BesuSATPGateway } from "../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../main/typescript/core/fabric-satp-gateway"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; import { knexClientConnection, @@ -39,8 +39,8 @@ const BESU_ASSET_ID = uuidv4(); let serverGatewayPluginOptions: IPluginSatpGatewayConstructorOptions; let clientGatewayPluginOptions: IPluginSatpGatewayConstructorOptions; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sourceGatewayServer: Server; let recipientGatewayserver: Server; @@ -86,7 +86,7 @@ beforeAll(async () => { const { address, port } = addressInfo; serverGatewayApiHost = `http://${address}:${port}`; - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect( pluginRecipientGateway.localRepository?.database, @@ -125,7 +125,7 @@ beforeAll(async () => { const { address, port } = addressInfo; clientGatewayApiHost = `http://${address}:${port}`; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); if (pluginSourceGateway.localRepository?.database == undefined) { throw new Error("Database is not correctly initialized"); @@ -225,7 +225,7 @@ test("successful run ODAP after client gateway crashed after after receiving tra await Servers.listen(listenOptions); - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); await pluginSourceGateway.registerWebServices(clientExpressApp); // client gateway self-healed and is back online diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/gateway-coordinator-init.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/gateway-coordinator-init.test.ts new file mode 100644 index 0000000000..7ddc8a62d9 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/gateway-coordinator-init.test.ts @@ -0,0 +1,157 @@ +import "jest-extended"; +import { + Containers, + FabricTestLedgerV1, + pruneDockerAllIfGithubAction, + BesuTestLedger, +} from "@hyperledger/cactus-test-tooling"; +import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; +// import coordinator factory, coordinator and coordinator options +import { SATPGateway, SATPGatewayConfig } from "../../../main/typescript/gateway-refactor"; +import { PluginFactorySATPGateway } from "../../../main/typescript/factory/plugin-factory-gateway-orchestrator"; +import { + IPluginFactoryOptions, PluginImportType, +} from "@hyperledger/cactus-core-api"; +import { SupportedGatewayImplementations } from './../../../main/typescript/core/types'; + +const logLevel: LogLevelDesc = "INFO"; +const log = LoggerProvider.getOrCreate({ + level: "INFO", + label: "satp-gateway-orchestrator-init-test", +}); +const factoryOptions: IPluginFactoryOptions = { + pluginImportType: PluginImportType.Local, +} +const factory = new PluginFactorySATPGateway(factoryOptions); + +beforeAll(async () => { + pruneDockerAllIfGithubAction({ logLevel }) + .then(() => { + log.info("Pruning throw OK"); + }) + .catch(async () => { + await Containers.logDiagnostics({ logLevel }); + fail("Pruning didn't throw OK"); + }); +}); + +describe("SATPGateway initialization", () => { + + it("initiates with default config", async () => { + const options: SATPGatewayConfig = {}; + const gateway = await factory.create(options); + + expect(gateway).toBeInstanceOf(SATPGateway); + + const identity = gateway.getIdentity(); + expect(identity).toBeDefined(); + expect(identity.id).toBeDefined(); + expect(identity.name).toBeDefined(); + expect(identity.version).toEqual([ + { + Core: "v02", + Architecture: "v02", + Crash: "v02", + }, + ]); + expect(identity.supportedChains).toEqual([ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ]); + expect(identity.proofID).toBe("mockProofID1"); + expect(identity.port).toBe(3000); + expect(identity.address).toBe("http://localhost"); + }); + + test("initiates custom config Gateway Coordinator", async () => { + const options: SATPGatewayConfig = { + logLevel: "INFO", + gid: { + id: "mockID", + name: "CustomGateway", + version: [ + { + Core: "v1", + Architecture: "v1", + Crash: "v1", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID10", + port: 3001, + address: "https://localhost", + }, + }; + const gateway = await factory.create(options); + + expect(gateway).toBeInstanceOf(SATPGateway); + + const identity = gateway.getIdentity(); + expect(identity).toBeDefined(); + expect(identity.id).toBeDefined(); + expect(identity.name).toBeDefined(); + expect(identity.version).toEqual([ + { + Core: "v1", + Architecture: "v1", + Crash: "v1", + }, + ]); + expect(identity.supportedChains).toEqual([ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ]); + expect(identity.proofID).toBe("mockProofID10"); + expect(identity.port).toBe(3001); + expect(identity.address).toBe("https://localhost"); + }); + + test("Gateway Server launches", async () => { + const options: SATPGatewayConfig = { + logLevel: "INFO", + gid: { + id: "mockID", + name: "CustomGateway", + version: [ + { + Core: "v02", + Architecture: "v02", + Crash: "v02", + }, + ], + supportedChains: [ + SupportedGatewayImplementations.FABRIC, + SupportedGatewayImplementations.BESU, + ], + proofID: "mockProofID10", + port: 3010, + address: "https://localhost", + }, + }; + const gateway = await factory.create(options); + expect(gateway).toBeInstanceOf(SATPGateway); + + const identity = gateway.getIdentity(); + expect(identity.port).toBe(3010); + expect(identity.address).toBe("https://localhost"); + await gateway.startupServer(); + await gateway.shutdown(); + }); + +}); + +afterAll(async () => { + // shutdown channels + + await pruneDockerAllIfGithubAction({ logLevel }) + .then(() => { + log.info("Pruning throw OK"); + }) + .catch(async () => { + await Containers.logDiagnostics({ logLevel }); + fail("Pruning didn't throw OK"); + }); +}); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts index 3a006161b4..51ce622134 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call-with-ledger-connector.test.ts @@ -52,15 +52,15 @@ import { import { makeSessionDataChecks } from "../make-checks"; import { - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/fabric-satp-gateway"; import { - BesuSatpGateway, - IBesuSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + BesuSATPGateway, + IBesuSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../knex.config"; /** @@ -91,8 +91,8 @@ let besuKeychainId: string; let fabricConnector: PluginLedgerConnectorFabric; let besuConnector: PluginLedgerConnectorBesu; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let clientGatewayApiHost: string; let serverGatewayApiHost: string; @@ -477,7 +477,7 @@ beforeAll(async () => { { // Gateways configuration - const clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions = { + const clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions = { name: "cactus-plugin#satpGateway", dltIDs: ["DLT2"], instanceId: uuidv4(), @@ -490,7 +490,7 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - const serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions = { + const serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions = { name: "cactus-plugin#satpGateway", dltIDs: ["DLT1"], instanceId: uuidv4(), @@ -503,8 +503,8 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call.test.ts index 7872b5517f..2f5ec22b1c 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-api-call.test.ts @@ -11,19 +11,19 @@ import { IListenOptions, Servers } from "@hyperledger/cactus-common"; import { Configuration } from "@hyperledger/cactus-core-api"; import { - PluginSatpGateway, + PluginSATPGateway, IPluginSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/plugin-satp-gateway"; +} from "../../../main/typescript/plugin-satp-gateway"; import { AssetProfile, ClientV1Request, } from "../../../main/typescript/public-api"; import { makeSessionDataChecks } from "../make-checks"; -import { BesuSatpGateway } from "../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../knex.config"; const MAX_RETRIES = 5; @@ -35,8 +35,8 @@ const BESU_ASSET_ID = uuidv4(); let sourceGatewayServer: Server; let recipientGatewayserver: Server; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; test("runs ODAP between two gateways via openApi", async () => { const clientGatewayPluginOptions: IPluginSatpGatewayConstructorOptions = { @@ -57,8 +57,8 @@ test("runs ODAP between two gateways via openApi", async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect(pluginRecipientGateway.localRepository?.database).not.toBeUndefined(); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-rollback.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-rollback.test.ts index b932b4378b..af92b02d7d 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-rollback.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap-rollback.test.ts @@ -54,15 +54,15 @@ import { import Web3 from "web3"; import { - IFabricSatpGatewayConstructorOptions, - FabricSatpGateway, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; + IFabricSATPGatewayConstructorOptions, + FabricSATPGateway, +} from "../../../main/typescript/core/fabric-satp-gateway"; import { - IBesuSatpGatewayConstructorOptions, - BesuSatpGateway, -} from "../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + IBesuSATPGatewayConstructorOptions, + BesuSATPGateway, +} from "../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../knex.config"; /** @@ -97,10 +97,10 @@ let besuConnector: PluginLedgerConnectorBesu; let clientGatewayApiHost: string; let serverGatewayApiHost: string; -let clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -538,8 +538,8 @@ beforeAll(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( @@ -817,7 +817,7 @@ test("client sends rollback message at the end of the protocol", async () => { await Servers.listen(listenOptions); - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); await pluginSourceGateway.registerWebServices(expressApp); await pluginSourceGateway.recoverOpenSessions(true); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap.test.ts index 1ff28ee2f1..145762dd29 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/odap.test.ts @@ -1,6 +1,6 @@ import "jest-extended"; import { v4 as uuidV4 } from "uuid"; -import { PluginSatpGateway } from "../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../main/typescript/plugin-satp-gateway"; import { AssetProfile, @@ -8,19 +8,20 @@ import { } from "../../../main/typescript/public-api"; import { makeSessionDataChecks } from "../make-checks"; -import { BesuSatpGateway } from "../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../knex.config"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; test("successful run ODAP instance", async () => { + console.log(knexRemoteConnection) const sourceGatewayConstructor = { name: "plugin-satp-gateway#sourceGateway", dltIDs: ["DLT2"], @@ -38,8 +39,8 @@ test("successful run ODAP instance", async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect(pluginRecipientGateway.localRepository?.database).not.toBeUndefined(); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts index beeda4d4b0..c0d496f64e 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-create-asset.test.ts @@ -53,15 +53,15 @@ import Web3 from "web3"; import { makeSessionDataChecks } from "../make-checks"; import { - BesuSatpGateway, - IBesuSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/besu-satp-gateway"; + BesuSATPGateway, + IBesuSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/besu-satp-gateway"; import { - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, +} from "../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -98,9 +98,9 @@ let besuKeychainId: string; let fabricConnector: PluginLedgerConnectorFabric; let besuConnector: PluginLedgerConnectorBesu; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let clientGatewayApiHost: string; let serverGatewayApiHost: string; @@ -513,7 +513,7 @@ beforeAll(async () => { beforeEach(async () => { { // Gateways configuration - const clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions = { + const clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions = { name: "cactus-plugin#satpGateway", dltIDs: ["DLT2"], instanceId: uuidv4(), @@ -543,8 +543,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect(pluginSourceGateway.localRepository?.database).not.toBeUndefined(); expect( @@ -807,7 +807,7 @@ test("server gateway crashes after creating besu asset", async () => { await Servers.listen(listenOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); await pluginRecipientGateway.registerWebServices(expressApp); // client gateway self-healed and is back online diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts index 7e22aa5441..92f0f6296a 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/integration/server-crash-after-transfer-initiation.test.ts @@ -16,15 +16,15 @@ import { } from "../../../main/typescript/public-api"; import { makeSessionDataChecks } from "../make-checks"; import { - IFabricSatpGatewayConstructorOptions, - FabricSatpGateway, -} from "../../../main/typescript/gateway/fabric-satp-gateway"; + IFabricSATPGatewayConstructorOptions, + FabricSATPGateway, +} from "../../../main/typescript/core/fabric-satp-gateway"; import { - IBesuSatpGatewayConstructorOptions, - BesuSatpGateway, -} from "../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../main/typescript/gateway/server/server-helper"; + IBesuSATPGatewayConstructorOptions, + BesuSATPGateway, +} from "../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../main/typescript/core/server-helper"; import { knexClientConnection, knexRemoteConnection } from "../knex.config"; @@ -34,10 +34,10 @@ const MAX_TIMEOUT = 5000; const FABRIC_ASSET_ID = uuidv4(); const BESU_ASSET_ID = uuidv4(); -let clientGatewayPluginOptions: IFabricSatpGatewayConstructorOptions; -let serverGatewayPluginOptions: IBesuSatpGatewayConstructorOptions; -let pluginSourceGateway: FabricSatpGateway; -let pluginRecipientGateway: BesuSatpGateway; +let clientGatewayPluginOptions: IFabricSATPGatewayConstructorOptions; +let serverGatewayPluginOptions: IBesuSATPGatewayConstructorOptions; +let pluginSourceGateway: FabricSATPGateway; +let pluginRecipientGateway: BesuSATPGateway; let sourceGatewayServer: Server; let recipientGatewayserver: Server; @@ -82,7 +82,7 @@ beforeAll(async () => { const { address, port } = addressInfo; serverGatewayApiHost = `http://${address}:${port}`; - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); expect( pluginRecipientGateway.localRepository?.database, @@ -121,7 +121,7 @@ beforeAll(async () => { const { address, port } = addressInfo; clientGatewayApiHost = `http://${address}:${port}`; - pluginSourceGateway = new FabricSatpGateway(clientGatewayPluginOptions); + pluginSourceGateway = new FabricSATPGateway(clientGatewayPluginOptions); if (pluginSourceGateway.localRepository?.database == undefined) { throw new Error("Database is not correctly initialized"); @@ -204,7 +204,7 @@ test("server gateway crashes after transfer initiation flow", async () => { await Servers.listen(listenOptions); - pluginRecipientGateway = new BesuSatpGateway(serverGatewayPluginOptions); + pluginRecipientGateway = new BesuSATPGateway(serverGatewayPluginOptions); await pluginRecipientGateway.registerWebServices(serverExpressApp); // server gateway self-healed and is back online diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts index d82d6f39a1..863e166f6d 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts @@ -1,8 +1,8 @@ -import { PluginSatpGateway } from "../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../main/typescript/plugin-satp-gateway"; export async function makeSessionDataChecks( - pluginSourceGateway: PluginSatpGateway, - pluginRecipientGateway: PluginSatpGateway, + pluginSourceGateway: PluginSATPGateway, + pluginRecipientGateway: PluginSATPGateway, sessionId: string, ): Promise { const clientSessionData = pluginSourceGateway.sessions.get(sessionId); @@ -160,122 +160,122 @@ export async function makeSessionDataChecks( await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "validate"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "validate"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "validate"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "validate"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "validate"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "validate"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "ack", "validate"), + PluginSATPGateway.getSatpLogKey(sessionId, "ack", "validate"), ), ).resolves.not.toBeUndefined(); await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "commence"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "commence"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "commence"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "commence"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "commence"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "commence"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "ack", "commence"), + PluginSATPGateway.getSatpLogKey(sessionId, "ack", "commence"), ), ).resolves.not.toBeUndefined(); await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "lock"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "lock"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "lock"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "lock"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "lock"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "lock"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "ack", "lock"), + PluginSATPGateway.getSatpLogKey(sessionId, "ack", "lock"), ), ).resolves.not.toBeUndefined(); await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "prepare"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "prepare"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "prepare"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "prepare"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "prepare"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "prepare"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "ack", "prepare"), + PluginSATPGateway.getSatpLogKey(sessionId, "ack", "prepare"), ), ).resolves.not.toBeUndefined(); await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "final"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "final"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "final"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "final"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "final"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "final"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "ack", "final"), + PluginSATPGateway.getSatpLogKey(sessionId, "ack", "final"), ), ).resolves.not.toBeUndefined(); await expect( pluginSourceGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "init", "complete"), + PluginSATPGateway.getSatpLogKey(sessionId, "init", "complete"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "exec", "complete"), + PluginSATPGateway.getSatpLogKey(sessionId, "exec", "complete"), ), ).resolves.not.toBeUndefined(); await expect( pluginRecipientGateway.getLogFromDatabase( - PluginSatpGateway.getSatpLogKey(sessionId, "done", "complete"), + PluginSATPGateway.getSatpLogKey(sessionId, "done", "complete"), ), ).resolves.not.toBeUndefined(); } diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-final.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-final.test.ts index 5af9109a5d..af553bf07f 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-final.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-final.test.ts @@ -3,17 +3,17 @@ import { SHA256 } from "crypto-js"; import { v4 as uuidv4 } from "uuid"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { CommitFinalV1Response, SessionData, } from "../../../../main/typescript/public-api"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; import { knexRemoteConnection } from "../../knex.config"; const MAX_RETRIES = 5; @@ -24,8 +24,8 @@ const COMMIT_ACK_CLAIM = "dummyCommitAckClaim"; let sourceGatewayConstructor; let recipientGatewayConstructor; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sequenceNumber: number; let sessionID: string; let step: number; @@ -48,8 +48,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -117,7 +117,7 @@ test("valid commit final response", async () => { sequenceNumber: sequenceNumber, }; - commitFinalResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(commitFinalResponse)), ); @@ -154,7 +154,7 @@ test("commit final response invalid because of wrong previous message hash", asy sequenceNumber: sequenceNumber, }; - commitFinalResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(commitFinalResponse)), ); @@ -182,7 +182,7 @@ test("commit final response invalid because of wrong signature", async () => { sequenceNumber: sequenceNumber, }; - commitFinalResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign("somethingWrong"), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-preparation.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-preparation.test.ts index 283c6d75d4..03494513f3 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-preparation.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/commit-preparation.test.ts @@ -4,16 +4,16 @@ import { v4 as uuidV4 } from "uuid"; import { IPluginSatpGatewayConstructorOptions, SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { CommitPreparationV1Response, SessionData, } from "../../../../main/typescript/public-api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -23,8 +23,8 @@ const COMMIT_PREPARATION_REQUEST_MESSAGE_HASH = let sourceGatewayConstructor: IPluginSatpGatewayConstructorOptions; let recipientGatewayConstructor: IPluginSatpGatewayConstructorOptions; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sequenceNumber: number; let sessionID: string; let step: number; @@ -45,8 +45,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -91,7 +91,7 @@ test("valid commit preparation response", async () => { sequenceNumber: sequenceNumber, }; - commitPreparationResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitPreparationResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign( JSON.stringify(commitPreparationResponse), ), @@ -130,7 +130,7 @@ test("commit preparation response invalid because of wrong previous message hash sequenceNumber: sequenceNumber, }; - commitPreparationResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitPreparationResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign( JSON.stringify(commitPreparationResponse), ), @@ -162,7 +162,7 @@ test("commit preparation response invalid because of wrong signature", async () sequenceNumber: sequenceNumber, }; - commitPreparationResponse.signature = PluginSatpGateway.bufArray2HexStr( + commitPreparationResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign("somethingWrong"), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/lock-evidence.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/lock-evidence.test.ts index 03d28603a5..eec07d8763 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/lock-evidence.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/lock-evidence.test.ts @@ -3,16 +3,16 @@ import { SHA256 } from "crypto-js"; import { v4 as uuidV4 } from "uuid"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { LockEvidenceV1Response, SessionData, } from "../../../../main/typescript/public-api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -22,8 +22,8 @@ const LOCK_EVIDENCE_REQUEST_MESSAGE_HASH = let sourceGatewayConstructor; let recipientGatewayConstructor; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sequenceNumber: number; let sessionID: string; let step: number; @@ -44,8 +44,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -90,7 +90,7 @@ test("valid lock evidence response", async () => { sequenceNumber: sequenceNumber, }; - lockEvidenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(lockEvidenceResponse)), ); @@ -125,7 +125,7 @@ test("lock evidence response invalid because of wrong previous message hash", as sequenceNumber: sequenceNumber, }; - lockEvidenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(lockEvidenceResponse)), ); @@ -152,7 +152,7 @@ test("lock evidence response invalid because of wrong signature", async () => { sequenceNumber: sequenceNumber, }; - lockEvidenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign("somethingWrong"), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-commence.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-commence.test.ts index f695f62883..9a098ad4fa 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-commence.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-commence.test.ts @@ -3,17 +3,17 @@ import { SHA256 } from "crypto-js"; import { v4 as uuidV4 } from "uuid"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { AssetProfile, SessionData, TransferCommenceV1Response, } from "../../../../main/typescript/public-api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -22,8 +22,8 @@ const COMMENCE_REQUEST_MESSAGE_HASH = "dummyCommenceRequestMessageHash"; let sourceGatewayConstructor; let recipientGatewayConstructor; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sequenceNumber: number; let sessionID: string; let step: number; @@ -44,8 +44,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -90,7 +90,7 @@ test("valid transfer commence response", async () => { sequenceNumber: sequenceNumber, }; - transferCommenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(transferCommenceResponse)), ); @@ -127,7 +127,7 @@ test("transfer commence response invalid because of wrong previous message hash" sequenceNumber: sequenceNumber, }; - transferCommenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign(JSON.stringify(transferCommenceResponse)), ); @@ -157,7 +157,7 @@ test("transfer commence response invalid because of wrong signature", async () = sequenceNumber: sequenceNumber, }; - transferCommenceResponse.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceResponse.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign("somethingWrong"), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-initialization.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-initialization.test.ts index d1f14ffc56..434e74777d 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-initialization.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/client/transfer-initialization.test.ts @@ -3,17 +3,17 @@ import { SHA256 } from "crypto-js"; import { v4 as uuidV4 } from "uuid"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { TransferInitializationV1Response, SessionData, AssetProfile, } from "../../../../main/typescript/public-api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; @@ -23,8 +23,8 @@ const INITIALIZATION_REQUEST_MESSAGE_HASH = let sourceGatewayConstructor; let recipientGatewayConstructor; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sequenceNumber: number; let sessionID: string; let step: number; @@ -45,8 +45,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -93,7 +93,7 @@ test("valid transfer initiation response", async () => { backupGatewaysAllowed: [], }; - initializationResponseMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationResponseMessage.signature = PluginSATPGateway.bufArray2HexStr( await pluginRecipientGateway.sign( JSON.stringify(initializationResponseMessage), ), @@ -140,7 +140,7 @@ test("transfer initiation response invalid because of wrong previous message has backupGatewaysAllowed: [], }; - initializationResponseMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationResponseMessage.signature = PluginSATPGateway.bufArray2HexStr( await pluginSourceGateway.sign( JSON.stringify(initializationResponseMessage), ), @@ -174,7 +174,7 @@ test("transfer initiation response invalid because it does not match transfer in backupGatewaysAllowed: [], }; - initializationResponseMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationResponseMessage.signature = PluginSATPGateway.bufArray2HexStr( await pluginSourceGateway.sign( JSON.stringify(initializationResponseMessage), ), diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/logging.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/logging.test.ts index 9bea4dc804..5087233c80 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/logging.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/logging.test.ts @@ -4,18 +4,18 @@ import { Secp256k1Keys } from "@hyperledger/cactus-common"; import { v4 as uuidV4 } from "uuid"; import { ILocalLog, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { SessionData } from "../../../../main/typescript/public-api"; import { SHA256 } from "crypto-js"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; import { - FabricSatpGateway, - IFabricSatpGatewayConstructorOptions, -} from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; + FabricSATPGateway, + IFabricSATPGatewayConstructorOptions, +} from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -23,10 +23,10 @@ import { knexServerConnection, } from "../../knex.config"; -let sourceGatewayConstructor: IFabricSatpGatewayConstructorOptions; +let sourceGatewayConstructor: IFabricSATPGatewayConstructorOptions; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sessionID: string; let step: number; let type: string; @@ -66,8 +66,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); sessionData = { id: sessionID, @@ -98,14 +98,14 @@ beforeEach(async () => { }); test("successful translation of log keys", async () => { - expect(PluginSatpGateway.getSatpLogKey(sessionID, type, operation)).toBe( + expect(PluginSATPGateway.getSatpLogKey(sessionID, type, operation)).toBe( `${sessionID}-${type}-${operation}`, ); }); test("successful logging of proof to ipfs and sqlite", async () => { const claim = "claim"; - const satpLogKey = PluginSatpGateway.getSatpLogKey( + const satpLogKey = PluginSATPGateway.getSatpLogKey( sessionID, "proof", "lock", @@ -141,7 +141,7 @@ test("successful logging of proof to ipfs and sqlite", async () => { }); test("successful logging to ipfs and sqlite", async () => { - const satpLogKey = PluginSatpGateway.getSatpLogKey( + const satpLogKey = PluginSATPGateway.getSatpLogKey( sessionID, type, operation, @@ -230,7 +230,7 @@ test("successful retrieval of last log", async () => { expect(lastLog.operation).toBe(satpLog3.operation); expect(lastLog.sessionID).toBe(satpLog3.sessionID); expect(lastLog.key).toBe( - PluginSatpGateway.getSatpLogKey(sessionID, type3, operation), + PluginSATPGateway.getSatpLogKey(sessionID, type3, operation), ); }); @@ -285,7 +285,7 @@ test("successful retrieval of logs more recent than another log", async () => { expect(moreRecentLogs[0].operation).toBe(satpLog.operation); expect(moreRecentLogs[0].sessionID).toBe(satpLog.sessionID); expect(moreRecentLogs[0].key).toBe( - PluginSatpGateway.getSatpLogKey(sessionID, type, operation), + PluginSATPGateway.getSatpLogKey(sessionID, type, operation), ); expect(moreRecentLogs[1].type).toBe(satpLog3.type); @@ -297,7 +297,7 @@ test("successful retrieval of logs more recent than another log", async () => { expect(moreRecentLogs[1].operation).toBe(satpLog3.operation); expect(moreRecentLogs[1].sessionID).toBe(satpLog3.sessionID); expect(moreRecentLogs[1].key).toBe( - PluginSatpGateway.getSatpLogKey(sessionID, type3, operation), + PluginSATPGateway.getSatpLogKey(sessionID, type3, operation), ); }); @@ -356,7 +356,7 @@ test("successful recover of sessions after crash", async () => { // simulate the crash of one gateway pluginSourceGateway.localRepository?.destroy(); - const newPluginSourceGateway = new FabricSatpGateway( + const newPluginSourceGateway = new FabricSATPGateway( sourceGatewayConstructor, ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-success.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-success.test.ts index 9ba8213ba8..f788ac6571 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-success.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-success.test.ts @@ -1,18 +1,18 @@ import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { v4 as uuidV4 } from "uuid"; -import { PluginSatpGateway } from "../../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../../main/typescript/plugin-satp-gateway"; import { RecoverSuccessV1Message, SessionData, } from "../../../../main/typescript/public-api"; import { randomInt } from "crypto"; -import { checkValidRecoverSuccessMessage } from "../../../../main/typescript/gateway/recovery/recover-success"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { checkValidRecoverSuccessMessage } from "../../../../main/typescript/recovery/recover-success"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -20,8 +20,8 @@ import { knexServerConnection, } from "../../knex.config"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sessionID: string; let sessionData: SessionData; @@ -47,8 +47,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -80,7 +80,7 @@ test("valid recover success message from client", async () => { success: true, }; - recoverSuccessMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverSuccessMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(recoverSuccessMessage)), ); @@ -97,7 +97,7 @@ test("valid recover success message from server", async () => { success: true, }; - recoverSuccessMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverSuccessMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginRecipientGateway.sign(JSON.stringify(recoverSuccessMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts index 7aee41c579..d322274466 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update-ack.test.ts @@ -1,18 +1,18 @@ import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { v4 as uuidV4 } from "uuid"; -import { PluginSatpGateway } from "../../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../../main/typescript/plugin-satp-gateway"; import { RecoverUpdateAckV1Message, SessionData, } from "../../../../main/typescript/public-api"; import { randomInt } from "crypto"; -import { checkValidRecoverUpdateAckMessage } from "../../../../main/typescript/gateway/recovery/recover-update-ack"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { checkValidRecoverUpdateAckMessage } from "../../../../main/typescript/recovery/recover-update-ack"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -20,8 +20,8 @@ import { knexServerConnection, } from "../../knex.config"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sessionID: string; let sessionData: SessionData; @@ -47,8 +47,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -81,7 +81,7 @@ test("valid recover update ack message from client", async () => { changedEntriesHash: [], }; - recoverUpdateAckMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverUpdateAckMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(recoverUpdateAckMessage)), ); @@ -99,7 +99,7 @@ test("valid recover update ack message from server", async () => { changedEntriesHash: [], }; - recoverUpdateAckMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverUpdateAckMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginRecipientGateway.sign(JSON.stringify(recoverUpdateAckMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update.test.ts index 070154ea22..1f3ad2cc77 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover-update.test.ts @@ -2,7 +2,7 @@ import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { Secp256k1Keys } from "@hyperledger/cactus-common"; import { v4 as uuidV4 } from "uuid"; -import { PluginSatpGateway } from "../../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../../main/typescript/plugin-satp-gateway"; import { RecoverUpdateV1Message, @@ -13,13 +13,13 @@ import { randomInt } from "crypto"; import { checkValidRecoverUpdateMessage, sendRecoverUpdateMessage, -} from "../../../../main/typescript/gateway/recovery/recover-update"; +} from "../../../../main/typescript/recovery/recover-update"; -import { checkValidRecoverMessage } from "../../../../main/typescript/gateway/recovery/recover"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { checkValidRecoverMessage } from "../../../../main/typescript/recovery/recover"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -30,8 +30,8 @@ import { const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sessionID: string; let sessionData: SessionData; @@ -59,8 +59,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -92,7 +92,7 @@ test("valid recover update message from server", async () => { signature: "", }; - recoverUpdateMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverUpdateMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginRecipientGateway.sign(JSON.stringify(recoverUpdateMessage)), ); @@ -172,7 +172,7 @@ test("check valid build of recover update message", async () => { newBasePath: "", }; - recoverMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(recoverMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover.test.ts index ea25ec8b7c..ad76becf89 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/recovery/recover.test.ts @@ -1,16 +1,16 @@ import "jest-extended"; import { Secp256k1Keys } from "@hyperledger/cactus-common"; import { v4 as uuidV4 } from "uuid"; -import { PluginSatpGateway } from "../../../../main/typescript/gateway/plugin-satp-gateway"; +import { PluginSATPGateway } from "../../../../main/typescript/plugin-satp-gateway"; import { RecoverV1Message } from "../../../../main/typescript/public-api"; import { randomInt } from "crypto"; -import { checkValidRecoverMessage } from "../../../../main/typescript/gateway/recovery/recover"; +import { checkValidRecoverMessage } from "../../../../main/typescript/recovery/recover"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexClientConnection, @@ -18,8 +18,8 @@ import { knexServerConnection, } from "../../knex.config"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let sessionID: string; let sequenceNumber: number; @@ -49,8 +49,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); const sessionData = { lastSequenceNumber: sequenceNumber, @@ -90,7 +90,7 @@ test("valid recover message request from client", async () => { newBasePath: "", }; - recoverMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(recoverMessage)), ); @@ -108,7 +108,7 @@ test("valid recover message request from server", async () => { newBasePath: "", }; - recoverMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginRecipientGateway.sign(JSON.stringify(recoverMessage)), ); @@ -130,7 +130,7 @@ test("recover message request from client with wrong signature", async () => { newBasePath: "", }; - recoverMessage.signature = PluginSatpGateway.bufArray2HexStr( + recoverMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginRecipientGateway.sign(JSON.stringify("wrongRecoverMessage")), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-final.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-final.test.ts index d2eeaf8f7d..68b49e8c2f 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-final.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-final.test.ts @@ -3,19 +3,19 @@ import { v4 as uuidv4 } from "uuid"; import { SHA256 } from "crypto-js"; import { SatpMessageType, - PluginSatpGateway, + PluginSATPGateway, ILocalLog, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; +} from "../../../../main/typescript/plugin-satp-gateway"; import { CommitFinalV1Request, SessionData, } from "../../../../main/typescript/generated/openapi/typescript-axios/api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; import { knexRemoteConnection } from "../../knex.config"; const MAX_RETRIES = 5; @@ -23,8 +23,8 @@ const MAX_TIMEOUT = 5000; const COMMIT_FINAL_CLAIM = "dummyCommitFinalClaim"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let dummyCommitPreparationResponseMessageHash: string; let sessionData: SessionData; let sessionID: string; @@ -49,8 +49,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -117,7 +117,7 @@ test("valid commit final request", async () => { sequenceNumber: sequenceNumber + 1, }; - commitFinalRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitFinalRequestMessage)), ); @@ -157,7 +157,7 @@ test("commit final request with wrong sessionId", async () => { sequenceNumber: sequenceNumber + 1, }; - commitFinalRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitFinalRequestMessage)), ); @@ -188,7 +188,7 @@ test("commit final request with wrong message type", async () => { sequenceNumber: sequenceNumber + 1, }; - commitFinalRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitFinalRequestMessage)), ); @@ -217,7 +217,7 @@ test("commit final request with wrong previous message hash", async () => { sequenceNumber: sequenceNumber + 1, }; - commitFinalRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitFinalRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitFinalRequestMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-preparation.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-preparation.test.ts index 7a5fe43217..dfc48380da 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-preparation.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/commit-preparation.test.ts @@ -1,24 +1,24 @@ import { randomInt } from "crypto"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { CommitPreparationV1Request, SessionData, } from "../../../../main/typescript/generated/openapi/typescript-axios/api"; import { v4 as uuidV4 } from "uuid"; import { SHA256 } from "crypto-js"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let dummyLockEvidenceResponseMessageHash: string; let sessionData: SessionData; let sessionID: string; @@ -40,8 +40,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -90,7 +90,7 @@ test("valid commit prepare request", async () => { sequenceNumber: sequenceNumber + 1, }; - commitPrepareRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitPrepareRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitPrepareRequestMessage)), ); @@ -127,7 +127,7 @@ test("commit prepare request with wrong sessionId", async () => { sequenceNumber: sequenceNumber + 1, }; - commitPrepareRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitPrepareRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitPrepareRequestMessage)), ); @@ -157,7 +157,7 @@ test("commit prepare request with wrong message type", async () => { sequenceNumber: sequenceNumber + 1, }; - commitPrepareRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitPrepareRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitPrepareRequestMessage)), ); @@ -187,7 +187,7 @@ test("commit prepare request with wrong previous message hash", async () => { sequenceNumber: sequenceNumber + 1, }; - commitPrepareRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + commitPrepareRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(commitPrepareRequestMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/lock-evidence.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/lock-evidence.test.ts index fc23aeef54..093e73971e 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/lock-evidence.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/lock-evidence.test.ts @@ -1,8 +1,8 @@ import { randomInt } from "crypto"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { LockEvidenceV1Request, SessionData, @@ -10,10 +10,10 @@ import { import { v4 as uuidV4 } from "uuid"; import { SHA256 } from "crypto-js"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../../knex.config"; const MAX_RETRIES = 5; @@ -21,8 +21,8 @@ const MAX_TIMEOUT = 5000; const LOCK_EVIDENCE_CLAIM = "dummyLockEvidenceClaim"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let dummyTransferCommenceResponseMessageHash: string; let sessionData: SessionData; let lockExpiryDate: string; @@ -47,8 +47,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -124,7 +124,7 @@ test("valid lock evidence request", async () => { sequenceNumber: sequenceNumber + 1, }; - lockEvidenceRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); @@ -164,7 +164,7 @@ test("lock evidence request with wrong sessionId", async () => { sequenceNumber: sequenceNumber + 1, }; - lockEvidenceRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); @@ -196,7 +196,7 @@ test("lock evidence request with wrong message type", async () => { sequenceNumber: sequenceNumber + 1, }; - lockEvidenceRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); @@ -226,7 +226,7 @@ test("lock evidence request with wrong previous message hash", async () => { sequenceNumber: sequenceNumber + 1, }; - lockEvidenceRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); @@ -256,7 +256,7 @@ test("transfer commence flow with invalid claim", async () => { sequenceNumber: sequenceNumber + 1, }; - lockEvidenceRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + lockEvidenceRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(lockEvidenceRequestMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-commence.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-commence.test.ts index d1b4484278..59bbe0e80b 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-commence.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-commence.test.ts @@ -1,8 +1,8 @@ import { randomInt } from "crypto"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { TransferCommenceV1Request, AssetProfile, @@ -10,16 +10,16 @@ import { } from "../../../../main/typescript/generated/openapi/typescript-axios/api"; import { v4 as uuidV4 } from "uuid"; import { SHA256 } from "crypto-js"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let dummyInitializationResponseMessageHash: string; let expiryDate: string; let assetProfile: AssetProfile; @@ -44,8 +44,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -109,7 +109,7 @@ test("valid transfer commence request", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCommenceRequest)), ); @@ -154,7 +154,7 @@ test("transfer commence request with wrong sessionId", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCommenceRequest)), ); @@ -189,7 +189,7 @@ test("transfer commence request with wrong message type", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCommenceRequest)), ); @@ -224,7 +224,7 @@ test("transfer commence request with wrong signature", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify("wrongData")), ); @@ -259,7 +259,7 @@ test("transfer commence request with wrong previous message hash", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCommenceRequest)), ); @@ -294,7 +294,7 @@ test("transfer commence request with wrong asset profile hash", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCommenceRequest.signature = PluginSatpGateway.bufArray2HexStr( + transferCommenceRequest.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCommenceRequest)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-complete.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-complete.test.ts index aab405e348..dbd97be6d9 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-complete.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-complete.test.ts @@ -1,7 +1,7 @@ import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { SessionData, TransferCompleteV1Request, @@ -9,14 +9,14 @@ import { import { v4 as uuidV4 } from "uuid"; import { SHA256 } from "crypto-js"; import { randomInt } from "crypto"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; import { knexRemoteConnection } from "../../knex.config"; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let dummyCommitFinalResponseMessageHash: string; let dummyTransferCommenceResponseMessageHash: string; let sessionData: SessionData; @@ -41,8 +41,8 @@ beforeEach(async () => { knexRemoteConfig: knexRemoteConnection, }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -98,7 +98,7 @@ test("dummy test for transfer complete flow", async () => { sequenceNumber: sequenceNumber + 1, }; - transferCompleteRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + transferCompleteRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(transferCompleteRequestMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-initialization.test.ts b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-initialization.test.ts index 9615f80401..c32508dcd9 100644 --- a/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-initialization.test.ts +++ b/packages/cactus-plugin-satp-hermes/src/test/typescript/unit/server/transfer-initialization.test.ts @@ -3,23 +3,23 @@ import { SHA256 } from "crypto-js"; import { v4 as uuidV4 } from "uuid"; import { SatpMessageType, - PluginSatpGateway, -} from "../../../../main/typescript/gateway/plugin-satp-gateway"; + PluginSATPGateway, +} from "../../../../main/typescript/plugin-satp-gateway"; import { TransferInitializationV1Request, AssetProfile, SessionData, } from "../../../../main/typescript/public-api"; -import { BesuSatpGateway } from "../../../../main/typescript/gateway/besu-satp-gateway"; -import { FabricSatpGateway } from "../../../../main/typescript/gateway/fabric-satp-gateway"; -import { ClientGatewayHelper } from "../../../../main/typescript/gateway/client/client-helper"; -import { ServerGatewayHelper } from "../../../../main/typescript/gateway/server/server-helper"; +import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; +import { FabricSATPGateway } from "../../../../main/typescript/core/fabric-satp-gateway"; +import { ClientGatewayHelper } from "../../../../main/typescript/core/client-helper"; +import { ServerGatewayHelper } from "../../../../main/typescript/core/server-helper"; const MAX_RETRIES = 5; const MAX_TIMEOUT = 5000; -let pluginSourceGateway: PluginSatpGateway; -let pluginRecipientGateway: PluginSatpGateway; +let pluginSourceGateway: PluginSATPGateway; +let pluginRecipientGateway: PluginSATPGateway; let expiryDate: string; let assetProfile: AssetProfile; let sequenceNumber: number; @@ -41,8 +41,8 @@ beforeEach(async () => { serverHelper: new ServerGatewayHelper(), }; - pluginSourceGateway = new FabricSatpGateway(sourceGatewayConstructor); - pluginRecipientGateway = new BesuSatpGateway(recipientGatewayConstructor); + pluginSourceGateway = new FabricSATPGateway(sourceGatewayConstructor); + pluginRecipientGateway = new BesuSATPGateway(recipientGatewayConstructor); if ( pluginSourceGateway.localRepository?.database == undefined || @@ -88,7 +88,7 @@ test("valid transfer initiation request", async () => { sourceLedgerAssetID: "", }; - initializationRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( await pluginSourceGateway.sign( JSON.stringify(initializationRequestMessage), ), @@ -156,7 +156,7 @@ test("transfer initiation request invalid because of incompatible DLTs", async ( sourceLedgerAssetID: "", }; - initializationRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( await pluginSourceGateway.sign( JSON.stringify(initializationRequestMessage), ), @@ -207,7 +207,7 @@ test("transfer initiation request invalid because of asset expired", async () => sourceLedgerAssetID: "", }; - initializationRequestMessage.signature = PluginSatpGateway.bufArray2HexStr( + initializationRequestMessage.signature = PluginSATPGateway.bufArray2HexStr( pluginSourceGateway.sign(JSON.stringify(initializationRequestMessage)), ); diff --git a/packages/cactus-plugin-satp-hermes/tsconfig.json b/packages/cactus-plugin-satp-hermes/tsconfig.json index 9246809a97..430c7cd63a 100644 --- a/packages/cactus-plugin-satp-hermes/tsconfig.json +++ b/packages/cactus-plugin-satp-hermes/tsconfig.json @@ -9,7 +9,7 @@ "skipLibCheck": true, "rootDir": "./src/", "tsBuildInfoFile": "../../.build-cache/cactus-plugin-satp-hermes.tsbuildinfo", - "moduleResolution": "Node16" + "moduleResolution": "Node16", }, "ts-node": { "files": true diff --git a/tsconfig.json b/tsconfig.json index 4df8528489..ff13912150 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -234,6 +234,8 @@ "esModuleInterop": true, "inlineSourceMap": true, "forceConsistentCasingInFileNames": true, - "useUnknownInCatchVariables": false + "useUnknownInCatchVariables": false, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, } } diff --git a/yarn.lock b/yarn.lock index 31b976c7b1..92fe3f6c2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4350,6 +4350,114 @@ __metadata: languageName: node linkType: hard +"@bufbuild/buf-darwin-arm64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-darwin-arm64@npm:1.29.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@bufbuild/buf-darwin-x64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-darwin-x64@npm:1.29.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@bufbuild/buf-linux-aarch64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-linux-aarch64@npm:1.29.0" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@bufbuild/buf-linux-x64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-linux-x64@npm:1.29.0" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@bufbuild/buf-win32-arm64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-win32-arm64@npm:1.29.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@bufbuild/buf-win32-x64@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf-win32-x64@npm:1.29.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@bufbuild/buf@npm:1.29.0": + version: 1.29.0 + resolution: "@bufbuild/buf@npm:1.29.0" + dependencies: + "@bufbuild/buf-darwin-arm64": "npm:1.29.0" + "@bufbuild/buf-darwin-x64": "npm:1.29.0" + "@bufbuild/buf-linux-aarch64": "npm:1.29.0" + "@bufbuild/buf-linux-x64": "npm:1.29.0" + "@bufbuild/buf-win32-arm64": "npm:1.29.0" + "@bufbuild/buf-win32-x64": "npm:1.29.0" + dependenciesMeta: + "@bufbuild/buf-darwin-arm64": + optional: true + "@bufbuild/buf-darwin-x64": + optional: true + "@bufbuild/buf-linux-aarch64": + optional: true + "@bufbuild/buf-linux-x64": + optional: true + "@bufbuild/buf-win32-arm64": + optional: true + "@bufbuild/buf-win32-x64": + optional: true + bin: + buf: bin/buf + protoc-gen-buf-breaking: bin/protoc-gen-buf-breaking + protoc-gen-buf-lint: bin/protoc-gen-buf-lint + checksum: 10/f966e764b9ef92d514361c6999c1633e57c79143317cf9d6dd3a12750e60e244c4e5d45bcf01fa3993a07d69a14011c95477ac365e889abeb742df51d2696294 + languageName: node + linkType: hard + +"@bufbuild/protobuf@npm:1.7.2, @bufbuild/protobuf@npm:^1.6.0, @bufbuild/protobuf@npm:^1.7.2": + version: 1.7.2 + resolution: "@bufbuild/protobuf@npm:1.7.2" + checksum: 10/f23ccc77066100157043cf36bd2506acdcb235f0a902f7662fbbb992e78df4202780aeb55bd2e3fd1945bd9e52a4fca759351f333f2ff779e32996e13eb56d34 + languageName: node + linkType: hard + +"@bufbuild/protoc-gen-es@npm:1.7.2": + version: 1.7.2 + resolution: "@bufbuild/protoc-gen-es@npm:1.7.2" + dependencies: + "@bufbuild/protobuf": "npm:^1.7.2" + "@bufbuild/protoplugin": "npm:1.7.2" + peerDependencies: + "@bufbuild/protobuf": 1.7.2 + peerDependenciesMeta: + "@bufbuild/protobuf": + optional: true + bin: + protoc-gen-es: bin/protoc-gen-es + checksum: 10/21898291c7239a61b7aa2fdbde7c2b40161d4e395783081bb9650840381764984075f405cd46e2f189df5b57d602a37796ae804b648338cf82a4ffecbef0de52 + languageName: node + linkType: hard + +"@bufbuild/protoplugin@npm:1.7.2, @bufbuild/protoplugin@npm:^1.6.0": + version: 1.7.2 + resolution: "@bufbuild/protoplugin@npm:1.7.2" + dependencies: + "@bufbuild/protobuf": "npm:1.7.2" + "@typescript/vfs": "npm:^1.4.0" + typescript: "npm:4.5.2" + checksum: 10/412c35a04a60fed1979b62fedc570c128efa8995290005df8d84bbf84a9b35cc6a9bbea5646210ed7708fb8cd274aea8ba30720ccd25eb62c9133efda55ca733 + languageName: node + linkType: hard + "@chainsafe/as-sha256@npm:^0.3.1": version: 0.3.1 resolution: "@chainsafe/as-sha256@npm:0.3.1" @@ -4616,6 +4724,60 @@ __metadata: languageName: node linkType: hard +"@connectrpc/connect-express@npm:1.3.0": + version: 1.3.0 + resolution: "@connectrpc/connect-express@npm:1.3.0" + dependencies: + "@types/express": "npm:^4.17.18" + peerDependencies: + "@bufbuild/protobuf": ^1.4.2 + "@connectrpc/connect": 1.3.0 + "@connectrpc/connect-node": 1.3.0 + checksum: 10/581495391477e2b8a2738bdc34dbf45a245d26cb4943a5b3d1813d80ae4f11d85e0d0f01d95e408e7b1cb7812a873218428d6b0cde9fc643747f06e8b7205627 + languageName: node + linkType: hard + +"@connectrpc/connect-node@npm:1.3.0": + version: 1.3.0 + resolution: "@connectrpc/connect-node@npm:1.3.0" + dependencies: + undici: "npm:^5.28.2" + peerDependencies: + "@bufbuild/protobuf": ^1.4.2 + "@connectrpc/connect": 1.3.0 + checksum: 10/34b4903220881b39128bc31c79a0a006cb44c7cb9074fd0d77e853ff016f51c2a131811421c971c01210d4329068026c278cf64d349f2eb38126d0604710816a + languageName: node + linkType: hard + +"@connectrpc/connect@npm:1.3.0": + version: 1.3.0 + resolution: "@connectrpc/connect@npm:1.3.0" + peerDependencies: + "@bufbuild/protobuf": ^1.4.2 + checksum: 10/7707d97ee6e4a83cc03371b1da1709c103f0338e85b2fbf49813053d96114818d34831b1c11715cc9badcc3ce5d4c9fbc423af4b6a8efa953bf0ef76cdc6e50d + languageName: node + linkType: hard + +"@connectrpc/protoc-gen-connect-es@npm:1.3.0": + version: 1.3.0 + resolution: "@connectrpc/protoc-gen-connect-es@npm:1.3.0" + dependencies: + "@bufbuild/protobuf": "npm:^1.6.0" + "@bufbuild/protoplugin": "npm:^1.6.0" + peerDependencies: + "@bufbuild/protoc-gen-es": ^1.6.0 + "@connectrpc/connect": 1.3.0 + peerDependenciesMeta: + "@bufbuild/protoc-gen-es": + optional: true + "@connectrpc/connect": + optional: true + bin: + protoc-gen-connect-es: bin/protoc-gen-connect-es + checksum: 10/23a17bef378ac2fa414fb35fe50a7630134946a086f75f9201c5d0c3631f32e61445628b0420eac7353e88193e170059969bc83bad96a9f43cb98db30243aa1c + languageName: node + linkType: hard + "@cspell/cspell-bundled-dicts@npm:^5.21.2": version: 5.21.2 resolution: "@cspell/cspell-bundled-dicts@npm:5.21.2" @@ -8212,6 +8374,33 @@ __metadata: languageName: unknown linkType: soft +"@hyperledger/cactus-plugin-bungee@workspace:packages/cactus-plugin-bungee": + version: 0.0.0-use.local + resolution: "@hyperledger/cactus-plugin-bungee@workspace:packages/cactus-plugin-bungee" + dependencies: + "@hyperledger/cactus-cmd-api-server": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-common": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-core": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-core-api": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-plugin-keychain-memory": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-plugin-ledger-connector-besu": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-plugin-ledger-connector-fabric": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-plugin-object-store-ipfs": "npm:2.0.0-alpha.2" + "@hyperledger/cactus-test-tooling": "npm:2.0.0-alpha.2" + "@types/body-parser": "npm:1.19.4" + "@types/crypto-js": "npm:4.0.1" + "@types/express": "npm:4.17.19" + "@types/fs-extra": "npm:11.0.3" + "@types/tape": "npm:4.13.4" + "@types/uuid": "npm:9.0.6" + axios: "npm:1.6.0" + express: "npm:4.18.2" + fabric-network: "npm:2.2.20" + typescript-optional: "npm:2.0.1" + uuid: "npm:9.0.1" + languageName: unknown + linkType: soft + "@hyperledger/cactus-plugin-consortium-manual@npm:2.0.0-alpha.2, @hyperledger/cactus-plugin-consortium-manual@workspace:packages/cactus-plugin-consortium-manual": version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-consortium-manual@workspace:packages/cactus-plugin-consortium-manual" @@ -9032,6 +9221,13 @@ __metadata: version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-satp-hermes@workspace:packages/cactus-plugin-satp-hermes" dependencies: + "@bufbuild/buf": "npm:1.29.0" + "@bufbuild/protobuf": "npm:1.7.2" + "@bufbuild/protoc-gen-es": "npm:1.7.2" + "@connectrpc/connect": "npm:1.3.0" + "@connectrpc/connect-express": "npm:1.3.0" + "@connectrpc/connect-node": "npm:1.3.0" + "@connectrpc/protoc-gen-connect-es": "npm:1.3.0" "@hyperledger/cactus-cmd-api-server": "npm:2.0.0-alpha.2" "@hyperledger/cactus-common": "npm:2.0.0-alpha.2" "@hyperledger/cactus-core": "npm:2.0.0-alpha.2" @@ -9043,12 +9239,16 @@ __metadata: "@hyperledger/cactus-test-tooling": "npm:2.0.0-alpha.2" "@types/body-parser": "npm:1.19.4" "@types/crypto-js": "npm:4.0.1" - "@types/express": "npm:4.17.19" + "@types/express": "npm:4.17.21" "@types/fs-extra": "npm:11.0.3" + "@types/node": "npm:18.18.2" + "@types/swagger-ui-express": "npm:4.1.6" "@types/tape": "npm:4.13.4" "@types/uuid": "npm:9.0.8" axios: "npm:1.6.0" body-parser: "npm:1.20.2" + class-transformer: "npm:0.5.1" + class-validator: "npm:0.14.1" crypto-js: "npm:4.2.0" express: "npm:4.18.2" fabric-network: "npm:2.2.20" @@ -9058,6 +9258,7 @@ __metadata: secp256k1: "npm:4.0.3" socket.io: "npm:4.5.4" sqlite3: "npm:5.1.5" + swagger-ui-express: "npm:5.0.0" typescript: "npm:5.3.3" typescript-optional: "npm:2.0.1" uuid: "npm:9.0.1" @@ -14873,6 +15074,18 @@ __metadata: languageName: node linkType: hard +"@types/express@npm:4.17.21, @types/express@npm:^4.17.18": + version: 4.17.21 + resolution: "@types/express@npm:4.17.21" + dependencies: + "@types/body-parser": "npm:*" + "@types/express-serve-static-core": "npm:^4.17.33" + "@types/qs": "npm:*" + "@types/serve-static": "npm:*" + checksum: 10/7a6d26cf6f43d3151caf4fec66ea11c9d23166e4f3102edfe45a94170654a54ea08cf3103d26b3928d7ebcc24162c90488e33986b7e3a5f8941225edd5eb18c7 + languageName: node + linkType: hard + "@types/express@npm:^4.17.13": version: 4.17.17 resolution: "@types/express@npm:4.17.17" @@ -15426,6 +15639,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:18.18.2": + version: 18.18.2 + resolution: "@types/node@npm:18.18.2" + checksum: 10/7585ed0c8ff6f6e8e78564c3b2def30d8c3a2c88fb63fb04b832b3b96497ff2609081154348cbb8906d81e3434c54ac61bf3aba4be66b4aeccc0c63aa4dca6be + languageName: node + linkType: hard + "@types/node@npm:20.4.7": version: 20.4.7 resolution: "@types/node@npm:20.4.7" @@ -15946,6 +16166,16 @@ __metadata: languageName: node linkType: hard +"@types/swagger-ui-express@npm:4.1.6": + version: 4.1.6 + resolution: "@types/swagger-ui-express@npm:4.1.6" + dependencies: + "@types/express": "npm:*" + "@types/serve-static": "npm:*" + checksum: 10/c1c4b58b12f9261af70b6a7e6420649b4f0a0343071ae8b98483c5885cd596f4c25015991f91f3f7c7a0baa461e2d76029d64de79108a89d03f3f83abbe6bc58 + languageName: node + linkType: hard + "@types/tape-promise@npm:4.0.1": version: 4.0.1 resolution: "@types/tape-promise@npm:4.0.1" @@ -16033,6 +16263,13 @@ __metadata: languageName: node linkType: hard +"@types/uuid@npm:9.0.6": + version: 9.0.6 + resolution: "@types/uuid@npm:9.0.6" + checksum: 10/739dcb2e620ff097fa916edeab455eb75640c4883a850784fdb15b32f67b719e05275c6d6419bb6da11350d26bd14ed05ba5e992ff228411cdd98cbc772d71ef + languageName: node + linkType: hard + "@types/uuid@npm:9.0.8": version: 9.0.8 resolution: "@types/uuid@npm:9.0.8" @@ -16040,6 +16277,13 @@ __metadata: languageName: node linkType: hard +"@types/validator@npm:^13.11.8": + version: 13.11.9 + resolution: "@types/validator@npm:13.11.9" + checksum: 10/2d397c69293cc726e0cf1b4c74c563ca4e459b00f216f3ff0ac184c9648103be27169e8c67f85be9c6e7a3fcbb149c6add66a2547b185a1b25aa79e4b61261bd + languageName: node + linkType: hard + "@types/validator@npm:^13.7.10": version: 13.11.7 resolution: "@types/validator@npm:13.11.7" @@ -16698,6 +16942,15 @@ __metadata: languageName: node linkType: hard +"@typescript/vfs@npm:^1.4.0": + version: 1.5.0 + resolution: "@typescript/vfs@npm:1.5.0" + dependencies: + debug: "npm:^4.1.1" + checksum: 10/9a60cfd4e4ef37f69558e7e8a0c4633f86aae969a4c1193435bfdf80eb9573d23850b65621631d07e2f9699a2d7351ae6d9caa46080595314bde03c2c63443dd + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -21367,6 +21620,17 @@ __metadata: languageName: node linkType: hard +"class-validator@npm:0.14.1": + version: 0.14.1 + resolution: "class-validator@npm:0.14.1" + dependencies: + "@types/validator": "npm:^13.11.8" + libphonenumber-js: "npm:^1.10.53" + validator: "npm:^13.9.0" + checksum: 10/0c34592a1cbdd5e9c35cd02f4babd94120339e875fc7627aa2bf5dffb45ecc373275e854389c6ff3d39781cddb85a18193b4e9e8f4d77d6d90e445fd0b8b8e11 + languageName: node + linkType: hard + "classic-level@npm:^1.2.0": version: 1.3.0 resolution: "classic-level@npm:1.3.0" @@ -36275,6 +36539,13 @@ __metadata: languageName: node linkType: hard +"libphonenumber-js@npm:^1.10.53": + version: 1.10.57 + resolution: "libphonenumber-js@npm:1.10.57" + checksum: 10/7344dd7e8f35b0bd19c5a4fecfd5f252ba3e1f2fa938e552662a34fbc0bc3bf02d3c0a7ce5adf369280a741c7c7d54940232092e997890b71cb3cb1114e9184b + languageName: node + linkType: hard + "libtap@npm:^1.4.0": version: 1.4.1 resolution: "libtap@npm:1.4.1" @@ -48761,6 +49032,24 @@ __metadata: languageName: node linkType: hard +"swagger-ui-dist@npm:>=5.0.0": + version: 5.11.9 + resolution: "swagger-ui-dist@npm:5.11.9" + checksum: 10/6446adfda2b5dd3fe0272fc8ba0ff030e726d842a6776ceb2d963077fa200defd3d21f4523142272c6a98e5eaaf8d1131467bf1ae971106730f39450b6a9880f + languageName: node + linkType: hard + +"swagger-ui-express@npm:5.0.0": + version: 5.0.0 + resolution: "swagger-ui-express@npm:5.0.0" + dependencies: + swagger-ui-dist: "npm:>=5.0.0" + peerDependencies: + express: ">=4.0.0 || >=5.0.0-beta" + checksum: 10/e970d99cb33b8db235feb23d24b79d680cfbb8f9e920863990df5549ae56a35b12dfa761bbdde22cd8cbec2823b7d1078710b4a1970c9441b541917b56d197cc + languageName: node + linkType: hard + "swap-case@npm:^1.1.0": version: 1.1.2 resolution: "swap-case@npm:1.1.2" @@ -50687,6 +50976,16 @@ __metadata: languageName: node linkType: hard +"typescript@npm:4.5.2": + version: 4.5.2 + resolution: "typescript@npm:4.5.2" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10/477935930ae75e2b5b06c283175ed1a899c2330d9c4422047821c5592ccb6e72a620285279b738f69ff3234d17368cce07cae91c5890b6d42134275eb643b59a + languageName: node + linkType: hard + "typescript@npm:5.2.2, typescript@npm:^4.6.4 || ^5.0.0": version: 5.2.2 resolution: "typescript@npm:5.2.2" @@ -50717,6 +51016,16 @@ __metadata: languageName: node linkType: hard +"typescript@patch:typescript@npm%3A4.5.2#optional!builtin": + version: 4.5.2 + resolution: "typescript@patch:typescript@npm%3A4.5.2#optional!builtin::version=4.5.2&hash=bcec9a" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10/2b1b5da201d27f6a1ec6b5fa26c169e2d9999b0aa7833bcd71386214f0249aeafb290dc9d06b6fa78008bc945e32fc7c7ab91d580116a9a9d451ea5d609a1553 + languageName: node + linkType: hard + "typescript@patch:typescript@npm%3A5.2.2#optional!builtin, typescript@patch:typescript@npm%3A^4.6.4 || ^5.0.0#optional!builtin": version: 5.2.2 resolution: "typescript@patch:typescript@npm%3A5.2.2#optional!builtin::version=5.2.2&hash=f3b441" @@ -50869,7 +51178,7 @@ __metadata: languageName: node linkType: hard -"undici@npm:5.28.3": +"undici@npm:5.28.3, undici@npm:^5.28.2": version: 5.28.3 resolution: "undici@npm:5.28.3" dependencies: @@ -51538,7 +51847,7 @@ __metadata: languageName: node linkType: hard -"validator@npm:^13.7.0": +"validator@npm:^13.7.0, validator@npm:^13.9.0": version: 13.11.0 resolution: "validator@npm:13.11.0" checksum: 10/4bf094641eb71729c06a42d669840e7189597ba655a8264adabac9bf03f95cd6fde5fbc894b0a13ee861bd4a852f56d2afdc9391aeaeb3fc0f9633a974140e12