Newer
Older
- [Introduction](#introduction)
- [Requirements](#requirements)
- [Architecture](#architecture)
- [Setup](#setup)
- [Local env](#local)
- [Docker env](#docker)
- [Usage](#usage-via-postman)
- [Example](#send-didcomm-messages-between-two-ocms)
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
OCM Engine is a monorepo based on [NestJS](http://nestjs.com) and [Nx](https://nx.dev), holding applications in `apps` directory and `libraries` in `libs`, which were used to create the applications and can be used for developing additional applications in `OCM` project.
### Apps list:
- Agent
- Attestation Manager
- Connection Manager
- Proof Manager
- Gateway
### Library list:
- Askar
- Clients
- Config
- Dtos
- Ledgers
- Nats
## Requirements
- Git
- NodeJS >= v18.16.0
- PostgresDB
- Nats
## Architecture
```mermaid
flowchart TD
Postman --http--> Gateway
Gateway --ws--> Postman
Gateway --tcp--> cm[Connection Manager] & am[Attestation Manager] & pm[Proof Manager] --event--> nats[NATS]
nats --event--> Agent
Agent --tcp--> Gateway
Agent <--> db[(PostgresDB)]
Agent <--> Ledger[(Ledger)]
```
## Setup
- ##### Install Git
How to install [Git](https://www.atlassian.com/git/tutorials/install-git) on my system.
- ##### Install NodeJS >= v18.16.0 version
How to install [NodeJS](https://nodejs.org/en/download/package-manager) on my system.
Second option is to use version manager like [nvm](https://github.com/nvm-sh/nvm) which will allow you to switch between different NodeJS versions.
- ##### Clone the repo
Once you have installed all Git, Node, Yarn you can clone the project with:
```
git clone git@code.vereign.com:gaiax/ocm/ocm-engine.git
```
or
```
git clone https://code.vereign.com/gaiax/ocm/ocm-engine.git
```
- ##### Install Dependencies
Go inside your cloned repo and install all dependencies with:
```
yarn install
```
## Local
You can run the entire stack or specific application locally.
Example for entire stack:
1. copy .env.example to .env
2. edit .env to your liking
3. yarn install
4. yarn infra:local or install PostgresDB and Nats broker locally and add them to .env
5. yarn serve:all
Example of running only the agent service as a rest service.
1. copy .env.example to .env
2. edit .env to your liking and change AGENT_IS_REST to true
3. yarn install
4. yarn infra:local or isntall PostgresDB and Nats broker locally and add them to .env
5. yarn serve:agent
## Docker
Example:
You can `issuer` OCM stack with:
1. edit issuer.env in compose directory
2. yarn infra:issuer
Then the gateway will be at http://localhost:8081 url
`Holder` OCM stack can be started with:
1. edit holder.env in compose directory
2. yarn infra:holder
Then the gateway will be at http://localhost:8082 url
You can run the entire stack - `issuer` and `holder` with:
1. edit issuer.env and holder.env in compose directory
2. yarn infra
Yarn commands are wrapper around docker-compose for easier use. You can still use docker-compose from compose dir.
## Usage via Postman
1. Import postman collection from the repo
2. Connect to Web Socket on the gateway address, to listen for responses
4. Response will be sent to the Web Socket
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
## Send Didcomm messages between two OCMs
1. Setup [Postman](#usage-via-postman) as the previous step
2. Check your local ip - on linux and macos - ifconfig, windows - ipconfig
3. Edit [issuer.env](compose/env/issuer.env)
- Change `AGENT_PEER_URL` to use your local ip - `http://your-local-ip:8001` - EXAMPLE `http://192.168.111.53:8001`
- Change `AGENT_NAME` and `AGENT_KEY` - those are the name and the key of the wallet
- Change `AGENT_DID_SEED` - this is a seed for private key from which the DID will be created.
4. Start the issuer with `yarn run infra:issuer` or `npm run infra:issuer`
5. Connect to the socket via postman. `ws://localhost:8081`
6. `Create new invitation` via postman request, on the socket listener you will receive invitation url response
7. Copy and paste this url in the chat
8. Another OCM (which performed the same setup steps, but with different values) should get this invitation url
8. Call `accept invitation` via postman with this invitation url as a body payload
9. Response will be returned on the socket, that a connection is made.
10. Get the connectionId from this response
11. Send basic message with connectionId and a string message
12. On the socket of issuer a event will be received with the message and connection id.
## License
This project is licensed under the AGPL License - see the [LICENSE](LICENSE) file for details.