Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#158 from TimoGlastra/afj
Browse files Browse the repository at this point in the history
javascript: add issue credential, present proof
  • Loading branch information
swcurran authored Feb 15, 2021
2 parents 80ae5ea + c9a1f35 commit 03d9350
Show file tree
Hide file tree
Showing 17 changed files with 1,111 additions and 260 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test-harness-acapy-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test-harness-acapy-javascript
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout-test-harness
uses: actions/checkout@v2
with:
path: test-harness
- name: run-von-network
uses: ./test-harness/actions/run-von-network
- name: run-indy-tails-server
uses: ./test-harness/actions/run-indy-tails-server
- name: run-test-harness-wo-reports
uses: ./test-harness/actions/run-test-harness
with:
DEFAULT_AGENT: acapy-master
BOB_AGENT: javascript
TEST_SCOPE: "-t @AcceptanceTest -t ~@wip -t ~@RFC0011 -t ~@RFC0023 -t ~@DIDExchangeConnection"
REPORT_PROJECT: acapy-b-javascript
continue-on-error: true
- name: run-send-gen-test-results-secure
uses: ./test-harness/actions/run-send-gen-test-results-secure
with:
REPORT_PROJECT: acapy-b-javascript
ADMIN_USER: ${{ secrets.AllureAdminUser }}
ADMIN_PW: ${{ secrets.AllureAdminPW }}
34 changes: 34 additions & 0 deletions .github/workflows/test-harness-javascript-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test-harness-javascript-dotnet
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout-test-harness
uses: actions/checkout@v2
with:
path: test-harness
- name: run-von-network
uses: ./test-harness/actions/run-von-network
- name: run-indy-tails-server
uses: ./test-harness/actions/run-indy-tails-server
- name: run-test-harness-wo-reports
uses: ./test-harness/actions/run-test-harness
with:
DEFAULT_AGENT: javascript
BOB_AGENT: dotnet-master
TEST_SCOPE: "-t @AcceptanceTest -t ~@wip -t ~@RFC0011 -t ~@RFC0023 -t ~@DIDExchangeConnection -t ~@ProofProposal"
REPORT_PROJECT: javascript-b-dotnet
continue-on-error: true
- name: run-send-gen-test-results-secure
uses: ./test-harness/actions/run-send-gen-test-results-secure
with:
REPORT_PROJECT: javascript-b-dotnet
ADMIN_USER: ${{ secrets.AllureAdminUser }}
ADMIN_PW: ${{ secrets.AllureAdminPW }}
33 changes: 33 additions & 0 deletions .github/workflows/test-harness-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: test-harness-javascript-javascript
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout-test-harness
uses: actions/checkout@v2
with:
path: test-harness
- name: run-von-network
uses: ./test-harness/actions/run-von-network
- name: run-indy-tails-server
uses: ./test-harness/actions/run-indy-tails-server
- name: run-test-harness-wo-reports
uses: ./test-harness/actions/run-test-harness
with:
DEFAULT_AGENT: javascript
TEST_SCOPE: "-t @AcceptanceTest -t ~@wip -t ~@RFC0011 -t ~@RFC0023 -t ~@DIDExchangeConnection"
REPORT_PROJECT: javascript
continue-on-error: true
- name: run-send-gen-test-results-secure
uses: ./test-harness/actions/run-send-gen-test-results-secure
with:
REPORT_PROJECT: javascript
ADMIN_USER: ${{ secrets.AllureAdminUser }}
ADMIN_PW: ${{ secrets.AllureAdminPW }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ A further complication is that as tests are added to the test suite, the backcha

Backchannels can be found in the [`aries-backchannels`](aries-backchannels) folder of this repo. For more information on building a backchannel, see the documentation in the [`aries-backchannels` README](aries-backchannels/README.md), and look at the code of the existing backchannels. To get help in building a backchannel for a component you want tested, please use GitHub issues and/or ask questions on the [Hyperledger Rocketchat](https://chat.hyperledger.org) `#aries-agent-test-harness` channel (free Linux Foundation account required).

Three backchannels have been implemented, for the [ACA-PY](https://github.com/hyperledger/aries-cloudagent-python), [VCX](https://github.com/hyperledger/indy-sdk/tree/master/vcx) and [.NET](https://github.com/hyperledger/aries-framework-dotnet) Aries agent frameworks. The ACA-Py and VCX are built on a common Python base (./aries-backchannels/python/aries_backchannel.py) that sets up the backchannel API listener and performs some basic request validation and dispatching. The ACA-PY (./aries-backchannels/acapy/acapy_backchannel.py) and VCX (./aries-backchannels/vcx/vcx_backchannel.py) implementations extend the base to add support for their respective agent frameworks.
Three backchannels have been implemented, for the [ACA-PY](https://github.com/hyperledger/aries-cloudagent-python), [VCX](https://github.com/hyperledger/indy-sdk/tree/master/vcx), [.NET](https://github.com/hyperledger/aries-framework-dotnet) and [JavaScript](https://github.com/hyperledger/aries-framework-javascript.git) Aries agent frameworks. The ACA-Py and VCX are built on a common Python base (./aries-backchannels/python/aries_backchannel.py) that sets up the backchannel API listener and performs some basic request validation and dispatching. The ACA-PY (./aries-backchannels/acapy/acapy_backchannel.py) and VCX (./aries-backchannels/vcx/vcx_backchannel.py) implementations extend the base to add support for their respective agent frameworks.

## The `manage` bash script

Expand Down
11 changes: 8 additions & 3 deletions TEST_REPORTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ behave -f allure_behave.formatter:AllureFormatter -o ./reports -t @AcceptanceTes
```
### Using Allure with CI
The AATH is executed with varying configurations and Aries Agent types at pre-determined intervals to make find issues and track deltas between builds of these agents. You can find the Allure reports for these test runs at the following links.
[Acapy to Acapy Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy/reports/latest)
[Acapy to Dotnet Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy-b-dotnet/reports/latest)
[Dotnet to Dotnet Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/dotnet/reports/latest)

- [Acapy to Acapy Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy/reports/latest)
- [Full Acapy to Acapy Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy-full/reports/latest)
- [Acapy to Dotnet Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy-b-dotnet/reports/latest)
- [Acapy to JavaScript Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/acapy-b-javascript/reports/latest)
- [Dotnet to Dotnet Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/dotnet/reports/latest)
- [JavaScript to JavaScript Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/javascript/reports/latest)
- [JavaScript to Dotnet Agent Interop Testing](https://allure.vonx.io/allure-docker-service-ui/projects/javascript-b-dotnet/reports/latest)

## Other Reporting Options

Expand Down
Binary file not shown.
23 changes: 12 additions & 11 deletions aries-backchannels/javascript/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@
"start:prod": "cross-env NODE_ENV=production node dist/index.js"
},
"dependencies": {
"@tsed/common": "5.65.1",
"@tsed/core": "5.65.1",
"@tsed/di": "5.65.1",
"@tsed/exceptions": "5.65.1",
"@tsed/platform-express": "5.65.1",
"@tsed/common": "6.25.2",
"@tsed/core": "6.25.2",
"@tsed/di": "6.25.2",
"@tsed/exceptions": "6.25.2",
"@tsed/platform-express": "6.25.2",
"aries-framework-javascript": "../aries-framework-javascript-v1.0.0.tgz",
"body-parser": "1.19.0",
"cross-env": "7.0.2",
"cross-env": "7.0.3",
"express": "4.17.1",
"indy-sdk": "^1.15.0-dev-1565",
"indy-sdk": "^1.15.0-dev-1618",
"minimist": "^1.2.5",
"node-fetch": "^2.6.0"
},
"devDependencies": {
"@types/express": "4.17.8",
"@types/express": "4.17.11",
"@types/indy-sdk": "^1.15.0",
"@types/minimist": "^1.2.0",
"@types/node": "14.6.4",
"@types/node": "14.14.28",
"@types/node-fetch": "^2.5.7",
"nodemon": "2.0.4",
"ts-node": "9.0.0",
"nodemon": "2.0.7",
"ts-node": "9.1.1",
"typescript": "4.0.2"
}
}
3 changes: 1 addition & 2 deletions aries-backchannels/javascript/server/src/TestAgent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-ignore
import indy from "indy-sdk";
import { InitConfig, Agent } from "aries-framework-javascript";
import express from "express";
Expand All @@ -25,7 +24,7 @@ export async function createAgent({
walletConfig: { id: `aath-javascript-${Date.now()}` },
walletCredentials: { key: "00000000000000000000000000000Test01" },
publicDidSeed,
url,
host: url,
port,
poolName: "aries-framework-javascript-pool",
genesisPath,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Controller, Get, Res } from "@tsed/common";

@Controller("/agent/command/status")
@Controller("/agent/command")
export class AgentStatusController {
@Get()
get(@Res() response: Res) {
@Get("/status")
getStatus(@Res() response: Res) {
// NOTE: Because the agent runs inside the backchannel (not separate processes)
// The agent is active as long as the backchannel is active
const active = true;
Expand All @@ -19,4 +19,10 @@ export class AgentStatusController {
status: "active",
};
}

@Get("/version")
getVersion(@Res() response: Res) {
// TODO: return actual version
return "1.0.0";
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Controller, Get, PathParams, Post, BodyParams } from "@tsed/common";
import { NotFound } from "@tsed/exceptions";
import { Agent, ConnectionRecord } from "aries-framework-javascript";
import {
Agent,
ConnectionRecord,
ConnectionInvitationMessage,
JsonTransformer,
} from "aries-framework-javascript";

@Controller("/agent/command/connection")
export class ConnectionController {
Expand Down Expand Up @@ -32,11 +37,14 @@ export class ConnectionController {

@Post("/create-invitation")
async createInvitation() {
const connection = await this.agent.connections.createConnection();
const {
invitation,
connectionRecord,
} = await this.agent.connections.createConnection();

return {
...this.mapConnection(connection),
invitation: connection.invitation?.toJSON(),
...this.mapConnection(connectionRecord),
invitation: invitation.toJSON(),
};
}

Expand All @@ -45,7 +53,7 @@ export class ConnectionController {
@BodyParams("data") invitation: Record<string, unknown>
) {
const connection = await this.agent.connections.receiveInvitation(
invitation
JsonTransformer.fromJSON(invitation, ConnectionInvitationMessage)
);

return this.mapConnection(connection);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Controller, Get, PathParams } from "@tsed/common";
import { Agent } from "aries-framework-javascript";

@Controller("/agent/command/credential")
export class CredentialController {
private agent: Agent;

public constructor(agent: Agent) {
this.agent = agent;
}

@Get("/:credentialId")
async getCredentialById(@PathParams("credentialId") credentialId: string) {
const indyCredential = await this.agent.credentials.getIndyCredential(
credentialId
);

// TODO: add state 'done' check
return {
referent: indyCredential.referent,
schema_id: indyCredential.schemaId,
cred_def_id: indyCredential.credentialDefinitionId,
credential: indyCredential.toJSON(),
};
}
}
Loading

0 comments on commit 03d9350

Please sign in to comment.