diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5c357a7dfa..3146ae47ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1703,57 +1703,32 @@ jobs: restore-keys: | ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} - run: ./tools/ci.sh - # cactus-plugin-satp-hermes: - # continue-on-error: false - # env: - # FULL_BUILD_DISABLED: true - # JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts - # JEST_TEST_RUNNER_DISABLED: false - # TAPE_TEST_RUNNER_DISABLED: true - # needs: build-dev - # runs-on: ubuntu-22.04 - # steps: - # - name: Use Node.js ${{ env.NODEJS_VERSION }} - # uses: actions/setup-node@v4.0.2 - # with: - # node-version: ${{ env.NODEJS_VERSION }} - # - uses: actions/checkout@v4.1.1 - # - id: yarn-cache-dir-path - # name: Get yarn cache directory path - # run: echo "::set-output name=dir::$(yarn cache dir)" - # - id: yarn-cache - # name: Restore Yarn Cache - # uses: actions/cache@v4.0.1 - # with: - # key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} - # path: ./.yarn/ - # restore-keys: | - # ${{ runner.os }}-yarn- - # - run: ./tools/ci.sh - cactus-plugin-bungee-hermes: + cactus-plugin-satp-hermes: continue-on-error: false env: FULL_BUILD_DISABLED: true + JEST_TEST_PATTERN: packages/cactus-plugin-satp-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts JEST_TEST_RUNNER_DISABLED: false - JEST_TEST_PATTERN: packages/cactus-plugin-bungee-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts TAPE_TEST_RUNNER_DISABLED: true needs: build-dev runs-on: ubuntu-22.04 steps: - name: Use Node.js ${{ env.NODEJS_VERSION }} - uses: actions/setup-node@v3.6.0 + uses: actions/setup-node@v4.0.2 with: node-version: ${{ env.NODEJS_VERSION }} - - uses: actions/checkout@v3.5.2 - + - uses: actions/checkout@v4.1.1 + - id: yarn-cache-dir-path + name: Get yarn cache directory path + run: echo "::set-output name=dir::$(yarn cache dir)" - id: yarn-cache name: Restore Yarn Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.1 with: key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} path: ./.yarn/ restore-keys: | - ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} + ${{ runner.os }}-yarn- - run: ./tools/ci.sh cactus-plugin-bungee-hermes: continue-on-error: false 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 2d57c9d1ed..6b5f92f18e 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 @@ -89,9 +89,7 @@ export class CbdcBridgingAppDummyInfrastructure { publishAllPorts: true, imageName: DEFAULT_FABRIC_2_AIO_IMAGE_NAME, imageVersion: FABRIC_25_LTS_AIO_IMAGE_VERSION, - envVars: new Map([ - ["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION], - ]), + envVars: new Map([["FABRIC_VERSION", FABRIC_25_LTS_AIO_FABRIC_VERSION]]), logLevel: level || "DEBUG", }); } @@ -387,7 +385,8 @@ export class CbdcBridgingAppDummyInfrastructure { sourceFiles, ccName: contractName, targetOrganizations: [this.org1Env, this.org2Env], - caFile: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, + caFile: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, ccLabel: "asset-reference-contract", ccLang: ChainCodeProgrammingLanguage.Typescript, ccSequence: 1, @@ -514,7 +513,8 @@ export class CbdcBridgingAppDummyInfrastructure { sourceFiles, ccName: contractName, targetOrganizations: [this.org1Env, this.org2Env], - caFile: FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, + caFile: + FABRIC_25_LTS_FABRIC_SAMPLES_ENV_INFO_ORG_1.ORDERER_TLS_ROOTCERT_FILE, ccLabel: "cbdc", ccLang: ChainCodeProgrammingLanguage.Javascript, ccSequence: 1, diff --git a/jest.config.js b/jest.config.js index 37a22b9e59..3a1646edad 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,8 +8,8 @@ module.exports = { setupFilesAfterEnv: ["jest-extended/all", "./jest.setup.console.logs.js"], testTimeout: 60 * 60 * 1000, moduleNameMapper: { - "^(.+)/(.+)_pb\\.js$": "$1/$2_pb" - }, + "^(.+)/(.+)_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-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 deleted file mode 100644 index c176ffe3af..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/proto/cacti/satp/v02/common/message.proto +++ /dev/null @@ -1,22 +0,0 @@ -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 index 27b1b1af44..7cae6bf8dd 100644 --- 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 @@ -3,17 +3,157 @@ 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 SessionData { + string id = 1; + string version = 2; + string transfer_context_id = 3; + MessageStagesHashes hashes = 4; + cacti.satp.v02.common.PayloadProfile payload_profile = 5; + MessageStagesSignatures signatures = 6; + string max_retries = 7; + string max_timeout = 8; + string logging_profile = 9; + string recipient_base_path = 10; + string source_base_path = 11; + string access_control_profile = 12; + string application_profile = 13; + int64 last_sequence_number = 14; + string sender_gateway_network_id = 15; + string recipient_gateway_network_id = 16; + string source_ledger_asset_id = 17; + string recipient_ledger_asset_id = 18; + string server_gateway_pubkey = 19; + string client_gateway_pubkey = 20; + string verified_originator_entity_id = 21; + string verified_beneficiary_entity_id = 22; + string asset_profile_id = 23; + string digital_asset_id = 24; + string originator_pubkey = 25; + string beneficiary_pubkey = 26; + string sender_gateway_owner_id = 27; + string receiver_gateway_owner_id = 28; + string hash_transfer_init_claims = 29; + cacti.satp.v02.common.SignatureAlgorithm signature_algorithm = 30; + cacti.satp.v02.common.LockType lock_type = 31; + uint64 lock_expiration_time = 32; + cacti.satp.v02.common.Permissions permitions = 33; + string developer_urn = 34; + cacti.satp.v02.common.CredentialProfile credential_profile = 35; + string subsequent_calls = 36; + string history = 37; + bool multiple_claims_allowed = 38; + bool multiple_cancels_allowed = 39; + string last_message_received_timestamp = 40; + MessageStagesTimestamps processed_timestamps = 41; + MessageStagesTimestamps received_timestamps = 42; + cacti.satp.v02.common.LockAssertionClaim lock_assertion_claim = 43; + cacti.satp.v02.common.LockAssertionFormat lock_assertion_format = 44; + cacti.satp.v02.common.MintAssertionClaims mint_assertion_claims = 45; + cacti.satp.v02.common.MintAssertionClaimsFormat mint_assertion_claims_format = 46; + cacti.satp.v02.common.BurnAssertionClaim burn_assertion_claim = 47; + cacti.satp.v02.common.BurnAssertionClaimFormat burn_assertion_claim_format = 48; + cacti.satp.v02.common.AssignmentAssertionClaim assignment_assertion_claim = 49; + cacti.satp.v02.common.AssignmentAssertionClaimFormat assignment_assertion_claim_format = 50; +} + + + +message MessageStagesHashes { + Stage1Hashes stage1 = 1; + Stage2Hashes stage2 = 2; + Stage3Hashes stage3 = 3; +} + +message Stage1Hashes { + string transfer_proposal_request_message_hash = 1; + string transfer_proposal_receipt_message_hash = 2; + string transfer_proposal_reject_message_hash = 3; + string transfer_commence_request_message_hash = 4; + string transfer_commence_response_message_hash = 5; +} + +message Stage2Hashes { + string lock_assertion_request_message_hash = 1; + string lock_assertion_receipt_message_hash = 2; +} + +message Stage3Hashes { + string commit_preparation_request_message_hash = 1; + string commit_ready_response_message_hash = 2; + string commit_final_assertion_request_message_hash = 3; + string commit_final_acknowledgement_receipt_response_message_hash = 4; + string transfer_complete_request_message_hash = 5; + string transfer_complete_response_message_hash = 6; +} + +message MessageStagesSignatures { + Stage1Signatures stage1 = 1; + Stage2Signatures stage2 = 2; + Stage3Signatures stage3 = 3; +} + +message Stage1Signatures { + string transfer_proposal_request_message_client_signature = 1; + string transfer_proposal_receipt_message_server_signature = 2; + string transfer_proposal_reject_message_server_signature = 3; + string transfer_commence_request_message_client_signature = 4; + string transfer_commence_response_message_server_signature = 5; +} + +message Stage2Signatures { + string lock_assertion_request_message_client_signature = 1; + string lock_assertion_receipt_message_server_signature = 2; +} + +message Stage3Signatures { + string commit_preparation_request_message_client_signature = 1; + string commit_ready_response_message_server_signature = 2; + string commit_final_assertion_request_message_client_signature = 3; + string commit_final_acknowledgement_receipt_response_message_server_signature = 4; + string transfer_complete_request_message_client_signature = 5; + string transfer_complete_response_message_server_signature = 6; +} + +message MessageStagesTimestamps { + Stage1Timestamps stage1 = 1; + Stage2Timestamps stage2 = 2; + Stage3Timestamps stage3 = 3; +} + +message Stage1Timestamps { + string transfer_proposal_request_message_timestamp = 1; + string transfer_proposal_receipt_message_timestamp = 2; + string transfer_proposal_reject_message_timestamp = 3; + string transfer_commence_request_message_timestamp = 4; + string transfer_commence_response_message_timestamp = 5; +} + +message Stage2Timestamps { + string lock_assertion_request_message_timestamp = 1; + string lock_assertion_receipt_message_timestamp = 2; +} + +message Stage3Timestamps { + string commit_preparation_request_message_timestamp = 1; + string commit_ready_response_message_timestamp = 2; + string commit_final_assertion_request_message_timestamp = 3; + string commit_final_acknoledgement_receipt_response_message_timestamp = 4; + string transfer_complete_request_message_timestamp = 5; + string transfer_complete_response_message_timestamp = 6; +} + message SendStatusRequest { string status = 1; - bool hasBackup = 2; + bool has_backup = 2; } message SendStatusResponse { string status = 1; - bool hasBackup = 2; + bool has_backup = 2; } 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 index 6f675dc321..2b7e609776 100644 --- 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 @@ -1,34 +1,24 @@ syntax = "proto3"; -package cacti.satp.v02.stage_0; +package cacti.satp.v02; -import "google/protobuf/empty.proto"; +import "cacti/satp/v02/common/message.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; +message PreTransferVerificationAndContextEstablishmentRequest { + cacti.satp.v02.common.CommonSatp context = 1; + cacti.satp.v02.common.TransferClaims transferClaims = 2; + // todo other fields } // TODO -message TransferProposalClaimsResponse { - string message_type = 1; +message PreTransferVerificationAndContextEstablishmentResponse { + } + +service SatpStage0Service { + // util RPCs + + // step RPCs + rpc TransferProposalClaims(PreTransferVerificationAndContextEstablishmentRequest) returns (PreTransferVerificationAndContextEstablishmentResponse) {}; + // todo other rpcs +} \ No newline at end of file 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 index 55ead8bcc6..4ea68757df 100644 --- 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 @@ -1,13 +1,36 @@ syntax = "proto3"; -package cacti.satp.v02.stage_1; +package cacti.satp.v02; -import "google/protobuf/empty.proto"; +import "cacti/satp/v02/common/message.proto"; - -service SATPStage1 { - // util RPCs +message TransferProposalRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + cacti.satp.v02.common.TransferClaims transfer_init_claims = 2; + cacti.satp.v02.common.TransferClaimsFormat transfer_init_claims_format = 3; + cacti.satp.v02.common.NetworkCapabilities network_capabilities = 4; + bool multiple_claims_allowed = 5; + bool multiple_cancels_allowed = 6; +} - // step RPCs +message TransferProposalReceiptRejectMessage { + cacti.satp.v02.common.CommonSatp common = 1; + string hash_transfer_init_claims = 2; + cacti.satp.v02.common.TransferClaims transfer_counter_claims = 3; + string timestamp = 4; +} +message TransferCommenceRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + string hash_transfer_init_claims = 2; + string client_transfer_number = 3; +} + +message TransferCommenceResponseMessage { + cacti.satp.v02.common.CommonSatp common = 1; +} + +service SatpStage1Service { + rpc TransferProposal(TransferProposalRequestMessage) returns (TransferProposalReceiptRejectMessage) {} + rpc TransferCommence(TransferCommenceRequestMessage) returns (TransferCommenceResponseMessage) {} } 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 index ac04ade64c..27863c71c1 100644 --- 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 @@ -1,13 +1,26 @@ syntax = "proto3"; -package cacti.satp.v02.stage_2; +package cacti.satp.v02; + +import "cacti/satp/v02/common/message.proto"; -import "google/protobuf/empty.proto"; - -service SATPStage2 { - // util RPCs - // step RPCs +message LockAssertionRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + cacti.satp.v02.common.LockAssertionClaim lock_assertion_claim = 2; + cacti.satp.v02.common.LockAssertionFormat lock_assertion_format = 3; + string lock_assertion_expiration = 4; + string client_transfer_number = 5; + string client_signature = 6; +} +message LockAssertionReceiptMessage { + cacti.satp.v02.common.CommonSatp common = 1; + string server_transfer_number = 2; + string server_signature = 3; +} + +service SatpStage2Service { + rpc LockAssertion(LockAssertionRequestMessage) returns (LockAssertionReceiptMessage) {} } 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 index 1797bb8ca7..78edd2f1b3 100644 --- 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 @@ -1,12 +1,50 @@ syntax = "proto3"; -package cacti.satp.v02.stage_3; +package cacti.satp.v02; +import "cacti/satp/v02/common/message.proto"; import "google/protobuf/empty.proto"; - -service SATPStage3 { - // util RPCs - // step RPCs +message CommitPreparationRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + string client_transfer_number = 2; + string client_signature = 3; +} + +message CommitReadyResponseMessage { + cacti.satp.v02.common.CommonSatp common = 1; + cacti.satp.v02.common.MintAssertionClaims mint_assertion_claims = 2; + cacti.satp.v02.common.MintAssertionClaimsFormat mint_assertion_claims_format = 3; + string server_transfer_number = 4; + string server_signature = 5; +} + +message CommitFinalAssertionRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + cacti.satp.v02.common.BurnAssertionClaim burn_assertion_claim = 2; + cacti.satp.v02.common.BurnAssertionClaimFormat burn_assertion_claim_format = 3; + string client_transfer_number = 4; + string client_signature = 5; } + +message CommitFinalAcknowledgementReceiptResponseMessage { + cacti.satp.v02.common.CommonSatp common = 1; + cacti.satp.v02.common.AssignmentAssertionClaim assignment_assertion_claim = 2; + cacti.satp.v02.common.AssignmentAssertionClaimFormat assignment_assertion_claim_format = 3; + string server_transfer_number = 4; + string server_signature = 5; +} + +message TransferCompleteRequestMessage { + cacti.satp.v02.common.CommonSatp common = 1; + string hash_transfer_commence = 2; + string client_transfer_number = 3; + string client_signature = 4; +} + +service SatpStage3Service { + rpc CommitPreparation(CommitPreparationRequestMessage) returns (CommitReadyResponseMessage) {} + rpc CommitFinalAssertion(CommitFinalAssertionRequestMessage) returns (CommitFinalAcknowledgementReceiptResponseMessage) {} + rpc TransferComplete(TransferCompleteRequestMessage) returns (google.protobuf.Empty) {} +} 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 deleted file mode 100644 index 50c6b4fa8c..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/proto/test/message.proto +++ /dev/null @@ -1,27 +0,0 @@ - -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/core/constants.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/constants.ts index 10b525dcab..9d3773228e 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/constants.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/constants.ts @@ -1,3 +1,5 @@ export const DEFAULT_PORT_GATEWAY_SERVER = 3010; export const DEFAULT_PORT_GATEWAY_CLIENT = DEFAULT_PORT_GATEWAY_SERVER + 1; export const DEFAULT_PORT_GATEWAY_UI = DEFAULT_PORT_GATEWAY_SERVER + 2; +export const DEFAULT_PORT_GATEWAY_GRPC = 4010; +export const SATP_VERSION = "v02"; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/dispatcher.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/dispatcher.ts new file mode 100644 index 0000000000..5ac543ca2d --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/dispatcher.ts @@ -0,0 +1,52 @@ +import { + Checks, + LogLevelDesc, + Logger, + LoggerProvider, +} from "@hyperledger/cactus-common"; + +import routesStage1 from "./stage-services/stage1-service"; +import routesStage2 from "./stage-services/stage2-service"; +import routesStage3 from "./stage-services/stage3-service"; + +export interface COREDispatcherOptions { + logger: Logger; + logLevel?: LogLevelDesc; + instanceId: string; +} + +export class COREDispatcher { + public static readonly CLASS_NAME = "COREDispacher"; + private readonly logger: Logger; + private readonly instanceId: string; + private endpoints: any[] | undefined; + + constructor(public readonly options: COREDispatcherOptions) { + const fnTag = `${COREDispatcher.CLASS_NAME}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + + const level = this.options.logLevel || "INFO"; + const label = this.className; + this.logger = LoggerProvider.getOrCreate({ level, label }); + this.instanceId = options.instanceId; + this.logger.info(`Instantiated ${this.className} OK`); + } + + public get className(): string { + return COREDispatcher.CLASS_NAME; + } + + getOrCreateServices() { + const fnTag = `${COREDispatcher.CLASS_NAME}#getOrCreateServices()`; + this.logger.info( + `${fnTag}, Registering gRPCservices on instanceId=${this.instanceId}`, + ); + if (Array.isArray(this.endpoints)) { + return this.endpoints; + } + + this.endpoints = [routesStage1, routesStage2, routesStage3]; + + return this.endpoints; + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage1-client-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage1-client-handler.ts new file mode 100644 index 0000000000..536acb2f16 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage1-client-handler.ts @@ -0,0 +1,373 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { SHA256 } from "crypto-js"; + +import { SATPGateway } from "../../../gateway-refactor"; +import { + TransferCommenceRequestMessage, + TransferProposalRequestMessage, + TransferProposalReceiptRejectMessage, +} from "../../../generated/proto/cacti/satp/v02/stage_1_pb"; +import { + MessageType, + CommonSatp, + TransferClaims, + NetworkCapabilities, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { + MessageStagesHashes, + MessageStagesSignatures, + SessionData, + Stage1Hashes, + Stage1Signatures, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { SATP_VERSION } from "../../constants"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage1ClientHandler { + public static readonly CLASS_NAME = "Stage1Handler-Client"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage1ClientHandler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage1ClientHandler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async transferProposalRequest( + sessionID: string, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferProposalRequest()`; + + const sessionData = gateway.getSession(sessionID); + + if ( + sessionData == undefined || + sessionData.version == undefined || + sessionData.id == undefined || + //sessionData.transferContextId == undefined || + sessionData.digitalAssetId == undefined || + //sessionData.assetProfileId == undefined || + sessionData.originatorPubkey == undefined || + sessionData.beneficiaryPubkey == undefined || + sessionData.senderGatewayNetworkId == undefined || + sessionData.recipientGatewayNetworkId == undefined || + sessionData.clientGatewayPubkey == undefined || + sessionData.serverGatewayPubkey == undefined || + sessionData.senderGatewayOwnerId == undefined || + sessionData.receiverGatewayOwnerId == undefined || + // sessionData.maxRetries == undefined || + // sessionData.maxTimeout == undefined || + sessionData.senderGatewayNetworkId == undefined || + sessionData.signatureAlgorithm == undefined || + sessionData.lockType == undefined || + sessionData.lockExpirationTime == undefined || + //sessionData.permitions == undefined || + //sessionData.developerUrn == undefined || + sessionData.credentialProfile == undefined || + //sessionData.applicationProfile == undefined || + sessionData.loggingProfile == undefined || + sessionData.accessControlProfile == undefined || + sessionData.lastSequenceNumber == undefined //|| + //sessionData.subsequentCalls == undefined || + //sessionData.history == undefined || + //sessionData.multipleClaimsAllowed == undefined || + //sessionData.multipleCancelsAllowed == undefined + ) { + throw new Error(`${fnTag}, session data is not correctly initialized`); + } + + if ( + !gateway.getSupportedDltIDs().includes(sessionData.senderGatewayNetworkId) + ) { + throw new Error( + `${fnTag}, recipient gateway dlt system is not supported by this gateway`, + ); + } + + if (sessionData.version != SATP_VERSION) { + throw new Error(`${fnTag}, unsupported SATP version`); + } + + const commonBody = new CommonSatp(); + commonBody.version = sessionData.version; + commonBody.messageType = MessageType.INIT_PROPOSAL; + commonBody.sessionId = sessionData.id; + // commonBody.transferContextId = sessionData.transferContextId; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.resourceUrl = ""; + + //commonBody.actionResponse = new ActionResponse(); + // commonBody.credentialBlock = sessionData.credentialBlock; + // commonBody.payloadProfile = sessionData.payloadProfile; + // commonBody.applicationProfile = sessionData.applicationProfile; + // commonBody.payload = new Payload(); + // commonBody.payloadHash = ""; + + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + commonBody.hashPreviousMessage = ""; + + const transferInitClaims = new TransferClaims(); + transferInitClaims.digitalAssetId = sessionData.digitalAssetId; + transferInitClaims.assetProfileId = sessionData.assetProfileId; + transferInitClaims.verifiedOriginatorEntityId = + sessionData.verifiedOriginatorEntityId; + transferInitClaims.verifiedBeneficiaryEntityId = + sessionData.verifiedBeneficiaryEntityId; + transferInitClaims.originatorPubkey = sessionData.originatorPubkey; + transferInitClaims.beneficiaryPubkey = sessionData.beneficiaryPubkey; + transferInitClaims.senderGatewayNetworkId = + sessionData.senderGatewayNetworkId; + transferInitClaims.recipientGatewayNetworkId = + sessionData.recipientGatewayNetworkId; + transferInitClaims.clientGatewayPubkey = sessionData.clientGatewayPubkey; + transferInitClaims.serverGatewayPubkey = sessionData.serverGatewayPubkey; + transferInitClaims.senderGatewayOwnerId = sessionData.senderGatewayOwnerId; + transferInitClaims.receiverGatewayOwnerId = + sessionData.receiverGatewayOwnerId; + + const networkCapabilities = new NetworkCapabilities(); + networkCapabilities.senderGatewayNetworkId = + sessionData.senderGatewayNetworkId; + networkCapabilities.signatureAlgorithm = sessionData.signatureAlgorithm; + networkCapabilities.lockType = sessionData.lockType; + networkCapabilities.lockExpirationTime = sessionData.lockExpirationTime; + //networkCapabilities.permitions = sessionData.permitions; + //networkCapabilities.developerUrn = sessionData.developerUrn; + networkCapabilities.credentialProfile = sessionData.credentialProfile; + //networkCapabilities.applicationProfile = sessionData.applicationProfile; + networkCapabilities.loggingProfile = sessionData.loggingProfile; + networkCapabilities.accessControlProfile = sessionData.accessControlProfile; + //networkCapabilities.subsequentCalls = sessionData.subsequentCalls; + //networkCapabilities.history = sessionData.history; + + const transferProposalRequestMessage = new TransferProposalRequestMessage(); + transferProposalRequestMessage.common = commonBody; + transferProposalRequestMessage.transferInitClaims = transferInitClaims; + // transferProposalRequestMessage.transferInitClaimsFormat = sessionData.transferInitClaimsFormat; + transferProposalRequestMessage.networkCapabilities = networkCapabilities; + // transferProposalRequestMessage.multipleClaimsAllowed = sessionData.multipleClaimsAllowed; + // transferProposalRequestMessage.multipleCancelsAllowed = sessionData.multipleCancelsAllowed; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(transferProposalRequestMessage), + ), + ); + + transferProposalRequestMessage.common.signature = messageSignature; + + sessionData.signatures = new MessageStagesSignatures(); + sessionData.signatures.stage1 = new Stage1Signatures(); + sessionData.signatures.stage1.transferCommenceRequestMessageClientSignature = + messageSignature; + + sessionData.hashes = new MessageStagesHashes(); + sessionData.hashes.stage1 = new Stage1Hashes(); + + sessionData.hashes.stage1.transferCommenceRequestMessageHash = SHA256( + JSON.stringify(transferProposalRequestMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionID, + type: "transferProposalRequest", + operation: "validate", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending TransferProposalRequest...`); + + return transferProposalRequestMessage; + } + + async transferCommenceRequest( + response: TransferProposalReceiptRejectMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferCommenceRequest()`; + + if (!response || !response.common) { + throw new Error("Response or response.common is undefined"); + } + + //const sessionData = gateway.sessions.get(response.common.sessionId); + const sessionData = new SessionData(); //todo change + + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined + ) { + throw new Error("Session data not loaded successfully"); + } + + const commonBody = new CommonSatp(); + commonBody.version = sessionData.version; + commonBody.messageType = MessageType.TRANSFER_COMMENCE_REQUEST; + commonBody.sequenceNumber = response.common.sequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage1.transferProposalReceiptMessageHash; //todo + + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + commonBody.sessionId = sessionData.id; + + const transferCommenceRequestMessage = new TransferCommenceRequestMessage(); + transferCommenceRequestMessage.common = commonBody; + transferCommenceRequestMessage.hashTransferInitClaims = + sessionData.hashTransferInitClaims; + // transferCommenceRequestMessage.clientTransferNumber = sessionData.clientTransferNumber; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(transferCommenceRequestMessage), + ), + ); + + transferCommenceRequestMessage.common.signature = messageSignature; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "transferCommenceRequest", + operation: "validate", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending TransferCommenceRequest...`); + + return transferCommenceRequestMessage; + } + + async checkTransferProposalReceiptRejectMessage( + response: TransferProposalReceiptRejectMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#checkTransferProposalReceiptRejectMessage()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message has no satp common body`); + } + + if ( + response.common.version == undefined || + response.common.sequenceNumber == undefined || + response.common.hashPreviousMessage == undefined || + response.timestamp == undefined + ) { + throw new Error(`${fnTag}, satp common body is missing required fields`); + } + + const sessionId = response.common.sessionId; + + const sessionData = gateway.getSession(sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.serverGatewayPubkey == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage1.transferProposalRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined + ) { + throw new Error(`${fnTag}, session data was not loaded correctly`); + } + + if (response.common.version != sessionData.version) { + throw new Error(`${fnTag}, TransferCommenceRequest version mismatch`); + } + + if ( + response.common.messageType != MessageType.INIT_RECEIPT && + response.common.messageType != MessageType.INIT_REJECT + ) { + throw new Error( + `${fnTag}, wrong message type for TransferCommenceRequest()`, + ); + } + + if ( + response.common.sequenceNumber != + sessionData.lastSequenceNumber + BigInt(1) + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt Message sequence number is wrong`, + ); + } + + if ( + response.common.hashPreviousMessage == undefined || + response.common.hashPreviousMessage != + sessionData.hashes.stage1.transferProposalRequestMessageHash + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt Message previous message hash is wrong`, + ); + } + + if ( + response.common.hashPreviousMessage != + sessionData.hashes.stage1.transferProposalRequestMessageHash + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt previous message hash does not match the one that was sent`, + ); + } + + if ( + response.common.serverGatewayPubkey != sessionData.serverGatewayPubkey + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt serverIdentity public key does not match the one that was sent`, + ); + } + + if ( + response.common.clientGatewayPubkey != sessionData.clientGatewayPubkey + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt clientIdentity public key does not match the one that was sent`, + ); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + response, + sessionData.serverGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, TransferProposalReceipt message signature verification failed`, + ); + } + + this.log.info(`TransferProposalReceipt passed all checks.`); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage2-client-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage2-client-handler.ts new file mode 100644 index 0000000000..92880531fa --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage2-client-handler.ts @@ -0,0 +1,225 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { TransferCommenceResponseMessage } from "../../../generated/proto/cacti/satp/v02/stage_1_pb"; +import { SATPGateway } from "../../../gateway-refactor"; +import { SATP_VERSION } from "../../constants"; +import { + CommonSatp, + MessageType, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { LockAssertionRequestMessage } from "../../../generated/proto/cacti/satp/v02/stage_2_pb"; +import { SHA256 } from "crypto-js"; +import { + Stage2Hashes, + Stage2Signatures, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage2ClientHandler { + public static readonly CLASS_NAME = "Stage2Handler-Client"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage2ClientHandler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage2ClientHandler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async lockAssertionRequest( + response: TransferCommenceResponseMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#lockAssertionRequest()`; + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage1.transferCommenceRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + sessionData.hashes.stage1.transferCommenceResponseMessageHash = SHA256( + JSON.stringify(response), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = sessionData.version; + commonBody.messageType = MessageType.LOCK_ASSERT; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage1.transferCommenceResponseMessageHash; + commonBody.sessionId = response.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const lockAssertionRequestMessage = new LockAssertionRequestMessage(); + lockAssertionRequestMessage.common = commonBody; + + lockAssertionRequestMessage.lockAssertionClaim = + sessionData.lockAssertionClaim; + lockAssertionRequestMessage.lockAssertionFormat = + sessionData.lockAssertionFormat; //todo change this + + const messageSignature = bufArray2HexStr( + sign(gateway.gatewaySigner, JSON.stringify(lockAssertionRequestMessage)), + ); + + lockAssertionRequestMessage.common.signature = messageSignature; + + sessionData.signatures.stage2 = new Stage2Signatures(); + sessionData.signatures.stage2.lockAssertionRequestMessageClientSignature = + messageSignature; + + sessionData.hashes.stage2 = new Stage2Hashes(); + sessionData.hashes.stage2.lockAssertionRequestMessageHash = SHA256( + JSON.stringify(lockAssertionRequestMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "lockAssertionRequest", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending LockAssertionMessage...`); + + return lockAssertionRequestMessage; + } + + checkTransferCommenceResponseMessage( + response: TransferCommenceResponseMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#lockAssertionRequestMessage()`; + + if ( + response.common == undefined || + response.common.version == undefined || + response.common.messageType == undefined || + response.common.sessionId == undefined || + // request.common.transferContextId == undefined || + response.common.sequenceNumber == undefined || + response.common.resourceUrl == undefined || + // request.common.actionResponse == undefined || + // request.common.payloadProfile == undefined || + // request.common.applicationProfile == undefined || + response.common.signature == undefined || + response.common.clientGatewayPubkey == undefined || + response.common.serverGatewayPubkey == undefined + ) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + if (response.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, unsupported SATP version`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.serverGatewayPubkey == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage1.transferProposalRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined + ) { + throw new Error(`${fnTag}, session data was not load correctly`); + } + + if ( + response.common.serverGatewayPubkey != sessionData.serverGatewayPubkey + ) { + throw new Error( + `${fnTag}, TransferCommenceResponse serverIdentity public key does not match the one that was sent`, + ); + } + + if ( + response.common.clientGatewayPubkey != sessionData.clientGatewayPubkey + ) { + throw new Error( + `${fnTag}, TransferCommenceResponse clientIdentity public key does not match the one that was sent`, + ); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + response.common, + response.common.serverGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, TransferCommenceResponse message signature verification failed`, + ); + } + + if (response.common.messageType != MessageType.TRANSFER_COMMENCE_RESPONSE) { + throw new Error( + `${fnTag}, wrong message type for TransferCommenceResponse `, + ); + } + + if ( + response.common.sequenceNumber != + sessionData.lastSequenceNumber + BigInt(1) + ) { + throw new Error( + `${fnTag}, TransferCommenceResponse sequence number is wrong`, + ); + } + + if ( + response.common.hashPreviousMessage != + sessionData.hashes.stage1.transferCommenceResponseMessageHash //todo + ) { + throw new Error( + `${fnTag}, TransferCommenceResponse previous message hash does not match the one that was sent`, + ); + } + + this.log.info(`TransferCommenceResponse passed all checks.`); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage3-client-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage3-client-handler.ts new file mode 100644 index 0000000000..85f2000542 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/client/stage3-client-handler.ts @@ -0,0 +1,541 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { LockAssertionReceiptMessage } from "../../../generated/proto/cacti/satp/v02/stage_2_pb"; +import { SATPGateway } from "../../../gateway-refactor"; +import { + CommonSatp, + MessageType, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { SATP_VERSION } from "../../constants"; +import { + CommitFinalAcknowledgementReceiptResponseMessage, + CommitFinalAssertionRequestMessage, + CommitPreparationRequestMessage, + CommitReadyResponseMessage, + TransferCompleteRequestMessage, +} from "../../../generated/proto/cacti/satp/v02/stage_3_pb"; +import { SHA256 } from "crypto-js"; +import { + SessionData, + Stage3Hashes, + Stage3Signatures, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage3ClientHandler { + public static readonly CLASS_NAME = "Stage3Handler-Client"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage3ClientHandler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage3ClientHandler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async commitPreparation( + response: LockAssertionReceiptMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#commitPreparation()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage2 == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + sessionData.hashes.stage2.lockAssertionReceiptMessageHash = SHA256( + JSON.stringify(response), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.COMMIT_PREPARE; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage2.lockAssertionReceiptMessageHash; + commonBody.sessionId = response.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const commitPreparationRequestMessage = + new CommitPreparationRequestMessage(); + commitPreparationRequestMessage.common = commonBody; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(commitPreparationRequestMessage), + ), + ); + + commitPreparationRequestMessage.common.signature = messageSignature; + + sessionData.signatures.stage3 = new Stage3Signatures(); + sessionData.signatures.stage3.commitPreparationRequestMessageClientSignature = + messageSignature; + + sessionData.hashes.stage3 = new Stage3Hashes(); + sessionData.hashes.stage3.commitPreparationRequestMessageHash = SHA256( + JSON.stringify(commitPreparationRequestMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "commitPreparation", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending CommitPreparationMessage...`); + + return commitPreparationRequestMessage; + } + + async commitFinalAssertion( + response: CommitReadyResponseMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#commitPreparation()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + //const sessionData = gateway.sessions.get(response.common.sessionId); + const sessionData = new SessionData(); //todo change + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.signatures == undefined || + sessionData.signatures.stage3 == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + sessionData.hashes.stage3.commitReadyResponseMessageHash = SHA256( + JSON.stringify(response), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.COMMIT_FINAL; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage3.commitReadyResponseMessageHash; + commonBody.sessionId = response.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const commitFinalAssertionRequestMessage = + new CommitFinalAssertionRequestMessage(); + commitFinalAssertionRequestMessage.common = commonBody; + + commitFinalAssertionRequestMessage.burnAssertionClaim = + sessionData.burnAssertionClaim; + commitFinalAssertionRequestMessage.burnAssertionClaimFormat = + sessionData.burnAssertionClaimFormat; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(commitFinalAssertionRequestMessage), + ), + ); + + commitFinalAssertionRequestMessage.common.signature = messageSignature; + + sessionData.signatures.stage3.commitFinalAssertionRequestMessageClientSignature = + messageSignature; + + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash = SHA256( + JSON.stringify(commitFinalAssertionRequestMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "commitFinalAssertion", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending CommitFinalAssertionMessage...`); + + return commitFinalAssertionRequestMessage; + } + + async transferComplete( + response: CommitFinalAcknowledgementReceiptResponseMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferComplete()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + //const sessionData = gateway.sessions.get(response.common.sessionId); + const sessionData = new SessionData(); //todo change + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.signatures == undefined || + sessionData.signatures.stage3 == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + sessionData.hashes.stage3.commitFinalAcknowledgementReceiptResponseMessageHash = + SHA256(JSON.stringify(response)).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.COMMIT_TRANSFER_COMPLETE; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage3.commitFinalAcknowledgementReceiptResponseMessageHash; + commonBody.sessionId = response.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const transferCompleteRequestMessage = new TransferCompleteRequestMessage(); + transferCompleteRequestMessage.common = commonBody; + transferCompleteRequestMessage.hashTransferCommence = + sessionData.hashes.stage1.transferCommenceRequestMessageHash; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(transferCompleteRequestMessage), + ), + ); + + transferCompleteRequestMessage.common.signature = messageSignature; + + sessionData.signatures.stage3.transferCompleteRequestMessageClientSignature = + messageSignature; + + sessionData.hashes.stage3.transferCompleteRequestMessageHash = SHA256( + JSON.stringify(transferCompleteRequestMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "transferComplete", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending TransferCompleteMessage...`); + + return transferCompleteRequestMessage; + } + + checkLockAssertionReceiptMessage( + response: LockAssertionReceiptMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkLockAssertionReceiptMessage()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + if (response.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, message version is not ${SATP_VERSION}`); + } + + if (response.common.messageType != MessageType.ASSERTION_RECEIPT) { + throw new Error(`${fnTag}, message type is not ASSERTION_RECEIPT`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage2 == undefined || + sessionData.hashes.stage2.lockAssertionRequestMessageHash == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + if ( + sessionData.lastSequenceNumber + BigInt(1) != + response.common.sequenceNumber + ) { + throw new Error(`${fnTag}, sequenceNumber does not match`); + } + + if ( + sessionData.hashes.stage2.lockAssertionRequestMessageHash != + response.common.hashPreviousMessage + ) { + throw new Error(`${fnTag}, hashPreviousMessage does not match`); + } + + if ( + sessionData.clientGatewayPubkey != response.common.clientGatewayPubkey + ) { + throw new Error(`${fnTag}, clientGatewayPubkey does not match`); + } + + if ( + sessionData.serverGatewayPubkey != response.common.serverGatewayPubkey + ) { + throw new Error(`${fnTag}, serverGatewayPubkey does not match`); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + response.common, + response.common.serverGatewayPubkey, + ) + ) { + throw new Error(`${fnTag}, message signature verification failed`); + } + + this.log.info(`LockAssertionReceiptMessage passed all checks.`); + } + + checkCommitReadyResponseMessage( + response: CommitReadyResponseMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkCommitReadyResponseMessage()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + if (response.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, message version is not ${SATP_VERSION}`); + } + + if (response.common.messageType != MessageType.COMMIT_READY) { + throw new Error(`${fnTag}, message type is not COMMIT_READY`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.hashes.stage3.commitPreparationRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + if ( + sessionData.lastSequenceNumber + BigInt(1) != + response.common.sequenceNumber + ) { + throw new Error(`${fnTag}, sequenceNumber does not match`); + } + + if ( + sessionData.hashes.stage3.commitPreparationRequestMessageHash != + response.common.hashPreviousMessage + ) { + throw new Error(`${fnTag}, hashPreviousMessage does not match`); + } + + if ( + sessionData.clientGatewayPubkey != response.common.clientGatewayPubkey + ) { + throw new Error(`${fnTag}, clientGatewayPubkey does not match`); + } + + if ( + sessionData.serverGatewayPubkey != response.common.serverGatewayPubkey + ) { + throw new Error(`${fnTag}, serverGatewayPubkey does not match`); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + response.common, + response.common.serverGatewayPubkey, + ) + ) { + throw new Error(`${fnTag}, message signature verification failed`); + } + + if (response.mintAssertionClaims == undefined) { + //todo + throw new Error(`${fnTag}, mintAssertionClaims is missing`); + } + + this.log.info(`CommitReadyResponseMessage passed all checks.`); + } + + checkCommitFinalAcknowledgementReceiptResponseMessage( + response: CommitFinalAcknowledgementReceiptResponseMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkCommitFinalAcknowledgementReceiptResponseMessage()`; + + if (response.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + if (response.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, message version is not ${SATP_VERSION}`); + } + + if (response.common.messageType != MessageType.ACK_COMMIT_FINAL) { + throw new Error(`${fnTag}, message type is not ACK_COMMIT_FINAL`); + } + + const sessionData = gateway.getSession(response.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${response.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${response.common.sessionId}`, + ); + } + + if ( + sessionData.lastSequenceNumber + BigInt(1) != + response.common.sequenceNumber + ) { + throw new Error(`${fnTag}, sequenceNumber does not match`); + } + + if ( + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash != + response.common.hashPreviousMessage + ) { + throw new Error(`${fnTag}, hashPreviousMessage does not match`); + } + + if ( + sessionData.clientGatewayPubkey != response.common.clientGatewayPubkey + ) { + throw new Error(`${fnTag}, clientGatewayPubkey does not match`); + } + + if ( + sessionData.serverGatewayPubkey != response.common.serverGatewayPubkey + ) { + throw new Error(`${fnTag}, serverGatewayPubkey does not match`); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + response.common, + response.common.serverGatewayPubkey, + ) + ) { + throw new Error(`${fnTag}, message signature verification failed`); + } + + if (response.assignmentAssertionClaim == undefined) { + throw new Error(`${fnTag}, assignmentAssertionClaim is missing`); + } + + this.log.info( + `CommitFinalAcknowledgementReceiptResponseMessage passed all checks.`, + ); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage1-server-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage1-server-handler.ts new file mode 100644 index 0000000000..b8f1daa767 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage1-server-handler.ts @@ -0,0 +1,448 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { SHA256 } from "crypto-js"; + +import { SATPGateway } from "../../../gateway-refactor"; +import { + TransferCommenceResponseMessage, + TransferCommenceRequestMessage, + TransferProposalRequestMessage, + TransferProposalReceiptRejectMessage, +} from "../../../generated/proto/cacti/satp/v02/stage_1_pb"; +import { + MessageType, + CommonSatp, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { + MessageStagesHashes, + MessageStagesSignatures, + MessageStagesTimestamps, + SessionData, + Stage1Hashes, + Stage1Signatures, + Stage1Timestamps, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { SATP_VERSION } from "../../constants"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage1Handler { + public static readonly CLASS_NAME = "Stage1Handler-Server"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage1Handler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage1Handler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async transferProposalResponse( + request: TransferProposalRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferProposalResponse()`; + + const recvTimestamp: string = Date.now().toString(); + + if ( + request.common == undefined || + request.transferInitClaims == undefined || + request.networkCapabilities == undefined + ) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + const sessionData = new SessionData(); + sessionData.id = request.common.sessionId; + sessionData.version = request.common.version; + sessionData.digitalAssetId = request.transferInitClaims.digitalAssetId; + //sessionData.assetProfile = request.common.payloadProfile.assetProfile; + // sessionData.applicationProfile = request.networkCapabilities.applicationProfile; + sessionData.originatorPubkey = request.common.clientGatewayPubkey; + sessionData.beneficiaryPubkey = request.common.serverGatewayPubkey; + sessionData.senderGatewayNetworkId = + request.transferInitClaims.senderGatewayNetworkId; + sessionData.recipientGatewayNetworkId = + request.transferInitClaims.recipientGatewayNetworkId; + sessionData.clientGatewayPubkey = request.common.clientGatewayPubkey; + sessionData.serverGatewayPubkey = request.common.serverGatewayPubkey; + sessionData.receiverGatewayOwnerId = + request.transferInitClaims.receiverGatewayOwnerId; + sessionData.senderGatewayOwnerId = + request.transferInitClaims.senderGatewayOwnerId; + sessionData.signatureAlgorithm = + request.networkCapabilities.signatureAlgorithm; + sessionData.lockType = request.networkCapabilities.lockType; + sessionData.lockExpirationTime = + request.networkCapabilities.lockExpirationTime; + sessionData.credentialProfile = + request.networkCapabilities.credentialProfile; + sessionData.loggingProfile = request.networkCapabilities.loggingProfile; + sessionData.accessControlProfile = + request.networkCapabilities.accessControlProfile; + + // sessionData.maxRetries = request.transferInitClaims.maxRetries; + // sessionData.maxTimeout = request.transferInitClaims.maxTimeout; + + sessionData.signatures = new MessageStagesSignatures(); + sessionData.signatures.stage1 = new Stage1Signatures(); + sessionData.signatures.stage1.transferCommenceRequestMessageClientSignature = + request.common.signature; + + sessionData.lastMessageReceivedTimestamp = recvTimestamp; + + sessionData.sourceLedgerAssetId = + request.transferInitClaims.verifiedOriginatorEntityId; + sessionData.recipientLedgerAssetId = + request.transferInitClaims.verifiedBeneficiaryEntityId; // todo shouldn't be the server to create this id? + + sessionData.hashTransferInitClaims = SHA256( + JSON.stringify(request.transferInitClaims), + ).toString(); + + sessionData.hashes = new MessageStagesHashes(); + sessionData.hashes.stage1 = new Stage1Hashes(); + + sessionData.hashes.stage1.transferCommenceRequestMessageHash = SHA256( + JSON.stringify(request), + ).toString(); + + sessionData.lastSequenceNumber = request.common.sequenceNumber + BigInt(1); + + sessionData.processedTimestamps = new MessageStagesTimestamps(); + sessionData.processedTimestamps.stage1 = new Stage1Timestamps(); + + sessionData.receivedTimestamps = new MessageStagesTimestamps(); + sessionData.receivedTimestamps.stage1 = new Stage1Timestamps(); + + sessionData.receivedTimestamps.stage1.transferCommenceRequestMessageTimestamp = + recvTimestamp; + + gateway.addSession(request.common.sessionId, sessionData); + + const commonBody = new CommonSatp(); + commonBody.version = sessionData.version; + commonBody.messageType = MessageType.INIT_RECEIPT; + commonBody.sessionId = sessionData.id; + commonBody.sequenceNumber = request.common.sequenceNumber + BigInt(1); + commonBody.resourceUrl = request.common.resourceUrl; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + commonBody.hashPreviousMessage = sessionData.hashTransferInitClaims; + + //todo if rejection + const transferProposalReceiptMessage = + new TransferProposalReceiptRejectMessage(); + transferProposalReceiptMessage.common = commonBody; + + sessionData.processedTimestamps.stage1.transferCommenceRequestMessageTimestamp = + Date.now().toString(); + transferProposalReceiptMessage.timestamp = + sessionData.processedTimestamps.stage1.transferCommenceRequestMessageTimestamp; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(transferProposalReceiptMessage), + ), + ); + + transferProposalReceiptMessage.common.signature = messageSignature; + + sessionData.signatures.stage1.transferProposalReceiptMessageServerSignature = + messageSignature; + sessionData.hashes.stage1.transferProposalReceiptMessageHash = SHA256( + JSON.stringify(transferProposalReceiptMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "transferProposalResponse", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending TransferProposalResponseMessage...`); + + return transferProposalReceiptMessage; + } + + async transferCommenceResponse( + request: TransferCommenceRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferCommenceResponse()`; + + const recvTimestamp: string = Date.now().toString(); + + if (request.common == undefined) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + sessionData.hashes.stage1.transferCommenceRequestMessageHash = SHA256( + JSON.stringify(request), + ).toString(); + + sessionData.lastMessageReceivedTimestamp = recvTimestamp; + this.log.info(`TransferCommenceRequest passed all checks.`); + + const commonBody = new CommonSatp(); + commonBody.version = sessionData.version; + commonBody.messageType = MessageType.TRANSFER_COMMENCE_RESPONSE; + commonBody.sequenceNumber = sessionData.lastSequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage1.transferCommenceRequestMessageHash; //todo + + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + commonBody.sessionId = sessionData.id; + + const transferCommenceResponseMessage = + new TransferCommenceResponseMessage(); + transferCommenceResponseMessage.common = commonBody; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + //sessionData.processedTimestamps.stage1.transferCommenceRequestMessageTimestamp = Date.now().toString(); + + sessionData.hashes.stage1.transferCommenceResponseMessageHash = SHA256( + JSON.stringify(transferCommenceResponseMessage), + ).toString(); + + //todo sign + await storeLog(gateway, { + sessionID: sessionData.id, + type: "transferCommenceResponse", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending TransferCommenceResponseMessage...`); + + return transferCommenceResponseMessage; + } + + checkTransferProposalRequestMessage( + request: TransferProposalRequestMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkTransferProposalRequestMessage()`; + + if ( + request.common == undefined || + request.common.version == undefined || + request.common.messageType == undefined || + request.common.sessionId == undefined || + // request.common.transferContextId == undefined || + request.common.sequenceNumber == undefined || + request.common.resourceUrl == undefined || + // request.common.actionResponse == undefined || + // request.common.payloadProfile == undefined || + // request.common.applicationProfile == undefined || + request.common.signature == undefined || + request.common.clientGatewayPubkey == undefined || + request.common.serverGatewayPubkey == undefined + ) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + if (request.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, unsupported SATP version`); + } + + //todo there is not a session data already here? + + if ( + !verifySignature( + gateway.gatewaySigner, + request.common, + request.common.clientGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, TransferProposalRequest message signature verification failed`, + ); + } + + if (request.common.messageType != MessageType.INIT_PROPOSAL) { + throw new Error( + `${fnTag}, wrong message type for TransferProposalRequest`, + ); + } + + if (request.transferInitClaims == undefined) { + throw new Error( + `${fnTag}, TransferProposalRequest message does not contain transfer initialization claims`, + ); + } + + if (request.networkCapabilities == undefined) { + throw new Error( + `${fnTag}, TransferProposalRequest message does not contain network capabilities and parameters`, + ); + } + + if ( + !gateway + .getSupportedDltIDs() + .includes(request.transferInitClaims.senderGatewayNetworkId) + ) { + throw new Error( + `${fnTag}, recipient gateway dlt system is not supported by this gateway`, + ); + } + + this.log.info(`TransferProposalRequest passed all checks.`); + } + + async checkTransferCommenceRequestMessage( + request: TransferCommenceRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#transferCommenceResponse()`; + + //const recvTimestamp: string = Date.now().toString(); + + if ( + request.common == undefined || + request.common.version == undefined || + request.common.messageType == undefined || + request.common.sessionId == undefined || + // request.common.transferContextId == undefined || + request.common.sequenceNumber == undefined || + request.common.resourceUrl == undefined || + // request.common.actionResponse == undefined || + // request.common.payloadProfile == undefined || + // request.common.applicationProfile == undefined || + request.common.signature == undefined || + request.common.clientGatewayPubkey == undefined || + request.common.serverGatewayPubkey == undefined + ) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + if (request.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, unsupported SATP version`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + + if ( + sessionData.serverGatewayPubkey == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage1.transferProposalRequestMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined + ) { + throw new Error(`${fnTag}, session data was not load correctly`); + } + + if (request.common.serverGatewayPubkey != sessionData.serverGatewayPubkey) { + throw new Error( + `${fnTag}, TransferCommenceRequest serverIdentity public key does not match the one that was sent`, + ); + } + + if (request.common.clientGatewayPubkey != sessionData.clientGatewayPubkey) { + throw new Error( + `${fnTag}, TransferCommenceRequest clientIdentity public key does not match the one that was sent`, + ); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + request.common, + request.common.clientGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, TransferCommenceRequest message signature verification failed`, + ); + } + + if (request.common.messageType != MessageType.TRANSFER_COMMENCE_REQUEST) { + throw new Error( + `${fnTag}, wrong message type for TransferCommenceRequest`, + ); + } + + if ( + request.common.sequenceNumber != + sessionData.lastSequenceNumber + BigInt(1) + ) { + throw new Error( + `${fnTag}, TransferCommenceRequest Message sequence number is wrong`, + ); + } + + if ( + request.common.hashPreviousMessage != + sessionData.hashes.stage1.transferProposalReceiptMessageHash //todo + ) { + throw new Error( + `${fnTag}, TransferCommenceRequest previous message hash does not match the one that was sent`, + ); + } + + if ( + request.hashTransferInitClaims == undefined || + request.hashTransferInitClaims != sessionData.hashTransferInitClaims + ) { + throw new Error( + `${fnTag}, TransferCommenceRequest message does not contain transfer claims`, + ); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + request, + sessionData.clientGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, TransferCommenceRequest message signature verification failed`, + ); + } + + this.log.info(`TransferCommenceRequest passed all checks.`); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage2-server-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage2-server-handler.ts new file mode 100644 index 0000000000..3914861540 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage2-server-handler.ts @@ -0,0 +1,224 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { + LockAssertionReceiptMessage, + LockAssertionRequestMessage, +} from "../../../generated/proto/cacti/satp/v02/stage_2_pb"; +import { SATPGateway } from "../../../gateway-refactor"; +import { SATP_VERSION } from "../../constants"; +import { + CommonSatp, + MessageType, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { + Stage2Hashes, + Stage2Signatures, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { SHA256 } from "crypto-js"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage2ServerHandler { + public static readonly CLASS_NAME = "Stage2Handler-Server"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage2ServerHandler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage2ServerHandler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async lockAssertionResponse( + request: LockAssertionRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#lockAssertionResponse()`; + + if (request.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + sessionData.hashes.stage2 = new Stage2Hashes(); + sessionData.hashes.stage2.lockAssertionRequestMessageHash = SHA256( + JSON.stringify(request), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.ASSERTION_RECEIPT; + commonBody.sequenceNumber = request.common.sequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage2.lockAssertionRequestMessageHash; + commonBody.sessionId = request.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const lockAssertionReceiptMessage = new LockAssertionReceiptMessage(); + lockAssertionReceiptMessage.common = commonBody; + + const messageSignature = bufArray2HexStr( + sign(gateway.gatewaySigner, JSON.stringify(lockAssertionReceiptMessage)), + ); + + lockAssertionReceiptMessage.common.signature = messageSignature; + + sessionData.signatures.stage2 = new Stage2Signatures(); + sessionData.signatures.stage2.lockAssertionRequestMessageClientSignature = + messageSignature; + + sessionData.hashes.stage2 = new Stage2Hashes(); + sessionData.hashes.stage2.lockAssertionRequestMessageHash = SHA256( + JSON.stringify(lockAssertionReceiptMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "lockAssertionResponse", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending LockAssertionResponseMessage...`); + + return lockAssertionReceiptMessage; + } + + checkLockAssertionRequestMessage( + request: LockAssertionRequestMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkLockAssertionRequestMessage()`; + + if ( + request.common == undefined || + request.common.version == undefined || + request.common.messageType == undefined || + request.common.sessionId == undefined || + // request.common.transferContextId == undefined || + request.common.sequenceNumber == undefined || + request.common.resourceUrl == undefined || + // request.common.actionrequest == undefined || + // request.common.payloadProfile == undefined || + // request.common.applicationProfile == undefined || + request.common.signature == undefined || + request.common.clientGatewayPubkey == undefined || + request.common.serverGatewayPubkey == undefined + ) { + throw new Error( + `${fnTag}, message satp common body is missing or is missing required fields`, + ); + } + + if (request.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, unsupported SATP version`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + + if ( + sessionData.serverGatewayPubkey == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage1 == undefined || + sessionData.hashes.stage1.transferCommenceResponseMessageHash == + undefined || + sessionData.lastSequenceNumber == undefined + ) { + throw new Error(`${fnTag}, session data was not load correctly`); + } + + if (request.common.serverGatewayPubkey != sessionData.serverGatewayPubkey) { + throw new Error( + `${fnTag}, LockAssertionRequest serverIdentity public key does not match the one that was sent`, + ); + } + + if (request.common.clientGatewayPubkey != sessionData.clientGatewayPubkey) { + throw new Error( + `${fnTag}, LockAssertionRequest clientIdentity public key does not match the one that was sent`, + ); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + request.common, + request.common.serverGatewayPubkey, + ) + ) { + throw new Error( + `${fnTag}, LockAssertionRequest message signature verification failed`, + ); + } + + if (request.common.messageType != MessageType.LOCK_ASSERT) { + throw new Error(`${fnTag}, wrong message type for LockAssertionRequest`); + } + + if ( + request.common.sequenceNumber != + sessionData.lastSequenceNumber + BigInt(1) + ) { + throw new Error( + `${fnTag}, LockAssertionRequest Message sequence number is wrong`, + ); + } + + if ( + request.common.hashPreviousMessage != + sessionData.hashes.stage1.transferCommenceResponseMessageHash + ) { + throw new Error( + `${fnTag}, LockAssertionRequest previous message hash does not match the one that was sent`, + ); + } + + if ( + request.lockAssertionFormat == undefined || + request.lockAssertionClaim == undefined + ) { + throw new Error( + `${fnTag}, LockAssertionRequest lockAssertionFormat or lockAssertionClaim is missing`, + ); + } + + this.log.info(`LockAssertionRequest passed all checks.`); + } +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage3-server-handler.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage3-server-handler.ts new file mode 100644 index 0000000000..0d1b7febb6 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-handlers/server/stage3-server-handler.ts @@ -0,0 +1,366 @@ +import { Logger, LoggerProvider } from "@hyperledger/cactus-common"; +import { SATPGateway } from "../../../gateway-refactor"; +import { + CommitFinalAcknowledgementReceiptResponseMessage, + CommitFinalAssertionRequestMessage, + CommitPreparationRequestMessage, + CommitReadyResponseMessage, +} from "../../../generated/proto/cacti/satp/v02/stage_3_pb"; +import { SATP_VERSION } from "../../constants"; +import { + CommonSatp, + MessageType, +} from "../../../generated/proto/cacti/satp/v02/common/common_messages_pb"; +import { + Stage3Hashes, + Stage3Signatures, +} from "../../../generated/proto/cacti/satp/v02/common/session_pb"; +import { SHA256 } from "crypto-js"; +import { + bufArray2HexStr, + sign, + storeLog, + verifySignature, +} from "../../../gateway-utils"; + +export class Stage3ServerHandler { + public static readonly CLASS_NAME = "Stage3Handler-Server"; + private _log: Logger; + + constructor() { + const level = "INFO"; + const label = Stage3ServerHandler.CLASS_NAME; + this._log = LoggerProvider.getOrCreate({ level, label }); + } + + public get className(): string { + return Stage3ServerHandler.CLASS_NAME; + } + + public get log(): Logger { + return this._log; + } + + async commitReady( + request: CommitPreparationRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#commitReady()`; + + if (request.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + sessionData.hashes.stage3 = new Stage3Hashes(); + + sessionData.hashes.stage3.commitPreparationRequestMessageHash = SHA256( + JSON.stringify(request), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.COMMIT_READY; + commonBody.sequenceNumber = request.common.sequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage3.commitPreparationRequestMessageHash; + commonBody.sessionId = request.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const commitReadyMessage = new CommitReadyResponseMessage(); + commitReadyMessage.common = commonBody; + + commitReadyMessage.mintAssertionClaims = sessionData.mintAssertionClaims; + commitReadyMessage.mintAssertionClaimsFormat = + sessionData.mintAssertionClaimsFormat; + + const messageSignature = bufArray2HexStr( + sign(gateway.gatewaySigner, JSON.stringify(commitReadyMessage)), + ); + + commitReadyMessage.common.signature = messageSignature; + + sessionData.signatures.stage3 = new Stage3Signatures(); + sessionData.signatures.stage3.commitReadyResponseMessageServerSignature = + messageSignature; + + sessionData.hashes.stage3.commitReadyResponseMessageHash = SHA256( + JSON.stringify(commitReadyMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "commitReady", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info(`${fnTag}, sending commitReadyMessage...`); + + return commitReadyMessage; + } + + async commitFinalAcknowledgementReceiptResponse( + request: CommitFinalAssertionRequestMessage, + gateway: SATPGateway, + ): Promise { + const fnTag = `${this.className}#commitFinalAcknowledgementReceiptResponse()`; + + if (request.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.hashes.stage3.commitReadyResponseMessageHash == undefined || + sessionData.signatures == undefined || + sessionData.signatures.stage3 == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash = SHA256( + JSON.stringify(request), + ).toString(); + + const commonBody = new CommonSatp(); + commonBody.version = SATP_VERSION; + commonBody.messageType = MessageType.ACK_COMMIT_FINAL; + commonBody.sequenceNumber = request.common.sequenceNumber + BigInt(1); + commonBody.hashPreviousMessage = + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash; + commonBody.sessionId = request.common.sessionId; + commonBody.clientGatewayPubkey = sessionData.clientGatewayPubkey; + commonBody.serverGatewayPubkey = sessionData.serverGatewayPubkey; + + sessionData.lastSequenceNumber = commonBody.sequenceNumber; + + const commitFinalAcknowledgementReceiptResponseMessage = + new CommitFinalAcknowledgementReceiptResponseMessage(); + commitFinalAcknowledgementReceiptResponseMessage.common = commonBody; + + commitFinalAcknowledgementReceiptResponseMessage.assignmentAssertionClaim = + sessionData.assignmentAssertionClaim; + commitFinalAcknowledgementReceiptResponseMessage.assignmentAssertionClaimFormat = + sessionData.assignmentAssertionClaimFormat; + + const messageSignature = bufArray2HexStr( + sign( + gateway.gatewaySigner, + JSON.stringify(commitFinalAcknowledgementReceiptResponseMessage), + ), + ); + + commitFinalAcknowledgementReceiptResponseMessage.common.signature = + messageSignature; + + sessionData.signatures.stage3.commitFinalAcknowledgementReceiptResponseMessageServerSignature = + messageSignature; + + sessionData.hashes.stage3.commitFinalAssertionRequestMessageHash = SHA256( + JSON.stringify(commitFinalAcknowledgementReceiptResponseMessage), + ).toString(); + + await storeLog(gateway, { + sessionID: sessionData.id, + type: "commitFinalAcknowledgementReceiptResponse", + operation: "lock", + data: JSON.stringify(sessionData), + }); + + this.log.info( + `${fnTag}, sending commitFinalAcknowledgementReceiptResponseMessage...`, + ); + + return commitFinalAcknowledgementReceiptResponseMessage; + } + + checkCommitPreparationRequestMessage( + request: CommitPreparationRequestMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkCommitPreparationRequestMessage()`; + + if (request.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + if (request.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, message version is not ${SATP_VERSION}`); + } + + if (request.common.messageType != MessageType.COMMIT_PREPARE) { + throw new Error(`${fnTag}, message type is not COMMIT_PREPARE`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + + if ( + sessionData == undefined || + sessionData.hashes == undefined || + sessionData.hashes.stage2 == undefined || + sessionData.hashes.stage2.lockAssertionReceiptMessageHash == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + if ( + sessionData.lastSequenceNumber + BigInt(1) != + request.common.sequenceNumber + ) { + throw new Error(`${fnTag}, sequenceNumber does not match`); + } + + if ( + sessionData.hashes.stage2.lockAssertionReceiptMessageHash != + request.common.hashPreviousMessage + ) { + throw new Error(`${fnTag}, hashPreviousMessage does not match`); + } + + if (sessionData.clientGatewayPubkey != request.common.clientGatewayPubkey) { + throw new Error(`${fnTag}, clientGatewayPubkey does not match`); + } + + if (sessionData.serverGatewayPubkey != request.common.serverGatewayPubkey) { + throw new Error(`${fnTag}, serverGatewayPubkey does not match`); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + request.common, + request.common.clientGatewayPubkey, + ) + ) { + throw new Error(`${fnTag}, message signature verification failed`); + } + + this.log.info(`CommitPreparationRequestMessage passed all checks.`); + } + + checkCommitFinalAssertionRequestMessage( + request: CommitFinalAssertionRequestMessage, + gateway: SATPGateway, + ): void { + const fnTag = `${this.className}#checkCommitFinalAssertionRequestMessage()`; + + if (request.common == undefined) { + throw new Error(`${fnTag}, message common body is missing`); + } + + if (request.common.version != SATP_VERSION) { + throw new Error(`${fnTag}, message version is not ${SATP_VERSION}`); + } + + if (request.common.messageType != MessageType.COMMIT_FINAL) { + throw new Error(`${fnTag}, message type is not COMMIT_FINAL`); + } + + const sessionData = gateway.getSession(request.common.sessionId); + + if (sessionData == undefined) { + throw new Error( + `${fnTag}, session data not found for session id ${request.common.sessionId}`, + ); + } + + if ( + sessionData.hashes == undefined || + sessionData.hashes.stage3 == undefined || + sessionData.hashes.stage3.commitReadyResponseMessageHash == undefined || + sessionData.lastSequenceNumber == undefined || + sessionData.version == undefined || + sessionData.signatures == undefined + ) { + throw new Error( + `${fnTag}, session data not loaded correctly ${request.common.sessionId}`, + ); + } + + if ( + sessionData.lastSequenceNumber + BigInt(1) != + request.common.sequenceNumber + ) { + throw new Error(`${fnTag}, sequenceNumber does not match`); + } + + if ( + sessionData.hashes.stage3.commitReadyResponseMessageHash != + request.common.hashPreviousMessage + ) { + throw new Error(`${fnTag}, hashPreviousMessage does not match`); + } + + if (sessionData.clientGatewayPubkey != request.common.clientGatewayPubkey) { + throw new Error(`${fnTag}, clientGatewayPubkey does not match`); + } + + if (sessionData.serverGatewayPubkey != request.common.serverGatewayPubkey) { + throw new Error(`${fnTag}, serverGatewayPubkey does not match`); + } + + if ( + !verifySignature( + gateway.gatewaySigner, + request.common, + request.common.clientGatewayPubkey, + ) + ) { + throw new Error(`${fnTag}, message signature verification failed`); + } + + if (request.burnAssertionClaim == undefined) { + throw new Error(`${fnTag}, mintAssertionClaims is missing`); + } + + this.log.info(`CommitFinalAssertionRequestMessage passed all checks.`); + } +} 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 index e69de29bb2..69c7d8b514 100644 --- 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 @@ -0,0 +1,3 @@ +export class SatpStage0 { + public static readonly CLASS_NAME = "SatpStage0"; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1-service.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1-service.ts new file mode 100644 index 0000000000..516e2dcba4 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage1-service.ts @@ -0,0 +1,33 @@ +import { ConnectRouter, HandlerContext } from "@connectrpc/connect"; + +import { SatpStage1Service } from "../../generated/proto/cacti/satp/v02/stage_1_connect"; +import { + TransferCommenceRequestMessage, + TransferCommenceResponseMessage, + TransferProposalReceiptRejectMessage, + TransferProposalRequestMessage, +} from "../../generated/proto/cacti/satp/v02/stage_1_pb"; + +export default (router: ConnectRouter) => + router.service(SatpStage1Service, { + async transferProposal( + req: TransferProposalRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new TransferProposalReceiptRejectMessage({}); + }, + async transferCommence( + req: TransferCommenceRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new TransferCommenceResponseMessage({}); + }, + }); 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 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2-service.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2-service.ts new file mode 100644 index 0000000000..33983eabce --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage2-service.ts @@ -0,0 +1,20 @@ +import { ConnectRouter, HandlerContext } from "@connectrpc/connect"; +import { SatpStage2Service } from "../../generated/proto/cacti/satp/v02/stage_2_connect"; +import { + LockAssertionReceiptMessage, + LockAssertionRequestMessage, +} from "../../generated/proto/cacti/satp/v02/stage_2_pb"; + +export default (router: ConnectRouter) => + router.service(SatpStage2Service, { + async lockAssertion( + req: LockAssertionRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new LockAssertionReceiptMessage({}); + }, + }); 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 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3-service.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3-service.ts new file mode 100644 index 0000000000..2639f01f0f --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3-service.ts @@ -0,0 +1,44 @@ +import { ConnectRouter, HandlerContext } from "@connectrpc/connect"; +import { SatpStage3Service } from "../../generated/proto/cacti/satp/v02/stage_3_connect"; +import { + CommitFinalAcknowledgementReceiptResponseMessage, + CommitFinalAssertionRequestMessage, + CommitPreparationRequestMessage, + CommitReadyResponseMessage, + TransferCompleteRequestMessage, +} from "../../generated/proto/cacti/satp/v02/stage_3_pb"; +import { Empty } from "@bufbuild/protobuf"; + +export default (router: ConnectRouter) => + router.service(SatpStage3Service, { + async commitPreparation( + req: CommitPreparationRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new CommitReadyResponseMessage({}); + }, + async commitFinalAssertion( + req: CommitFinalAssertionRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new CommitFinalAcknowledgementReceiptResponseMessage({}); + }, + async transferComplete( + req: TransferCompleteRequestMessage, + context: HandlerContext, + ) { + console.log("Received request", req, context); + + //todo + + return new Empty({}); + }, + }); 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 deleted file mode 100644 index 991aa1a51e..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/stage3.ts +++ /dev/null @@ -1 +0,0 @@ - \ 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 deleted file mode 100644 index 0cb18dc834..0000000000 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/stage-services/test-services.ts +++ /dev/null @@ -1,14 +0,0 @@ -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 index 6c33f0ac0b..b952bd6185 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/core/types.ts @@ -1,6 +1,7 @@ -import { Secp256k1Keys, LogLevelDesc } from "@hyperledger/cactus-common"; +import { LogLevelDesc } from "@hyperledger/cactus-common"; import { ValidatorOptions } from "class-validator"; import { BLODispatcher } from "../blo/dispatcher"; +import { ISignerKeyPairs } from "@hyperledger/cactus-common/src/main/typescript/signer-key-pairs"; export enum CurrentDrafts { Core = "Core", @@ -43,13 +44,14 @@ export type GatewayIdentity = { proofID?: string; gatewayServerPort?: number; gatewayClientPort?: number; + gatewayGrpcPort?: number; address?: Address; }; export interface SATPGatewayConfig { gid?: GatewayIdentity; logLevel?: LogLevelDesc; - keys?: Secp256k1Keys; + keyPair?: ISignerKeyPairs; environment?: "development" | "production"; enableOpenAPI?: boolean; validationOptions?: ValidatorOptions; @@ -68,3 +70,18 @@ export function isOfType( ): obj is T { return obj instanceof type; } + +export interface LocalLog { + sessionID: string; + type: string; + key?: string; + operation: string; + timestamp?: string; + data: string; +} +export interface RemoteLog { + key: string; + hash: string; + signature: string; + signerPubKey: string; +} 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 index 2191fc0da2..f983574a62 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-refactor.ts @@ -4,6 +4,8 @@ import { Checks, LoggerProvider, ILoggerOptions, + JsObjectSigner, + IJsObjectSignerOptions, } from "@hyperledger/cactus-common"; import { v4 as uuidv4 } from "uuid"; @@ -26,15 +28,22 @@ import { import { GatewayOrchestrator } from "./gol/gateway-orchestrator"; export { SATPGatewayConfig }; import express, { Express } from "express"; -import { expressConnectMiddleware } from "@connectrpc/connect-express"; import http from "http"; import { configureRoutes } from "./web-services/router"; import { DEFAULT_PORT_GATEWAY_CLIENT, + DEFAULT_PORT_GATEWAY_GRPC, DEFAULT_PORT_GATEWAY_SERVER, } from "./core/constants"; import { BLODispatcher, BLODispatcherOptions } from "./blo/dispatcher"; - +import { SessionData } from "./generated/proto/cacti/satp/v02/common/session_pb"; +import { expressConnectMiddleware } from "@connectrpc/connect-express"; +import { bufArray2HexStr } from "./gateway-utils"; +import { COREDispatcher } from "./core/dispatcher"; +import { + ILocalLogRepository, + IRemoteLogRepository, +} from "./repository/interfaces/repository"; export class SATPGateway { // todo more checks; example port from config is between 3000 and 9000 @IsDefined() @@ -60,9 +69,20 @@ export class SATPGateway { private BLOApplication?: Express; private BLOServer?: http.Server; private BLODispatcher?: BLODispatcher; + private gRPCServer?: http.Server; + private gRPCApplication?: Express; + private COREDispatcher?: COREDispatcher; + + private objectSigner: JsObjectSigner; // TODO!: add logic to manage sessions (parallelization, user input, freeze, unfreeze, rollback, recovery) - // private sessions: Map = new Map(); + private supportedDltIDs: SupportedGatewayImplementations[]; + private sessions: Map = new Map(); + private _pubKey: string; + private _privKey: string; + + public localRepository?: ILocalLogRepository; + public remoteRepository?: IRemoteLogRepository; constructor(public readonly options: SATPGatewayConfig) { const fnTag = `${this.label}#constructor()`; @@ -77,6 +97,21 @@ export class SATPGateway { this.logger = LoggerProvider.getOrCreate(logOptions); this.logger.info("Initializing Gateway Coordinator"); + if (this.config.keyPair == undefined) { + throw new Error("Key pair is undefined"); + } + + this._pubKey = bufArray2HexStr(this.config.keyPair.publicKey); + this._privKey = bufArray2HexStr(this.config.keyPair.privateKey); + + this.logger.info(`Gateway's public key: ${this._pubKey}`); + + const objectSignerOptions: IJsObjectSignerOptions = { + privateKey: this._privKey, + logLevel: "debug", + }; + this.objectSigner = new JsObjectSigner(objectSignerOptions); + if (options.enableOpenAPI) { this.setupOpenAPI(); } @@ -95,6 +130,8 @@ export class SATPGateway { instanceId: this.config.gid!.id, }; + this.supportedDltIDs = this.config.gid!.supportedChains; + if (!this.config.gid || !dispatcherOps.instanceId) { throw new Error("Invalid configuration"); } @@ -102,6 +139,30 @@ export class SATPGateway { this.BLODispatcher = new BLODispatcher(dispatcherOps); } + public getSessions(): Map { + return this.sessions; + } + + public getSession(sessionId: string): SessionData | undefined { + return this.sessions.get(sessionId); + } + + public getSupportedDltIDs(): string[] { + return this.supportedDltIDs; + } + + public addSession(sessionId: string, sessionData: SessionData): void { + this.sessions.set(sessionId, sessionData); + } + + public get gatewaySigner(): JsObjectSigner { + return this.objectSigner; + } + + public get pubKey(): string { + return this._pubKey; + } + // todo load docs for gateway coordinator and expose them in a http gatewayApplication setupOpenAPI(): void { const fnTag = `${this.label}#setupOpenAPI()`; @@ -124,8 +185,8 @@ export class SATPGateway { static ProcessGatewayCoordinatorConfig( pluginOptions: SATPGatewayConfig, ): SATPGatewayConfig { - if (!pluginOptions.keys) { - pluginOptions.keys = Secp256k1Keys.generateKeyPairsBuffer(); + if (!pluginOptions.keyPair) { + pluginOptions.keyPair = Secp256k1Keys.generateKeyPairsBuffer(); } const id = uuidv4(); @@ -217,13 +278,57 @@ export class SATPGateway { this.logger.trace(`Entering ${fnTag}`); await Promise.all([ - // TODO! need to add TLS support for Connect and gRPC to work + // grpc server does not start correctly + // this.startupGRPCServer(), this.startupGatewayServer(), this.startupBOLServer(), ]); this.logger.info("Both GatewayServer and BLOServer have started"); } + + async startupGRPCServer(): Promise { + const fnTag = `${this.label}#startupGRPCServer()`; + this.logger.trace(`Entering ${fnTag}`); + this.logger.info("Starting gRPC server"); + const port = this.options.gid?.gatewayGrpcPort ?? DEFAULT_PORT_GATEWAY_GRPC; + + return new Promise(async (resolve, reject) => { + if (this.gRPCApplication || !this.gRPCServer) { + if (!this.COREDispatcher) { + throw new Error("COREDispatcher is not defined"); + } + + this.gRPCApplication = express(); + + try { + const gRPCServices = await this.COREDispatcher.getOrCreateServices(); + for (const service of gRPCServices) { + this.logger.debug(`Registering web service: ${service.getPath()}`); + await service.registerExpress(this.COREDispatcher); + } + } catch (error) { + throw new Error(`Failed to register web services: ${error}`); + } + + this.gRPCServer = http.createServer(this.gRPCApplication); + + this.gRPCServer.listen(port, () => { + this.logger.info(`gRPC server started and listening on port ${port}`); + resolve(); + }); + + this.gRPCServer.on("error", (error) => { + this.logger.error(`gRPC server failed to start: ${error}`); + reject(error); + }); + } else { + this.logger.warn("Server already running"); + resolve(); + } + }); + } + async startupGatewayServer(): Promise { const fnTag = `${this.label}#startupGatewayServer()`; this.logger.trace(`Entering ${fnTag}`); @@ -442,6 +547,9 @@ export class SATPGateway { const fnTag = `${this.label}#getGatewaySeeds()`; this.logger.debug(`Entering ${fnTag}`); + this.logger.info("Shutting down Node server - gRPC"); + await this.shutdownGRPCServer(); + this.logger.info("Shutting down Node server - Gateway"); await this.shutdownGatewayServer(); @@ -498,4 +606,22 @@ export class SATPGateway { this.logger.warn("Server is not running."); } } + + private async shutdownGRPCServer(): Promise { + const fnTag = `${this.label}#shutdownGRPCServer()`; + this.logger.debug(`Entering ${fnTag}`); + if (this.gRPCServer) { + try { + await this.gRPCServer.close(); + this.gRPCServer = undefined; + this.logger.info("Server shut down"); + } catch (error) { + this.logger.error( + `Error shutting down the gatewayApplication: ${error}`, + ); + } + } else { + this.logger.warn("Server is not running."); + } + } } diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-utils.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-utils.ts new file mode 100644 index 0000000000..22ee13a58f --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway-utils.ts @@ -0,0 +1,104 @@ +import { JsObjectSigner } from "@hyperledger/cactus-common"; +import { LocalLog, RemoteLog } from "./core/types"; +import { SATPGateway } from "./gateway-refactor"; +import { SHA256 } from "crypto-js"; + +export function bufArray2HexStr(array: Uint8Array): string { + return Buffer.from(array).toString("hex"); +} + +export function sign(objectSigner: JsObjectSigner, msg: string): Uint8Array { + return objectSigner.sign(msg); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function verifySignature( + objectSigner: JsObjectSigner, + obj: any, + pubKey: string, +): boolean { + const sourceSignature = new Uint8Array(Buffer.from(obj.signature, "hex")); + const sourcePubkey = new Uint8Array(Buffer.from(pubKey, "hex")); + + const signature = obj.signature; + obj.signature = ""; + if ( + !objectSigner.verify(JSON.stringify(obj), sourceSignature, sourcePubkey) + ) { + return false; + } + + obj.signature = signature; + return true; +} + +export async function storeLog( + gateway: SATPGateway, + localLog: LocalLog, +): Promise { + localLog.key = getSatpLogKey( + localLog.sessionID, + localLog.type, + localLog.operation, + ); + localLog.timestamp = Date.now().toString(); + + await storeInDatabase(gateway, localLog); + + // Keep the order consistent with the order of the fields in the table + // so that the hash matches when retrieving from the database + const hash = SHA256( + JSON.stringify(localLog, [ + "sessionID", + "type", + "key", + "operation", + "timestamp", + "data", + ]), + ).toString(); + + await storeRemoteLog(gateway, localLog.key, hash); +} + +export async function storeInDatabase( + gateway: SATPGateway, + LocalLog: LocalLog, +) { + await gateway.localRepository?.create(LocalLog); +} + +export async function storeRemoteLog( + gateway: SATPGateway, + key: string, + hash: string, +) { + const fnTag = `${gateway.label}#storeInDatabase()`; + + const remoteLog: RemoteLog = { + key: key, + hash: hash, + signature: "", + signerPubKey: gateway.pubKey, + }; + + remoteLog.signature = bufArray2HexStr( + sign(gateway.gatewaySigner, JSON.stringify(remoteLog)), + ); + + const response = await gateway.remoteRepository?.create(remoteLog); + + if (response.status < 200 && response.status > 299) { + throw new Error( + `${fnTag}, got response ${response.status} when logging to remote`, + ); + } +} + +export function getSatpLogKey( + sessionID: string, + type: string, + operation: string, +): string { + return `${sessionID}-${type}-${operation}`; +} diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/common_messages_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/common_messages_pb.ts new file mode 100644 index 0000000000..be34c080ca --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/common/common_messages_pb.ts @@ -0,0 +1,1507 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/common/common_messages.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, protoInt64 } 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" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.MessageType + */ +export enum MessageType { + /** + * @generated from enum value: MESSAGE_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_PROPOSAL = 1; + */ + INIT_PROPOSAL = 1, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_RECEIPT = 2; + */ + INIT_RECEIPT = 2, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_REJECT = 3; + */ + INIT_REJECT = 3, + + /** + * @generated from enum value: MESSAGE_TYPE_TRANSFER_COMMENCE_REQUEST = 4; + */ + TRANSFER_COMMENCE_REQUEST = 4, + + /** + * @generated from enum value: MESSAGE_TYPE_TRANSFER_COMMENCE_RESPONSE = 5; + */ + TRANSFER_COMMENCE_RESPONSE = 5, + + /** + * @generated from enum value: MESSAGE_TYPE_LOCK_ASSERT = 6; + */ + LOCK_ASSERT = 6, + + /** + * @generated from enum value: MESSAGE_TYPE_ASSERTION_RECEIPT = 7; + */ + ASSERTION_RECEIPT = 7, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_PREPARE = 8; + */ + COMMIT_PREPARE = 8, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_READY = 9; + */ + COMMIT_READY = 9, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_FINAL = 10; + */ + COMMIT_FINAL = 10, + + /** + * @generated from enum value: MESSAGE_TYPE_ACK_COMMIT_FINAL = 11; + */ + ACK_COMMIT_FINAL = 11, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_TRANSFER_COMPLETE = 12; + */ + COMMIT_TRANSFER_COMPLETE = 12, +} +// Retrieve enum metadata with: proto3.getEnumType(MessageType) +proto3.util.setEnumType(MessageType, "cacti.satp.v02.common.MessageType", [ + { no: 0, name: "MESSAGE_TYPE_UNSPECIFIED" }, + { no: 1, name: "MESSAGE_TYPE_INIT_PROPOSAL" }, + { no: 2, name: "MESSAGE_TYPE_INIT_RECEIPT" }, + { no: 3, name: "MESSAGE_TYPE_INIT_REJECT" }, + { no: 4, name: "MESSAGE_TYPE_TRANSFER_COMMENCE_REQUEST" }, + { no: 5, name: "MESSAGE_TYPE_TRANSFER_COMMENCE_RESPONSE" }, + { no: 6, name: "MESSAGE_TYPE_LOCK_ASSERT" }, + { no: 7, name: "MESSAGE_TYPE_ASSERTION_RECEIPT" }, + { no: 8, name: "MESSAGE_TYPE_COMMIT_PREPARE" }, + { no: 9, name: "MESSAGE_TYPE_COMMIT_READY" }, + { no: 10, name: "MESSAGE_TYPE_COMMIT_FINAL" }, + { no: 11, name: "MESSAGE_TYPE_ACK_COMMIT_FINAL" }, + { no: 12, name: "MESSAGE_TYPE_COMMIT_TRANSFER_COMPLETE" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.CredentialProfile + */ +export enum CredentialProfile { + /** + * @generated from enum value: CREDENTIAL_PROFILE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_SAML = 1; + */ + SAML = 1, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_OAUTH = 2; + */ + OAUTH = 2, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_X509 = 3; + */ + X509 = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(CredentialProfile) +proto3.util.setEnumType(CredentialProfile, "cacti.satp.v02.common.CredentialProfile", [ + { no: 0, name: "CREDENTIAL_PROFILE_UNSPECIFIED" }, + { no: 1, name: "CREDENTIAL_PROFILE_SAML" }, + { no: 2, name: "CREDENTIAL_PROFILE_OAUTH" }, + { no: 3, name: "CREDENTIAL_PROFILE_X509" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.SignatureAlgorithm + */ +export enum SignatureAlgorithm { + /** + * @generated from enum value: SIGNATURE_ALGORITHM_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_RSA = 1; + */ + RSA = 1, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_ECDSA = 2; + */ + ECDSA = 2, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_DSA = 3; + */ + DSA = 3, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_HMAC = 4; + */ + HMAC = 4, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_RSASSA_PSS = 5; + */ + RSASSA_PSS = 5, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_EDDSA = 6; + */ + EDDSA = 6, +} +// Retrieve enum metadata with: proto3.getEnumType(SignatureAlgorithm) +proto3.util.setEnumType(SignatureAlgorithm, "cacti.satp.v02.common.SignatureAlgorithm", [ + { no: 0, name: "SIGNATURE_ALGORITHM_UNSPECIFIED" }, + { no: 1, name: "SIGNATURE_ALGORITHM_RSA" }, + { no: 2, name: "SIGNATURE_ALGORITHM_ECDSA" }, + { no: 3, name: "SIGNATURE_ALGORITHM_DSA" }, + { no: 4, name: "SIGNATURE_ALGORITHM_HMAC" }, + { no: 5, name: "SIGNATURE_ALGORITHM_RSASSA_PSS" }, + { no: 6, name: "SIGNATURE_ALGORITHM_EDDSA" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.LockType + */ +export enum LockType { + /** + * @generated from enum value: LOCK_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: LOCK_TYPE_FAUCET = 1; + */ + FAUCET = 1, + + /** + * @generated from enum value: LOCK_TYPE_TIMELOCK = 2; + */ + TIMELOCK = 2, + + /** + * @generated from enum value: LOCK_TYPE_HASHLOCK = 3; + */ + HASHLOCK = 3, + + /** + * @generated from enum value: LOCK_TYPE_HASHLOCKTIME = 4; + */ + HASHLOCKTIME = 4, + + /** + * @generated from enum value: LOCK_TYPE_MULTICLAIM = 5; + */ + MULTICLAIM = 5, + + /** + * @generated from enum value: LOCK_TYPE_DESTROYBURN = 6; + */ + DESTROYBURN = 6, +} +// Retrieve enum metadata with: proto3.getEnumType(LockType) +proto3.util.setEnumType(LockType, "cacti.satp.v02.common.LockType", [ + { no: 0, name: "LOCK_TYPE_UNSPECIFIED" }, + { no: 1, name: "LOCK_TYPE_FAUCET" }, + { no: 2, name: "LOCK_TYPE_TIMELOCK" }, + { no: 3, name: "LOCK_TYPE_HASHLOCK" }, + { no: 4, name: "LOCK_TYPE_HASHLOCKTIME" }, + { no: 5, name: "LOCK_TYPE_MULTICLAIM" }, + { no: 6, name: "LOCK_TYPE_DESTROYBURN" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.Error + */ +export enum Error { + /** + * @generated from enum value: ERROR_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE = 1; + */ + BADLY_FORMATED_MESSAGE = 1, + + /** + * @generated from enum value: ERROR_INCORRECT_PARAMETER = 2; + */ + INCORRECT_PARAMETER = 2, + + /** + * @generated from enum value: ERROR_ACK_MISMATCH = 3; + */ + ACK_MISMATCH = 3, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_CLAIM = 4; + */ + BADLY_FORMATED_MESSAGE_CLAIM = 4, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_BAD_SIGNATURE = 5; + */ + BADLY_FORMATED_MESSAGE_BAD_SIGNATURE = 5, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID = 6; + */ + BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID = 6, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES = 7; + */ + BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES = 7, + + /** + * @generated from enum value: ERROR_EXPIRED_SIGNING_KEY_CERTIFICATE = 8; + */ + EXPIRED_SIGNING_KEY_CERTIFICATE = 8, + + /** + * @generated from enum value: ERROR_EXPIRED_CLAIM = 9; + */ + EXPIRED_CLAIM = 9, + + /** + * @generated from enum value: ERROR_INCORRERCT_PARAMETER = 10; + */ + INCORRERCT_PARAMETER = 10, + + /** + * @generated from enum value: ERROR_MESSAGE_OUT_OF_SEQUENCE = 11; + */ + MESSAGE_OUT_OF_SEQUENCE = 11, +} +// Retrieve enum metadata with: proto3.getEnumType(Error) +proto3.util.setEnumType(Error, "cacti.satp.v02.common.Error", [ + { no: 0, name: "ERROR_UNSPECIFIED" }, + { no: 1, name: "ERROR_BADLY_FORMATED_MESSAGE" }, + { no: 2, name: "ERROR_INCORRECT_PARAMETER" }, + { no: 3, name: "ERROR_ACK_MISMATCH" }, + { no: 4, name: "ERROR_BADLY_FORMATED_MESSAGE_CLAIM" }, + { no: 5, name: "ERROR_BADLY_FORMATED_MESSAGE_BAD_SIGNATURE" }, + { no: 6, name: "ERROR_BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID" }, + { no: 7, name: "ERROR_BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES" }, + { no: 8, name: "ERROR_EXPIRED_SIGNING_KEY_CERTIFICATE" }, + { no: 9, name: "ERROR_EXPIRED_CLAIM" }, + { no: 10, name: "ERROR_INCORRERCT_PARAMETER" }, + { no: 11, name: "ERROR_MESSAGE_OUT_OF_SEQUENCE" }, +]); + +/** + * 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); + } +} + +/** + * @generated from message cacti.satp.v02.common.TransferClaims + */ +export class TransferClaims extends Message { + /** + * @generated from field: string digital_asset_id = 1; + */ + digitalAssetId = ""; + + /** + * @generated from field: string asset_profile_id = 2; + */ + assetProfileId = ""; + + /** + * @generated from field: string verified_originator_entity_id = 3; + */ + verifiedOriginatorEntityId = ""; + + /** + * @generated from field: string verified_beneficiary_entity_id = 4; + */ + verifiedBeneficiaryEntityId = ""; + + /** + * @generated from field: string originator_pubkey = 5; + */ + originatorPubkey = ""; + + /** + * @generated from field: string beneficiary_pubkey = 6; + */ + beneficiaryPubkey = ""; + + /** + * @generated from field: string sender_gateway_network_id = 7; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: string recipient_gateway_network_id = 8; + */ + recipientGatewayNetworkId = ""; + + /** + * @generated from field: string client_gateway_pubkey = 9; + */ + clientGatewayPubkey = ""; + + /** + * @generated from field: string server_gateway_pubkey = 10; + */ + serverGatewayPubkey = ""; + + /** + * @generated from field: string sender_gateway_owner_id = 11; + */ + senderGatewayOwnerId = ""; + + /** + * @generated from field: string receiver_gateway_owner_id = 12; + */ + receiverGatewayOwnerId = ""; + + /** + * @generated from field: uint32 max_retries = 13; + */ + maxRetries = 0; + + /** + * @generated from field: uint64 max_timeout = 14; + */ + maxTimeout = protoInt64.zero; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.TransferClaims"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "digital_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "asset_profile_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "verified_originator_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "verified_beneficiary_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "originator_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "beneficiary_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "recipient_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "client_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "server_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "sender_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "receiver_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 13, name: "max_retries", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 14, name: "max_timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferClaims { + return new TransferClaims().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferClaims { + return new TransferClaims().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferClaims { + return new TransferClaims().fromJsonString(jsonString, options); + } + + static equals(a: TransferClaims | PlainMessage | undefined, b: TransferClaims | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferClaims, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.TransferClaimsFormat + */ +export class TransferClaimsFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.TransferClaimsFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromJsonString(jsonString, options); + } + + static equals(a: TransferClaimsFormat | PlainMessage | undefined, b: TransferClaimsFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferClaimsFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Permissions + */ +export class Permissions extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Permissions"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Permissions { + return new Permissions().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Permissions { + return new Permissions().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Permissions { + return new Permissions().fromJsonString(jsonString, options); + } + + static equals(a: Permissions | PlainMessage | undefined, b: Permissions | PlainMessage | undefined): boolean { + return proto3.util.equals(Permissions, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.SubsequentCalls + */ +export class SubsequentCalls extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.SubsequentCalls"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromJsonString(jsonString, options); + } + + static equals(a: SubsequentCalls | PlainMessage | undefined, b: SubsequentCalls | PlainMessage | undefined): boolean { + return proto3.util.equals(SubsequentCalls, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.History + */ +export class History extends Message { + /** + * @generated from field: repeated cacti.satp.v02.common.Transaction transactions = 1; + */ + transactions: Transaction[] = []; + + /** + * @generated from field: repeated cacti.satp.v02.common.ActionCategory action_categories = 2; + */ + actionCategories: ActionCategory[] = []; + + /** + * @generated from field: string origin = 3; + */ + origin = ""; + + /** + * @generated from field: string destination = 4; + */ + destination = ""; + + /** + * @generated from field: string balance = 5; + */ + balance = ""; + + /** + * @generated from field: cacti.satp.v02.common.STATUS status = 6; + */ + status = STATUS.STATUS_UNSPECIFIED; + + /** + * @generated from field: cacti.satp.v02.common.ApplicationParameters application_parameters = 7; + */ + applicationParameters?: ApplicationParameters; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.History"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "transactions", kind: "message", T: Transaction, repeated: true }, + { no: 2, name: "action_categories", kind: "message", T: ActionCategory, repeated: true }, + { no: 3, name: "origin", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "destination", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "balance", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "status", kind: "enum", T: proto3.getEnumType(STATUS) }, + { no: 7, name: "application_parameters", kind: "message", T: ApplicationParameters }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): History { + return new History().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): History { + return new History().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): History { + return new History().fromJsonString(jsonString, options); + } + + static equals(a: History | PlainMessage | undefined, b: History | PlainMessage | undefined): boolean { + return proto3.util.equals(History, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ActionCategory + */ +export class ActionCategory extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ActionCategory"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActionCategory { + return new ActionCategory().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActionCategory { + return new ActionCategory().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActionCategory { + return new ActionCategory().fromJsonString(jsonString, options); + } + + static equals(a: ActionCategory | PlainMessage | undefined, b: ActionCategory | PlainMessage | undefined): boolean { + return proto3.util.equals(ActionCategory, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Transaction + */ +export class Transaction extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Transaction"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Transaction { + return new Transaction().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Transaction { + return new Transaction().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Transaction { + return new Transaction().fromJsonString(jsonString, options); + } + + static equals(a: Transaction | PlainMessage | undefined, b: Transaction | PlainMessage | undefined): boolean { + return proto3.util.equals(Transaction, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ApplicationParameters + */ +export class ApplicationParameters extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ApplicationParameters"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromJsonString(jsonString, options); + } + + static equals(a: ApplicationParameters | PlainMessage | undefined, b: ApplicationParameters | PlainMessage | undefined): boolean { + return proto3.util.equals(ApplicationParameters, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.NetworkCapabilities + */ +export class NetworkCapabilities extends Message { + /** + * @generated from field: string sender_gateway_network_id = 1; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: cacti.satp.v02.common.SignatureAlgorithm signature_algorithm = 2; + */ + signatureAlgorithm = SignatureAlgorithm.UNSPECIFIED; + + /** + * @generated from field: repeated cacti.satp.v02.common.SignatureAlgorithm supported_signature_algorithms = 3; + */ + supportedSignatureAlgorithms: SignatureAlgorithm[] = []; + + /** + * @generated from field: cacti.satp.v02.common.LockType lock_type = 4; + */ + lockType = LockType.UNSPECIFIED; + + /** + * @generated from field: uint64 lock_expiration_time = 5; + */ + lockExpirationTime = protoInt64.zero; + + /** + * @generated from field: cacti.satp.v02.common.Permissions permissions = 6; + */ + permissions?: Permissions; + + /** + * @generated from field: string developer_urn = 7; + */ + developerUrn = ""; + + /** + * @generated from field: cacti.satp.v02.common.CredentialProfile credential_profile = 8; + */ + credentialProfile = CredentialProfile.UNSPECIFIED; + + /** + * @generated from field: string application_profile = 9; + */ + applicationProfile = ""; + + /** + * @generated from field: string logging_profile = 10; + */ + loggingProfile = ""; + + /** + * @generated from field: string access_control_profile = 11; + */ + accessControlProfile = ""; + + /** + * @generated from field: cacti.satp.v02.common.SubsequentCalls subsequent_calls = 12; + */ + subsequentCalls?: SubsequentCalls; + + /** + * @generated from field: repeated cacti.satp.v02.common.History history = 13; + */ + history: History[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.NetworkCapabilities"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "signature_algorithm", kind: "enum", T: proto3.getEnumType(SignatureAlgorithm) }, + { no: 3, name: "supported_signature_algorithms", kind: "enum", T: proto3.getEnumType(SignatureAlgorithm), repeated: true }, + { no: 4, name: "lock_type", kind: "enum", T: proto3.getEnumType(LockType) }, + { no: 5, name: "lock_expiration_time", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "permissions", kind: "message", T: Permissions }, + { no: 7, name: "developer_urn", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "credential_profile", kind: "enum", T: proto3.getEnumType(CredentialProfile) }, + { no: 9, name: "application_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "logging_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "access_control_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "subsequent_calls", kind: "message", T: SubsequentCalls }, + { no: 13, name: "history", kind: "message", T: History, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromJsonString(jsonString, options); + } + + static equals(a: NetworkCapabilities | PlainMessage | undefined, b: NetworkCapabilities | PlainMessage | undefined): boolean { + return proto3.util.equals(NetworkCapabilities, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.CommonSatp + */ +export class CommonSatp extends Message { + /** + * @generated from field: string version = 1; + */ + version = ""; + + /** + * @generated from field: cacti.satp.v02.common.MessageType message_type = 2; + */ + messageType = MessageType.UNSPECIFIED; + + /** + * @generated from field: string session_id = 3; + */ + sessionId = ""; + + /** + * @generated from field: string transfer_context_id = 4; + */ + transferContextId = ""; + + /** + * @generated from field: uint64 sequence_number = 5; + */ + sequenceNumber = protoInt64.zero; + + /** + * @generated from field: string resource_url = 6; + */ + resourceUrl = ""; + + /** + * @generated from field: cacti.satp.v02.common.ActionResponse action_response = 8; + */ + actionResponse?: ActionResponse; + + /** + * @generated from field: string credential_block = 10; + */ + credentialBlock = ""; + + /** + * @generated from field: cacti.satp.v02.common.PayloadProfile payload_profile = 11; + */ + payloadProfile?: PayloadProfile; + + /** + * @generated from field: cacti.satp.v02.common.Payload payload = 13; + */ + payload?: Payload; + + /** + * @generated from field: string payload_hash = 14; + */ + payloadHash = ""; + + /** + * @generated from field: string signature = 15; + */ + signature = ""; + + /** + * @generated from field: string client_gateway_pubkey = 16; + */ + clientGatewayPubkey = ""; + + /** + * @generated from field: string server_gateway_pubkey = 17; + */ + serverGatewayPubkey = ""; + + /** + * @generated from field: string hash_previous_message = 18; + */ + hashPreviousMessage = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.CommonSatp"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) }, + { no: 3, name: "session_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "transfer_context_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "sequence_number", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "resource_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "action_response", kind: "message", T: ActionResponse }, + { no: 10, name: "credential_block", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "payload_profile", kind: "message", T: PayloadProfile }, + { no: 13, name: "payload", kind: "message", T: Payload }, + { no: 14, name: "payload_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 15, name: "signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 16, name: "client_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 17, name: "server_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 18, name: "hash_previous_message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommonSatp { + return new CommonSatp().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommonSatp { + return new CommonSatp().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommonSatp { + return new CommonSatp().fromJsonString(jsonString, options); + } + + static equals(a: CommonSatp | PlainMessage | undefined, b: CommonSatp | PlainMessage | undefined): boolean { + return proto3.util.equals(CommonSatp, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ActionResponse + */ +export class ActionResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ActionResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActionResponse { + return new ActionResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActionResponse { + return new ActionResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActionResponse { + return new ActionResponse().fromJsonString(jsonString, options); + } + + static equals(a: ActionResponse | PlainMessage | undefined, b: ActionResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ActionResponse, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.PayloadProfile + */ +export class PayloadProfile extends Message { + /** + * @generated from field: cacti.satp.v02.common.AssetProfile asset_profile = 1; + */ + assetProfile?: AssetProfile; + + /** + * @generated from field: string capabilities = 2; + */ + capabilities = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.PayloadProfile"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "asset_profile", kind: "message", T: AssetProfile }, + { no: 2, name: "capabilities", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PayloadProfile { + return new PayloadProfile().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PayloadProfile { + return new PayloadProfile().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PayloadProfile { + return new PayloadProfile().fromJsonString(jsonString, options); + } + + static equals(a: PayloadProfile | PlainMessage | undefined, b: PayloadProfile | PlainMessage | undefined): boolean { + return proto3.util.equals(PayloadProfile, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssetProfile + */ +export class AssetProfile extends Message { + /** + * @generated from field: string issuer = 1; + */ + issuer = ""; + + /** + * @generated from field: string asset_code = 2; + */ + assetCode = ""; + + /** + * @generated from field: string asset_code_type = 3; + */ + assetCodeType = ""; + + /** + * @generated from field: string issuance_date = 4; + */ + issuanceDate = ""; + + /** + * @generated from field: string expiration_date = 5; + */ + expirationDate = ""; + + /** + * @generated from field: string verification_end_point = 6; + */ + verificationEndPoint = ""; + + /** + * @generated from field: string digital_signature = 7; + */ + digitalSignature = ""; + + /** + * @generated from field: string prospectus_link = 8; + */ + prospectusLink = ""; + + /** + * @generated from field: repeated string key_information_link = 9; + */ + keyInformationLink: string[] = []; + + /** + * @generated from field: repeated string keywords = 10; + */ + keywords: string[] = []; + + /** + * @generated from field: repeated string transfer_restrictions = 11; + */ + transferRestrictions: string[] = []; + + /** + * @generated from field: repeated string ledger_requirements = 12; + */ + ledgerRequirements: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssetProfile"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "issuer", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "asset_code", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "asset_code_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "issuance_date", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "expiration_date", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "verification_end_point", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "digital_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "prospectus_link", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "key_information_link", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 10, name: "keywords", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 11, name: "transfer_restrictions", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 12, name: "ledger_requirements", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssetProfile { + return new AssetProfile().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssetProfile { + return new AssetProfile().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssetProfile { + return new AssetProfile().fromJsonString(jsonString, options); + } + + static equals(a: AssetProfile | PlainMessage | undefined, b: AssetProfile | PlainMessage | undefined): boolean { + return proto3.util.equals(AssetProfile, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Payload + */ +export class Payload extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Payload"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Payload { + return new Payload().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Payload { + return new Payload().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Payload { + return new Payload().fromJsonString(jsonString, options); + } + + static equals(a: Payload | PlainMessage | undefined, b: Payload | PlainMessage | undefined): boolean { + return proto3.util.equals(Payload, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.LockAssertionClaim + */ +export class LockAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.LockAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionClaim | PlainMessage | undefined, b: LockAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.LockAssertionFormat + */ +export class LockAssertionFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.LockAssertionFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionFormat | PlainMessage | undefined, b: LockAssertionFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MintAssertionClaims + */ +export class MintAssertionClaims extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MintAssertionClaims"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromJsonString(jsonString, options); + } + + static equals(a: MintAssertionClaims | PlainMessage | undefined, b: MintAssertionClaims | PlainMessage | undefined): boolean { + return proto3.util.equals(MintAssertionClaims, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MintAssertionClaimsFormat + */ +export class MintAssertionClaimsFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MintAssertionClaimsFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromJsonString(jsonString, options); + } + + static equals(a: MintAssertionClaimsFormat | PlainMessage | undefined, b: MintAssertionClaimsFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(MintAssertionClaimsFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.BurnAssertionClaim + */ +export class BurnAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.BurnAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: BurnAssertionClaim | PlainMessage | undefined, b: BurnAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(BurnAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.BurnAssertionClaimFormat + */ +export class BurnAssertionClaimFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.BurnAssertionClaimFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromJsonString(jsonString, options); + } + + static equals(a: BurnAssertionClaimFormat | PlainMessage | undefined, b: BurnAssertionClaimFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(BurnAssertionClaimFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssignmentAssertionClaim + */ +export class AssignmentAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssignmentAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: AssignmentAssertionClaim | PlainMessage | undefined, b: AssignmentAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(AssignmentAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssignmentAssertionClaimFormat + */ +export class AssignmentAssertionClaimFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssignmentAssertionClaimFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromJsonString(jsonString, options); + } + + static equals(a: AssignmentAssertionClaimFormat | PlainMessage | undefined, b: AssignmentAssertionClaimFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(AssignmentAssertionClaimFormat, a, b); + } +} + 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 index 38f10e65cc..9d7fd15f6d 100644 --- 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 @@ -4,7 +4,7 @@ // @ts-nocheck import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; -import { Message, proto3 } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; /** * @generated from enum cacti.satp.v02.common.STATUS @@ -32,6 +32,304 @@ proto3.util.setEnumType(STATUS, "cacti.satp.v02.common.STATUS", [ { no: 2, name: "STATUS_ERROR" }, ]); +/** + * @generated from enum cacti.satp.v02.common.MessageType + */ +export enum MessageType { + /** + * @generated from enum value: MESSAGE_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_PROPOSAL = 1; + */ + INIT_PROPOSAL = 1, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_RECEIPT = 2; + */ + INIT_RECEIPT = 2, + + /** + * @generated from enum value: MESSAGE_TYPE_INIT_REJECT = 3; + */ + INIT_REJECT = 3, + + /** + * @generated from enum value: MESSAGE_TYPE_TRANSFER_COMMENCE_REQUEST = 4; + */ + TRANSFER_COMMENCE_REQUEST = 4, + + /** + * @generated from enum value: MESSAGE_TYPE_TRANSFER_COMMENCE_RESPONSE = 5; + */ + TRANSFER_COMMENCE_RESPONSE = 5, + + /** + * @generated from enum value: MESSAGE_TYPE_LOCK_ASSERT = 6; + */ + LOCK_ASSERT = 6, + + /** + * @generated from enum value: MESSAGE_TYPE_ASSERTION_RECEIPT = 7; + */ + ASSERTION_RECEIPT = 7, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_PREPARE = 8; + */ + COMMIT_PREPARE = 8, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_READY = 9; + */ + COMMIT_READY = 9, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_FINAL = 10; + */ + COMMIT_FINAL = 10, + + /** + * @generated from enum value: MESSAGE_TYPE_ACK_COMMIT_FINAL = 11; + */ + ACK_COMMIT_FINAL = 11, + + /** + * @generated from enum value: MESSAGE_TYPE_COMMIT_TRANSFER_COMPLETE = 12; + */ + COMMIT_TRANSFER_COMPLETE = 12, +} +// Retrieve enum metadata with: proto3.getEnumType(MessageType) +proto3.util.setEnumType(MessageType, "cacti.satp.v02.common.MessageType", [ + { no: 0, name: "MESSAGE_TYPE_UNSPECIFIED" }, + { no: 1, name: "MESSAGE_TYPE_INIT_PROPOSAL" }, + { no: 2, name: "MESSAGE_TYPE_INIT_RECEIPT" }, + { no: 3, name: "MESSAGE_TYPE_INIT_REJECT" }, + { no: 4, name: "MESSAGE_TYPE_TRANSFER_COMMENCE_REQUEST" }, + { no: 5, name: "MESSAGE_TYPE_TRANSFER_COMMENCE_RESPONSE" }, + { no: 6, name: "MESSAGE_TYPE_LOCK_ASSERT" }, + { no: 7, name: "MESSAGE_TYPE_ASSERTION_RECEIPT" }, + { no: 8, name: "MESSAGE_TYPE_COMMIT_PREPARE" }, + { no: 9, name: "MESSAGE_TYPE_COMMIT_READY" }, + { no: 10, name: "MESSAGE_TYPE_COMMIT_FINAL" }, + { no: 11, name: "MESSAGE_TYPE_ACK_COMMIT_FINAL" }, + { no: 12, name: "MESSAGE_TYPE_COMMIT_TRANSFER_COMPLETE" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.CredentialProfile + */ +export enum CredentialProfile { + /** + * @generated from enum value: CREDENTIAL_PROFILE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_SAML = 1; + */ + SAML = 1, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_OAUTH = 2; + */ + OAUTH = 2, + + /** + * @generated from enum value: CREDENTIAL_PROFILE_X509 = 3; + */ + X509 = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(CredentialProfile) +proto3.util.setEnumType(CredentialProfile, "cacti.satp.v02.common.CredentialProfile", [ + { no: 0, name: "CREDENTIAL_PROFILE_UNSPECIFIED" }, + { no: 1, name: "CREDENTIAL_PROFILE_SAML" }, + { no: 2, name: "CREDENTIAL_PROFILE_OAUTH" }, + { no: 3, name: "CREDENTIAL_PROFILE_X509" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.SignatureAlgorithm + */ +export enum SignatureAlgorithm { + /** + * @generated from enum value: SIGNATURE_ALGORITHM_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_RSA = 1; + */ + RSA = 1, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_ECDSA = 2; + */ + ECDSA = 2, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_DSA = 3; + */ + DSA = 3, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_HMAC = 4; + */ + HMAC = 4, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_RSASSA_PSS = 5; + */ + RSASSA_PSS = 5, + + /** + * @generated from enum value: SIGNATURE_ALGORITHM_EDDSA = 6; + */ + EDDSA = 6, +} +// Retrieve enum metadata with: proto3.getEnumType(SignatureAlgorithm) +proto3.util.setEnumType(SignatureAlgorithm, "cacti.satp.v02.common.SignatureAlgorithm", [ + { no: 0, name: "SIGNATURE_ALGORITHM_UNSPECIFIED" }, + { no: 1, name: "SIGNATURE_ALGORITHM_RSA" }, + { no: 2, name: "SIGNATURE_ALGORITHM_ECDSA" }, + { no: 3, name: "SIGNATURE_ALGORITHM_DSA" }, + { no: 4, name: "SIGNATURE_ALGORITHM_HMAC" }, + { no: 5, name: "SIGNATURE_ALGORITHM_RSASSA_PSS" }, + { no: 6, name: "SIGNATURE_ALGORITHM_EDDSA" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.LockType + */ +export enum LockType { + /** + * @generated from enum value: LOCK_TYPE_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: LOCK_TYPE_FAUCET = 1; + */ + FAUCET = 1, + + /** + * @generated from enum value: LOCK_TYPE_TIMELOCK = 2; + */ + TIMELOCK = 2, + + /** + * @generated from enum value: LOCK_TYPE_HASHLOCK = 3; + */ + HASHLOCK = 3, + + /** + * @generated from enum value: LOCK_TYPE_HASHLOCKTIME = 4; + */ + HASHLOCKTIME = 4, + + /** + * @generated from enum value: LOCK_TYPE_MULTICLAIM = 5; + */ + MULTICLAIM = 5, + + /** + * @generated from enum value: LOCK_TYPE_DESTROYBURN = 6; + */ + DESTROYBURN = 6, +} +// Retrieve enum metadata with: proto3.getEnumType(LockType) +proto3.util.setEnumType(LockType, "cacti.satp.v02.common.LockType", [ + { no: 0, name: "LOCK_TYPE_UNSPECIFIED" }, + { no: 1, name: "LOCK_TYPE_FAUCET" }, + { no: 2, name: "LOCK_TYPE_TIMELOCK" }, + { no: 3, name: "LOCK_TYPE_HASHLOCK" }, + { no: 4, name: "LOCK_TYPE_HASHLOCKTIME" }, + { no: 5, name: "LOCK_TYPE_MULTICLAIM" }, + { no: 6, name: "LOCK_TYPE_DESTROYBURN" }, +]); + +/** + * @generated from enum cacti.satp.v02.common.Error + */ +export enum Error { + /** + * @generated from enum value: ERROR_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE = 1; + */ + BADLY_FORMATED_MESSAGE = 1, + + /** + * @generated from enum value: ERROR_INCORRECT_PARAMETER = 2; + */ + INCORRECT_PARAMETER = 2, + + /** + * @generated from enum value: ERROR_ACK_MISMATCH = 3; + */ + ACK_MISMATCH = 3, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_CLAIM = 4; + */ + BADLY_FORMATED_MESSAGE_CLAIM = 4, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_BAD_SIGNATURE = 5; + */ + BADLY_FORMATED_MESSAGE_BAD_SIGNATURE = 5, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID = 6; + */ + BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID = 6, + + /** + * @generated from enum value: ERROR_BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES = 7; + */ + BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES = 7, + + /** + * @generated from enum value: ERROR_EXPIRED_SIGNING_KEY_CERTIFICATE = 8; + */ + EXPIRED_SIGNING_KEY_CERTIFICATE = 8, + + /** + * @generated from enum value: ERROR_EXPIRED_CLAIM = 9; + */ + EXPIRED_CLAIM = 9, + + /** + * @generated from enum value: ERROR_INCORRERCT_PARAMETER = 10; + */ + INCORRERCT_PARAMETER = 10, + + /** + * @generated from enum value: ERROR_MESSAGE_OUT_OF_SEQUENCE = 11; + */ + MESSAGE_OUT_OF_SEQUENCE = 11, +} +// Retrieve enum metadata with: proto3.getEnumType(Error) +proto3.util.setEnumType(Error, "cacti.satp.v02.common.Error", [ + { no: 0, name: "ERROR_UNSPECIFIED" }, + { no: 1, name: "ERROR_BADLY_FORMATED_MESSAGE" }, + { no: 2, name: "ERROR_INCORRECT_PARAMETER" }, + { no: 3, name: "ERROR_ACK_MISMATCH" }, + { no: 4, name: "ERROR_BADLY_FORMATED_MESSAGE_CLAIM" }, + { no: 5, name: "ERROR_BADLY_FORMATED_MESSAGE_BAD_SIGNATURE" }, + { no: 6, name: "ERROR_BADLY_FORMATED_MESSAGE_WRONG_TRANSACTION_ID" }, + { no: 7, name: "ERROR_BADLY_FORMATED_MESSAGE_MISMATCH_HASH_VALUES" }, + { no: 8, name: "ERROR_EXPIRED_SIGNING_KEY_CERTIFICATE" }, + { no: 9, name: "ERROR_EXPIRED_CLAIM" }, + { no: 10, name: "ERROR_INCORRERCT_PARAMETER" }, + { no: 11, name: "ERROR_MESSAGE_OUT_OF_SEQUENCE" }, +]); + /** * TODO: define the common parameters to every protocol message * @@ -147,3 +445,1063 @@ export class Ack extends Message { } } +/** + * @generated from message cacti.satp.v02.common.TransferClaims + */ +export class TransferClaims extends Message { + /** + * @generated from field: string digital_asset_id = 1; + */ + digitalAssetId = ""; + + /** + * @generated from field: string asset_profile_id = 2; + */ + assetProfileId = ""; + + /** + * @generated from field: string verified_originator_entity_id = 3; + */ + verifiedOriginatorEntityId = ""; + + /** + * @generated from field: string verified_beneficiary_entity_id = 4; + */ + verifiedBeneficiaryEntityId = ""; + + /** + * @generated from field: string originator_pubkey = 5; + */ + originatorPubkey = ""; + + /** + * @generated from field: string beneficiary_pubkey = 6; + */ + beneficiaryPubkey = ""; + + /** + * @generated from field: string sender_gateway_network_id = 7; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: string recipient_gateway_network_id = 8; + */ + recipientGatewayNetworkId = ""; + + /** + * @generated from field: string client_gateway_pubkey = 9; + */ + clientGatewayPubkey = ""; + + /** + * @generated from field: string server_gateway_pubkey = 10; + */ + serverGatewayPubkey = ""; + + /** + * @generated from field: string sender_gateway_owner_id = 11; + */ + senderGatewayOwnerId = ""; + + /** + * @generated from field: string receiver_gateway_owner_id = 12; + */ + receiverGatewayOwnerId = ""; + + /** + * @generated from field: uint32 max_retries = 13; + */ + maxRetries = 0; + + /** + * @generated from field: uint64 max_timeout = 14; + */ + maxTimeout = protoInt64.zero; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.TransferClaims"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "digital_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "asset_profile_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "verified_originator_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "verified_beneficiary_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "originator_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "beneficiary_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "recipient_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "client_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "server_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "sender_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "receiver_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 13, name: "max_retries", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 14, name: "max_timeout", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferClaims { + return new TransferClaims().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferClaims { + return new TransferClaims().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferClaims { + return new TransferClaims().fromJsonString(jsonString, options); + } + + static equals(a: TransferClaims | PlainMessage | undefined, b: TransferClaims | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferClaims, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.TransferClaimsFormat + */ +export class TransferClaimsFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.TransferClaimsFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferClaimsFormat { + return new TransferClaimsFormat().fromJsonString(jsonString, options); + } + + static equals(a: TransferClaimsFormat | PlainMessage | undefined, b: TransferClaimsFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferClaimsFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Permissions + */ +export class Permissions extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Permissions"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Permissions { + return new Permissions().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Permissions { + return new Permissions().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Permissions { + return new Permissions().fromJsonString(jsonString, options); + } + + static equals(a: Permissions | PlainMessage | undefined, b: Permissions | PlainMessage | undefined): boolean { + return proto3.util.equals(Permissions, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.SubsequentCalls + */ +export class SubsequentCalls extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.SubsequentCalls"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SubsequentCalls { + return new SubsequentCalls().fromJsonString(jsonString, options); + } + + static equals(a: SubsequentCalls | PlainMessage | undefined, b: SubsequentCalls | PlainMessage | undefined): boolean { + return proto3.util.equals(SubsequentCalls, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.History + */ +export class History extends Message { + /** + * @generated from field: repeated cacti.satp.v02.common.Transaction transactions = 1; + */ + transactions: Transaction[] = []; + + /** + * @generated from field: repeated cacti.satp.v02.common.ActionCategory action_categories = 2; + */ + actionCategories: ActionCategory[] = []; + + /** + * @generated from field: string origin = 3; + */ + origin = ""; + + /** + * @generated from field: string destination = 4; + */ + destination = ""; + + /** + * @generated from field: string balance = 5; + */ + balance = ""; + + /** + * @generated from field: cacti.satp.v02.common.STATUS status = 6; + */ + status = STATUS.STATUS_UNSPECIFIED; + + /** + * @generated from field: cacti.satp.v02.common.ApplicationParameters application_parameters = 7; + */ + applicationParameters?: ApplicationParameters; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.History"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "transactions", kind: "message", T: Transaction, repeated: true }, + { no: 2, name: "action_categories", kind: "message", T: ActionCategory, repeated: true }, + { no: 3, name: "origin", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "destination", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "balance", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "status", kind: "enum", T: proto3.getEnumType(STATUS) }, + { no: 7, name: "application_parameters", kind: "message", T: ApplicationParameters }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): History { + return new History().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): History { + return new History().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): History { + return new History().fromJsonString(jsonString, options); + } + + static equals(a: History | PlainMessage | undefined, b: History | PlainMessage | undefined): boolean { + return proto3.util.equals(History, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ActionCategory + */ +export class ActionCategory extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ActionCategory"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActionCategory { + return new ActionCategory().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActionCategory { + return new ActionCategory().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActionCategory { + return new ActionCategory().fromJsonString(jsonString, options); + } + + static equals(a: ActionCategory | PlainMessage | undefined, b: ActionCategory | PlainMessage | undefined): boolean { + return proto3.util.equals(ActionCategory, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Transaction + */ +export class Transaction extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Transaction"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Transaction { + return new Transaction().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Transaction { + return new Transaction().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Transaction { + return new Transaction().fromJsonString(jsonString, options); + } + + static equals(a: Transaction | PlainMessage | undefined, b: Transaction | PlainMessage | undefined): boolean { + return proto3.util.equals(Transaction, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ApplicationParameters + */ +export class ApplicationParameters extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ApplicationParameters"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ApplicationParameters { + return new ApplicationParameters().fromJsonString(jsonString, options); + } + + static equals(a: ApplicationParameters | PlainMessage | undefined, b: ApplicationParameters | PlainMessage | undefined): boolean { + return proto3.util.equals(ApplicationParameters, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.NetworkCapabilities + */ +export class NetworkCapabilities extends Message { + /** + * @generated from field: string sender_gateway_network_id = 1; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: cacti.satp.v02.common.SignatureAlgorithm signature_algorithm = 2; + */ + signatureAlgorithm = SignatureAlgorithm.UNSPECIFIED; + + /** + * @generated from field: repeated cacti.satp.v02.common.SignatureAlgorithm supported_signature_algorithms = 3; + */ + supportedSignatureAlgorithms: SignatureAlgorithm[] = []; + + /** + * @generated from field: cacti.satp.v02.common.LockType lock_type = 4; + */ + lockType = LockType.UNSPECIFIED; + + /** + * @generated from field: uint64 lock_expiration_time = 5; + */ + lockExpirationTime = protoInt64.zero; + + /** + * @generated from field: cacti.satp.v02.common.Permissions permissions = 6; + */ + permissions?: Permissions; + + /** + * @generated from field: string developer_urn = 7; + */ + developerUrn = ""; + + /** + * @generated from field: cacti.satp.v02.common.CredentialProfile credential_profile = 8; + */ + credentialProfile = CredentialProfile.UNSPECIFIED; + + /** + * @generated from field: string application_profile = 9; + */ + applicationProfile = ""; + + /** + * @generated from field: string logging_profile = 10; + */ + loggingProfile = ""; + + /** + * @generated from field: string access_control_profile = 11; + */ + accessControlProfile = ""; + + /** + * @generated from field: cacti.satp.v02.common.SubsequentCalls subsequent_calls = 12; + */ + subsequentCalls?: SubsequentCalls; + + /** + * @generated from field: repeated cacti.satp.v02.common.History history = 13; + */ + history: History[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.NetworkCapabilities"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "signature_algorithm", kind: "enum", T: proto3.getEnumType(SignatureAlgorithm) }, + { no: 3, name: "supported_signature_algorithms", kind: "enum", T: proto3.getEnumType(SignatureAlgorithm), repeated: true }, + { no: 4, name: "lock_type", kind: "enum", T: proto3.getEnumType(LockType) }, + { no: 5, name: "lock_expiration_time", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "permissions", kind: "message", T: Permissions }, + { no: 7, name: "developer_urn", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "credential_profile", kind: "enum", T: proto3.getEnumType(CredentialProfile) }, + { no: 9, name: "application_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "logging_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "access_control_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "subsequent_calls", kind: "message", T: SubsequentCalls }, + { no: 13, name: "history", kind: "message", T: History, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NetworkCapabilities { + return new NetworkCapabilities().fromJsonString(jsonString, options); + } + + static equals(a: NetworkCapabilities | PlainMessage | undefined, b: NetworkCapabilities | PlainMessage | undefined): boolean { + return proto3.util.equals(NetworkCapabilities, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.CommonSatp + */ +export class CommonSatp extends Message { + /** + * @generated from field: string version = 1; + */ + version = ""; + + /** + * @generated from field: cacti.satp.v02.common.MessageType message_type = 2; + */ + messageType = MessageType.UNSPECIFIED; + + /** + * @generated from field: string session_id = 3; + */ + sessionId = ""; + + /** + * @generated from field: string transfer_context_id = 4; + */ + transferContextId = ""; + + /** + * @generated from field: uint64 sequence_number = 5; + */ + sequenceNumber = protoInt64.zero; + + /** + * @generated from field: string resource_url = 6; + */ + resourceUrl = ""; + + /** + * @generated from field: cacti.satp.v02.common.ActionResponse action_response = 8; + */ + actionResponse?: ActionResponse; + + /** + * @generated from field: string credential_block = 10; + */ + credentialBlock = ""; + + /** + * @generated from field: cacti.satp.v02.common.PayloadProfile payload_profile = 11; + */ + payloadProfile?: PayloadProfile; + + /** + * @generated from field: cacti.satp.v02.common.Payload payload = 13; + */ + payload?: Payload; + + /** + * @generated from field: string payload_hash = 14; + */ + payloadHash = ""; + + /** + * @generated from field: string signature = 15; + */ + signature = ""; + + /** + * @generated from field: string client_gateway_pubkey = 16; + */ + clientGatewayPubkey = ""; + + /** + * @generated from field: string server_gateway_pubkey = 17; + */ + serverGatewayPubkey = ""; + + /** + * @generated from field: string hash_previous_message = 18; + */ + hashPreviousMessage = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.CommonSatp"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "message_type", kind: "enum", T: proto3.getEnumType(MessageType) }, + { no: 3, name: "session_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "transfer_context_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "sequence_number", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 6, name: "resource_url", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "action_response", kind: "message", T: ActionResponse }, + { no: 10, name: "credential_block", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "payload_profile", kind: "message", T: PayloadProfile }, + { no: 13, name: "payload", kind: "message", T: Payload }, + { no: 14, name: "payload_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 15, name: "signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 16, name: "client_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 17, name: "server_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 18, name: "hash_previous_message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommonSatp { + return new CommonSatp().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommonSatp { + return new CommonSatp().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommonSatp { + return new CommonSatp().fromJsonString(jsonString, options); + } + + static equals(a: CommonSatp | PlainMessage | undefined, b: CommonSatp | PlainMessage | undefined): boolean { + return proto3.util.equals(CommonSatp, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.ActionResponse + */ +export class ActionResponse extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.ActionResponse"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ActionResponse { + return new ActionResponse().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ActionResponse { + return new ActionResponse().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ActionResponse { + return new ActionResponse().fromJsonString(jsonString, options); + } + + static equals(a: ActionResponse | PlainMessage | undefined, b: ActionResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(ActionResponse, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.PayloadProfile + */ +export class PayloadProfile extends Message { + /** + * @generated from field: cacti.satp.v02.common.AssetProfile asset_profile = 1; + */ + assetProfile?: AssetProfile; + + /** + * @generated from field: string capabilities = 2; + */ + capabilities = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.PayloadProfile"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "asset_profile", kind: "message", T: AssetProfile }, + { no: 2, name: "capabilities", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PayloadProfile { + return new PayloadProfile().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PayloadProfile { + return new PayloadProfile().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PayloadProfile { + return new PayloadProfile().fromJsonString(jsonString, options); + } + + static equals(a: PayloadProfile | PlainMessage | undefined, b: PayloadProfile | PlainMessage | undefined): boolean { + return proto3.util.equals(PayloadProfile, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssetProfile + */ +export class AssetProfile extends Message { + /** + * @generated from field: string issuer = 1; + */ + issuer = ""; + + /** + * @generated from field: string asset_code = 2; + */ + assetCode = ""; + + /** + * @generated from field: string asset_code_type = 3; + */ + assetCodeType = ""; + + /** + * @generated from field: string issuance_date = 4; + */ + issuanceDate = ""; + + /** + * @generated from field: string expiration_date = 5; + */ + expirationDate = ""; + + /** + * @generated from field: string verification_end_point = 6; + */ + verificationEndPoint = ""; + + /** + * @generated from field: string digital_signature = 7; + */ + digitalSignature = ""; + + /** + * @generated from field: string prospectus_link = 8; + */ + prospectusLink = ""; + + /** + * @generated from field: repeated string key_information_link = 9; + */ + keyInformationLink: string[] = []; + + /** + * @generated from field: repeated string keywords = 10; + */ + keywords: string[] = []; + + /** + * @generated from field: repeated string transfer_restrictions = 11; + */ + transferRestrictions: string[] = []; + + /** + * @generated from field: repeated string ledger_requirements = 12; + */ + ledgerRequirements: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssetProfile"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "issuer", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "asset_code", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "asset_code_type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "issuance_date", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "expiration_date", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "verification_end_point", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 7, name: "digital_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "prospectus_link", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "key_information_link", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 10, name: "keywords", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 11, name: "transfer_restrictions", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 12, name: "ledger_requirements", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssetProfile { + return new AssetProfile().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssetProfile { + return new AssetProfile().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssetProfile { + return new AssetProfile().fromJsonString(jsonString, options); + } + + static equals(a: AssetProfile | PlainMessage | undefined, b: AssetProfile | PlainMessage | undefined): boolean { + return proto3.util.equals(AssetProfile, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Payload + */ +export class Payload extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Payload"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Payload { + return new Payload().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Payload { + return new Payload().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Payload { + return new Payload().fromJsonString(jsonString, options); + } + + static equals(a: Payload | PlainMessage | undefined, b: Payload | PlainMessage | undefined): boolean { + return proto3.util.equals(Payload, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.LockAssertionClaim + */ +export class LockAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.LockAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionClaim { + return new LockAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionClaim | PlainMessage | undefined, b: LockAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.LockAssertionFormat + */ +export class LockAssertionFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.LockAssertionFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionFormat { + return new LockAssertionFormat().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionFormat | PlainMessage | undefined, b: LockAssertionFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MintAssertionClaims + */ +export class MintAssertionClaims extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MintAssertionClaims"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MintAssertionClaims { + return new MintAssertionClaims().fromJsonString(jsonString, options); + } + + static equals(a: MintAssertionClaims | PlainMessage | undefined, b: MintAssertionClaims | PlainMessage | undefined): boolean { + return proto3.util.equals(MintAssertionClaims, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MintAssertionClaimsFormat + */ +export class MintAssertionClaimsFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MintAssertionClaimsFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MintAssertionClaimsFormat { + return new MintAssertionClaimsFormat().fromJsonString(jsonString, options); + } + + static equals(a: MintAssertionClaimsFormat | PlainMessage | undefined, b: MintAssertionClaimsFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(MintAssertionClaimsFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.BurnAssertionClaim + */ +export class BurnAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.BurnAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BurnAssertionClaim { + return new BurnAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: BurnAssertionClaim | PlainMessage | undefined, b: BurnAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(BurnAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.BurnAssertionClaimFormat + */ +export class BurnAssertionClaimFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.BurnAssertionClaimFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BurnAssertionClaimFormat { + return new BurnAssertionClaimFormat().fromJsonString(jsonString, options); + } + + static equals(a: BurnAssertionClaimFormat | PlainMessage | undefined, b: BurnAssertionClaimFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(BurnAssertionClaimFormat, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssignmentAssertionClaim + */ +export class AssignmentAssertionClaim extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssignmentAssertionClaim"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssignmentAssertionClaim { + return new AssignmentAssertionClaim().fromJsonString(jsonString, options); + } + + static equals(a: AssignmentAssertionClaim | PlainMessage | undefined, b: AssignmentAssertionClaim | PlainMessage | undefined): boolean { + return proto3.util.equals(AssignmentAssertionClaim, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.AssignmentAssertionClaimFormat + */ +export class AssignmentAssertionClaimFormat extends Message { + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.AssignmentAssertionClaimFormat"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): AssignmentAssertionClaimFormat { + return new AssignmentAssertionClaimFormat().fromJsonString(jsonString, options); + } + + static equals(a: AssignmentAssertionClaimFormat | PlainMessage | undefined, b: AssignmentAssertionClaimFormat | PlainMessage | undefined): boolean { + return proto3.util.equals(AssignmentAssertionClaimFormat, a, b); + } +} + 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 index 7fa4974994..7d1077b54d 100644 --- 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 @@ -4,7 +4,999 @@ // @ts-nocheck import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; -import { Message, proto3 } from "@bufbuild/protobuf"; +import { Message, proto3, protoInt64 } from "@bufbuild/protobuf"; +import { AssignmentAssertionClaim, AssignmentAssertionClaimFormat, BurnAssertionClaim, BurnAssertionClaimFormat, CredentialProfile, LockAssertionClaim, LockAssertionFormat, LockType, MintAssertionClaims, MintAssertionClaimsFormat, PayloadProfile, Permissions, SignatureAlgorithm } from "./message_pb.js"; + +/** + * @generated from message cacti.satp.v02.common.SessionData + */ +export class SessionData extends Message { + /** + * @generated from field: string id = 1; + */ + id = ""; + + /** + * @generated from field: string version = 2; + */ + version = ""; + + /** + * @generated from field: string transfer_context_id = 3; + */ + transferContextId = ""; + + /** + * @generated from field: cacti.satp.v02.common.MessageStagesHashes hashes = 4; + */ + hashes?: MessageStagesHashes; + + /** + * @generated from field: cacti.satp.v02.common.PayloadProfile payload_profile = 5; + */ + payloadProfile?: PayloadProfile; + + /** + * @generated from field: cacti.satp.v02.common.MessageStagesSignatures signatures = 6; + */ + signatures?: MessageStagesSignatures; + + /** + * @generated from field: string max_retries = 7; + */ + maxRetries = ""; + + /** + * @generated from field: string max_timeout = 8; + */ + maxTimeout = ""; + + /** + * @generated from field: string logging_profile = 9; + */ + loggingProfile = ""; + + /** + * @generated from field: string recipient_base_path = 10; + */ + recipientBasePath = ""; + + /** + * @generated from field: string source_base_path = 11; + */ + sourceBasePath = ""; + + /** + * @generated from field: string access_control_profile = 12; + */ + accessControlProfile = ""; + + /** + * @generated from field: string application_profile = 13; + */ + applicationProfile = ""; + + /** + * @generated from field: int64 last_sequence_number = 14; + */ + lastSequenceNumber = protoInt64.zero; + + /** + * @generated from field: string sender_gateway_network_id = 15; + */ + senderGatewayNetworkId = ""; + + /** + * @generated from field: string recipient_gateway_network_id = 16; + */ + recipientGatewayNetworkId = ""; + + /** + * @generated from field: string source_ledger_asset_id = 17; + */ + sourceLedgerAssetId = ""; + + /** + * @generated from field: string recipient_ledger_asset_id = 18; + */ + recipientLedgerAssetId = ""; + + /** + * @generated from field: string server_gateway_pubkey = 19; + */ + serverGatewayPubkey = ""; + + /** + * @generated from field: string client_gateway_pubkey = 20; + */ + clientGatewayPubkey = ""; + + /** + * @generated from field: string verified_originator_entity_id = 21; + */ + verifiedOriginatorEntityId = ""; + + /** + * @generated from field: string verified_beneficiary_entity_id = 22; + */ + verifiedBeneficiaryEntityId = ""; + + /** + * @generated from field: string asset_profile_id = 23; + */ + assetProfileId = ""; + + /** + * @generated from field: string digital_asset_id = 24; + */ + digitalAssetId = ""; + + /** + * @generated from field: string originator_pubkey = 25; + */ + originatorPubkey = ""; + + /** + * @generated from field: string beneficiary_pubkey = 26; + */ + beneficiaryPubkey = ""; + + /** + * @generated from field: string sender_gateway_owner_id = 27; + */ + senderGatewayOwnerId = ""; + + /** + * @generated from field: string receiver_gateway_owner_id = 28; + */ + receiverGatewayOwnerId = ""; + + /** + * @generated from field: string hash_transfer_init_claims = 29; + */ + hashTransferInitClaims = ""; + + /** + * @generated from field: cacti.satp.v02.common.SignatureAlgorithm signature_algorithm = 30; + */ + signatureAlgorithm = SignatureAlgorithm.UNSPECIFIED; + + /** + * @generated from field: cacti.satp.v02.common.LockType lock_type = 31; + */ + lockType = LockType.UNSPECIFIED; + + /** + * @generated from field: uint64 lock_expiration_time = 32; + */ + lockExpirationTime = protoInt64.zero; + + /** + * @generated from field: cacti.satp.v02.common.Permissions permitions = 33; + */ + permitions?: Permissions; + + /** + * @generated from field: string developer_urn = 34; + */ + developerUrn = ""; + + /** + * @generated from field: cacti.satp.v02.common.CredentialProfile credential_profile = 35; + */ + credentialProfile = CredentialProfile.UNSPECIFIED; + + /** + * @generated from field: string subsequent_calls = 36; + */ + subsequentCalls = ""; + + /** + * @generated from field: string history = 37; + */ + history = ""; + + /** + * @generated from field: bool multiple_claims_allowed = 38; + */ + multipleClaimsAllowed = false; + + /** + * @generated from field: bool multiple_cancels_allowed = 39; + */ + multipleCancelsAllowed = false; + + /** + * @generated from field: string last_message_received_timestamp = 40; + */ + lastMessageReceivedTimestamp = ""; + + /** + * @generated from field: cacti.satp.v02.common.MessageStagesTimestamps processed_timestamps = 41; + */ + processedTimestamps?: MessageStagesTimestamps; + + /** + * @generated from field: cacti.satp.v02.common.MessageStagesTimestamps received_timestamps = 42; + */ + receivedTimestamps?: MessageStagesTimestamps; + + /** + * @generated from field: cacti.satp.v02.common.LockAssertionClaim lock_assertion_claim = 43; + */ + lockAssertionClaim?: LockAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.LockAssertionFormat lock_assertion_format = 44; + */ + lockAssertionFormat?: LockAssertionFormat; + + /** + * @generated from field: cacti.satp.v02.common.MintAssertionClaims mint_assertion_claims = 45; + */ + mintAssertionClaims?: MintAssertionClaims; + + /** + * @generated from field: cacti.satp.v02.common.MintAssertionClaimsFormat mint_assertion_claims_format = 46; + */ + mintAssertionClaimsFormat?: MintAssertionClaimsFormat; + + /** + * @generated from field: cacti.satp.v02.common.BurnAssertionClaim burn_assertion_claim = 47; + */ + burnAssertionClaim?: BurnAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.BurnAssertionClaimFormat burn_assertion_claim_format = 48; + */ + burnAssertionClaimFormat?: BurnAssertionClaimFormat; + + /** + * @generated from field: cacti.satp.v02.common.AssignmentAssertionClaim assignment_assertion_claim = 49; + */ + assignmentAssertionClaim?: AssignmentAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.AssignmentAssertionClaimFormat assignment_assertion_claim_format = 50; + */ + assignmentAssertionClaimFormat?: AssignmentAssertionClaimFormat; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.SessionData"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "transfer_context_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "hashes", kind: "message", T: MessageStagesHashes }, + { no: 5, name: "payload_profile", kind: "message", T: PayloadProfile }, + { no: 6, name: "signatures", kind: "message", T: MessageStagesSignatures }, + { no: 7, name: "max_retries", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 8, name: "max_timeout", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 9, name: "logging_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 10, name: "recipient_base_path", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "source_base_path", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "access_control_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 13, name: "application_profile", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 14, name: "last_sequence_number", kind: "scalar", T: 3 /* ScalarType.INT64 */ }, + { no: 15, name: "sender_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 16, name: "recipient_gateway_network_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 17, name: "source_ledger_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 18, name: "recipient_ledger_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 19, name: "server_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 20, name: "client_gateway_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 21, name: "verified_originator_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 22, name: "verified_beneficiary_entity_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 23, name: "asset_profile_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 24, name: "digital_asset_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 25, name: "originator_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 26, name: "beneficiary_pubkey", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 27, name: "sender_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 28, name: "receiver_gateway_owner_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 29, name: "hash_transfer_init_claims", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 30, name: "signature_algorithm", kind: "enum", T: proto3.getEnumType(SignatureAlgorithm) }, + { no: 31, name: "lock_type", kind: "enum", T: proto3.getEnumType(LockType) }, + { no: 32, name: "lock_expiration_time", kind: "scalar", T: 4 /* ScalarType.UINT64 */ }, + { no: 33, name: "permitions", kind: "message", T: Permissions }, + { no: 34, name: "developer_urn", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 35, name: "credential_profile", kind: "enum", T: proto3.getEnumType(CredentialProfile) }, + { no: 36, name: "subsequent_calls", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 37, name: "history", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 38, name: "multiple_claims_allowed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 39, name: "multiple_cancels_allowed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 40, name: "last_message_received_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 41, name: "processed_timestamps", kind: "message", T: MessageStagesTimestamps }, + { no: 42, name: "received_timestamps", kind: "message", T: MessageStagesTimestamps }, + { no: 43, name: "lock_assertion_claim", kind: "message", T: LockAssertionClaim }, + { no: 44, name: "lock_assertion_format", kind: "message", T: LockAssertionFormat }, + { no: 45, name: "mint_assertion_claims", kind: "message", T: MintAssertionClaims }, + { no: 46, name: "mint_assertion_claims_format", kind: "message", T: MintAssertionClaimsFormat }, + { no: 47, name: "burn_assertion_claim", kind: "message", T: BurnAssertionClaim }, + { no: 48, name: "burn_assertion_claim_format", kind: "message", T: BurnAssertionClaimFormat }, + { no: 49, name: "assignment_assertion_claim", kind: "message", T: AssignmentAssertionClaim }, + { no: 50, name: "assignment_assertion_claim_format", kind: "message", T: AssignmentAssertionClaimFormat }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SessionData { + return new SessionData().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SessionData { + return new SessionData().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SessionData { + return new SessionData().fromJsonString(jsonString, options); + } + + static equals(a: SessionData | PlainMessage | undefined, b: SessionData | PlainMessage | undefined): boolean { + return proto3.util.equals(SessionData, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MessageStagesHashes + */ +export class MessageStagesHashes extends Message { + /** + * @generated from field: cacti.satp.v02.common.Stage1Hashes stage1 = 1; + */ + stage1?: Stage1Hashes; + + /** + * @generated from field: cacti.satp.v02.common.Stage2Hashes stage2 = 2; + */ + stage2?: Stage2Hashes; + + /** + * @generated from field: cacti.satp.v02.common.Stage3Hashes stage3 = 3; + */ + stage3?: Stage3Hashes; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MessageStagesHashes"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stage1", kind: "message", T: Stage1Hashes }, + { no: 2, name: "stage2", kind: "message", T: Stage2Hashes }, + { no: 3, name: "stage3", kind: "message", T: Stage3Hashes }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MessageStagesHashes { + return new MessageStagesHashes().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MessageStagesHashes { + return new MessageStagesHashes().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MessageStagesHashes { + return new MessageStagesHashes().fromJsonString(jsonString, options); + } + + static equals(a: MessageStagesHashes | PlainMessage | undefined, b: MessageStagesHashes | PlainMessage | undefined): boolean { + return proto3.util.equals(MessageStagesHashes, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage1Hashes + */ +export class Stage1Hashes extends Message { + /** + * @generated from field: string transfer_proposal_request_message_hash = 1; + */ + transferProposalRequestMessageHash = ""; + + /** + * @generated from field: string transfer_proposal_receipt_message_hash = 2; + */ + transferProposalReceiptMessageHash = ""; + + /** + * @generated from field: string transfer_proposal_reject_message_hash = 3; + */ + transferProposalRejectMessageHash = ""; + + /** + * @generated from field: string transfer_commence_request_message_hash = 4; + */ + transferCommenceRequestMessageHash = ""; + + /** + * @generated from field: string transfer_commence_response_message_hash = 5; + */ + transferCommenceResponseMessageHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage1Hashes"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "transfer_proposal_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "transfer_proposal_receipt_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "transfer_proposal_reject_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "transfer_commence_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_commence_response_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage1Hashes { + return new Stage1Hashes().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage1Hashes { + return new Stage1Hashes().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage1Hashes { + return new Stage1Hashes().fromJsonString(jsonString, options); + } + + static equals(a: Stage1Hashes | PlainMessage | undefined, b: Stage1Hashes | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage1Hashes, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage2Hashes + */ +export class Stage2Hashes extends Message { + /** + * @generated from field: string lock_assertion_request_message_hash = 1; + */ + lockAssertionRequestMessageHash = ""; + + /** + * @generated from field: string lock_assertion_receipt_message_hash = 2; + */ + lockAssertionReceiptMessageHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage2Hashes"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "lock_assertion_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "lock_assertion_receipt_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage2Hashes { + return new Stage2Hashes().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage2Hashes { + return new Stage2Hashes().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage2Hashes { + return new Stage2Hashes().fromJsonString(jsonString, options); + } + + static equals(a: Stage2Hashes | PlainMessage | undefined, b: Stage2Hashes | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage2Hashes, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage3Hashes + */ +export class Stage3Hashes extends Message { + /** + * @generated from field: string commit_preparation_request_message_hash = 1; + */ + commitPreparationRequestMessageHash = ""; + + /** + * @generated from field: string commit_ready_response_message_hash = 2; + */ + commitReadyResponseMessageHash = ""; + + /** + * @generated from field: string commit_final_assertion_request_message_hash = 3; + */ + commitFinalAssertionRequestMessageHash = ""; + + /** + * @generated from field: string commit_final_acknowledgement_receipt_response_message_hash = 4; + */ + commitFinalAcknowledgementReceiptResponseMessageHash = ""; + + /** + * @generated from field: string transfer_complete_request_message_hash = 5; + */ + transferCompleteRequestMessageHash = ""; + + /** + * @generated from field: string transfer_complete_response_message_hash = 6; + */ + transferCompleteResponseMessageHash = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage3Hashes"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "commit_preparation_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "commit_ready_response_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "commit_final_assertion_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "commit_final_acknowledgement_receipt_response_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_complete_request_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "transfer_complete_response_message_hash", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage3Hashes { + return new Stage3Hashes().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage3Hashes { + return new Stage3Hashes().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage3Hashes { + return new Stage3Hashes().fromJsonString(jsonString, options); + } + + static equals(a: Stage3Hashes | PlainMessage | undefined, b: Stage3Hashes | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage3Hashes, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MessageStagesSignatures + */ +export class MessageStagesSignatures extends Message { + /** + * @generated from field: cacti.satp.v02.common.Stage1Signatures stage1 = 1; + */ + stage1?: Stage1Signatures; + + /** + * @generated from field: cacti.satp.v02.common.Stage2Signatures stage2 = 2; + */ + stage2?: Stage2Signatures; + + /** + * @generated from field: cacti.satp.v02.common.Stage3Signatures stage3 = 3; + */ + stage3?: Stage3Signatures; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MessageStagesSignatures"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stage1", kind: "message", T: Stage1Signatures }, + { no: 2, name: "stage2", kind: "message", T: Stage2Signatures }, + { no: 3, name: "stage3", kind: "message", T: Stage3Signatures }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MessageStagesSignatures { + return new MessageStagesSignatures().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MessageStagesSignatures { + return new MessageStagesSignatures().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MessageStagesSignatures { + return new MessageStagesSignatures().fromJsonString(jsonString, options); + } + + static equals(a: MessageStagesSignatures | PlainMessage | undefined, b: MessageStagesSignatures | PlainMessage | undefined): boolean { + return proto3.util.equals(MessageStagesSignatures, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage1Signatures + */ +export class Stage1Signatures extends Message { + /** + * @generated from field: string transfer_proposal_request_message_client_signature = 1; + */ + transferProposalRequestMessageClientSignature = ""; + + /** + * @generated from field: string transfer_proposal_receipt_message_server_signature = 2; + */ + transferProposalReceiptMessageServerSignature = ""; + + /** + * @generated from field: string transfer_proposal_reject_message_server_signature = 3; + */ + transferProposalRejectMessageServerSignature = ""; + + /** + * @generated from field: string transfer_commence_request_message_client_signature = 4; + */ + transferCommenceRequestMessageClientSignature = ""; + + /** + * @generated from field: string transfer_commence_response_message_server_signature = 5; + */ + transferCommenceResponseMessageServerSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage1Signatures"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "transfer_proposal_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "transfer_proposal_receipt_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "transfer_proposal_reject_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "transfer_commence_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_commence_response_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage1Signatures { + return new Stage1Signatures().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage1Signatures { + return new Stage1Signatures().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage1Signatures { + return new Stage1Signatures().fromJsonString(jsonString, options); + } + + static equals(a: Stage1Signatures | PlainMessage | undefined, b: Stage1Signatures | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage1Signatures, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage2Signatures + */ +export class Stage2Signatures extends Message { + /** + * @generated from field: string lock_assertion_request_message_client_signature = 1; + */ + lockAssertionRequestMessageClientSignature = ""; + + /** + * @generated from field: string lock_assertion_receipt_message_server_signature = 2; + */ + lockAssertionReceiptMessageServerSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage2Signatures"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "lock_assertion_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "lock_assertion_receipt_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage2Signatures { + return new Stage2Signatures().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage2Signatures { + return new Stage2Signatures().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage2Signatures { + return new Stage2Signatures().fromJsonString(jsonString, options); + } + + static equals(a: Stage2Signatures | PlainMessage | undefined, b: Stage2Signatures | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage2Signatures, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage3Signatures + */ +export class Stage3Signatures extends Message { + /** + * @generated from field: string commit_preparation_request_message_client_signature = 1; + */ + commitPreparationRequestMessageClientSignature = ""; + + /** + * @generated from field: string commit_ready_response_message_server_signature = 2; + */ + commitReadyResponseMessageServerSignature = ""; + + /** + * @generated from field: string commit_final_assertion_request_message_client_signature = 3; + */ + commitFinalAssertionRequestMessageClientSignature = ""; + + /** + * @generated from field: string commit_final_acknowledgement_receipt_response_message_server_signature = 4; + */ + commitFinalAcknowledgementReceiptResponseMessageServerSignature = ""; + + /** + * @generated from field: string transfer_complete_request_message_client_signature = 5; + */ + transferCompleteRequestMessageClientSignature = ""; + + /** + * @generated from field: string transfer_complete_response_message_server_signature = 6; + */ + transferCompleteResponseMessageServerSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage3Signatures"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "commit_preparation_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "commit_ready_response_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "commit_final_assertion_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "commit_final_acknowledgement_receipt_response_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_complete_request_message_client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "transfer_complete_response_message_server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage3Signatures { + return new Stage3Signatures().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage3Signatures { + return new Stage3Signatures().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage3Signatures { + return new Stage3Signatures().fromJsonString(jsonString, options); + } + + static equals(a: Stage3Signatures | PlainMessage | undefined, b: Stage3Signatures | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage3Signatures, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.MessageStagesTimestamps + */ +export class MessageStagesTimestamps extends Message { + /** + * @generated from field: cacti.satp.v02.common.Stage1Timestamps stage1 = 1; + */ + stage1?: Stage1Timestamps; + + /** + * @generated from field: cacti.satp.v02.common.Stage2Timestamps stage2 = 2; + */ + stage2?: Stage2Timestamps; + + /** + * @generated from field: cacti.satp.v02.common.Stage3Timestamps stage3 = 3; + */ + stage3?: Stage3Timestamps; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.MessageStagesTimestamps"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "stage1", kind: "message", T: Stage1Timestamps }, + { no: 2, name: "stage2", kind: "message", T: Stage2Timestamps }, + { no: 3, name: "stage3", kind: "message", T: Stage3Timestamps }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MessageStagesTimestamps { + return new MessageStagesTimestamps().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MessageStagesTimestamps { + return new MessageStagesTimestamps().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MessageStagesTimestamps { + return new MessageStagesTimestamps().fromJsonString(jsonString, options); + } + + static equals(a: MessageStagesTimestamps | PlainMessage | undefined, b: MessageStagesTimestamps | PlainMessage | undefined): boolean { + return proto3.util.equals(MessageStagesTimestamps, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage1Timestamps + */ +export class Stage1Timestamps extends Message { + /** + * @generated from field: string transfer_proposal_request_message_timestamp = 1; + */ + transferProposalRequestMessageTimestamp = ""; + + /** + * @generated from field: string transfer_proposal_receipt_message_timestamp = 2; + */ + transferProposalReceiptMessageTimestamp = ""; + + /** + * @generated from field: string transfer_proposal_reject_message_timestamp = 3; + */ + transferProposalRejectMessageTimestamp = ""; + + /** + * @generated from field: string transfer_commence_request_message_timestamp = 4; + */ + transferCommenceRequestMessageTimestamp = ""; + + /** + * @generated from field: string transfer_commence_response_message_timestamp = 5; + */ + transferCommenceResponseMessageTimestamp = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage1Timestamps"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "transfer_proposal_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "transfer_proposal_receipt_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "transfer_proposal_reject_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "transfer_commence_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_commence_response_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage1Timestamps { + return new Stage1Timestamps().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage1Timestamps { + return new Stage1Timestamps().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage1Timestamps { + return new Stage1Timestamps().fromJsonString(jsonString, options); + } + + static equals(a: Stage1Timestamps | PlainMessage | undefined, b: Stage1Timestamps | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage1Timestamps, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage2Timestamps + */ +export class Stage2Timestamps extends Message { + /** + * @generated from field: string lock_assertion_request_message_timestamp = 1; + */ + lockAssertionRequestMessageTimestamp = ""; + + /** + * @generated from field: string lock_assertion_receipt_message_timestamp = 2; + */ + lockAssertionReceiptMessageTimestamp = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage2Timestamps"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "lock_assertion_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "lock_assertion_receipt_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage2Timestamps { + return new Stage2Timestamps().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage2Timestamps { + return new Stage2Timestamps().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage2Timestamps { + return new Stage2Timestamps().fromJsonString(jsonString, options); + } + + static equals(a: Stage2Timestamps | PlainMessage | undefined, b: Stage2Timestamps | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage2Timestamps, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.common.Stage3Timestamps + */ +export class Stage3Timestamps extends Message { + /** + * @generated from field: string commit_preparation_request_message_timestamp = 1; + */ + commitPreparationRequestMessageTimestamp = ""; + + /** + * @generated from field: string commit_ready_response_message_timestamp = 2; + */ + commitReadyResponseMessageTimestamp = ""; + + /** + * @generated from field: string commit_final_assertion_request_message_timestamp = 3; + */ + commitFinalAssertionRequestMessageTimestamp = ""; + + /** + * @generated from field: string commit_final_acknoledgement_receipt_response_message_timestamp = 4; + */ + commitFinalAcknoledgementReceiptResponseMessageTimestamp = ""; + + /** + * @generated from field: string transfer_complete_request_message_timestamp = 5; + */ + transferCompleteRequestMessageTimestamp = ""; + + /** + * @generated from field: string transfer_complete_response_message_timestamp = 6; + */ + transferCompleteResponseMessageTimestamp = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.common.Stage3Timestamps"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "commit_preparation_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "commit_ready_response_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "commit_final_assertion_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "commit_final_acknoledgement_receipt_response_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "transfer_complete_request_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "transfer_complete_response_message_timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Stage3Timestamps { + return new Stage3Timestamps().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Stage3Timestamps { + return new Stage3Timestamps().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Stage3Timestamps { + return new Stage3Timestamps().fromJsonString(jsonString, options); + } + + static equals(a: Stage3Timestamps | PlainMessage | undefined, b: Stage3Timestamps | PlainMessage | undefined): boolean { + return proto3.util.equals(Stage3Timestamps, a, b); + } +} /** * @generated from message cacti.satp.v02.common.SendStatusRequest @@ -16,7 +1008,7 @@ export class SendStatusRequest extends Message { status = ""; /** - * @generated from field: bool hasBackup = 2; + * @generated from field: bool has_backup = 2; */ hasBackup = false; @@ -29,7 +1021,7 @@ export class SendStatusRequest extends Message { 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 */ }, + { no: 2, name: "has_backup", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): SendStatusRequest { @@ -59,7 +1051,7 @@ export class SendStatusResponse extends Message { status = ""; /** - * @generated from field: bool hasBackup = 2; + * @generated from field: bool has_backup = 2; */ hasBackup = false; @@ -72,7 +1064,7 @@ export class SendStatusResponse extends Message { 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 */ }, + { no: 2, name: "has_backup", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): SendStatusResponse { 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 index 056b2b8058..788bc328e8 100644 --- 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 @@ -1,28 +1,28 @@ // @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) +// @generated from file cacti/satp/v02/stage_0.proto (package cacti.satp.v02, syntax proto3) /* eslint-disable */ // @ts-nocheck -import { TransferProposalClaimsRequest, TransferProposalClaimsResponse } from "./stage_0_pb.js"; +import { PreTransferVerificationAndContextEstablishmentRequest, PreTransferVerificationAndContextEstablishmentResponse } from "./stage_0_pb.js"; import { MethodKind } from "@bufbuild/protobuf"; /** * util RPCs * - * @generated from service cacti.satp.v02.stage_0.SATPStage0 + * @generated from service cacti.satp.v02.SatpStage0Service */ -export const SATPStage0 = { - typeName: "cacti.satp.v02.stage_0.SATPStage0", +export const SatpStage0Service = { + typeName: "cacti.satp.v02.SatpStage0Service", methods: { /** * step RPCs * - * @generated from rpc cacti.satp.v02.stage_0.SATPStage0.TransferProposalClaims + * @generated from rpc cacti.satp.v02.SatpStage0Service.TransferProposalClaims */ transferProposalClaims: { name: "TransferProposalClaims", - I: TransferProposalClaimsRequest, - O: TransferProposalClaimsResponse, + I: PreTransferVerificationAndContextEstablishmentRequest, + O: PreTransferVerificationAndContextEstablishmentResponse, kind: MethodKind.Unary, }, } 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 index 01bd2a9225..6edec95886 100644 --- 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 @@ -1,156 +1,87 @@ // @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) +// @generated from file cacti/satp/v02/stage_0.proto (package cacti.satp.v02, syntax proto3) /* eslint-disable */ // @ts-nocheck import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; +import { CommonSatp, TransferClaims } from "./common/message_pb.js"; /** - * @generated from message cacti.satp.v02.stage_0.TransferProposalClaimsRequest + * @generated from message cacti.satp.v02.PreTransferVerificationAndContextEstablishmentRequest */ -export class TransferProposalClaimsRequest extends Message { +export class PreTransferVerificationAndContextEstablishmentRequest extends Message { /** - * @generated from field: string message_type = 1; + * @generated from field: cacti.satp.v02.common.CommonSatp context = 1; */ - messageType = ""; + context?: CommonSatp; /** - * @generated from field: string asset_asset_id = 2; + * todo other fields + * + * @generated from field: cacti.satp.v02.common.TransferClaims transferClaims = 2; */ - assetAssetId = ""; + transferClaims?: TransferClaims; - /** - * @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) { + 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 typeName = "cacti.satp.v02.PreTransferVerificationAndContextEstablishmentRequest"; 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 */ }, + { no: 1, name: "context", kind: "message", T: CommonSatp }, + { no: 2, name: "transferClaims", kind: "message", T: TransferClaims }, ]); - static fromBinary(bytes: Uint8Array, options?: Partial): TransferProposalClaimsRequest { - return new TransferProposalClaimsRequest().fromBinary(bytes, options); + static fromBinary(bytes: Uint8Array, options?: Partial): PreTransferVerificationAndContextEstablishmentRequest { + return new PreTransferVerificationAndContextEstablishmentRequest().fromBinary(bytes, options); } - static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalClaimsRequest { - return new TransferProposalClaimsRequest().fromJson(jsonValue, options); + static fromJson(jsonValue: JsonValue, options?: Partial): PreTransferVerificationAndContextEstablishmentRequest { + return new PreTransferVerificationAndContextEstablishmentRequest().fromJson(jsonValue, options); } - static fromJsonString(jsonString: string, options?: Partial): TransferProposalClaimsRequest { - return new TransferProposalClaimsRequest().fromJsonString(jsonString, options); + static fromJsonString(jsonString: string, options?: Partial): PreTransferVerificationAndContextEstablishmentRequest { + return new PreTransferVerificationAndContextEstablishmentRequest().fromJsonString(jsonString, options); } - static equals(a: TransferProposalClaimsRequest | PlainMessage | undefined, b: TransferProposalClaimsRequest | PlainMessage | undefined): boolean { - return proto3.util.equals(TransferProposalClaimsRequest, a, b); + static equals(a: PreTransferVerificationAndContextEstablishmentRequest | PlainMessage | undefined, b: PreTransferVerificationAndContextEstablishmentRequest | PlainMessage | undefined): boolean { + return proto3.util.equals(PreTransferVerificationAndContextEstablishmentRequest, a, b); } } /** * TODO * - * @generated from message cacti.satp.v02.stage_0.TransferProposalClaimsResponse + * @generated from message cacti.satp.v02.PreTransferVerificationAndContextEstablishmentResponse */ -export class TransferProposalClaimsResponse extends Message { - /** - * @generated from field: string message_type = 1; - */ - messageType = ""; - - constructor(data?: PartialMessage) { +export class PreTransferVerificationAndContextEstablishmentResponse extends Message { + 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 typeName = "cacti.satp.v02.PreTransferVerificationAndContextEstablishmentResponse"; 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 fromBinary(bytes: Uint8Array, options?: Partial): PreTransferVerificationAndContextEstablishmentResponse { + return new PreTransferVerificationAndContextEstablishmentResponse().fromBinary(bytes, options); } - static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalClaimsResponse { - return new TransferProposalClaimsResponse().fromJson(jsonValue, options); + static fromJson(jsonValue: JsonValue, options?: Partial): PreTransferVerificationAndContextEstablishmentResponse { + return new PreTransferVerificationAndContextEstablishmentResponse().fromJson(jsonValue, options); } - static fromJsonString(jsonString: string, options?: Partial): TransferProposalClaimsResponse { - return new TransferProposalClaimsResponse().fromJsonString(jsonString, options); + static fromJsonString(jsonString: string, options?: Partial): PreTransferVerificationAndContextEstablishmentResponse { + return new PreTransferVerificationAndContextEstablishmentResponse().fromJsonString(jsonString, options); } - static equals(a: TransferProposalClaimsResponse | PlainMessage | undefined, b: TransferProposalClaimsResponse | PlainMessage | undefined): boolean { - return proto3.util.equals(TransferProposalClaimsResponse, a, b); + static equals(a: PreTransferVerificationAndContextEstablishmentResponse | PlainMessage | undefined, b: PreTransferVerificationAndContextEstablishmentResponse | PlainMessage | undefined): boolean { + return proto3.util.equals(PreTransferVerificationAndContextEstablishmentResponse, 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 index c66c54ca67..1f51ca2bd2 100644 --- 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 @@ -1,16 +1,35 @@ // @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) +// @generated from file cacti/satp/v02/stage_1.proto (package cacti.satp.v02, syntax proto3) /* eslint-disable */ // @ts-nocheck +import { TransferCommenceRequestMessage, TransferCommenceResponseMessage, TransferProposalReceiptRejectMessage, TransferProposalRequestMessage } from "./stage_1_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + /** - * util RPCs - * - * @generated from service cacti.satp.v02.stage_1.SATPStage1 + * @generated from service cacti.satp.v02.SatpStage1Service */ -export const SATPStage1 = { - typeName: "cacti.satp.v02.stage_1.SATPStage1", +export const SatpStage1Service = { + typeName: "cacti.satp.v02.SatpStage1Service", methods: { + /** + * @generated from rpc cacti.satp.v02.SatpStage1Service.TransferProposal + */ + transferProposal: { + name: "TransferProposal", + I: TransferProposalRequestMessage, + O: TransferProposalReceiptRejectMessage, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.SatpStage1Service.TransferCommence + */ + transferCommence: { + name: "TransferCommence", + I: TransferCommenceRequestMessage, + O: TransferCommenceResponseMessage, + kind: MethodKind.Unary, + }, } } as const; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_pb.ts new file mode 100644 index 0000000000..e59e1019c7 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_1_pb.ts @@ -0,0 +1,217 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/stage_1.proto (package cacti.satp.v02, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { CommonSatp, NetworkCapabilities, TransferClaims, TransferClaimsFormat } from "./common/message_pb.js"; + +/** + * @generated from message cacti.satp.v02.TransferProposalRequestMessage + */ +export class TransferProposalRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: cacti.satp.v02.common.TransferClaims transfer_init_claims = 2; + */ + transferInitClaims?: TransferClaims; + + /** + * @generated from field: cacti.satp.v02.common.TransferClaimsFormat transfer_init_claims_format = 3; + */ + transferInitClaimsFormat?: TransferClaimsFormat; + + /** + * @generated from field: cacti.satp.v02.common.NetworkCapabilities network_capabilities = 4; + */ + networkCapabilities?: NetworkCapabilities; + + /** + * @generated from field: bool multiple_claims_allowed = 5; + */ + multipleClaimsAllowed = false; + + /** + * @generated from field: bool multiple_cancels_allowed = 6; + */ + multipleCancelsAllowed = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.TransferProposalRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "transfer_init_claims", kind: "message", T: TransferClaims }, + { no: 3, name: "transfer_init_claims_format", kind: "message", T: TransferClaimsFormat }, + { no: 4, name: "network_capabilities", kind: "message", T: NetworkCapabilities }, + { no: 5, name: "multiple_claims_allowed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 6, name: "multiple_cancels_allowed", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferProposalRequestMessage { + return new TransferProposalRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalRequestMessage { + return new TransferProposalRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferProposalRequestMessage { + return new TransferProposalRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: TransferProposalRequestMessage | PlainMessage | undefined, b: TransferProposalRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferProposalRequestMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.TransferProposalReceiptRejectMessage + */ +export class TransferProposalReceiptRejectMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: string hash_transfer_init_claims = 2; + */ + hashTransferInitClaims = ""; + + /** + * @generated from field: cacti.satp.v02.common.TransferClaims transfer_counter_claims = 3; + */ + transferCounterClaims?: TransferClaims; + + /** + * @generated from field: string timestamp = 4; + */ + timestamp = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.TransferProposalReceiptRejectMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "hash_transfer_init_claims", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "transfer_counter_claims", kind: "message", T: TransferClaims }, + { no: 4, name: "timestamp", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferProposalReceiptRejectMessage { + return new TransferProposalReceiptRejectMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferProposalReceiptRejectMessage { + return new TransferProposalReceiptRejectMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferProposalReceiptRejectMessage { + return new TransferProposalReceiptRejectMessage().fromJsonString(jsonString, options); + } + + static equals(a: TransferProposalReceiptRejectMessage | PlainMessage | undefined, b: TransferProposalReceiptRejectMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferProposalReceiptRejectMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.TransferCommenceRequestMessage + */ +export class TransferCommenceRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: string hash_transfer_init_claims = 2; + */ + hashTransferInitClaims = ""; + + /** + * @generated from field: string client_transfer_number = 3; + */ + clientTransferNumber = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.TransferCommenceRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "hash_transfer_init_claims", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "client_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferCommenceRequestMessage { + return new TransferCommenceRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferCommenceRequestMessage { + return new TransferCommenceRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferCommenceRequestMessage { + return new TransferCommenceRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: TransferCommenceRequestMessage | PlainMessage | undefined, b: TransferCommenceRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferCommenceRequestMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.TransferCommenceResponseMessage + */ +export class TransferCommenceResponseMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.TransferCommenceResponseMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferCommenceResponseMessage { + return new TransferCommenceResponseMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferCommenceResponseMessage { + return new TransferCommenceResponseMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferCommenceResponseMessage { + return new TransferCommenceResponseMessage().fromJsonString(jsonString, options); + } + + static equals(a: TransferCommenceResponseMessage | PlainMessage | undefined, b: TransferCommenceResponseMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferCommenceResponseMessage, a, b); + } +} + 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 index d00165f0c4..1acc5ea289 100644 --- 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 @@ -1,16 +1,26 @@ // @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) +// @generated from file cacti/satp/v02/stage_2.proto (package cacti.satp.v02, syntax proto3) /* eslint-disable */ // @ts-nocheck +import { LockAssertionReceiptMessage, LockAssertionRequestMessage } from "./stage_2_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; + /** - * util RPCs - * - * @generated from service cacti.satp.v02.stage_2.SATPStage2 + * @generated from service cacti.satp.v02.SatpStage2Service */ -export const SATPStage2 = { - typeName: "cacti.satp.v02.stage_2.SATPStage2", +export const SatpStage2Service = { + typeName: "cacti.satp.v02.SatpStage2Service", methods: { + /** + * @generated from rpc cacti.satp.v02.SatpStage2Service.LockAssertion + */ + lockAssertion: { + name: "LockAssertion", + I: LockAssertionRequestMessage, + O: LockAssertionReceiptMessage, + kind: MethodKind.Unary, + }, } } as const; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_pb.ts new file mode 100644 index 0000000000..a7e91edc78 --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_2_pb.ts @@ -0,0 +1,125 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/stage_2.proto (package cacti.satp.v02, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { CommonSatp, LockAssertionClaim, LockAssertionFormat } from "./common/message_pb.js"; + +/** + * @generated from message cacti.satp.v02.LockAssertionRequestMessage + */ +export class LockAssertionRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: cacti.satp.v02.common.LockAssertionClaim lock_assertion_claim = 2; + */ + lockAssertionClaim?: LockAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.LockAssertionFormat lock_assertion_format = 3; + */ + lockAssertionFormat?: LockAssertionFormat; + + /** + * @generated from field: string lock_assertion_expiration = 4; + */ + lockAssertionExpiration = ""; + + /** + * @generated from field: string client_transfer_number = 5; + */ + clientTransferNumber = ""; + + /** + * @generated from field: string client_signature = 6; + */ + clientSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.LockAssertionRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "lock_assertion_claim", kind: "message", T: LockAssertionClaim }, + { no: 3, name: "lock_assertion_format", kind: "message", T: LockAssertionFormat }, + { no: 4, name: "lock_assertion_expiration", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "client_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionRequestMessage { + return new LockAssertionRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionRequestMessage { + return new LockAssertionRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionRequestMessage { + return new LockAssertionRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionRequestMessage | PlainMessage | undefined, b: LockAssertionRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionRequestMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.LockAssertionReceiptMessage + */ +export class LockAssertionReceiptMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: string server_transfer_number = 2; + */ + serverTransferNumber = ""; + + /** + * @generated from field: string server_signature = 3; + */ + serverSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.LockAssertionReceiptMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "server_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): LockAssertionReceiptMessage { + return new LockAssertionReceiptMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): LockAssertionReceiptMessage { + return new LockAssertionReceiptMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): LockAssertionReceiptMessage { + return new LockAssertionReceiptMessage().fromJsonString(jsonString, options); + } + + static equals(a: LockAssertionReceiptMessage | PlainMessage | undefined, b: LockAssertionReceiptMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(LockAssertionReceiptMessage, a, b); + } +} + 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 index ee19d09258..d7e1779400 100644 --- 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 @@ -1,16 +1,44 @@ // @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) +// @generated from file cacti/satp/v02/stage_3.proto (package cacti.satp.v02, syntax proto3) /* eslint-disable */ // @ts-nocheck +import { CommitFinalAcknowledgementReceiptResponseMessage, CommitFinalAssertionRequestMessage, CommitPreparationRequestMessage, CommitReadyResponseMessage, TransferCompleteRequestMessage } from "./stage_3_pb.js"; +import { Empty, MethodKind } from "@bufbuild/protobuf"; + /** - * util RPCs - * - * @generated from service cacti.satp.v02.stage_3.SATPStage3 + * @generated from service cacti.satp.v02.SatpStage3Service */ -export const SATPStage3 = { - typeName: "cacti.satp.v02.stage_3.SATPStage3", +export const SatpStage3Service = { + typeName: "cacti.satp.v02.SatpStage3Service", methods: { + /** + * @generated from rpc cacti.satp.v02.SatpStage3Service.CommitPreparation + */ + commitPreparation: { + name: "CommitPreparation", + I: CommitPreparationRequestMessage, + O: CommitReadyResponseMessage, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.SatpStage3Service.CommitFinalAssertion + */ + commitFinalAssertion: { + name: "CommitFinalAssertion", + I: CommitFinalAssertionRequestMessage, + O: CommitFinalAcknowledgementReceiptResponseMessage, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc cacti.satp.v02.SatpStage3Service.TransferComplete + */ + transferComplete: { + name: "TransferComplete", + I: TransferCompleteRequestMessage, + O: Empty, + kind: MethodKind.Unary, + }, } } as const; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_pb.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_pb.ts new file mode 100644 index 0000000000..7c4c0246fe --- /dev/null +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/generated/proto/cacti/satp/v02/stage_3_pb.ts @@ -0,0 +1,296 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file cacti/satp/v02/stage_3.proto (package cacti.satp.v02, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { AssignmentAssertionClaim, AssignmentAssertionClaimFormat, BurnAssertionClaim, BurnAssertionClaimFormat, CommonSatp, MintAssertionClaims, MintAssertionClaimsFormat } from "./common/message_pb.js"; + +/** + * @generated from message cacti.satp.v02.CommitPreparationRequestMessage + */ +export class CommitPreparationRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: string client_transfer_number = 2; + */ + clientTransferNumber = ""; + + /** + * @generated from field: string client_signature = 3; + */ + clientSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.CommitPreparationRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "client_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommitPreparationRequestMessage { + return new CommitPreparationRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommitPreparationRequestMessage { + return new CommitPreparationRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommitPreparationRequestMessage { + return new CommitPreparationRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: CommitPreparationRequestMessage | PlainMessage | undefined, b: CommitPreparationRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(CommitPreparationRequestMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.CommitReadyResponseMessage + */ +export class CommitReadyResponseMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: cacti.satp.v02.common.MintAssertionClaims mint_assertion_claims = 2; + */ + mintAssertionClaims?: MintAssertionClaims; + + /** + * @generated from field: cacti.satp.v02.common.MintAssertionClaimsFormat mint_assertion_claims_format = 3; + */ + mintAssertionClaimsFormat?: MintAssertionClaimsFormat; + + /** + * @generated from field: string server_transfer_number = 4; + */ + serverTransferNumber = ""; + + /** + * @generated from field: string server_signature = 5; + */ + serverSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.CommitReadyResponseMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "mint_assertion_claims", kind: "message", T: MintAssertionClaims }, + { no: 3, name: "mint_assertion_claims_format", kind: "message", T: MintAssertionClaimsFormat }, + { no: 4, name: "server_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommitReadyResponseMessage { + return new CommitReadyResponseMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommitReadyResponseMessage { + return new CommitReadyResponseMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommitReadyResponseMessage { + return new CommitReadyResponseMessage().fromJsonString(jsonString, options); + } + + static equals(a: CommitReadyResponseMessage | PlainMessage | undefined, b: CommitReadyResponseMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(CommitReadyResponseMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.CommitFinalAssertionRequestMessage + */ +export class CommitFinalAssertionRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: cacti.satp.v02.common.BurnAssertionClaim burn_assertion_claim = 2; + */ + burnAssertionClaim?: BurnAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.BurnAssertionClaimFormat burn_assertion_claim_format = 3; + */ + burnAssertionClaimFormat?: BurnAssertionClaimFormat; + + /** + * @generated from field: string client_transfer_number = 4; + */ + clientTransferNumber = ""; + + /** + * @generated from field: string client_signature = 5; + */ + clientSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.CommitFinalAssertionRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "burn_assertion_claim", kind: "message", T: BurnAssertionClaim }, + { no: 3, name: "burn_assertion_claim_format", kind: "message", T: BurnAssertionClaimFormat }, + { no: 4, name: "client_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommitFinalAssertionRequestMessage { + return new CommitFinalAssertionRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommitFinalAssertionRequestMessage { + return new CommitFinalAssertionRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommitFinalAssertionRequestMessage { + return new CommitFinalAssertionRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: CommitFinalAssertionRequestMessage | PlainMessage | undefined, b: CommitFinalAssertionRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(CommitFinalAssertionRequestMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.CommitFinalAcknowledgementReceiptResponseMessage + */ +export class CommitFinalAcknowledgementReceiptResponseMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: cacti.satp.v02.common.AssignmentAssertionClaim assignment_assertion_claim = 2; + */ + assignmentAssertionClaim?: AssignmentAssertionClaim; + + /** + * @generated from field: cacti.satp.v02.common.AssignmentAssertionClaimFormat assignment_assertion_claim_format = 3; + */ + assignmentAssertionClaimFormat?: AssignmentAssertionClaimFormat; + + /** + * @generated from field: string server_transfer_number = 4; + */ + serverTransferNumber = ""; + + /** + * @generated from field: string server_signature = 5; + */ + serverSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.CommitFinalAcknowledgementReceiptResponseMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "assignment_assertion_claim", kind: "message", T: AssignmentAssertionClaim }, + { no: 3, name: "assignment_assertion_claim_format", kind: "message", T: AssignmentAssertionClaimFormat }, + { no: 4, name: "server_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "server_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CommitFinalAcknowledgementReceiptResponseMessage { + return new CommitFinalAcknowledgementReceiptResponseMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CommitFinalAcknowledgementReceiptResponseMessage { + return new CommitFinalAcknowledgementReceiptResponseMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CommitFinalAcknowledgementReceiptResponseMessage { + return new CommitFinalAcknowledgementReceiptResponseMessage().fromJsonString(jsonString, options); + } + + static equals(a: CommitFinalAcknowledgementReceiptResponseMessage | PlainMessage | undefined, b: CommitFinalAcknowledgementReceiptResponseMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(CommitFinalAcknowledgementReceiptResponseMessage, a, b); + } +} + +/** + * @generated from message cacti.satp.v02.TransferCompleteRequestMessage + */ +export class TransferCompleteRequestMessage extends Message { + /** + * @generated from field: cacti.satp.v02.common.CommonSatp common = 1; + */ + common?: CommonSatp; + + /** + * @generated from field: string hash_transfer_commence = 2; + */ + hashTransferCommence = ""; + + /** + * @generated from field: string client_transfer_number = 3; + */ + clientTransferNumber = ""; + + /** + * @generated from field: string client_signature = 4; + */ + clientSignature = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "cacti.satp.v02.TransferCompleteRequestMessage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "common", kind: "message", T: CommonSatp }, + { no: 2, name: "hash_transfer_commence", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "client_transfer_number", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "client_signature", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): TransferCompleteRequestMessage { + return new TransferCompleteRequestMessage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): TransferCompleteRequestMessage { + return new TransferCompleteRequestMessage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): TransferCompleteRequestMessage { + return new TransferCompleteRequestMessage().fromJsonString(jsonString, options); + } + + static equals(a: TransferCompleteRequestMessage | PlainMessage | undefined, b: TransferCompleteRequestMessage | PlainMessage | undefined): boolean { + return proto3.util.equals(TransferCompleteRequestMessage, a, b); + } +} + diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts index 25de4a19ae..046b37d527 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/plugin-satp-gateway.ts @@ -23,7 +23,6 @@ import { import { TransferInitializationV1Response, DefaultApi as SatpApi, - SessionData, ClientV1Request, TransferCommenceV1Request, TransferCommenceV1Response, @@ -35,12 +34,12 @@ import { CommitFinalV1Response, TransferCompleteV1Request, TransferInitializationV1Request, - LocalLog, RecoverV1Message, RecoverUpdateV1Message, RecoverUpdateAckV1Message, RollbackV1Message, RollbackAckV1Message, + SessionData } 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"; @@ -92,10 +91,7 @@ import { RollbackAckMessageEndpointV1 } from "./web-services/recovery/rollback-a 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"; -import { - ILocalLogRepository, - IRemoteLogRepository, -} from "./repository/interfaces/repository"; +import { IRemoteLogRepository } from "./repository/interfaces/repository"; export enum SatpMessageType { InitializationRequest = "urn:ietf:satp:msgtype:init-transfer-msg", @@ -111,6 +107,7 @@ export enum SatpMessageType { TransferCompleteRequest = "urn:ietf:satp:msgtype:commit-transfer-complete-msg", } +import { LocalLog, RemoteLog } from "./core/types"; export interface IPluginSatpGatewayConstructorOptions { name: string; dltIDs: string[]; @@ -130,23 +127,6 @@ export interface IKeyPair { publicKey: Uint8Array; privateKey: Uint8Array; } - -export interface IRemoteLog { - key: string; - hash: string; - signature: string; - signerPubKey: string; -} - -export interface ILocalLog { - key?: string; - sessionID: string; - data?: string; - type: string; - operation: string; - timestamp?: string; -} - // todo implement factory export abstract class PluginSATPGateway implements ICactusPlugin, IPluginWebService @@ -159,7 +139,7 @@ export abstract class PluginSATPGateway private _pubKey: string; private _privKey: string; - public localRepository?: ILocalLogRepository; + public localRepository?: LocalLogRepository; public remoteRepository?: IRemoteLogRepository; private endpoints: IWebServiceEndpoint[] | undefined; @@ -469,7 +449,7 @@ export abstract class PluginSATPGateway } } - async storeInDatabase(LocalLog: ILocalLog) { + async storeInDatabase(LocalLog: LocalLog) { const fnTag = `${this.className}#storeInDatabase()`; this.log.info(`${fnTag}, Storing locally log: ${JSON.stringify(LocalLog)}`); @@ -479,7 +459,7 @@ export abstract class PluginSATPGateway async storeRemoteLog(key: string, hash: string) { const fnTag = `${this.className}#storeRemoteLog()`; - const remoteLog: IRemoteLog = { + const remoteLog: RemoteLog = { key: key, hash: hash, signature: "", @@ -527,7 +507,7 @@ export abstract class PluginSATPGateway await this.storeRemoteLog(localLog.key, hash); } - async storeProof(localLog: ILocalLog): Promise { + async storeProof(localLog: LocalLog): Promise { if (localLog.data == undefined) return; localLog.key = PluginSATPGateway.getSatpLogKey( @@ -544,7 +524,7 @@ export abstract class PluginSATPGateway await this.storeRemoteLog(localLog.key, hash); } - async getLogFromDatabase(logKey: string): Promise { + async getLogFromDatabase(logKey: string): Promise { const fnTag = `${this.className}#getLogFromDatabase()`; this.log.info(`${fnTag}, retrieving log with key ${logKey}`); @@ -566,13 +546,11 @@ export abstract class PluginSATPGateway }); } - async getLogsMoreRecentThanTimestamp( - timestamp: string, - ): Promise { + async getLogsMoreRecentThanTimestamp(timestamp: string): Promise { const fnTag = `${this.className}#getLogsMoreRecentThanTimestamp()`; this.log.info(`${fnTag}, retrieving logs more recent than ${timestamp}`); - const logs: ILocalLog[] | undefined = + const logs: LocalLog[] | undefined = await this.localRepository?.readLogsMoreRecentThanTimestamp(timestamp); if (logs == undefined) { @@ -584,7 +562,7 @@ export abstract class PluginSATPGateway return logs; } - async getLogFromRemote(logKey: string): Promise { + async getLogFromRemote(logKey: string): Promise { const fnTag = `${this.className}#getSatpLogFromIPFS()`; this.log.info(`Retrieving log with key: <${logKey}>`); diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts index 9526328bf5..8d1524398f 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/interfaces/repository.ts @@ -1,4 +1,4 @@ -import { IRemoteLog, ILocalLog } from "../../plugin-satp-gateway"; +import { LocalLog, RemoteLog } from "../../core/types"; export interface IRepository { readById(id: K): Promise; @@ -7,22 +7,22 @@ export interface IRepository { reset(): any; } -export interface ILocalLogRepository extends IRepository { +export interface ILocalLogRepository extends IRepository { database: any; - readById(id: string): Promise; - readLogsNotProofs(): Promise; - readLogsMoreRecentThanTimestamp(timestamp: string): Promise; - readLastestLog(sessionID: string): Promise; - create(log: ILocalLog): Promise; + readById(id: string): Promise; + readLogsNotProofs(): Promise; + readLogsMoreRecentThanTimestamp(timestamp: string): Promise; + readLastestLog(sessionID: string): Promise; + create(log: LocalLog): Promise; deleteBySessionId(log: string): any; destroy(): any; reset(): any; } -export interface IRemoteLogRepository extends IRepository { +export interface IRemoteLogRepository extends IRepository { database: any; - readById(id: string): Promise; - create(log: IRemoteLog): any; + readById(id: string): Promise; + create(log: RemoteLog): any; destroy(): any; reset(): any; } diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts index aafc69ef34..ef4514f055 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/ipfs-remote-log-repository.ts @@ -1,7 +1,7 @@ import { DefaultApi as ObjectStoreIpfsApi } from "@hyperledger/cactus-plugin-object-store-ipfs"; import { Configuration } from "@hyperledger/cactus-core-api"; import { IRemoteLogRepository } from "./interfaces/repository"; -import { IRemoteLog } from "../plugin-satp-gateway"; +import { RemoteLog } from "../core/types"; export class IPFSRemoteLogRepository implements IRemoteLogRepository { public static readonly CLASS_NAME = "IPFSRemoteLogRepository"; @@ -17,7 +17,7 @@ export class IPFSRemoteLogRepository implements IRemoteLogRepository { return IPFSRemoteLogRepository.CLASS_NAME; } - readById(logKey: string): Promise { + readById(logKey: string): Promise { const fnTag = `${this.className}#readById()`; return this.database @@ -32,7 +32,7 @@ export class IPFSRemoteLogRepository implements IRemoteLogRepository { }); } - create(log: IRemoteLog): any { + create(log: RemoteLog): any { const fnTag = `${this.className}#create()`; const logBase64 = Buffer.from(JSON.stringify(log)).toString("base64"); diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts index b977e3e111..e74b027266 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-local-log-repository.ts @@ -1,4 +1,4 @@ -import { ILocalLog } from "../plugin-satp-gateway"; +import { LocalLog } from "../core/types"; import { ILocalLogRepository } from "./interfaces/repository"; import knex, { Knex } from "knex"; @@ -18,24 +18,24 @@ export class KnexLocalLogRepository implements ILocalLogRepository { return this.database("logs"); } - readById(logKey: string): Promise { + readById(logKey: string): Promise { return this.getLogsTable().where({ key: logKey }).first(); } - readLastestLog(sessionID: string): Promise { + readLastestLog(sessionID: string): Promise { return this.getLogsTable() .orderBy("timestamp", "desc") .where({ sessionID: sessionID }) .first(); } - readLogsMoreRecentThanTimestamp(timestamp: string): Promise { + readLogsMoreRecentThanTimestamp(timestamp: string): Promise { return this.getLogsTable() .where("timestamp", ">", timestamp) .whereNot("type", "like", "%proof%"); } - create(log: ILocalLog): any { + create(log: LocalLog): any { return this.getLogsTable().insert(log); } @@ -43,7 +43,7 @@ export class KnexLocalLogRepository implements ILocalLogRepository { return this.database().where({ sessionID: sessionID }).del(); } - readLogsNotProofs(): Promise { + readLogsNotProofs(): Promise { return this.getLogsTable() .select( this.database.raw( diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts index 9431076d0a..529eda61b5 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/repository/knex-remote-log-repository.ts @@ -1,5 +1,5 @@ import { IRemoteLogRepository } from "./interfaces/repository"; -import { IRemoteLog } from "../plugin-satp-gateway"; +import { RemoteLog } from "../core/types"; import knex, { Knex } from "knex"; export class KnexRemoteLogRepository implements IRemoteLogRepository { @@ -21,11 +21,11 @@ export class KnexRemoteLogRepository implements IRemoteLogRepository { return this.database("remote-logs"); } - readById(logKey: string): Promise { + readById(logKey: string): Promise { return this.getLogsTable().where({ key: logKey }).first(); } - create(log: IRemoteLog): any { + create(log: RemoteLog): any { return this.getLogsTable().insert(log); } 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 index 7ddc8a62d9..f3f920b869 100644 --- 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 @@ -1,18 +1,20 @@ 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 { + SATPGateway, + SATPGatewayConfig, +} from "../../../main/typescript/gateway-refactor"; import { PluginFactorySATPGateway } from "../../../main/typescript/factory/plugin-factory-gateway-orchestrator"; import { - IPluginFactoryOptions, PluginImportType, + IPluginFactoryOptions, + PluginImportType, } from "@hyperledger/cactus-core-api"; -import { SupportedGatewayImplementations } from './../../../main/typescript/core/types'; +import { SupportedGatewayImplementations } from "./../../../main/typescript/core/types"; const logLevel: LogLevelDesc = "INFO"; const log = LoggerProvider.getOrCreate({ @@ -21,7 +23,7 @@ const log = LoggerProvider.getOrCreate({ }); const factoryOptions: IPluginFactoryOptions = { pluginImportType: PluginImportType.Local, -} +}; const factory = new PluginFactorySATPGateway(factoryOptions); beforeAll(async () => { @@ -36,14 +38,13 @@ beforeAll(async () => { }); 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(); + const identity = gateway.Identity; expect(identity).toBeDefined(); expect(identity.id).toBeDefined(); expect(identity.name).toBeDefined(); @@ -59,7 +60,7 @@ describe("SATPGateway initialization", () => { SupportedGatewayImplementations.BESU, ]); expect(identity.proofID).toBe("mockProofID1"); - expect(identity.port).toBe(3000); + expect(identity.gatewayClientPort).toBe(3011); expect(identity.address).toBe("http://localhost"); }); @@ -81,7 +82,7 @@ describe("SATPGateway initialization", () => { SupportedGatewayImplementations.BESU, ], proofID: "mockProofID10", - port: 3001, + gatewayClientPort: 3001, address: "https://localhost", }, }; @@ -89,7 +90,7 @@ describe("SATPGateway initialization", () => { expect(gateway).toBeInstanceOf(SATPGateway); - const identity = gateway.getIdentity(); + const identity = gateway.Identity; expect(identity).toBeDefined(); expect(identity.id).toBeDefined(); expect(identity.name).toBeDefined(); @@ -105,7 +106,7 @@ describe("SATPGateway initialization", () => { SupportedGatewayImplementations.BESU, ]); expect(identity.proofID).toBe("mockProofID10"); - expect(identity.port).toBe(3001); + expect(identity.gatewayClientPort).toBe(3001); expect(identity.address).toBe("https://localhost"); }); @@ -127,20 +128,19 @@ describe("SATPGateway initialization", () => { SupportedGatewayImplementations.BESU, ], proofID: "mockProofID10", - port: 3010, + gatewayClientPort: 3010, address: "https://localhost", }, }; const gateway = await factory.create(options); expect(gateway).toBeInstanceOf(SATPGateway); - const identity = gateway.getIdentity(); - expect(identity.port).toBe(3010); + const identity = gateway.Identity; + expect(identity.gatewayClientPort).toBe(3010); expect(identity.address).toBe("https://localhost"); - await gateway.startupServer(); + await gateway.startupBOLServer(); await gateway.shutdown(); }); - }); afterAll(async () => { 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 3e8af87d5f..e71bb32874 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 @@ -2,11 +2,8 @@ import { v4 as uuidv4 } from "uuid"; import "jest-extended"; import { Secp256k1Keys } from "@hyperledger/cactus-common"; import { v4 as uuidV4 } from "uuid"; -import { - ILocalLog, - PluginSATPGateway, -} from "../../../../main/typescript/plugin-satp-gateway"; - +import { PluginSATPGateway } from "../../../../main/typescript/plugin-satp-gateway"; +import { LocalLog } from "../../../../main/typescript/core/types"; import { SessionData } from "../../../../main/typescript/public-api"; import { SHA256 } from "crypto-js"; import { BesuSATPGateway } from "../../../../main/typescript/core/besu-satp-gateway"; @@ -34,10 +31,10 @@ let type2: string; let type3: string; let type4: string; let operation: string; -let satpLog: ILocalLog; -let satpLog2: ILocalLog; -let satpLog3: ILocalLog; -let satpLog4: ILocalLog; +let satpLog: LocalLog; +let satpLog2: LocalLog; +let satpLog3: LocalLog; +let satpLog4: LocalLog; let sessionData: SessionData; beforeEach(async () => { 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 f93dd989c8..8aa8aa03d7 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 @@ -4,9 +4,10 @@ import { SHA256 } from "crypto-js"; import { SatpMessageType, PluginSATPGateway, - ILocalLog, } from "../../../../main/typescript/plugin-satp-gateway"; +import { LocalLog } from "../../../../main/typescript/core/types"; + import { CommitFinalV1Request, SessionData, @@ -94,7 +95,7 @@ beforeEach(async () => { type: "proof", operation: "delete", data: COMMIT_FINAL_CLAIM, - } as ILocalLog); + } as LocalLog); }); test("valid commit final request", async () => { diff --git a/yarn.lock b/yarn.lock index c31ca06963..b936eade9f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4262,6 +4262,13 @@ __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-arm64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-darwin-arm64@npm:1.30.0" @@ -4269,6 +4276,13 @@ __metadata: 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-darwin-x64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-darwin-x64@npm:1.30.0" @@ -4276,6 +4290,13 @@ __metadata: 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-aarch64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-linux-aarch64@npm:1.30.0" @@ -4283,6 +4304,13 @@ __metadata: 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-linux-x64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-linux-x64@npm:1.30.0" @@ -4290,6 +4318,13 @@ __metadata: 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-arm64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-win32-arm64@npm:1.30.0" @@ -4297,6 +4332,13 @@ __metadata: 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-win32-x64@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf-win32-x64@npm:1.30.0" @@ -4304,6 +4346,37 @@ __metadata: 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/buf@npm:1.30.0": version: 1.30.0 resolution: "@bufbuild/buf@npm:1.30.0" @@ -4335,13 +4408,37 @@ __metadata: languageName: node linkType: hard -"@bufbuild/protobuf@npm:1.8.0, @bufbuild/protobuf@npm:^1.7.2, @bufbuild/protobuf@npm:^1.8.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/protobuf@npm:1.8.0, @bufbuild/protobuf@npm:^1.6.0, @bufbuild/protobuf@npm:^1.7.2, @bufbuild/protobuf@npm:^1.8.0": version: 1.8.0 resolution: "@bufbuild/protobuf@npm:1.8.0" checksum: 10/f91d60ff1609c023466500e99312d2e92ac09c163d615c315fa25d9e50f1e9b76a3a9cac776786a3dd5c5065bb7061bf29388587e2a1d27306f68ed98e57a892 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/protoc-gen-es@npm:1.8.0": version: 1.8.0 resolution: "@bufbuild/protoc-gen-es@npm:1.8.0" @@ -4359,7 +4456,18 @@ __metadata: languageName: node linkType: hard -"@bufbuild/protoplugin@npm:1.8.0, @bufbuild/protoplugin@npm:^1.7.2": +"@bufbuild/protoplugin@npm:1.7.2": + 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 + +"@bufbuild/protoplugin@npm:1.8.0, @bufbuild/protoplugin@npm:^1.6.0, @bufbuild/protoplugin@npm:^1.7.2": version: 1.8.0 resolution: "@bufbuild/protoplugin@npm:1.8.0" dependencies: @@ -4636,6 +4744,19 @@ __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-express@npm:1.4.0": version: 1.4.0 resolution: "@connectrpc/connect-express@npm:1.4.0" @@ -4661,6 +4782,18 @@ __metadata: 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-node@npm:1.4.0": version: 1.4.0 resolution: "@connectrpc/connect-node@npm:1.4.0" @@ -4683,6 +4816,15 @@ __metadata: 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/connect@npm:1.4.0": version: 1.4.0 resolution: "@connectrpc/connect@npm:1.4.0" @@ -4692,15 +4834,15 @@ __metadata: languageName: node linkType: hard -"@connectrpc/protoc-gen-connect-es@npm:1.4.0": - version: 1.4.0 - resolution: "@connectrpc/protoc-gen-connect-es@npm:1.4.0" +"@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.7.2" - "@bufbuild/protoplugin": "npm:^1.7.2" + "@bufbuild/protobuf": "npm:^1.6.0" + "@bufbuild/protoplugin": "npm:^1.6.0" peerDependencies: - "@bufbuild/protoc-gen-es": ^1.7.2 - "@connectrpc/connect": 1.4.0 + "@bufbuild/protoc-gen-es": ^1.6.0 + "@connectrpc/connect": 1.3.0 peerDependenciesMeta: "@bufbuild/protoc-gen-es": optional: true @@ -4708,7 +4850,7 @@ __metadata: optional: true bin: protoc-gen-connect-es: bin/protoc-gen-connect-es - checksum: 10/41aca6dd648857504595acb063e5061aa058f629b4939bb9941464f292915b4b40d63793e6567745517ec187d069b6110827f6649ecea203b1ca99de5efca4d9 + checksum: 10/23a17bef378ac2fa414fb35fe50a7630134946a086f75f9201c5d0c3631f32e61445628b0420eac7353e88193e170059969bc83bad96a9f43cb98db30243aa1c languageName: node linkType: hard @@ -8294,33 +8436,6 @@ __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" @@ -12880,14 +12995,14 @@ __metadata: linkType: hard "@quobix/vacuum@npm:^0.9.10": - version: 0.9.10 - resolution: "@quobix/vacuum@npm:0.9.10" + version: 0.9.13 + resolution: "@quobix/vacuum@npm:0.9.13" dependencies: node-fetch: "npm:^3.2.10" tar: "npm:^6.1.11" bin: vacuum: bin/vacuum.js - checksum: 10/9a6b2a2f70cdfd493b0d64e4dff9ec9c2b6b1b29d90192cad40ca25678ebdb950f6ebab4b155eaef75090d07690e495874815cbb48797117834be567f9af685a + checksum: 10/330be4ac2af28d0e387f2eab77182ac5a37b44c456f76705d51c0b5b97d937295781ed514e905a313bb0a1cd4fa15e17112efa4fffbea5f203917c76a4be3d00 languageName: node linkType: hard @@ -35066,9 +35181,9 @@ __metadata: linkType: hard "libphonenumber-js@npm:^1.10.53": - version: 1.10.58 - resolution: "libphonenumber-js@npm:1.10.58" - checksum: 10/8ac5a23a8b37ad4a8e75de29e0436270272429e1deebf090257f23c67a23138938619822c260408c1ade7170e1859e4ced732b80011e38148ed9a0848dd9a850 + version: 1.10.60 + resolution: "libphonenumber-js@npm:1.10.60" + checksum: 10/5fbae9dde13fdad9e14166dc652aae896ef16896b6c436563b8860eef8beda0b63286a54c962fc4e2345a6c4aef63d01aad9c1a81663d96566f9a764e70536d4 languageName: node linkType: hard @@ -47312,9 +47427,9 @@ __metadata: linkType: hard "swagger-ui-dist@npm:>=5.0.0": - version: 5.12.0 - resolution: "swagger-ui-dist@npm:5.12.0" - checksum: 10/2e52f3958b6e6cbdc1a904828f7c15eee34b3327696c4a26a6987a5036582a04aa22d8cc4587af4849de0ba10ec4e036390fa4ecad3a2e90184b0f4437fabde3 + version: 5.15.1 + resolution: "swagger-ui-dist@npm:5.15.1" + checksum: 10/5250fda8d2135edf485dc334f88fc42c05da568379ced81429b01f06c64cabc337a7a925e7bb3d0c9d5e5ef79ad07aa9d1392a3ddafefe6e83b03538db7334e7 languageName: node linkType: hard