Skip to content

Commit

Permalink
feat(indy-sdk): replace indy SDK with AFJ
Browse files Browse the repository at this point in the history
- Refactor test ledger `indy-testnet` into `indy-all-in-one`. New package uses
    the latest indy version, has healtcheck script, updated startup / cleanup
    scripts.
- Remove `indy-sdk-cli` image since it's not used anymore.
- Refactor `cactus-example-discounted-asset-trade` to use own aries agent
    instead of indy connector. This way it doesn't need to use indy-sdk anymore,
    and python indy connector can be safely removed / upgraded.
- Update sample app readme to explain current workflow.
- Remove client scripts since `cactus-example-discounted-asset-trade-client`
    can now be used to interact with the sample app.
- Add `cactus-example-discounted-asset-trade-client`. It contains script for
    setting up test credentials on the ledger, script with interactive menu for
    interacting with `cactus-example-discounted-asset-trade` sample app,
    and bunch of helper functions used for writing these apps.

Depends on #2859
Depends on #2860

Signed-off-by: Michal Bajer <michal.bajer@fujitsu.com>
  • Loading branch information
outSH committed Jan 19, 2024
1 parent 31eefd6 commit 3291dcc
Show file tree
Hide file tree
Showing 58 changed files with 3,011 additions and 1,765 deletions.
7 changes: 7 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"adminpw",
"Albertirsa",
"ALLFORTX",
"Anoncreds",
"anoncreds",
"ANYFORTX",
"APIV",
"approveformyorg",
"Askar",
"askar",
"Authz",
"authzn",
"AWSSM",
Expand Down Expand Up @@ -37,9 +41,12 @@
"couchdb",
"COUCHDBADDRESS",
"COUCHDBCONFIG",
"Creds",
"data",
"dclm",
"DHTAPI",
"Dids",
"dids",
"DockerOde",
"ealen",
"ecparams",
Expand Down
6 changes: 0 additions & 6 deletions .dcilintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ docs-cactus/source/conf.py
# Links would be broken if we refactored the offending lines
docs/docs/contributing/requesting-a-change.md

# Cannot be edited due to configuration schema of third party software
examples/register-indy-data/register-indy-data.py

# Cannot be edited due to configuration schema of third party software
tools/docker/indy-testnet/Dockerfile

# Cannot be edited due to configuration schema of third party software
packages/cactus-test-tooling/src/main/typescript/keycloak/keycloak-container.ts

Expand Down
4 changes: 4 additions & 0 deletions examples/cactus-example-cbdc-bridging-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@
},
"devDependencies": {
"@types/uuid": "^9.0.7"
},
"engines": {
"node": ">=18",
"npm": ">=8"
}
}
75 changes: 75 additions & 0 deletions examples/cactus-example-discounted-asset-trade-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# cactus-example-discounted-asset-trade-client
- Client applications and helper libraries for interacting with test indy ledger and Cacti discounted asset trade example app.
- Uses Hyperledger Aries Framework JavaScript (AFJ).
- **Before running any of the script make sure that test indy ledger is running and it's config is available under `/etc/cactus/indy-all-in-one/` (at least `pool_transactions_genesis` should be there.)**

## Build
- This package will be build as part of main cacti build (`yarn run configure` in root dir), or can be build manually by running `yarn run build` from this directory).

## Setup Credentials Script
- This script can be used to setup indy credentials before running the example app, or to simply check indy test ledger operational status.
- Script will register employment credential, issue it to agent `Alice`, and check that employment proof is correct.
- Can be run repeatadelly.

``` bash
# Run the script
yarn setup-credentials

# Run with debug logs
LOG_LEVEL=DEBUG yarn setup-credentials
```

### Sample output

