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
GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=0.0.0.0
......
......@@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file. See
[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)
......
......@@ -126,9 +126,9 @@ Example:
## Usage via Postman
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
4. Response will be sent to the Socket.io
4. Response will be sent to the Web Socket
## Send Didcomm messages between two OCMs
......
......@@ -26,7 +26,8 @@ export class AppController {
2,
)}`,
);
this.eventsGateway.server.emit(this.gatewayConfig.socketEventName, dto);
this.eventsGateway.sentEvent(dto);
return "ok";
}
}
import { WebSocketGateway, WebSocketServer } from "@nestjs/websockets";
import { Server } from "socket.io";
import { Server, WebSocket } from "ws";
import { CloudEventDto } from "@ocm-engine/dtos";
@WebSocketGateway()
export class EventsGateway {
@WebSocketServer()
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";
import { ConfigService } from "@nestjs/config";
import { IGateway } from "@ocm-engine/config";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import { WsAdapter } from "@nestjs/platform-ws";
import * as fs from "fs";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useWebSocketAdapter(new WsAdapter(app));
const configService = app.get(ConfigService);
const gatewayConfig = configService.get<IGateway>("gateway")!;
......@@ -24,7 +26,7 @@ async function bootstrap() {
app.setGlobalPrefix(globalPrefix);
app.enableShutdownHooks();
const microservice = app.connectMicroservice<MicroserviceOptions>({
app.connectMicroservice<MicroserviceOptions>({
transport: Transport.TCP,
options: {
host: gatewayConfig.host,
......
......@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*,messages.*"
GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-holder
......
......@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*"
GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-holder
......
......@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,credentials.definition.*,cre
GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-issuer
......
......@@ -20,7 +20,6 @@ NATS_SUBJECTS="connections.*,proofs.*,credentials.*,schemas.*"
GATEWAY_HTTP_PORT=8081
GATEWAY_TCP_PORT=8881
GATEWAY_SOCKET_EVENT_NAME=message
GATEWAY_MESSAGE_PATTERN=webhook
GATEWAY_HOST=gateway-issuer
......
......@@ -5,7 +5,7 @@ import { IConfAgent } from "../interfaces/agent.config.interface";
export const agentConfig = registerAs(
"agent",
(): IConfAgent => ({
agentPeerPort: parseInt(process.env["AGENT_PEER_URL"]!.split(":")[2]),
agentPeerPort: parseInt(process.env["AGENT_PEER_PORT"]!) || 8001,
agentPeerAddress: process.env["AGENT_PEER_URL"]!,
agentName: process.env["AGENT_NAME"]!,
agentKey: process.env["AGENT_KEY"]!,
......
......@@ -7,7 +7,6 @@ export const gatewayConfig = registerAs(
(): IGateway => ({
httpPort: parseInt(process.env["GATEWAY_HTTP_PORT"]!),
tcpPort: parseInt(process.env["GATEWAY_TCP_PORT"]!),
socketEventName: process.env["GATEWAY_SOCKET_EVENT_NAME"]!,
messagePattern: process.env["GATEWAY_MESSAGE_PATTERN"]!,
host: process.env["GATEWAY_HOST"]!,
}),
......
export interface IGateway {
httpPort: number;
tcpPort: number;
socketEventName: string;
messagePattern: string;
host: string;
}
......@@ -3,7 +3,6 @@ import Joi from "joi";
export const gatewaySchema = Joi.object({
GATEWAY_HTTP_PORT: Joi.string().required(),
GATEWAY_TCP_PORT: Joi.string().required(),
GATEWAY_SOCKET_EVENT_NAME: Joi.string().required(),
GATEWAY_MESSAGE_PATTERN: Joi.string().required(),
GATEWAY_HOST: Joi.string().required(),
});
......@@ -14,38 +14,35 @@
"build:pm:production": "nx run proof-manager:build:production",
"build:gw": "nx run gateway:build:development --parallel=3",
"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:agent": "nx run agent:serve:development",
"serve:cm": "nx run connection-manager:serve:development",
"serve:am": "nx run attestation-manager:serve:development",
"serve:pm": "nx run proof-manager:serve:development",
"serve:gw": "nx run gateway:serve:development",
"infra": "cd compose && docker-compose --profile issuer --profile holder up -d --build",
"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:holder": "cd compose && docker-compose --profile holder up -d --build",
"infra:issuer:stop": "cd compose && docker-compose --profile issuer 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:stop": "cd compose && docker-compose -f=docker-compose.infra.yml stop",
"infra:simple": "cd compose && docker-compose -f docker-compose.simple.yml up -d"
},
"private": true,
"dependencies": {
"@hyperledger/anoncreds-nodejs": "^0.1.0-dev.15",
"@hyperledger/aries-askar-nodejs": "^0.1.0-dev.12",
"@hyperledger/aries-askar-shared": "^0.1.0-dev.12",
"@hyperledger/indy-vdr-nodejs": "^0.1.0-dev.14",
"@hyperledger/anoncreds-nodejs": "^0.1.0",
"@hyperledger/aries-askar-nodejs": "^0.1.0",
"@hyperledger/aries-askar-shared": "^0.1.0",
"@hyperledger/indy-vdr-nodejs": "^0.1.0",
"@nestjs/common": "^9.0.0",
"@nestjs/config": "^2.3.1",
"@nestjs/core": "^9.0.0",
"@nestjs/microservices": "^9.4.2",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/platform-socket.io": "^9.4.2",
"@nestjs/platform-ws": "^10.1.3",
"@nestjs/websockets": "^9.4.2",
"async-retry": "^1.3.3",
"axios": "^1.0.0",
......@@ -59,12 +56,12 @@
"tslib": "^2.3.0"
},
"devDependencies": {
"@aries-framework/anoncreds": "0.4.0-alpha.120",
"@aries-framework/anoncreds-rs": "0.4.0-alpha.120",
"@aries-framework/askar": "0.4.0-alpha.120",
"@aries-framework/core": "0.4.0-alpha.120",
"@aries-framework/indy-vdr": "0.4.0-alpha.120",
"@aries-framework/node": "0.4.0-alpha.120",
"@aries-framework/anoncreds": "^0.4.0",
"@aries-framework/anoncreds-rs": "^0.4.0",
"@aries-framework/askar": "^0.4.0",
"@aries-framework/core": "^0.4.0",
"@aries-framework/indy-vdr": "^0.4.0",
"@aries-framework/node": "^0.4.0",
"@commitlint/config-conventional": "^17.6.1",
"@nestjs/schematics": "^9.0.0",
"@nestjs/swagger": "^6.3.0",
......
This diff is collapsed.