diff --git a/BUILD.md b/BUILD.md index 88878b8593..a784830b53 100644 --- a/BUILD.md +++ b/BUILD.md @@ -105,7 +105,7 @@ The `npm run watch` script in action: * Docker Compose * OpenJDK (Corda support Java 8 JDK but do not currently support Java 9 or higher) * `sudo apt install openjdk-8-jdk-headless` - * Indy SDK + * Indy SDK (optional) * [Installing the SDK](https://github.com/hyperledger/indy-sdk#installing-the-sdk) * [Build the SDK from source](https://github.com/hyperledger/indy-sdk#how-to-build-indy-sdk-from-source) diff --git a/examples/cactus-example-discounted-asset-trade/Dockerfile b/examples/cactus-example-discounted-asset-trade/Dockerfile index 6198cdb831..de05eec284 100644 --- a/examples/cactus-example-discounted-asset-trade/Dockerfile +++ b/examples/cactus-example-discounted-asset-trade/Dockerfile @@ -1,6 +1,7 @@ FROM cactus-cmd-socketio-server:latest ARG NPM_PKG_VERSION=latest +ARG INDY_SDK_PKG_VERSION=1.16.0-dev-1649 ENV APP_HOME=/root/cactus @@ -9,8 +10,8 @@ WORKDIR ${APP_HOME} # Required by indy-sdk RUN apt-get update \ && apt-get install -y libsodium23 \ - libssl1.1 \ - libzmq5 \ + libssl1.1 \ + libzmq5 \ && rm -rf /var/lib/apt/lists/* # Copy indy sdk lib from base ubuntu image @@ -18,8 +19,8 @@ RUN apt-get update \ COPY --from=indy-sdk-cli:latest /usr/lib/libindy.so /usr/lib/ COPY ./package.json ./dist/yarn.lock ./ -RUN yarn add "${CACTUS_CMD_SOCKETIO_PATH}" "@hyperledger/cactus-verifier-client@${NPM_PKG_VERSION}" \ - --production --ignore-engines --non-interactive --cache-folder ./.yarnCache && \ +RUN yarn add "${CACTUS_CMD_SOCKETIO_PATH}" "@hyperledger/cactus-verifier-client@${NPM_PKG_VERSION}" "indy-sdk@${INDY_SDK_PKG_VERSION}" \ + --production --ignore-engines --non-interactive --cache-folder ./.yarnCache && \ rm -rf ./.yarnCache COPY ./dist ./dist/ diff --git a/examples/cactus-example-discounted-asset-trade/README.md b/examples/cactus-example-discounted-asset-trade/README.md index 14cb062a33..9645964a26 100644 --- a/examples/cactus-example-discounted-asset-trade/README.md +++ b/examples/cactus-example-discounted-asset-trade/README.md @@ -1,6 +1,5 @@ # Cactus discounted-asset-trade - ## Abstract Cactus discounted-asset-trade is a sample application that calculates asset cost based on customer type. In this application, when the users transfer the asset ownership in the cactus discounted-asset-trade, they present their employee proofs to the asset-owner company to receive an employee discount. We implement the employee proofs by proofs on Hyperledger Indy. Asset ownership is represented by a [asset-transfer-basic](https://github.com/hyperledger/fabric-samples/tree/release-2.2/asset-transfer-basic) chaincodetoken on Hyperledger Fabric, which can be exchanged for ETH currency on a private Ethereum blockchain. This Business Logic Plugin (BLP) application controls a process from employee certification using Hyperledger Indy to payment using Ethereum. @@ -28,206 +27,262 @@ Alice will use credentials and other Indy formats such as schema and definition ## Setup Overview ### fabric-socketio-validator + - Validator for fabric ledger. - Docker networks: `fabric-all-in-one_testnet-2x`, `cactus-example-discounted-asset-trade-net` ### ethereum-validator + - Validator for ethereum ledger. - Docker network: `geth1net`, `cactus-example-discounted-asset-trade-net` ### indy-sdk-cli-base-image + - Base image for indy validator. - It will build the image and immediately exit on run. ### indy-validator + - Validator for indy ledger. - Assumes ledger runs at `172.16.0.2` - Docker network: `indy-testnet_indy_net` - Accessed only by nginx proxy container. ### indy-validator-nginx + - Load balancer / gateway for indy validator. - Use it's endpoint to talk to indy validator. - Uses config from `./nginx/nginx.conf` - Docker network: `indy-testnet_indy_net`, `cactus-example-discounted-asset-trade-net` ### cmd-socketio-base-image + - Base image for `cactus-example-discounted-asset-trade` BLP. - Contains cactus cmd socketio server module - It will build the image and immediately exit on run. ### cactus-example-discounted-asset-trade-blp + - Main logic for this sample application. - Use it's endpoint (`localhost:5034`) to interact the bussiness logic. - Docker network: `cactus-example-discounted-asset-trade-net` ### register-indy-data + - Setup application. - Will generate proof and store it in local configuration on startup. - This application can also be used to send requests to the BLP. ## Indy Schema + ![Indy node pool and validator](./image/indy-setup-schema.svg) ## Preparations + 1. Configure Cactus: - ``` - # execute in root cactus dir - pushd ../.. - npm run configure - popd - ``` + + ``` + # execute in root cactus dir + pushd ../.. + npm run configure + popd + ``` 1. Start the ledgers: - ``` - ./script-start-ledgers.sh - ``` - - This script will start all ledger docker containers, networks, and will setup configuration needed to operate the sample app. - - (NOTICE: Before executing the above, your account needs to be added to the docker group (`usermod -a -G docker YourAccount` from root user)) - - On success, this should start three containers: - - `geth1` - - `asset_trade_faio2x_testnet` - - `indy-testnet-pool` + + ``` + ./script-start-ledgers.sh + ``` + + - This script will start all ledger docker containers, networks, and will setup configuration needed to operate the sample app. + - (NOTICE: Before executing the above, your account needs to be added to the docker group (`usermod -a -G docker YourAccount` from root user)) + - On success, this should start three containers: + - `geth1` + - `asset_trade_faio2x_testnet` + - `indy-testnet-pool` 1. Launch discounted-asset-trade and validators from local `docker-compose.yml` (use separate console for that, docker-compose will block your prompt): - ``` - docker-compose build && docker-compose up - # or - npm run start - ``` - - This will build and launch all needed containers, the final output should look like this: - - ``` - cactus-example-discounted-asset-trade-ethereum-validator | listening on *:5050 - ... - cactus-example-discounted-asset-trade-fabric-socketio-validator | listening on *:5040 - ... - cactus-example-discounted-asset-trade-indy-validator | 2022-01-31 16:00:49,552 INFO success: validator entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) - ... - cactus-example-discounted-asset-trade-indy-validator-nginx | 2022/01/31 16:00:49 [notice] 1#1: start worker process 35 - ... - cmd-socketio-base-dummy exited with code 0 - ... - indy-sdk-cli-base-dummy exited with code 0 - ... - register-indy-data | Done. - register-indy-data exited with code 0 - ... - cactus-example-discounted-asset-trade-blp | [2022-01-31T16:00:56.208] [INFO] www - listening on *: 5034 - ``` + + ``` + docker-compose build && docker-compose up + # or + npm run start + ``` + + This will build and launch all needed containers, the final output should look like this: + + ``` + cactus-example-discounted-asset-trade-ethereum-validator | listening on *:5050 + ... + cactus-example-discounted-asset-trade-fabric-socketio-validator | listening on *:5040 + ... + cactus-example-discounted-asset-trade-indy-validator | 2022-01-31 16:00:49,552 INFO success: validator entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) + ... + cactus-example-discounted-asset-trade-indy-validator-nginx | 2022/01/31 16:00:49 [notice] 1#1: start worker process 35 + ... + cmd-socketio-base-dummy exited with code 0 + ... + indy-sdk-cli-base-dummy exited with code 0 + ... + register-indy-data | Done. + register-indy-data exited with code 0 + ... + cactus-example-discounted-asset-trade-blp | [2022-01-31T16:00:56.208] [INFO] www - listening on *: 5034 + ``` ### Dockerless run + For development purposes, it might be useful to run the sample application outside of docker-compose environment. +1. Install Indy SDK required by this sample app: + - [Installing the SDK](https://github.com/hyperledger/indy-sdk#installing-the-sdk) + - [Build the SDK from source](https://github.com/hyperledger/indy-sdk#how-to-build-indy-sdk-from-source) + - Or use these steps for Ubuntu 20.04: + ```bash + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ + && sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \ + && sudo apt-get update \ + && sudo apt-get install -y \ + libindy \ + libnullpay \ + libvcx \ + indy-cli \ + && sudo rm -f /etc/apt/sources.list.d/sovrin.list* + ``` +1. Add indy-sdk node package: `yarn add indy-sdk@1.16.0-dev-1649` (or edit `package.json` directly) 1. Configure cactus and start the ledgers as described above. 1. Run `./script-dockerless-config-patch.sh` from `cactus-example-discounted-asset-trade/` directory. This will patch the configs and copy it to global location. 1. Start validators (each in separate cmd window). - 1. `cd packages/cactus-plugin-ledger-connector-fabric-socketio/ && npm run start` - 1. `cd packages/cactus-plugin-ledger-connector-go-ethereum-socketio/ && npm run start` - 1. `docker build packages-python/cactus_validator_socketio_indy/ -t indy-validator && docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator` + 1. ```bash + cd packages/cactus-plugin-ledger-connector-fabric-socketio/ && npm run start + ``` + 1. ```bash + cd packages/cactus-plugin-ledger-connector-go-ethereum-socketio/ && npm run start + ``` + 1. ```bash + docker build tools/docker/indy-sdk-cli -t indy-sdk-cli && + pushd packages-python/cactus_validator_socketio_indy/ && sh ./setup_indy.sh && popd && + docker build packages-python/cactus_validator_socketio_indy/ -t indy-validator && + docker run -v/etc/cactus/:/etc/cactus --rm --net="indy-testnet_indy_net" -p 10080:8000 indy-validator + ``` 1. Start asset-trade: `npm run start-dockerless` ## How to use this application 1. (Optional) Check the balance on Ethereum and the asset ownership on Fabric using the following script: - ``` - node ./read-ledger-state.js - ``` - - The result looks like the following (simplified output): - - ``` - # Ethereum fromAccount: - { status: 200, amount: 100000 } - - # Ethereum toAccount: - { status: 200, amount: 0 } - - # Fabric: - [ - { - ... - }, - { - ID: 'asset2', - color: 'red', - size: 5, - owner: 'Brad', - appraisedValue: 400 - }, - ... - ] - ``` - -1. Run the transaction execution using the following script: - ``` - ./script-post-trade-request.sh - ``` - - ... or send request manually: - - ``` - docker run --rm -ti -v "$(pwd)/etc/cactus/":"/etc/cactus/" --net="host" register-indy-data - ``` - - After this, the transactions are executed by order. When the following log appears on the console where you executed `docker-compose`, the transactions are completed. - - ``` - [INFO] BusinessLogicAssetTrade - ##INFO: completed asset-trade, businessLogicID: guks32pf, tradeID: *******-001 - ``` + + ``` + node ./read-ledger-state.js + ``` + + The result looks like the following (simplified output): + + ``` + # Ethereum fromAccount: + { status: 200, amount: 100000 } + + # Ethereum toAccount: + { status: 200, amount: 0 } + + # Fabric: + [ + { + ... + }, + { + ID: 'asset2', + color: 'red', + size: 5, + owner: 'Brad', + appraisedValue: 400 + }, + ... + ] + ``` + +1. Run the transaction execution: + + **For docker-compose environment, run:** + + ``` + ./script-post-trade-request.sh + ``` + + ... or send request manually: + + ``` + docker run --rm -ti -v "$(pwd)/etc/cactus/":"/etc/cactus/" --net="host" register-indy-data + ``` + + **For dockerless environment, run:** + + ```bash + pushd ../register-indy-data && sh ./script-build-docker.sh && popd && + docker run --rm -ti -v/etc/cactus/:/etc/cactus/ --net="host" register-indy-data --force + ``` + + **After sending the requests** + + - The transactions are executed by order. + - When the following log appears on the BLP console, the transactions are completed. + + ``` + [INFO] BusinessLogicAssetTrade - ##INFO: completed asset-trade, businessLogicID: guks32pf, tradeID: *******-001 + ``` 1. (Optional) Check the balance on Ethereum and the asset ownership on Fabric using the following script - ``` - node ./read-ledger-state.js - ``` - - The result looks like the following (simplified output). In the following case, 50 coins from `fromAccount` was transferred to `toAccount`, and the asset ownership ("owner") was transferred from Brad to Cathy. - - ``` - # Ethereum fromAccount: - { status: 200, amount: 99950 } - - # Ethereum toAccount: - { status: 200, amount: 50 } - - # Fabric: - [ - { - ... - }, - { - ID: 'asset2', - color: 'red', - size: 5, - owner: 'Cathy', - appraisedValue: 400 - }, - ... - ] - ``` + + ``` + node ./read-ledger-state.js + ``` + + The result looks like the following (simplified output). In the following case, 50 coins from `fromAccount` was transferred to `toAccount`, and the asset ownership ("owner") was transferred from Brad to Cathy. + + ``` + # Ethereum fromAccount: + { status: 200, amount: 99950 } + + # Ethereum toAccount: + { status: 200, amount: 50 } + + # Fabric: + [ + { + ... + }, + { + ID: 'asset2', + color: 'red', + size: 5, + owner: 'Cathy', + appraisedValue: 400 + }, + ... + ] + ``` ## How to stop the application and Docker containers 1. Press `Ctrl+C` in `docker-compose` console to stop the application. 1. Run cleanup script - ``` - sudo ./script-cleanup.sh - ``` + ``` + sudo ./script-cleanup.sh + ``` #### Manual cleanup instructions 1. Remove the config files on your machine - ``` - sudo rm -r ./etc/cactus/ - ``` + ``` + sudo rm -r ./etc/cactus/ + ``` 1. Stop the docker containers of Ethereum, Fabric and Indy - - `docker stop geth1 asset_trade_faio2x_testnet indy-testnet-pool` - - `docker rm geth1 asset_trade_faio2x_testnet indy-testnet-pool` + + - `docker stop geth1 asset_trade_faio2x_testnet indy-testnet-pool` + - `docker rm geth1 asset_trade_faio2x_testnet indy-testnet-pool` 1. Clear indy testnet sandbox - ``` - pushd ../../tools/docker/indy-testnet/ - ./script-cleanup.sh - popd - ``` + ``` + pushd ../../tools/docker/indy-testnet/ + ./script-cleanup.sh + popd + ``` diff --git a/examples/cactus-example-discounted-asset-trade/config/default.yaml b/examples/cactus-example-discounted-asset-trade/config/default.yaml deleted file mode 100755 index 7014b6a46c..0000000000 --- a/examples/cactus-example-discounted-asset-trade/config/default.yaml +++ /dev/null @@ -1 +0,0 @@ -../../../packages/cactus-cmd-socketio-server/config/default.yaml \ No newline at end of file diff --git a/examples/cactus-example-discounted-asset-trade/config/default.yaml b/examples/cactus-example-discounted-asset-trade/config/default.yaml new file mode 120000 index 0000000000..7014b6a46c --- /dev/null +++ b/examples/cactus-example-discounted-asset-trade/config/default.yaml @@ -0,0 +1 @@ +../../../packages/cactus-cmd-socketio-server/config/default.yaml \ No newline at end of file diff --git a/examples/cactus-example-discounted-asset-trade/docker-compose.yml b/examples/cactus-example-discounted-asset-trade/docker-compose.yml index 32009e9b4f..81d1260375 100644 --- a/examples/cactus-example-discounted-asset-trade/docker-compose.yml +++ b/examples/cactus-example-discounted-asset-trade/docker-compose.yml @@ -4,6 +4,14 @@ version: "3.4" # ./etc/cactus should already exist and contain cactus node configs services: + cmd-socketio-base-image: + # Build base image and immediately exit + container_name: cmd-socketio-base-dummy + image: cactus-cmd-socketio-server + build: + context: ../../packages/cactus-cmd-socketio-server/ + command: ["echo", "OK - Exit"] + fabric-socketio-validator: container_name: cactus-example-discounted-asset-trade-fabric-socketio-validator image: cactus-plugin-ledger-connector-fabric-socketio @@ -11,6 +19,8 @@ services: context: ../../packages/cactus-plugin-ledger-connector-fabric-socketio/ ports: - "5040:5040" + depends_on: + - cmd-socketio-base-image volumes: - type: bind source: ./etc/cactus @@ -26,6 +36,8 @@ services: context: ../../packages/cactus-plugin-ledger-connector-go-ethereum-socketio/ ports: - "5050:5050" + depends_on: + - cmd-socketio-base-image volumes: - type: bind source: ./etc/cactus @@ -76,14 +88,6 @@ services: - indy-testnet_indy_net - cactus-example-discounted-asset-trade-net - cmd-socketio-base-image: - # Build base image and immediately exit - container_name: cmd-socketio-base-dummy - image: cactus-cmd-socketio-server - build: - context: ../../packages/cactus-cmd-socketio-server/ - command: ["echo", "OK - Exit"] - cactus-example-discounted-asset-trade-blp: container_name: cactus-example-discounted-asset-trade-blp image: cactus-example-discounted-asset-trade-blp diff --git a/examples/cactus-example-discounted-asset-trade/package.json b/examples/cactus-example-discounted-asset-trade/package.json index 8c36b321f2..f376c95833 100644 --- a/examples/cactus-example-discounted-asset-trade/package.json +++ b/examples/cactus-example-discounted-asset-trade/package.json @@ -28,7 +28,6 @@ "fabric-client": "1.4.19", "fabric-network": "1.4.19", "http-errors": "1.6.3", - "indy-sdk": "1.16.0-dev-1649", "jsonwebtoken": "8.5.1", "log4js": "6.4.0", "morgan": "1.9.1", diff --git a/examples/cactus-example-electricity-trade/README.md b/examples/cactus-example-electricity-trade/README.md index 5d1ab2074c..fd9d2cef3b 100644 --- a/examples/cactus-example-electricity-trade/README.md +++ b/examples/cactus-example-electricity-trade/README.md @@ -79,7 +79,7 @@ In this example, we use the Sawtooth intkey transaction processor as an applicat For development purposes, it might be useful to run the sample application outside of docker-compose environment. 1. Configure cactus and start the ledgers as described above. -1. Run `./script-dockerless-config-patch.sh` from `cactus-example-discounted-asset-trade/` directory. This will patch the configs and copy it to global location. +1. Run `./script-dockerless-config-patch.sh` from `cactus-example-electricity-trade/` directory. This will patch the configs and copy it to global location. 1. Start validators (each in separate cmd window). 1. `cd packages/cactus-plugin-ledger-connector-go-ethereum-socketio/ && npm run start` 1. `cd packages/cactus-plugin-ledger-connector-sawtooth-socketio/ && npm run start` diff --git a/examples/cactus-example-electricity-trade/docker-compose.yml b/examples/cactus-example-electricity-trade/docker-compose.yml index 1cd957dd53..db4fef7168 100644 --- a/examples/cactus-example-electricity-trade/docker-compose.yml +++ b/examples/cactus-example-electricity-trade/docker-compose.yml @@ -4,6 +4,14 @@ version: "3.4" # ./etc/cactus should already exist and contain cactus node configs services: + cmd-socketio-base-image: + # Build base image and immediately exit + container_name: cmd-socketio-base-dummy + image: cactus-cmd-socketio-server + build: + context: ../../packages/cactus-cmd-socketio-server/ + command: ["echo", "OK - Exit"] + ethereum-validator: container_name: cactus-example-electricity-trade-ethereum-validator image: cactus-plugin-ledger-connector-go-ethereum-socketio @@ -14,6 +22,8 @@ services: networks: - geth1net - cactus-example-electricity-trade-net + depends_on: + - cmd-socketio-base-image volumes: - type: bind source: ./etc/cactus @@ -29,19 +39,13 @@ services: networks: - sawtooth_aio_testnet_1x - cactus-example-electricity-trade-net + depends_on: + - cmd-socketio-base-image volumes: - type: bind source: ./etc/cactus target: /etc/cactus - cmd-socketio-base-image: - # Build base image and immediately exit - container_name: cmd-socketio-base-dummy - image: cactus-cmd-socketio-server - build: - context: ../../packages/cactus-cmd-socketio-server/ - command: ["echo", "OK - Exit"] - cactus-example-electricity-trade-blp: container_name: cactus-example-electricity-trade-blp image: cactus-example-electricity-trade-blp diff --git a/examples/cactus-example-electricity-trade/script-dockerless-config-patch.sh b/examples/cactus-example-electricity-trade/script-dockerless-config-patch.sh index c602ab4aff..d3ced99573 100755 --- a/examples/cactus-example-electricity-trade/script-dockerless-config-patch.sh +++ b/examples/cactus-example-electricity-trade/script-dockerless-config-patch.sh @@ -13,7 +13,7 @@ sudo chown -hR $(whoami) "$COMMON_CACTUS_CONFIG" echo "Patch validators..." sed -i 's/geth1/localhost/g' "${COMMON_CACTUS_CONFIG}/connector-go-ethereum-socketio/default.yaml" -sed -i 's/rest-api/localhost/g' "${COMMON_CACTUS_CONFIG}/connector-sawtooth-socketio/default.yaml" +sed -i 's/sawtooth_all_in_one_ledger_1x/localhost/g' "${COMMON_CACTUS_CONFIG}/connector-sawtooth-socketio/default.yaml" echo "Patch validator-registry-config.yaml..." sed -i 's/ethereum-validator/localhost/g' "${COMMON_CACTUS_CONFIG}/validator-registry-config.yaml" diff --git a/packages/cactus-cmd-socketio-server/README.md b/packages/cactus-cmd-socketio-server/README.md index d2c28a54f7..f45056134d 100644 --- a/packages/cactus-cmd-socketio-server/README.md +++ b/packages/cactus-cmd-socketio-server/README.md @@ -7,3 +7,11 @@ This module is responsible for providing the cactus node server using socket.io - [cactus-example-electricity-trade](../../examples/cactus-example-electricity-trade) - [cactus-example-discounted-asset-trade](../../examples/cactus-example-discounted-asset-trade) +## Docker +- Docker image of this package is used mostly as a base for other applications and plugins (BLP, socketio connectors). +- Docker build process will use artifacts from the latest build. Make sure `./dist` contains the version you want to dockerize. + +``` +# Build +docker build . -t cactus-cmd-socketio-server +``` \ No newline at end of file diff --git a/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/ConfigUtil.ts b/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/ConfigUtil.ts index 764d2dbb2f..5590d1e946 100644 --- a/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/ConfigUtil.ts +++ b/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/ConfigUtil.ts @@ -6,9 +6,18 @@ */ const fs = require("fs"); -const path = require("path"); const yaml = require("js-yaml"); +function readConfig(path: string, encoding = "utf8"): object { + try { + return yaml.safeLoad( + fs.readFileSync(path, encoding) + ); + } catch (err: unknown) { + return {} + } +} + export class ConfigUtil { /** * Get configuration object @@ -16,12 +25,8 @@ export class ConfigUtil { * @return {object} Configuration object */ static getConfig(): object { - const configCommon: any = yaml.safeLoad( - fs.readFileSync("/etc/cactus/default.yaml", "utf8") - ); - const configAppli: any = yaml.safeLoad( - fs.readFileSync("/etc/cactus/usersetting.yaml", "utf8") - ); + const configCommon = readConfig("/etc/cactus/default.yaml", "utf8"); + const configAppli = readConfig("/etc/cactus/usersetting.yaml", "utf8"); return ConfigUtil.mergeObjects(configCommon, configAppli); } diff --git a/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/DBAccess.ts b/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/DBAccess.ts index 4e89ba7126..3f31387625 100644 --- a/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/DBAccess.ts +++ b/packages/cactus-cmd-socketio-server/src/main/typescript/routing-interface/util/DBAccess.ts @@ -15,12 +15,10 @@ const fs = require("fs"); const path = require("path"); const yaml = require("js-yaml"); const configDefault: any = ConfigUtil.getConfig(); -const configVerifier: ValidatorRegistry = new ValidatorRegistry( - path.resolve(__dirname, "/etc/cactus/validator-registry-config.yaml") -); -const configContract: any = yaml.safeLoad( - fs.readFileSync("/etc/cactus/contractInfo.yaml", "utf8") -); + +import { getLogger } from "log4js"; +const logger = getLogger("DBAccess"); +logger.level = configDefault.logLevel; export class DBAccess { ledgerPluginInfo: LedgerPluginInfo[] = []; @@ -32,16 +30,31 @@ export class DBAccess { } getLedgerPluginInfo(): LedgerPluginInfo[] { - // TODO: Future access to DB for connection information + try { + const configVerifier: ValidatorRegistry = new ValidatorRegistry( + path.resolve(__dirname, "/etc/cactus/validator-registry-config.yaml") + ); + this.ledgerPluginInfo = configVerifier.ledgerPluginInfo; + } catch (error) { + logger.info("Could not get ledger plugin info"); + logger.debug(error); + } - this.ledgerPluginInfo = configVerifier.ledgerPluginInfo; return this.ledgerPluginInfo; } getContractInfo(): [] { - // TODO: Future access to DB for contract information + try { + const configContract: any = yaml.safeLoad( + fs.readFileSync("/etc/cactus/contractInfo.yaml", "utf8") + ); + + this.contractInfo = configContract.contractInfo; + } catch (error) { + logger.info("Could not get contract info"); + logger.debug(error); + } - this.contractInfo = configContract.contractInfo; return this.contractInfo; } diff --git a/packages/cactus-cmd-socketio-server/src/main/typescript/util/TransactionSigner.ts b/packages/cactus-cmd-socketio-server/src/main/typescript/util/TransactionSigner.ts index af2b3fa7fd..edfffe3df4 100644 --- a/packages/cactus-cmd-socketio-server/src/main/typescript/util/TransactionSigner.ts +++ b/packages/cactus-cmd-socketio-server/src/main/typescript/util/TransactionSigner.ts @@ -40,6 +40,11 @@ let fabricChannel: any = undefined; export class TransactionSigner { static signTxEthereum(rawTx: object, signPkey: string) { logger.debug(`####in signTxEthereum()`); + + if (!configVerifier.signTxInfo) { + throw new Error("Missing configVerifier.signTxInfo"); + } + // ethereumjs-tx2.1.2_support const customCommon = ethJsCommon.forCustomChain( configVerifier.signTxInfo.ethereum.network, @@ -80,6 +85,10 @@ export class TransactionSigner { logger.debug(`######call signTxFabric()`); let invokeResponse; // Return value from chain code + if (!configVerifier.signTxInfo) { + throw new Error("Missing configVerifier.signTxInfo"); + } + // channel object generation if (fabricChannel === undefined) { fabricChannel = await TransactionSigner.setupChannel( @@ -257,6 +266,11 @@ export class TransactionSigner { verify: false, }; logger.debug("tlssetup start"); + + if (!configVerifier.signTxInfo) { + throw new Error("Missing configVerifier.signTxInfo"); + } + const caService = new classFabricCAService( configVerifier.signTxInfo.fabric.ca.URL, tlsOptions, @@ -277,6 +291,11 @@ export class TransactionSigner { // Creating a channel object static async setupChannel(channelName: any) { logger.debug("setupChannel start"); + + if (!configVerifier.signTxInfo) { + throw new Error("Missing configVerifier.signTxInfo"); + } + const client = new classClient(); await TransactionSigner.TLSSetup( client, diff --git a/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/validator-registry.ts b/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/validator-registry.ts index 7c7a3a154e..145e2b85f1 100644 --- a/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/validator-registry.ts +++ b/packages/cactus-cmd-socketio-server/src/main/typescript/verifier/validator-registry.ts @@ -62,13 +62,17 @@ type SignTxInfo = { }; export class ValidatorRegistry { - ledgerPluginInfo: Array; - signTxInfo: SignTxInfo; + ledgerPluginInfo: Array = []; + signTxInfo: SignTxInfo | undefined; constructor(path: string) { - const yamlText = fs.readFileSync(path, "utf8"); - const yamlObj = yaml.safeLoad(yamlText); - this.ledgerPluginInfo = yamlObj.ledgerPluginInfo; - this.signTxInfo = yamlObj.signTxInfo; + try { + const yamlText = fs.readFileSync(path, "utf8"); + const yamlObj = yaml.safeLoad(yamlText); + this.ledgerPluginInfo = yamlObj.ledgerPluginInfo; + this.signTxInfo = yamlObj.signTxInfo; + } catch (error) { + console.log("Could not read validator registry"); + } } } diff --git a/packages/cactus-cmd-socketio-server/src/test/typescript/unit/ValidatorAuthentication.test.ts b/packages/cactus-cmd-socketio-server/src/test/typescript/unit/validator-authentication.test.ts similarity index 74% rename from packages/cactus-cmd-socketio-server/src/test/typescript/unit/ValidatorAuthentication.test.ts rename to packages/cactus-cmd-socketio-server/src/test/typescript/unit/validator-authentication.test.ts index 1dc8279e72..51265161c1 100644 --- a/packages/cactus-cmd-socketio-server/src/test/typescript/unit/ValidatorAuthentication.test.ts +++ b/packages/cactus-cmd-socketio-server/src/test/typescript/unit/validator-authentication.test.ts @@ -29,30 +29,31 @@ const { publicKey, privateKey } = generateKeyPairSync("ec", { namedCurve: "P-256", }); -// Mock private key reading -import { readFileSync } from "fs"; -jest.mock("fs"); -(readFileSync as jest.Mock).mockReturnValue( - privateKey.export({ type: "sec1", format: "pem" }), -); +const mockConfig = { + sslParam: { + port: 0, + keyValue: privateKey.export({ type: "sec1", format: "pem" }), + certValue: publicKey, + jwtAlgo: "ES256", + }, + logLevel: "info", +}; + +jest.mock("config"); +import config from "config"; +(config.has as jest.Mock).mockImplementation(() => true); +(config.get as jest.Mock).mockImplementation((keyPath: string) => { + let entry = mockConfig as any; + keyPath.split(".").forEach((key: string) => (entry = entry[key])); + return entry; +}); -import { config } from "../../../main/typescript/common/core/config/default"; -import { ValidatorAuthentication } from "../../../main/typescript/verifier/ValidatorAuthentication"; +import { signMessageJwt } from "../../../main/typescript/verifier/validator-authentication"; ////////////////////////// // UNIT TESTS ///////////////////////// -test("Validator loads private key from it's config path", () => { - // Called once - expect((readFileSync as jest.Mock).mock.calls.length).toBe(1); - - // 1'st argument of the 1'st call. - expect((readFileSync as jest.Mock).mock.calls[0][0]).toContain( - config.validatorKeyPath, - ); -}); - test("Static method sign encrypts payload using private key", () => { const message = { message: "Hello", @@ -60,7 +61,7 @@ test("Static method sign encrypts payload using private key", () => { }; // Call sign - const signedMessage = ValidatorAuthentication.sign(message); + const signedMessage = signMessageJwt(message); // Assert signed message log.debug("signedMessage:", signedMessage); diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/Dockerfile b/packages/cactus-plugin-ledger-connector-fabric-socketio/Dockerfile index 7a236879d2..aa2ca1db68 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/Dockerfile +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/Dockerfile @@ -1,15 +1,15 @@ -# TODO -# Install connector as yarn package like in @hyperledger/cactus-plugin-ledger-connector-besu +FROM cactus-cmd-socketio-server:latest -FROM node:14 +ENV CACTUS_CONNECTOR_FABRIC_PATH=/opt/cactus-plugin-ledger-connector-fabric-socketio -WORKDIR /root/cactus/ - -COPY ./dist/yarn.lock ./package.json ./ -RUN yarn install --production --ignore-engines --non-interactive --cache-folder ./.yarnCache; rm -rf ./.yarnCache +WORKDIR ${CACTUS_CONNECTOR_FABRIC_PATH} COPY ./dist ./dist/ +COPY ./dist/yarn.lock ./package.json ./ +RUN yarn add "${CACTUS_CMD_SOCKETIO_PATH}" \ + --production --frozen-lockfile --ignore-engines --non-interactive --cache-folder ./.yarnCache && \ + rm -rf ./.yarnCache EXPOSE 5040 VOLUME ["/etc/cactus/"] -CMD ["npm", "run", "start"] +CMD [ "npm", "run", "start" ] diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/README.md b/packages/cactus-plugin-ledger-connector-fabric-socketio/README.md index 2b832b46f6..81cde7af8e 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/README.md +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/README.md @@ -49,12 +49,16 @@ This plugin provides `Cactus` a way to interact with Hyperledger Fabric networks ``` ### Docker +- This image depends on `cactus-cmd-socketio-server:latest` to be present in local store. **Make sure to follow docker build instructions in [cactus-cmd-socketio-server README](../../packages/cactus-cmd-socketio-server/README.md)) before bulding this image!** +- Docker build process will use artifacts from the latest build. Make sure `./dist` contains the version you want to dockerize. + ``` # Build +pushd ../../packages/cactus-cmd-socketio-server/ && docker build . -t cactus-cmd-socketio-server && popd docker build . -t cactus-plugin-ledger-connector-fabric-socketio # Run -docker run -v/etc/cactus/:/etc/cactus -p 5040:5040 --net=fabric-all-in-one_testnet-2x cactus-plugin-ledger-connector-fabric-socketio +docker run -v/etc/cactus/:/etc/cactus -p 5040:5040 cactus-plugin-ledger-connector-fabric-socketio ``` ### Manual diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/package.json b/packages/cactus-plugin-ledger-connector-fabric-socketio/package.json index 8a5822e82b..5265b1a911 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/package.json +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@types/node": "14.17.32", - "@hyperledger/cactus-cmd-socket-server": "1.0.0", + "@hyperledger/cactus-cmd-socketio-server": "1.1.2", "body-parser": "1.17.2", "cookie-parser": "1.4.6", "debug": "4.1.1", diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/common/core/bin/www.ts b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/common/core/bin/www.ts index 54d84819a8..0193c687ac 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/common/core/bin/www.ts +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/common/core/bin/www.ts @@ -20,7 +20,7 @@ if (!process.env["NODE_CONFIG_DIR"]) { // Must be set before import config process.env["NODE_CONFIG_DIR"] = DEFAULT_NODE_CONFIG_DIR; } -import { configRead } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead } from "@hyperledger/cactus-cmd-socketio-server"; import fs = require("fs"); import { Server } from "socket.io" diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts index 8c02dfffd3..ba5ca9a8f4 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts @@ -19,7 +19,7 @@ import FabricClient from "fabric-client"; // IF declaration for fabric import { getClientAndChannel, getSubmitterAndEnroll } from "./fabricaccess"; // config file -import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socketio-server"; // Log settings import { getLogger } from "log4js"; const logger = getLogger("ServerMonitorPlugin[" + process.pid + "]"); diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerPlugin.ts b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerPlugin.ts index cac8092077..2290d6650a 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerPlugin.ts +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/ServerPlugin.ts @@ -12,7 +12,7 @@ */ // config file -import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socketio-server"; // Log settings import { getLogger } from "log4js"; @@ -387,7 +387,7 @@ export class ServerPlugin { throw errObj; } - const signedBlock = ValidatorAuthentication.sign({ + const signedBlock = signMessageJwt({ result: block, }); diff --git a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/fabricaccess.ts b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/fabricaccess.ts index 14d4b6a451..5da5ad4f8d 100644 --- a/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/fabricaccess.ts +++ b/packages/cactus-plugin-ledger-connector-fabric-socketio/src/main/typescript/connector/fabricaccess.ts @@ -11,7 +11,7 @@ */ //Dependent library -import { configRead } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead } from "@hyperledger/cactus-cmd-socketio-server"; const path = require("path"); import fs from "fs"; diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/Dockerfile b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/Dockerfile index dec7f9fb4c..1386fc3ffd 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/Dockerfile +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/Dockerfile @@ -1,13 +1,15 @@ -# TODO -# Install connector as yarn package like in @hyperledger/cactus-plugin-ledger-connector-besu +FROM cactus-cmd-socketio-server:latest -FROM node:12 +ENV CACTUS_CONNECTOR_GO_ETH_PATH=/opt/cactus-plugin-ledger-connector-go-ethereum-socketio -WORKDIR /root/cactus/ +WORKDIR ${CACTUS_CONNECTOR_GO_ETH_PATH} COPY ./dist ./dist/ COPY ./dist/yarn.lock ./package.json ./ -RUN yarn install --production --frozen-lockfile --non-interactive --cache-folder ./.yarnCache; rm -rf ./.yarnCache +RUN yarn add "${CACTUS_CMD_SOCKETIO_PATH}" \ + --production --frozen-lockfile --ignore-engines --non-interactive --cache-folder ./.yarnCache && \ + rm -rf ./.yarnCache EXPOSE 5050 +VOLUME ["/etc/cactus/"] CMD [ "npm", "run", "start" ] diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md index 683c63d857..2f34de01a6 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md @@ -48,12 +48,16 @@ This plugin provides `Cactus` a way to interact with Go-Ethereum networks. Using ``` ### Docker +- This image depends on `cactus-cmd-socketio-server:latest` to be present in local store. **Make sure to follow docker build instructions in [cactus-cmd-socketio-server README](../../packages/cactus-cmd-socketio-server/README.md)) before bulding this image!** +- Docker build process will use artifacts from the latest build. Make sure `./dist` contains the version you want to dockerize. + ``` # Build +pushd ../../packages/cactus-cmd-socketio-server/ && docker build . -t cactus-cmd-socketio-server && popd docker build . -t cactus-plugin-ledger-connector-go-ethereum-socketio # Run -docker run -v/etc/cactus/:/etc/cactus -p 5050:5050 --net=geth1net cactus-plugin-ledger-connector-go-ethereum-socketio +docker run -v/etc/cactus/:/etc/cactus -p 5050:5050 cactus-plugin-ledger-connector-go-ethereum-socketio ``` ### Manual diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json index c30e121f5d..e7d96b563e 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@types/node": "14.17.32", - "@hyperledger/cactus-cmd-socket-server": "1.0.0", + "@hyperledger/cactus-cmd-socketio-server": "1.1.2", "body-parser": "1.17.2", "cookie-parser": "1.4.6", "debug": "4.1.1", diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/common/core/bin/www.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/common/core/bin/www.ts index 9a6710f6d8..e1bed78a32 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/common/core/bin/www.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/common/core/bin/www.ts @@ -26,7 +26,7 @@ if (!process.env["NODE_CONFIG_DIR"]) { // Must be set before import config process.env["NODE_CONFIG_DIR"] = DEFAULT_NODE_CONFIG_DIR; } -import { configRead } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead } from "@hyperledger/cactus-cmd-socketio-server"; import fs = require("fs"); import { Server } from "socket.io" diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts index ef57039aa4..cbc011c527 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts @@ -14,7 +14,7 @@ */ // configuration file -import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socketio-server"; // Log settings import { getLogger } from "log4js"; const logger = getLogger("ServerMonitorPlugin[" + process.pid + "]"); diff --git a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerPlugin.ts b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerPlugin.ts index 1cc5157cb7..3ef15c090d 100644 --- a/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerPlugin.ts +++ b/packages/cactus-plugin-ledger-connector-go-ethereum-socketio/src/main/typescript/connector/ServerPlugin.ts @@ -12,7 +12,7 @@ */ // configuration file -import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socketio-server"; // Log settings import { getLogger } from "log4js"; const logger = getLogger("ServerPlugin[" + process.pid + "]"); diff --git a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/Dockerfile b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/Dockerfile index 3879fa1ba8..75c03ba5a9 100644 --- a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/Dockerfile +++ b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/Dockerfile @@ -1,13 +1,15 @@ -# TODO -# Install connector as yarn package like in @hyperledger/cactus-plugin-ledger-connector-besu +FROM cactus-cmd-socketio-server:latest -FROM node:12 +ENV CACTUS_CONNECTOR_SAWTOOTH_PATH=/opt/cactus-plugin-ledger-connector-sawtooth-socketio -WORKDIR /root/cactus/ +WORKDIR ${CACTUS_CONNECTOR_SAWTOOTH_PATH} COPY ./dist ./dist/ COPY ./dist/yarn.lock ./package.json ./ -RUN yarn install --production --frozen-lockfile --non-interactive --cache-folder ./.yarnCache; rm -rf ./.yarnCache +RUN yarn add "${CACTUS_CMD_SOCKETIO_PATH}" \ + --production --frozen-lockfile --ignore-engines --non-interactive --cache-folder ./.yarnCache && \ + rm -rf ./.yarnCache EXPOSE 5140 +VOLUME ["/etc/cactus/"] CMD [ "npm", "run", "start" ] diff --git a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/README.md b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/README.md index 6c0ab2678a..f534151aff 100644 --- a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/README.md +++ b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/README.md @@ -46,12 +46,16 @@ This plugin provides `Cactus` a way to interact with Hyperledger Sawtooth networ ``` ### Docker +- This image depends on `cactus-cmd-socketio-server:latest` to be present in local store. **Make sure to follow docker build instructions in [cactus-cmd-socketio-server README](../../packages/cactus-cmd-socketio-server/README.md)) before bulding this image!** +- Docker build process will use artifacts from the latest build. Make sure `./dist` contains the version you want to dockerize. + ``` # Build +pushd ../../packages/cactus-cmd-socketio-server/ && docker build . -t cactus-cmd-socketio-server && popd docker build . -t cactus-plugin-ledger-connector-sawtooth-socketio # Run -docker run -v/etc/cactus/:/etc/cactus -p 5140:5140 --net=sawtooth_net cactus-plugin-ledger-connector-sawtooth-socketio +docker run -v/etc/cactus/:/etc/cactus -p 5140:5140 cactus-plugin-ledger-connector-sawtooth-socketio ``` ### Manual diff --git a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/package.json b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/package.json index d26ce0c93e..4995f9971c 100644 --- a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/package.json +++ b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@types/node": "14.17.32", - "@hyperledger/cactus-cmd-socket-server": "1.0.0", + "@hyperledger/cactus-cmd-socketio-server": "1.1.2", "body-parser": "1.17.2", "cbor": "6.0.1", "cookie-parser": "1.4.6", diff --git a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/common/core/bin/www.ts b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/common/core/bin/www.ts index 8d797f0c67..f8ba309749 100755 --- a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/common/core/bin/www.ts +++ b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/common/core/bin/www.ts @@ -26,7 +26,7 @@ if (!process.env["NODE_CONFIG_DIR"]) { // Must be set before import config process.env["NODE_CONFIG_DIR"] = DEFAULT_NODE_CONFIG_DIR; } -import { configRead } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead } from "@hyperledger/cactus-cmd-socketio-server"; import fs = require("fs"); import { Server } from "socket.io" diff --git a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts index 8ba5fb20a9..90b3724ea4 100644 --- a/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts +++ b/packages/cactus-plugin-ledger-connector-sawtooth-socketio/src/main/typescript/connector/ServerMonitorPlugin.ts @@ -15,7 +15,7 @@ // configuration file const SplugUtil = require("./PluginUtil"); -import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socket-server"; +import { configRead, signMessageJwt } from "@hyperledger/cactus-cmd-socketio-server"; // Log settings import { getLogger } from "log4js"; const logger = getLogger("ServerMonitorPlugin[" + process.pid + "]"); diff --git a/tools/ci.sh b/tools/ci.sh index cfca7e7433..67fe09598e 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -105,17 +105,6 @@ function mainTask() npm --version java -version - # Install Indy SDK - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ - && sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \ - && sudo apt-get update \ - && sudo apt-get install -y \ - libindy \ - libnullpay \ - libvcx \ - indy-cli \ - && sudo rm -f /etc/apt/sources.list.d/sovrin.list* - # install npm 7 globally - needed because Node v12, v14 default to npm v6 npm install -g npm@7.19.1 npm --version diff --git a/tools/docker/indy-sdk-cli/Dockerfile b/tools/docker/indy-sdk-cli/Dockerfile index fdf7a61cd4..06bd8366c4 100644 --- a/tools/docker/indy-sdk-cli/Dockerfile +++ b/tools/docker/indy-sdk-cli/Dockerfile @@ -20,7 +20,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # NodeJS and indy-sdk -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \ +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ && add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \ && apt-get update && apt-get install -y \ diff --git a/yarn.lock b/yarn.lock index cfb8b4ae86..9ddcb35fa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6417,7 +6417,7 @@ bind-obj-methods@^3.0.0: resolved "https://registry.yarnpkg.com/bind-obj-methods/-/bind-obj-methods-3.0.0.tgz#65b66544d9d668d80dfefe2089dd347ad1dbcaed" integrity sha512-nLEaaz3/sEzNSyPWRsN9HNsqwk1AUyECtGj+XwGdIi3xABnEqecvXtIJ0wehQXuuER5uZ/5fTs2usONgYjG+iw== -bindings@^1.2.1, bindings@^1.3.1, bindings@^1.5.0: +bindings@^1.2.1, bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -12688,15 +12688,6 @@ indexof@0.0.1: resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= -indy-sdk@1.16.0-dev-1649: - version "1.16.0-dev-1649" - resolved "https://registry.yarnpkg.com/indy-sdk/-/indy-sdk-1.16.0-dev-1649.tgz#e2c781d11356b60c4497b0ac515435ed9a5be4be" - integrity sha512-bbByZ/JUqR5LBi9yoiExXjmBEQqrNsb6hm0ts2lcVshBdN6DPYayVgmwjS7E7jMbBG5wFy/zk04HZVuVCYPlMw== - dependencies: - bindings "^1.3.1" - nan "^2.11.1" - node-gyp "^8.0.0" - infer-owner@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" @@ -16365,11 +16356,6 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.11.1: - version "2.16.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.16.0.tgz#664f43e45460fb98faf00edca0bb0d7b8dce7916" - integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA== - nan@^2.13.2, nan@^2.14.0, nan@^2.14.1, nan@^2.15.0, nan@^2.2.1: version "2.15.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" @@ -16592,7 +16578,7 @@ node-gyp-build@^4.2.0, node-gyp-build@^4.2.2, node-gyp-build@^4.3.0: resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3" integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q== -node-gyp@8.x, node-gyp@^8.0.0, node-gyp@^8.2.0, node-gyp@^8.4.1: +node-gyp@8.x, node-gyp@^8.2.0, node-gyp@^8.4.1: version "8.4.1" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-8.4.1.tgz#3d49308fc31f768180957d6b5746845fbd429937" integrity sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==