``` bash
Running with log level INFO
Connecting Alice with Issuer...
Connecting aliceCactiAgent to issuerCactiAgent...
Agents connected!
Register and issue the employment credential...
Register Credential Schema...
Register employment certificate credential schema 'cactiJobCert'...
Register Credential Definition...
Register job certificate credential definition (schemaId: 'did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0') ...
Issue the credential...
Accepting credential 018e6578-4e52-4ae0-8381-8c935c8a13dc...
Credential accepted!
Credential was issed and accepted by a peer agent!
Verify employment status proof...
Proof request was sent
Accepting proof 5c0986ab-4f1d-4850-a2ff-53c90ce34a12...
Proof request accepted!
Requested proof status: done
Finishing - cleaning up the agents...
All done.
``````

## Discounted Asset Trade Client
- Used to interact with discounted asset trade example application.
- Will connect Alice agent to sample application. After that you can choose action to perform.
- Actions:
- `Start the trade`: Will send trade request to example app, asset2 will change owner and payment will be processed on etherem (see `cactus-example-discounted-asset-trade` README for more details)
- `Get this agent credentials`: Get list of Alice credentials.
- `Get assets`: Get example app asset list (both fabric assets and ethereum balances)
- `Exit`: Cleanup and leave. Note - may take few seconds due to ongoing timeouts etc...
- Note: Use arrow keys to restore menu if any async message caused it to disappear.

``` bash
# Run the script
yarn run-discounted-asset-trade-client
# Run with debug logs
LOG_LEVEL=DEBUG yarn run-discounted-asset-trade-client
```

### Sample output

``` bash
Running with log level INFO
Connected to the discounted asset trade sample app agent! ID: 5a4f0cf6-b53a-4f3d-9494-112edfdfd626
Action: (Use arrow keys)
❯ Start the trade
Get this agent credentials
Get assets
Exit
``````
79 changes: 79 additions & 0 deletions examples/cactus-example-discounted-asset-trade-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@hyperledger/cactus-example-discounted-asset-trade-client",
"version": "2.0.0-alpha.2",
"description": "Client for interacting with discounted asset trade sample app and some tools for setting up indy enviroment",
"keywords": [
"Hyperledger",
"Cacti",
"Cactus",
"Integration",
"Blockchain",
"Distributed Ledger Technology"
],
"homepage": "https://github.com/hyperledger/cacti#readme",
"bugs": {
"url": "https://github.com/hyperledger/cacti/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hyperledger/cacti.git"
},
"license": "Apache-2.0",
"author": {
"name": "Hyperledger Cacti Contributors",
"email": "cacti@lists.hyperledger.org",
"url": "https://www.hyperledger.org/use/cacti"
},
"contributors": [
{
"name": "Please add yourself to the list of contributors",
"email": "your.name@example.com",
"url": "https://example.com"
},
{
"name": "Michal Bajer",
"email": "michal.bajer@fujitsu.com",
"url": "https://www.fujitsu.com/global/"
}
],
"main": "dist/lib/main/typescript/index.js",
"module": "dist/lib/main/typescript/index.js",
"types": "dist/lib/main/typescript/index.d.ts",
"bin": {
"run-discounted-asset-trade-client": "dist/lib/main/typescript/scripts/run-discounted-asset-trade-client.js",
"setup-credentials": "dist/lib/main/typescript/scripts/setup-credentials.js"
},
"files": [
"dist/*"
],
"scripts": {
"build": "tsc",
"run-discounted-asset-trade-client": "node dist/lib/main/typescript/scripts/run-discounted-asset-trade-client.js",
"setup-credentials": "node dist/lib/main/typescript/scripts/setup-credentials.js"
},
"dependencies": {
"@hyperledger/anoncreds-nodejs": "0.2.0-dev.4",
"@hyperledger/aries-askar-nodejs": "0.2.0-dev.1",
"@hyperledger/indy-vdr-nodejs": "0.2.0-dev.3",
"axios": "1.5.1",
"inquirer": "8.2.6",
"loglevel": "1.8.1"
},
"devDependencies": {
"@aries-framework/anoncreds": "0.5.0-alpha.58",
"@aries-framework/anoncreds-rs": "0.5.0-alpha.58",
"@aries-framework/askar": "0.5.0-alpha.58",
"@aries-framework/core": "0.5.0-alpha.58",
"@aries-framework/indy-sdk": "0.5.0-alpha.58",
"@aries-framework/indy-vdr": "0.5.0-alpha.58",
"@aries-framework/node": "0.5.0-alpha.58",
"@types/inquirer": "8.2.6"
},
"engines": {
"node": ">=18",
"npm": ">=8"
},
"publishConfig": {
"access": "public"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./public-api";
Loading

0 comments on commit 3291dcc

Please sign in to comment.