Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • svdh/ocm-engine
1 result
Show changes
Showing with 1884 additions and 2037 deletions
...@@ -21,7 +21,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,credentials.definition.*,cre ...@@ -21,7 +21,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,credentials.definition.*,cre
GATEWAY_HTTP_PORT=8081 GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881 GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=0.0.0.0 GATEWAY_HOST=0.0.0.0
......
...@@ -3,6 +3,19 @@ ...@@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file. See All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines. [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.6.0...v1.7.0) (2023-08-08)
### Features
* add separate var for peer port ([63ca360](https://code.vereign.com/gaiax/ocm/ocm-engine/commit/63ca360e5fcf670964eebfd15147f3b80127df66))
* replace socket.io with websocket ([119d295](https://code.vereign.com/gaiax/ocm/ocm-engine/commit/119d295fb614f20be715fddf6a5dc3c757ccaf91))
### Bug Fixes
* bcovrin interaction with ledger ([a72dc2b](https://code.vereign.com/gaiax/ocm/ocm-engine/commit/a72dc2b78611f56769c642928e1d991f6b9ebee3))
## [1.6.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.5.0...v1.6.0) (2023-06-13) ## [1.6.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.5.0...v1.6.0) (2023-06-13)
......
...@@ -126,9 +126,9 @@ Example: ...@@ -126,9 +126,9 @@ Example:
## Usage via Postman ## Usage via Postman
1. Import postman collection from the repo 1. Import postman collection from the repo
2. Connect to Socket.io on the gateway address, to listen for responses with [postman](https://learning.postman.com/docs/sending-requests/websocket/websocket) event is "message" 2. Connect to Web Socket on the gateway address, to listen for responses
3. Make a request 3. Make a request
4. Response will be sent to the Socket.io 4. Response will be sent to the Web Socket
## Send Didcomm messages between two OCMs ## Send Didcomm messages between two OCMs
......
...@@ -26,7 +26,8 @@ export class AppController { ...@@ -26,7 +26,8 @@ export class AppController {
2, 2,
)}`, )}`,
); );
this.eventsGateway.server.emit(this.gatewayConfig.socketEventName, dto);
this.eventsGateway.sentEvent(dto);
return "ok"; return "ok";
} }
} }
import { WebSocketGateway, WebSocketServer } from "@nestjs/websockets"; import { WebSocketGateway, WebSocketServer } from "@nestjs/websockets";
import { Server } from "socket.io"; import { Server, WebSocket } from "ws";
import { CloudEventDto } from "@ocm-engine/dtos";
@WebSocketGateway() @WebSocketGateway()
export class EventsGateway { export class EventsGateway {
@WebSocketServer() @WebSocketServer()
server: Server; server: Server;
sentEvent<T>(dto: CloudEventDto<T>) {
this.server.clients.forEach((client) => {
if (client.readyState === WebSocket.OPEN) {
client.send(JSON.stringify(dto));
}
});
}
} }
...@@ -12,10 +12,12 @@ import { MicroserviceOptions, Transport } from "@nestjs/microservices"; ...@@ -12,10 +12,12 @@ import { MicroserviceOptions, Transport } from "@nestjs/microservices";
import { ConfigService } from "@nestjs/config"; import { ConfigService } from "@nestjs/config";
import { IGateway } from "@ocm-engine/config"; import { IGateway } from "@ocm-engine/config";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"; import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import { WsAdapter } from "@nestjs/platform-ws";
import * as fs from "fs"; import * as fs from "fs";
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
app.useWebSocketAdapter(new WsAdapter(app));
const configService = app.get(ConfigService); const configService = app.get(ConfigService);
const gatewayConfig = configService.get<IGateway>("gateway")!; const gatewayConfig = configService.get<IGateway>("gateway")!;
...@@ -24,7 +26,7 @@ async function bootstrap() { ...@@ -24,7 +26,7 @@ async function bootstrap() {
app.setGlobalPrefix(globalPrefix); app.setGlobalPrefix(globalPrefix);
app.enableShutdownHooks(); app.enableShutdownHooks();
const microservice = app.connectMicroservice<MicroserviceOptions>({ app.connectMicroservice<MicroserviceOptions>({
transport: Transport.TCP, transport: Transport.TCP,
options: { options: {
host: gatewayConfig.host, host: gatewayConfig.host,
......
...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*,messages.*" ...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*,messages.*"
GATEWAY_HTTP_PORT=8081 GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881 GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-holder GATEWAY_HOST=gateway-holder
......
...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*" ...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*"
GATEWAY_HTTP_PORT=8081 GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881 GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-holder GATEWAY_HOST=gateway-holder
......
...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,credentials.definition.*,cre ...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,credentials.definition.*,cre
GATEWAY_HTTP_PORT=8081 GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881 GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-issuer GATEWAY_HOST=gateway-issuer
......
...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*" ...@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*"
GATEWAY_HTTP_PORT=8081 GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881 GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-issuer GATEWAY_HOST=gateway-issuer
......
...@@ -5,7 +5,7 @@ import { IConfAgent } from "../interfaces/agent.config.interface"; ...@@ -5,7 +5,7 @@ import { IConfAgent } from "../interfaces/agent.config.interface";
export const agentConfig = registerAs( export const agentConfig = registerAs(
"agent", "agent",
(): IConfAgent => ({ (): IConfAgent => ({
agentPeerPort: parseInt(process.env["AGENT_PEER_URL"]!.split(":")[2]), agentPeerPort: parseInt(process.env["AGENT_PEER_PORT"]!) || 8001,
agentPeerAddress: process.env["AGENT_PEER_URL"]!, agentPeerAddress: process.env["AGENT_PEER_URL"]!,
agentName: process.env["AGENT_NAME"]!, agentName: process.env["AGENT_NAME"]!,
agentKey: process.env["AGENT_KEY"]!, agentKey: process.env["AGENT_KEY"]!,
......
...@@ -7,7 +7,6 @@ export const gatewayConfig = registerAs( ...@@ -7,7 +7,6 @@ export const gatewayConfig = registerAs(
(): IGateway => ({ (): IGateway => ({
httpPort: parseInt(process.env["GATEWAY_HTTP_PORT"]!), httpPort: parseInt(process.env["GATEWAY_HTTP_PORT"]!),
tcpPort: parseInt(process.env["GATEWAY_TCP_PORT"]!), tcpPort: parseInt(process.env["GATEWAY_TCP_PORT"]!),
socketEventName: process.env["GATEWAY_SOCKET_EVENT_NAME"]!,
messagePattern: process.env["GATEWAY_MESSAGE_PATTERN"]!, messagePattern: process.env["GATEWAY_MESSAGE_PATTERN"]!,
host: process.env["GATEWAY_HOST"]!, host: process.env["GATEWAY_HOST"]!,
}), }),
......
export interface IGateway { export interface IGateway {
httpPort: number; httpPort: number;
tcpPort: number; tcpPort: number;
socketEventName: string;
messagePattern: string; messagePattern: string;
host: string; host: string;
} }
...@@ -3,7 +3,6 @@ import Joi from "joi"; ...@@ -3,7 +3,6 @@ import Joi from "joi";
export const gatewaySchema = Joi.object({ export const gatewaySchema = Joi.object({
GATEWAY_HTTP_PORT: Joi.string().required(), GATEWAY_HTTP_PORT: Joi.string().required(),
GATEWAY_TCP_PORT: Joi.string().required(), GATEWAY_TCP_PORT: Joi.string().required(),
GATEWAY_SOCKET_EVENT_NAME: Joi.string().required(),
GATEWAY_MESSAGE_PATTERN: Joi.string().required(), GATEWAY_MESSAGE_PATTERN: Joi.string().required(),
GATEWAY_HOST: Joi.string().required(), GATEWAY_HOST: Joi.string().required(),
}); });
...@@ -14,38 +14,35 @@ ...@@ -14,38 +14,35 @@
"build:pm:production": "nx run proof-manager:build:production", "build:pm:production": "nx run proof-manager:build:production",
"build:gw": "nx run gateway:build:development --parallel=3", "build:gw": "nx run gateway:build:development --parallel=3",
"build:gw:production": "nx run gateway:build:production", "build:gw:production": "nx run gateway:build:production",
"serve:all": "concurrently \"yarn serve:agent\" \"yarn serve:cm\" \"yarn serve:am\" \"yarn serve:pm\" \"yarn serve:gw\"", "serve:all": "concurrently \"yarn serve:agent\" \"yarn serve:cm\" \"yarn serve:am\" \"yarn serve:pm\" \"yarn serve:gw\"",
"serve:agent": "nx run agent:serve:development", "serve:agent": "nx run agent:serve:development",
"serve:cm": "nx run connection-manager:serve:development", "serve:cm": "nx run connection-manager:serve:development",
"serve:am": "nx run attestation-manager:serve:development", "serve:am": "nx run attestation-manager:serve:development",
"serve:pm": "nx run proof-manager:serve:development", "serve:pm": "nx run proof-manager:serve:development",
"serve:gw": "nx run gateway:serve:development", "serve:gw": "nx run gateway:serve:development",
"infra": "cd compose && docker-compose --profile issuer --profile holder up -d --build", "infra": "cd compose && docker-compose --profile issuer --profile holder up -d --build",
"infra:down": "cd compose && docker-compose --profile issuer --profile holder down", "infra:down": "cd compose && docker-compose --profile issuer --profile holder down",
"infra:status" : "cd compose && docker-compose ps -a", "infra:status": "cd compose && docker-compose ps -a",
"infra:issuer": "cd compose && docker-compose --profile issuer up -d --build", "infra:issuer": "cd compose && docker-compose --profile issuer up -d --build",
"infra:holder": "cd compose && docker-compose --profile holder up -d --build", "infra:holder": "cd compose && docker-compose --profile holder up -d --build",
"infra:issuer:stop": "cd compose && docker-compose --profile issuer stop", "infra:issuer:stop": "cd compose && docker-compose --profile issuer stop",
"infra:holder:stop": "cd compose && docker-compose --profile holder stop", "infra:holder:stop": "cd compose && docker-compose --profile holder stop",
"infra:local": "cd compose && docker-compose -f=docker-compose.infra.yml up -d", "infra:local": "cd compose && docker-compose -f=docker-compose.infra.yml up -d",
"infra:local:stop": "cd compose && docker-compose -f=docker-compose.infra.yml stop", "infra:local:stop": "cd compose && docker-compose -f=docker-compose.infra.yml stop",
"infra:simple": "cd compose && docker-compose -f docker-compose.simple.yml up -d" "infra:simple": "cd compose && docker-compose -f docker-compose.simple.yml up -d"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@hyperledger/anoncreds-nodejs": "^0.1.0-dev.15", "@hyperledger/anoncreds-nodejs": "^0.1.0",
"@hyperledger/aries-askar-nodejs": "^0.1.0-dev.12", "@hyperledger/aries-askar-nodejs": "^0.1.0",
"@hyperledger/aries-askar-shared": "^0.1.0-dev.12", "@hyperledger/aries-askar-shared": "^0.1.0",
"@hyperledger/indy-vdr-nodejs": "^0.1.0-dev.14", "@hyperledger/indy-vdr-nodejs": "^0.1.0",
"@nestjs/common": "^9.0.0", "@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.3.1", "@nestjs/config": "^2.3.1",
"@nestjs/core": "^9.0.0", "@nestjs/core": "^9.0.0",
"@nestjs/microservices": "^9.4.2", "@nestjs/microservices": "^9.4.2",
"@nestjs/platform-express": "^9.0.0", "@nestjs/platform-express": "^9.0.0",
"@nestjs/platform-socket.io": "^9.4.2", "@nestjs/platform-ws": "^10.1.3",
"@nestjs/websockets": "^9.4.2", "@nestjs/websockets": "^9.4.2",
"async-retry": "^1.3.3", "async-retry": "^1.3.3",
"axios": "^1.0.0", "axios": "^1.0.0",
...@@ -59,12 +56,12 @@ ...@@ -59,12 +56,12 @@
"tslib": "^2.3.0" "tslib": "^2.3.0"
}, },
"devDependencies": { "devDependencies": {
"@aries-framework/anoncreds": "0.4.0-alpha.120", "@aries-framework/anoncreds": "^0.4.0",
"@aries-framework/anoncreds-rs": "0.4.0-alpha.120", "@aries-framework/anoncreds-rs": "^0.4.0",
"@aries-framework/askar": "0.4.0-alpha.120", "@aries-framework/askar": "^0.4.0",
"@aries-framework/core": "0.4.0-alpha.120", "@aries-framework/core": "^0.4.0",
"@aries-framework/indy-vdr": "0.4.0-alpha.120", "@aries-framework/indy-vdr": "^0.4.0",
"@aries-framework/node": "0.4.0-alpha.120", "@aries-framework/node": "^0.4.0",
"@commitlint/config-conventional": "^17.6.1", "@commitlint/config-conventional": "^17.6.1",
"@nestjs/schematics": "^9.0.0", "@nestjs/schematics": "^9.0.0",
"@nestjs/swagger": "^6.3.0", "@nestjs/swagger": "^6.3.0",
......
This diff is collapsed.