Skip to content

Commit c29ee0b

Browse files
committed
[INJICERT-1138] Add missing scripts for docker-compose setup (mosip#374)
* Update docker compose init scripts Signed-off-by: Piyush7034 <[email protected]> * Remove multiple vc types for farmer vc Signed-off-by: Piyush7034 <[email protected]> * Add new usec case setup md file for docker-compose (mosip#364) Signed-off-by: Piyush7034 <[email protected]> * Fix script in new-usecase md file Signed-off-by: Piyush7034 <[email protected]> * Update Postgres-plugin-usecase.md file Signed-off-by: Piyush7034 <[email protected]> --------- Signed-off-by: Piyush7034 <[email protected]> Signed-off-by: Vishwa <[email protected]> Signed-off-by: Piyush7034 <[email protected]>
1 parent 35b446e commit c29ee0b

File tree

2 files changed

+320
-111
lines changed

2 files changed

+320
-111
lines changed
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
## Note: This Document is just a draft. More simplified setu steps will be added as an enhancement.
2+
# Adding a new usecase to Docker Compose Injistack
3+
This document outlines the steps to add a new usecase using the Postgres Data Provider Plugin to the Docker Compose setup for Injistack.
4+
5+
# Current Usecases
6+
Current usecases include:
7+
8+
## Farmer Usecase:
9+
1. Config file: [certify-csvdp-farmer.properties](../../docker-compose/docker-compose-injistack/certify-csvdp-farmer.properties)
10+
2. Plugin Used: mock-certify-plugin
11+
3. Plugin mode: `Data Provider`
12+
4. Conditional Property Name:
13+
- `mosip.certify.integration.data-provider-plugin` : `MockCSVDataProviderPlugin`
14+
5. Mounted config file of the current usecase in the `docker-compose.yml` file under the `certify` service under `volumes` section:
15+
- Example:
16+
```
17+
services:
18+
certify:
19+
...
20+
volumes:
21+
- ./config/certify-postgres-landregistry.properties:/home/mosip/config/certify-farmer-csvdp.properties
22+
```
23+
24+
## New Usecase Setup
25+
## New usecase setup using Postgres Plugin:
26+
1. Usecase Name: `Land Registry Usecase`
27+
2. VC Types: `RegistrationReceiptCredential`, `LandRegistryCredential`
28+
29+
# Steps to Add a New Usecase
30+
1. Add the property config file for the new usecase `certify-postgres-landregistry.properties` in the [config](../../docker-compose/docker-compose-injistack/config) directory.
31+
2. Plugin to be used: `postgres-dataprovider-plugin`
32+
3. Plugin mode: `Data Provider`
33+
4. Conditional Property Name:
34+
- `mosip.certify.integration.data-provider-plugin` : `PostgresDataProviderPlugin`
35+
5. Mount the config file of the new usecase by adding it to the `docker-compose.yml` file under the `certify` service under `volumes` section:
36+
- Example:
37+
```
38+
services:
39+
certify:
40+
...
41+
volumes:
42+
- ./config/certify-postgres-landregistry.properties:/home/mosip/config/certify-postgres-landregistry.properties
43+
```
44+
45+
6. Update the `active_profile_env` to use the postgres-landregistry usecase by updating the following line to the `docker-compose.yml` file under the `certify` service under `environment` section:
46+
```
47+
environment:
48+
- active_profile_env=default, certify-postgres-landregistry
49+
```
50+
51+
52+
# Add the scripts to create tables and insert data for the usecase specific tables.
53+
1. In the [certify_init.sql](../../docker-compose/docker-compose-injistack/certify_init.sql) file, add the SQL scripts to create the necessary tables and insert data for the new usecase.
54+
```
55+
CREATE TABLE CERTIFY.registration_receipt_data (
56+
...
57+
);
58+
59+
CREATE TABLE CERTIFY.statement_data (
60+
...
61+
);
62+
63+
INSERT INTO CERTIFY.registration_receipt_data
64+
(...)
65+
VALUES
66+
(...);
67+
68+
INSERT INTO CERTIFY.statement_data
69+
(...)
70+
VALUES
71+
(...);
72+
```
73+
74+
2. The id or primary key field for the above insert statements should be a valid UIN available in the mock-identity-system if using esignet as the auth provider.
75+
76+
2. Use the Credential-Config APIs to add new VC type to the credential_config table
77+
- Use the `POST /v1/credential-configurations` API to add the new VC type.
78+
```
79+
"/credential-configurations": {
80+
"post": {
81+
"tags": [
82+
"credential-config-controller"
83+
],
84+
"operationId": "addCredentialConfiguration",
85+
"requestBody": {
86+
"content": {
87+
"application/json": {
88+
"schema": {
89+
"$ref": "#/components/schemas/CredentialConfigurationDTO"
90+
}
91+
}
92+
},
93+
"required": true
94+
},
95+
"responses": {
96+
"200": {
97+
"description": "OK",
98+
"content": {
99+
"application/json": {
100+
"schema": {
101+
"$ref": "#/components/schemas/CredentialConfigResponse"
102+
}
103+
}
104+
}
105+
}
106+
}
107+
}
108+
```
109+
110+
3. Request Structure: CredentialConfigurationDTO
111+
```
112+
{
113+
"credentialConfigKeyId": "RegistrationReceiptCredential",
114+
"vcTemplate": "",
115+
"keyManagerAppId": "CERTIFY_VC_SIGN_ED25519",
116+
"keyManagerRefId": "ED25519_SIGN",
117+
"signatureAlgo": "EdDSA",
118+
"context": [
119+
"https://www.w3.org/2018/credentials/v1",
120+
"https://mosip.github.io/inji-config/contexts/landregistry-registration-receipt-context.json"
121+
],
122+
"credentialType": [
123+
"VerifiableCredential",
124+
"RegistrationReceiptCredential"
125+
],
126+
"credentialFormat": "ldp_vc",
127+
"didUrl": "did:web:mosip.github.io:inji-config:dev-int-inji:landregistry-ed25519#key-0",
128+
"display": [{
129+
"name": "REGISTRATION RECEIPT OF THE RURAL PROPERTY IN CAR",
130+
"locale": "en",
131+
"logo": {
132+
"url": "https://mosip.github.io/inji-config/logos/agro-vertias-logo.png",
133+
"alt_text": "Registration Receipt Credential logo"
134+
},
135+
"background_image": { "uri": "https://mosip.github.io/inji-config/logos/agro-vertias-logo.png" },
136+
"background_color": "#ebfaff",
137+
"text_color": "#000000"
138+
}],
139+
"order": ["NumberOfCAR","RegistrationDate","RuralPropertyName","Municipality","Latitude","Longitude","TotalArea","FiscalModules","ProtocolCode","CPF","HolderName","TotalDeclaredArea","AdministrativeEasementArea","NetArea","ConsolidatedArea","NativeVegetationRemnant","LegalReserveArea","PermanentPreservationArea","RestrictedUseArea"],
140+
"scope": "land_registry_vc_ldp",
141+
"credentialSubject": {
142+
"NumberOfCAR": {
143+
"display": [
144+
{
145+
"name": "CAR Registration Number",
146+
"locale": "en"
147+
}
148+
]
149+
},
150+
"RegistrationDate": {
151+
"display": [
152+
{
153+
"name": "Registration Date",
154+
"locale": "en"
155+
}
156+
]
157+
}
158+
}
159+
}
160+
```
161+
162+
4. Response Structure: CredentialConfigResponse
163+
```
164+
{
165+
"configId": "<UUID>",
166+
"status": "active"
167+
}
168+
```
169+
170+
5. Test the well-known endpoint to ensure the new VC type is available:
171+
- Access the well-known endpoint: `http://localhost:8090/.well-known/credential-configurations`
172+
- Verify that the new VC type is listed in the response.
173+
174+
175+
## Update mimoto config:
176+
1. Add the new usecase to the `mimoto` config file located at [mimoto-issuers-config.json](../../docker-compose/docker-compose-injistack/config/mimoto-issuers-config.json):
177+
```
178+
{
179+
"issuers": [
180+
{
181+
"credential_issuer": "Landregistry",
182+
"issuer_id": "Landregisrty",
183+
"protocol": "OpenId4VCI",
184+
"display": [
185+
{
186+
"name": "Landregistry Department",
187+
"logo": {
188+
"url": "https://mosip.github.io/inji-config/logos/agro-vertias-logo.png",
189+
"alt_text": "landregistry-logo"
190+
},
191+
"title": "Landregistry Department",
192+
"description": "Download Landregistry Credentials",
193+
"language": "en"
194+
}
195+
],
196+
"client_id": "wallet-demo",
197+
"redirect_uri": "io.mosip.residentapp.inji://oauthredirect",
198+
"token_endpoint": "http://localhost:8099/v1/mimoto/get-token/Landregistry",
199+
"authorization_audience": "https://esignet-mock.collab.mosip.net/v1/esignet/oauth/v2/token",
200+
"proxy_token_endpoint": "https://esignet-mock.collab.mosip.net/v1/esignet/oauth/v2/token",
201+
"client_alias": "wallet-demo-client",
202+
"qr_code_type": "EmbeddedVC",
203+
"enabled": "true",
204+
"wellknown_endpoint": "http://certify-nginx:80/.well-known/openid-credential-issuer"
205+
}]
206+
}
207+
```

0 commit comments

Comments
 (0)