Skip to content

Commit

Permalink
feat: DIDComm V2 messaging support (#1458)
Browse files Browse the repository at this point in the history
Co-authored-by: Karim Stekelenburg <karim@animo.id>
Co-authored-by: Ariel Gentile <gentilester@gmail.com>
Co-authored-by: Timo Glastra <timo@animo.id>
Co-authored-by: Jim Ezesinachi <ezesinachijim@gmail.com>
Co-authored-by: Ry Jones <ry@linux.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kim Ebert <kim@developmint.work>
Co-authored-by: Grammatopoulos Athanasios Vasileios <GramThanos@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Victor Anene <62852943+Vickysomtee@users.noreply.github.com>
Co-authored-by: Jim Ezesinachi <jim@animo.id>
Co-authored-by: KolbyRKunz <KolbyKunz@yahoo.com>
Co-authored-by: Berend Sliedrecht <61358536+blu3beri@users.noreply.github.com>
Co-authored-by: Jason C. Leach <jason.leach@fullboar.ca>
Co-authored-by: Martin Auer <martin.auer97@gmail.com>
Co-authored-by: Niall Shaw <100220424+niall-shaw@users.noreply.github.com>
Co-authored-by: Pritam Singh <43764373+Zzocker@users.noreply.github.com>
Co-authored-by: Mo <10432473+morrieinmaas@users.noreply.github.com>
Co-authored-by: NB-MikeRichardson <93971245+NB-MikeRichardson@users.noreply.github.com>
Co-authored-by: Amit-Padmani <106090107+Amit-Padmani@users.noreply.github.com>
Co-authored-by: DaevMithran <61043607+DaevMithran@users.noreply.github.com>
Co-authored-by: Alexander Shenshin <93187809+AlexanderShenshin@users.noreply.github.com>
fix(openid4vc-client): set package to private (#1210)
fix: fix typing issues with typescript 4.9 (#1214)
Fixes #1205
resolver (#1247)
fix: set updateAt on records when updating a record (#1272)
fix(transport)!: added docs moved connection to connectionId (#1222)
fix(indy-vdr): export relevant packages from root (#1291)
fix(askar): generate nonce suitable for anoncreds (#1295)
resolver and registrar for did:indy (#1253)
fix: imports from core (#1303)
fix: thread id improvements (#1311)
fix: loosen base64 validation (#1312)
fix(samples): dummy module response message type (#1321)
fix: seed and private key validation and return type in registrars (#1324)
fix!: don't emit legacy did:sov prefix for new protocols (#1245)
fix(askar): anoncrypt messages unpacking (#1332)
fix: expose indy pool configs and action menu messages (#1333)
fix: create new socket if socket state is 'closing' (#1337)
fix(anoncreds): include prover_did for legacy indy (#1342)
fix(indy-sdk): import from core (#1346)
fix(anoncreds-rs): save revocation registry index (#1351)
fix: isNewSocket logic (#1355)
fix(tenant): Correctly configure storage for multi tenant agents (#1359)
Fixes hyperledger#1353
fix(anoncreds): Buffer not imported from core (#1367)
fix(core): repository event when calling deleteById (#1356)
fix(askar): custom error handling (#1372)
fix: return HTTP 415 if unsupported content type (#1313)
fix: remove named capture groups (#1378)
fix example usage of indy-sdk-react-native package (#1382)
fix: connection id in sessions for new connections (#1383)
fix: did cache key not being set correctly (#1394)
fix: incorrect type for anoncreds registration (#1396)
fix: reference to indyLedgers in IndyXXXNotConfiguredError (#1397)
fix: add reflect-metadata (#1409)
fix: various anoncreds revocation fixes (#1416)
fix: jsonld credential format identifier version (#1412)
fix: remove `deleteOnFinish` and added documentation (#1418)
fix(askar): default key derivation method (#1420)
fix(anoncreds): make revocation status list inline with the spec (#1421)
fix(anoncreds-rs): revocation status list as JSON (#1422)
fix: issuance with unqualified identifiers (#1431)
fix(connections): store imageUrl when using DIDExchange (#1433)
fix(indy-vdr): do not force indy-vdr version (#1434)
fix: small issues with migration and WAL files (#1443)
fix: migration of link secret (#1444)
fix: Emit RoutingCreated event for mediator routing record (#1445)
fix: small updates to cheqd module and demo (#1439)
fix: remove scope check from response (#1450)
  • Loading branch information
2 parents 1a9bb1f + 12bbe55 commit d6e2b67
Show file tree
Hide file tree
Showing 1,041 changed files with 60,884 additions and 29,488 deletions.
18 changes: 18 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# arm + amd compatible Dockerfile
FROM ghcr.io/findy-network/findy-base:indy-1.16.ubuntu-18.04 AS indy-base

FROM ubuntu:18.04

# install indy deps and files from base
RUN apt-get update && apt-get install -y libsodium23 libssl1.1 libzmq5 git zsh

COPY --from=indy-base /usr/include/indy /usr/include/indy
COPY --from=indy-base /usr/lib/libindy.a /usr/lib/libindy.a
COPY --from=indy-base /usr/lib/libindy.so /usr/lib/libindy.so

RUN apt-get install -y curl python3 build-essential ca-certificates && \
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install v16 && \
npm install yarn -g
7 changes: 7 additions & 0 deletions .devcontainer/devcontainer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Any environment variables that the container needs
# go in here.
#
# Example(s)
# GENESIS_TXN_PATH=/work/network/genesis/local-genesis.txn
#
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": ["--env-file", ".devcontainer/devcontainer.env"],
"workspaceMount": "source=${localWorkspaceFolder},target=/work,type=bind",
"workspaceFolder": "/work"
}
16 changes: 15 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ module.exports = {
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:workspaces/recommended',
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
plugins: ['workspaces'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.eslint.json'],
Expand Down Expand Up @@ -87,10 +89,14 @@ module.exports = {
},
},
{
files: ['jest.config.ts', '.eslintrc.js'],
files: ['jest.config.ts', '.eslintrc.js', './scripts/**'],
env: {
node: true,
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
'no-undef': 'off',
},
},
{
files: ['demo/**'],
Expand Down Expand Up @@ -122,5 +128,13 @@ module.exports = {
],
},
},
{
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', '**/tests/**'],
rules: {
'workspaces/no-relative-imports': 'off',
'workspaces/require-dependency': 'off',
'workspaces/no-absolute-imports': 'off',
},
},
],
}
14 changes: 14 additions & 0 deletions .github/actions/setup-cheqd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup cheqd
description: Setup a cheqd network to perform tests
author: 'daev@cheqd.io'

runs:
using: composite
steps:
- name: Start cheqd localnet
run: docker run --rm -d -p 26657:26657 ghcr.io/cheqd/cheqd-testnet:latest
shell: bash

branding:
icon: scissors
color: purple
9 changes: 8 additions & 1 deletion .github/actions/setup-indy-pool/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ inputs:
seed:
description: Seed to register on the ledger
required: true
endorserSeed:
description: Endorser seed to register on the ledger
required: true

runs:
using: composite
Expand All @@ -20,10 +23,14 @@ runs:
run: docker exec indy-pool indy-cli-setup
shell: bash

- name: Register DID on ledger
- name: Register Trustee DID on ledger
run: docker exec indy-pool add-did-from-seed ${{ inputs.seed }} TRUSTEE
shell: bash

- name: Register Endorser DID on ledger
run: docker exec indy-pool add-did-from-seed ${{ inputs.endorserSeed }} ENDORSER
shell: bash

branding:
icon: scissors
color: purple
4 changes: 2 additions & 2 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release-canary:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
name: Release Canary
if: "!startsWith(github.event.head_commit.message, 'chore(release): v')"
steps:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
git push origin v${{ steps.get-version.outputs.version }} --no-verify
release-stable:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
name: Create Stable Release
# Only run if the last pushed commit is a release commit
if: "startsWith(github.event.head_commit.message, 'chore(release): v')"
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ on:

env:
TEST_AGENT_PUBLIC_DID_SEED: 000000000000000000000000Trustee9
ENDORSER_AGENT_PUBLIC_DID_SEED: 00000000000000000000000Endorser9
GENESIS_TXN_PATH: network/genesis/local-genesis.txn
LIB_INDY_STRG_POSTGRES: /home/runner/work/aries-framework-javascript/indy-sdk/experimental/plugins/postgres_storage/target/release # for Linux
NODE_OPTIONS: --max_old_space_size=4096

# Make sure we're not running multiple release steps at the same time as this can give issues with determining the next npm version to release.
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
Expand All @@ -25,7 +27,7 @@ jobs:
# validation scripts. To still be able to run the CI we can manually trigger it by adding the 'ci-test'
# label to the pull request
ci-trigger:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
outputs:
triggered: ${{ steps.check.outputs.triggered }}
steps:
Expand All @@ -36,15 +38,15 @@ jobs:
export SHOULD_RUN='true'
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ci-test" ]]; then
export SHOULD_RUN='false'
else
else
export SHOULD_RUN='true'
fi
echo "SHOULD_RUN: ${SHOULD_RUN}"
echo "::set-output name=triggered::${SHOULD_RUN}"
validate:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
name: Validate
steps:
- name: Checkout aries-framework-javascript
Expand Down Expand Up @@ -75,24 +77,30 @@ jobs:
run: yarn build

integration-test:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
name: Integration Tests

strategy:
matrix:
node-version: [14.x, 16.x, 17.x, 18.x]
node-version: [16.x, 18.x]

steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2

# setup dependencies

- name: Setup Libindy
uses: ./.github/actions/setup-libindy

- name: Setup Indy Pool
uses: ./.github/actions/setup-indy-pool
with:
seed: ${TEST_AGENT_PUBLIC_DID_SEED}
endorserSeed: ${ENDORSER_AGENT_PUBLIC_DID_SEED}

- name: Setup Cheqd
uses: ./.github/actions/setup-cheqd

- name: Setup Postgres
uses: ./.github/actions/setup-postgres
Expand All @@ -104,17 +112,22 @@ jobs:
uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node-version }}

- name: Add ref-napi resolution in Node18
run: node ./scripts/add-ref-napi-resolution.js
if: matrix.node-version == '18.x'

- name: Install dependencies
run: yarn install

- name: Run tests
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test --coverage
run: TEST_AGENT_PUBLIC_DID_SEED=${TEST_AGENT_PUBLIC_DID_SEED} ENDORSER_AGENT_PUBLIC_DID_SEED=${ENDORSER_AGENT_PUBLIC_DID_SEED} GENESIS_TXN_PATH=${GENESIS_TXN_PATH} yarn test --coverage --forceExit --bail

- uses: codecov/codecov-action@v1
if: always()

version-stable:
runs-on: ubuntu-20.04
runs-on: aries-ubuntu-2004
name: Release stable
needs: [integration-test, validate]
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.3.3](https://github.com/hyperledger/aries-framework-javascript/compare/v0.3.2...v0.3.3) (2023-01-18)

### Bug Fixes

- fix typing issues with typescript 4.9 ([#1214](https://github.com/hyperledger/aries-framework-javascript/issues/1214)) ([087980f](https://github.com/hyperledger/aries-framework-javascript/commit/087980f1adf3ee0bc434ca9782243a62c6124444))
- **openid4vc-client:** set package to private ([#1210](https://github.com/hyperledger/aries-framework-javascript/issues/1210)) ([c697716](https://github.com/hyperledger/aries-framework-javascript/commit/c697716bf1837b9fef307f60ff97f01d3d926728))

### Features

- add anoncreds package ([#1118](https://github.com/hyperledger/aries-framework-javascript/issues/1118)) ([adba83d](https://github.com/hyperledger/aries-framework-javascript/commit/adba83d8df176288083969f2c3f975bbfc1acd9c))
- add minimal oidc-client package ([#1197](https://github.com/hyperledger/aries-framework-javascript/issues/1197)) ([b6f89f9](https://github.com/hyperledger/aries-framework-javascript/commit/b6f89f943dc4417626f868ac9f43a3d890ab62c6))
- adding trust ping events and trust ping command ([#1182](https://github.com/hyperledger/aries-framework-javascript/issues/1182)) ([fd006f2](https://github.com/hyperledger/aries-framework-javascript/commit/fd006f262a91f901e7f8a9c6e6882ea178230005))
- **anoncreds:** add anoncreds registry service ([#1204](https://github.com/hyperledger/aries-framework-javascript/issues/1204)) ([86647e7](https://github.com/hyperledger/aries-framework-javascript/commit/86647e7f55c9a362f6ab500538c4de2112e42206))
- **indy-sdk:** add indy-sdk package ([#1200](https://github.com/hyperledger/aries-framework-javascript/issues/1200)) ([9933b35](https://github.com/hyperledger/aries-framework-javascript/commit/9933b35a6aa4524caef8a885e71b742cd0d7186b))

## [0.3.2](https://github.com/hyperledger/aries-framework-javascript/compare/v0.3.1...v0.3.2) (2023-01-04)

### Bug Fixes
Expand Down
48 changes: 41 additions & 7 deletions DEVREADME.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@

This file is intended for developers working on the internals of the framework. If you're just looking how to get started with the framework, see the [docs](./docs)

# Environment Setup

## VSCode devContainer

This project comes with a [.devcontainer](./devcontainer) to make it as easy as possible to setup your dev environment and begin contributing to this project.

All the [environment variables](https://code.visualstudio.com/remote/advancedcontainers/environment-variables) noted below can be added to [devcontainer.env](./devcontainer.env) and exposed to the development docker container.

When running in a container your project root directory will be `/work`. Use this to correctly path any environment variables, for example:

```console
GENESIS_TXN_PATH=/work/network/genesis/local-genesis.txn
```

## Running tests

Test are executed using jest. Some test require either the **mediator agents** or the **ledger** to be running. When running tests that require a connection to the ledger pool, you need to set the `TEST_AGENT_PUBLIC_DID_SEED` and `GENESIS_TXN_PATH` environment variables.
Test are executed using jest. Some test require either the **mediator agents** or the **ledger** to be running. When running tests that require a connection to the ledger pool, you need to set the `TEST_AGENT_PUBLIC_DID_SEED`, `ENDORSER_AGENT_PUBLIC_DID_SEED` and `GENESIS_TXN_PATH` environment variables.

### Setting environment variables

Expand All @@ -17,6 +31,9 @@ If you're using the setup as described in this document, you don't need to provi
- `TEST_AGENT_PUBLIC_DID_SEED`: The seed to use for the public DID. This will be used to do public write operations to the ledger. You should use a seed for a DID that is already registered on the ledger.
- If using the local or default genesis, use the same seed you used for the `add-did-from-seed` command from the [ledger setup](#setup-ledger) in the previous step. (default is `000000000000000000000000Trustee9`)
- If using the BuilderNet genesis, make sure your seed is registered on the BuilderNet using [selfserve.sovrin.org](https://selfserve.sovrin.org/) and you have read and accepted the associated [Transaction Author Agreement](https://github.com/sovrin-foundation/sovrin/blob/master/TAA/TAA.md). We are not responsible for any unwanted consequences of using the BuilderNet.
- `ENDORSER_AGENT_PUBLIC_DID_SEED`: The seed to use for the public Endorser DID. This will be used to endorse transactions. You should use a seed for a DID that is already registered on the ledger.
- If using the local or default genesis, use the same seed you used for the `add-did-from-seed` command from the [ledger setup](#setup-ledger) in the previous step. (default is `00000000000000000000000Endorser9`)
- If using the BuilderNet genesis, make sure your seed is registered on the BuilderNet using [selfserve.sovrin.org](https://selfserve.sovrin.org/) and you have read and accepted the associated [Transaction Author Agreement](https://github.com/sovrin-foundation/sovrin/blob/master/TAA/TAA.md). We are not responsible for any unwanted consequences of using the BuilderNet.

### Setup Postgres

Expand All @@ -30,7 +47,7 @@ docker pull postgres
docker run --name postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
```

### Setup Ledger
### Setup Indy Ledger

For testing we've added a setup to this repo that allows you to quickly setup an indy ledger.

Expand All @@ -47,13 +64,30 @@ docker run -d --rm --name indy-pool -p 9701-9708:9701-9708 indy-pool
# Setup CLI. This creates a wallet, connects to the ledger and sets the Transaction Author Agreement
docker exec indy-pool indy-cli-setup

# DID and Verkey from seed. Set 'Trustee' role in order to be able to register public DIDs
# DID and Verkey from seed. Set 'ENDORSER' role in order to be able to register public DIDs
docker exec indy-pool add-did-from-seed 00000000000000000000000Endorser9 ENDORSER

# DID and Verkey from seed. Set 'Trustee'
docker exec indy-pool add-did-from-seed 000000000000000000000000Trustee9 TRUSTEE

# If you want to register using the DID/Verkey you can use
# docker exec indy-pool add-did "NkGXDEPgpFGjQKMYmz6SyF" "CrSA1WbYYWLJoHm16Xw1VEeWxFvXtWjtsfEzMsjB5vDT"
```

### Setup Cheqd Ledger

In addition, there's also a docker command to run a cheqd test network.

```sh
docker run --rm -d -p 26657:26657 ghcr.io/cheqd/cheqd-testnet:latest
```

If you want to run tests without the cheqd ledger, you can use the following ignore pattern:

```sh
yarn test --testPathIgnorePatterns packages/cheqd
```

### Run all tests

You can run the tests using the following command.
Expand All @@ -65,19 +99,19 @@ yarn test
If you're not using the ledger setup from above, make sure you pass the correct environment variables from [Setting environment variables](#setting-environment-variables) for connecting to the indy **ledger** pool.

```sh
GENESIS_TXN_PATH=network/genesis/local-genesis.txn TEST_AGENT_PUBLIC_DID_SEED=000000000000000000000000Trustee9 yarn test
GENESIS_TXN_PATH=network/genesis/local-genesis.txn TEST_AGENT_PUBLIC_DID_SEED=000000000000000000000000Trustee9 ENDORSER_AGENT_PUBLIC_DID_SEED=00000000000000000000000Endorser9 yarn test
```

Locally, you might want to run the tests without postgres tests. You can do that by ignoring the tests:

```sh
yarn test --testPathIgnorePatterns ./packages/core/tests/postgres.e2e.test.ts -u
yarn test --testPathIgnorePatterns postgres.e2e.test.ts
```

In case you run into trouble running the tests, e.g. complaining about snapshots not being up-to-date, you can try and remove the data stored for the indy-client. On a Unix system with default setup you achieve this by running:
In case you run into trouble running the tests, e.g. complaining about snapshots not being up-to-date, you can try and remove the data stored for the indy-client or AFJ. Note this removes all wallets and data, so make sure you're okay with all data being removed. On a Unix system with default setup you achieve this by running:

```sh
rm -rf ~/.indy-client
rm -rf ~/.indy-client ~/.afj
```

## Usage with Docker
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04 as base
FROM ubuntu:20.04 as base

ENV DEBIAN_FRONTEND noninteractive

Expand Down
Loading

0 comments on commit d6e2b67

Please sign in to comment.