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
Branches
No related tags found
No related merge requests found
Pipeline #64639 failed
...@@ -11,30 +11,104 @@ services: ...@@ -11,30 +11,104 @@ services:
volumes: volumes:
- ./data/db-simple/:/var/lib/postgresql/data/ - ./data/db-simple/:/var/lib/postgresql/data/
agent-issuer-simple: builder:
container_name: agent-issuer-simple privileged: true
build: image: node:18.16.0-buster-slim
context: "../" volumes:
dockerfile: "./apps/agent/deployment/Dockerfile" - ./../yarn.lock:/app/yarn.lock
env_file: - ./../package.json:/app/package.json
- ./env/issuer.simple.env - ./../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: ports:
- "8080:8080" - "8080:8081"
- "8001:8001" - "8001:8001"
env_file:
- ./env/issuer.simple.env
depends_on: depends_on:
builder:
condition: service_completed_successfully
pg_db: pg_db:
condition: service_started condition: service_started
agent-holder-simple: agent-holder:
container_name: agent-holder-simple container_name: agent-holder
build: image: node:18.16.0
context: "../" volumes:
dockerfile: "./apps/agent/deployment/Dockerfile" - ./data/node_modules:/app/node_modules
env_file: - ./data/dist/apps/agent:/app/
- ./env/holder.simple.env working_dir: /app
command: node main.js
ports: ports:
- "8081:8080" - "8090:8081"
- "6001:6001" - "6001:6001"
env_file:
- ./env/holder.simple.env
depends_on: depends_on:
builder:
condition: service_completed_successfully
pg_db: pg_db:
condition: service_started 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" LEDGERS="BCOVRIN_TEST"
IDUNION_KEY= IDUNION_KEY=
AGENT_PEER_URL="http://agent-issuer:8001" AGENT_PEER_URL="http://192.168.1.5:8001"
AGENT_NAME=DEV_SIMPLE_AGENT_ISSUER_OCM # this should be changed to company name AGENT_NAME=TEST_AGENT
AGENT_KEY=DEV_SIMPLE_AGENT_ISSUER_OCM #example random string AGENT_KEY=TEST_AGENT
AGENT_DID_SEED=200000000000000000000000TCuste21js #did private key seed min lenght 32 AGENT_DID_SEED=200000000000000000000000TCuste21js
AGENT_DB_HOST=pg_db:5432 AGENT_DB_HOST=pg_db:5432
AGENT_DB_USER=postgres AGENT_DB_USER=postgres
AGENT_DB_PASS=postgres AGENT_DB_PASS=postgres
......
...@@ -6,7 +6,9 @@ import { ...@@ -6,7 +6,9 @@ import {
CredentialsModule, CredentialsModule,
DidsModule, DidsModule,
Key, Key,
KeyDidResolver,
KeyType, KeyType,
PeerDidResolver,
ProofsModule, ProofsModule,
TypedArrayEncoder, TypedArrayEncoder,
V2CredentialProtocol, V2CredentialProtocol,
...@@ -24,6 +26,7 @@ import { ...@@ -24,6 +26,7 @@ import {
IndyVdrIndyDidRegistrar, IndyVdrIndyDidRegistrar,
IndyVdrIndyDidResolver, IndyVdrIndyDidResolver,
IndyVdrModule, IndyVdrModule,
IndyVdrSovDidResolver,
} from "@aries-framework/indy-vdr"; } from "@aries-framework/indy-vdr";
import { AnonCredsRsModule } from "@aries-framework/anoncreds-rs"; import { AnonCredsRsModule } from "@aries-framework/anoncreds-rs";
import { anoncreds } from "@hyperledger/anoncreds-nodejs"; import { anoncreds } from "@hyperledger/anoncreds-nodejs";
...@@ -126,7 +129,12 @@ export const getAskarAnonCredsIndyModules = (networks: any) => { ...@@ -126,7 +129,12 @@ export const getAskarAnonCredsIndyModules = (networks: any) => {
}), }),
dids: new DidsModule({ dids: new DidsModule({
registrars: [new IndyVdrIndyDidRegistrar()], registrars: [new IndyVdrIndyDidRegistrar()],
resolvers: [new IndyVdrIndyDidResolver()], resolvers: [
new IndyVdrSovDidResolver(),
new IndyVdrIndyDidResolver(),
new KeyDidResolver(),
new PeerDidResolver(),
],
}), }),
askar: new AskarModule({ askar: new AskarModule({
ariesAskar, ariesAskar,
......
...@@ -5,6 +5,8 @@ import { ...@@ -5,6 +5,8 @@ import {
BasicMessageEventTypes, BasicMessageEventTypes,
BasicMessageRole, BasicMessageRole,
BasicMessageStateChangedEvent, BasicMessageStateChangedEvent,
ProofEventTypes,
ProofStateChangedEvent,
} from "@aries-framework/core"; } from "@aries-framework/core";
import { import {
MakeBasicMessageResponseDto, MakeBasicMessageResponseDto,
...@@ -30,6 +32,22 @@ export class AgentEventListenerServce implements OnModuleInit { ...@@ -30,6 +32,22 @@ export class AgentEventListenerServce implements OnModuleInit {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.agentConfig = this.configService.get<IConfAgent>("agent")!; 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( this.askar.agent.events.on(
BasicMessageEventTypes.BasicMessageStateChanged, BasicMessageEventTypes.BasicMessageStateChanged,
async (ev: BasicMessageStateChangedEvent) => { async (ev: BasicMessageStateChangedEvent) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment