Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(indy-sdk): replace indy SDK with AFJ #2861

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
``````
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": "[email protected]",
"url": "https://www.hyperledger.org/use/cacti"
},
"contributors": [
{
"name": "Please add yourself to the list of contributors",
"email": "[email protected]",
"url": "https://example.com"
},
{
"name": "Michal Bajer",
"email": "[email protected]",
"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
Loading