Skip to content
Snippets Groups Projects
Unverified Commit c776e2e3 authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

wip: proof event change listener, trying to get email from credential

parent 8b5ef4cb
No related branches found
No related tags found
No related merge requests found
Pipeline #64639 failed with stages
in 29 minutes and 42 seconds
......@@ -11,30 +11,104 @@ services:
volumes:
- ./data/db-simple/:/var/lib/postgresql/data/
agent-issuer-simple:
container_name: agent-issuer-simple
build:
context: "../"
dockerfile: "./apps/agent/deployment/Dockerfile"
env_file:
- ./env/issuer.simple.env
builder:
privileged: true
image: node:18.16.0-buster-slim
volumes:
- ./../yarn.lock:/app/yarn.lock
- ./../package.json:/app/package.json
- ./../apps:/app/apps
- ./../libs:/app/libs
- ./../nx.json:/app/nx.json
- ./../tsconfig.base.json:/app/tsconfig.base.json
- ./data/node_modules:/app/node_modules
- ./data/dist:/app/dist
working_dir: /app
command:
- sh
- -c
- |
whoami
apt update -y && apt install python3 git make build-essential -y
yarn install
yarn build:all
exit 0
agent-issuer:
container_name: agent-issuer
image: node:18.16.0
volumes:
- ./data/node_modules:/app/node_modules
- ./data/dist/apps/agent:/app/
working_dir: /app
command: node main.js
ports:
- "8080:8080"
- "8080:8081"
- "8001:8001"
env_file:
- ./env/issuer.simple.env
depends_on:
builder:
condition: service_completed_successfully
pg_db:
condition: service_started
agent-holder-simple:
container_name: agent-holder-simple
build:
context: "../"
dockerfile: "./apps/agent/deployment/Dockerfile"
env_file:
- ./env/holder.simple.env
agent-holder:
container_name: agent-holder
image: node:18.16.0
volumes:
- ./data/node_modules:/app/node_modules
- ./data/dist/apps/agent:/app/
working_dir: /app
command: node main.js
ports:
- "8081:8080"
- "8090:8081"
- "6001:6001"
env_file:
- ./env/holder.simple.env
depends_on:
builder:
condition: service_completed_successfully
pg_db:
condition: service_started
# agent-holder-simple:
# container_name: agent-holder-simple
# build:
# context: "."
# dockerfile: "../apps/agent/deployment/Dockerfile"
# env_file:
# - ./env/holder.simple.env
# ports:
# - "8081:8080"
# - "6001:6001"
# depends_on:
# pg_db:
# condition: service_started
mpy:
container_name: mpy
image: aries-framework-go/agent-rest-interop
environment:
- ARIESD_API_HOST=0.0.0.0:8092
- ARIESD_INBOUND_HOST=http@0.0.0.0:8091
- ARIESD_INBOUND_HOST_EXTERNAL=http@http://mpy.com:8091
- ARIESD_AUTO_ACCEPT=true
- ARIESD_DEFAULT_LABEL=mediator-agent-1
- ARIESD_DATABASE_TYPE=leveldb
- ARIESD_DATABASE_PREFIX=mediator
- ARIESD_DATABASE_TIMEOUT=60
- ARIESD_OUTBOUND_TRANSPORT=http
- ARIESD_LOG_LEVEL=DEBUG
- ARIESD_HTTP_RESOLVER=did:peer@http://test.bcovrin.vonx.io
ports:
- 8091:8091
- 8092:8092
volumes:
- ./certificates:/etc/tls
entrypoint: ""
command: /bin/sh -c "cp /etc/tls/* /usr/local/share/ca-certificates/;update-ca-certificates; aries-agent-rest start"
LEDGERS="BCOVRIN_TEST"
IDUNION_KEY=
AGENT_PEER_URL="http://agent-issuer:8001"
AGENT_NAME=DEV_SIMPLE_AGENT_ISSUER_OCM # this should be changed to company name
AGENT_KEY=DEV_SIMPLE_AGENT_ISSUER_OCM #example random string
AGENT_DID_SEED=200000000000000000000000TCuste21js #did private key seed min lenght 32
AGENT_PEER_URL="http://192.168.1.5:8001"
AGENT_NAME=TEST_AGENT
AGENT_KEY=TEST_AGENT
AGENT_DID_SEED=200000000000000000000000TCuste21js
AGENT_DB_HOST=pg_db:5432
AGENT_DB_USER=postgres
AGENT_DB_PASS=postgres
......
......@@ -6,7 +6,9 @@ import {
CredentialsModule,
DidsModule,
Key,
KeyDidResolver,
KeyType,
PeerDidResolver,
ProofsModule,
TypedArrayEncoder,
V2CredentialProtocol,
......@@ -24,6 +26,7 @@ import {
IndyVdrIndyDidRegistrar,
IndyVdrIndyDidResolver,
IndyVdrModule,
IndyVdrSovDidResolver,
} from "@aries-framework/indy-vdr";
import { AnonCredsRsModule } from "@aries-framework/anoncreds-rs";
import { anoncreds } from "@hyperledger/anoncreds-nodejs";
......@@ -126,7 +129,12 @@ export const getAskarAnonCredsIndyModules = (networks: any) => {
}),
dids: new DidsModule({
registrars: [new IndyVdrIndyDidRegistrar()],
resolvers: [new IndyVdrIndyDidResolver()],
resolvers: [
new IndyVdrSovDidResolver(),
new IndyVdrIndyDidResolver(),
new KeyDidResolver(),
new PeerDidResolver(),
],
}),
askar: new AskarModule({
ariesAskar,
......
......@@ -5,6 +5,8 @@ import {
BasicMessageEventTypes,
BasicMessageRole,
BasicMessageStateChangedEvent,
ProofEventTypes,
ProofStateChangedEvent,
} from "@aries-framework/core";
import {
MakeBasicMessageResponseDto,
......@@ -30,6 +32,22 @@ export class AgentEventListenerServce implements OnModuleInit {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.agentConfig = this.configService.get<IConfAgent>("agent")!;
this.askar.agent.events.on(
ProofEventTypes.ProofStateChanged,
async (ev: ProofStateChangedEvent) => {
const requestedCredentials =
await this.askar.agent.proofs.selectCredentialsForRequest({
proofRecordId: ev.payload.proofRecord.id,
});
console.log("event", JSON.stringify(ev, null, 2));
console.log("cred", JSON.stringify(ev, null, 2));
//is this the way to get the email from credential ?
console.log(requestedCredentials.proofFormats.anoncreds?.attributes);
},
);
this.askar.agent.events.on(
BasicMessageEventTypes.BasicMessageStateChanged,
async (ev: BasicMessageStateChangedEvent) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment