Skip to content

Commit daee7df

Browse files
authored
Merge pull request #75 from Vikastc/sdk-4
fix: Remove vc verify and implement new sdk
2 parents 0a2479e + d24a55e commit daee7df

34 files changed

+2137
-2534
lines changed

.env

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
AGENT_PORT=5106
2-
VERIFY_PORT=5004
32
AGENT_DID_NAME="issuer.agent.0235@cord"
43

5-
CORD_WSS_URL=wss://sparknet.cord.network
6-
AUTHOR_URI=//sparknet/agent
7-
8-
CHAIN_SPACE_ID=space:cord:c35h1XGuUXDHwtJTre7dwsb7KqZM5DWYA4kpPRuSx6BZJnXTg
9-
CHAIN_SPACE_AUTH=auth:cord:a3fHEajeParsSaCNLffgi9UVL3dieXNrufHujvdorccQ94qqv
10-
MNEMONIC=loyal federal rare goddess chief display vessel athlete vault fork grab eager strategy lonely current foster eager toe holiday unveil heavy city belt agent
11-
124
TYPEORM_PORT=5432
135

146
STUDIO_TYPEORM_HOST=postgres42
@@ -27,4 +19,12 @@ STUDIO_TYPEORM_LOGGING=false
2719

2820
# WALLET_URL = http://wallet:5001/api/v1
2921
WEB_URL=issuer-agent.demo.dhiway.com
30-
REQUEST_URL_TOKEN=d53b731c-be91-458d-bd97-71d37d444e60
22+
REQUEST_URL_TOKEN=d53b731c-be91-458d-bd97-71d37d444e60
23+
24+
# Cord
25+
NETWORK_ADDRESS=wss://weave1.testnet.cord.network
26+
STASH_ACC_MNEMONIC=demo
27+
28+
# Redis
29+
REDIS_URL=redis://redis_container:6379
30+
REDIS_TIMEOUT=3600

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules
22
.vscode
3+
dist

.prettierrc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"useTabs": false,
3-
"tabWidth": 2,
4-
"singleQuote": true,
5-
"jsxBracketSameLine": false
2+
"useTabs": false,
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"jsxBracketSameLine": false
66
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-slim as prod
1+
FROM node:22-slim as prod
22

33
#ENV NODE_ENV=production
44

Dockerfile.for-ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20.1-slim as builder
1+
FROM node:22-slim as builder
22

33
WORKDIR /app
44

Dockerfile.mac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20.1-slim
1+
FROM node:22-slim
22

33
WORKDIR /app
44

@@ -11,6 +11,6 @@ RUN yarn build
1111

1212
EXPOSE 5001
1313

14-
CMD ["npm", "run", "prod"]
14+
CMD ["yarn", "run", "prod"]
1515

1616
#CMD ["tail", "-f", "/dev/null"]

docker-compose.yaml

Lines changed: 66 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,73 @@
1-
version: '3.8'
2-
31
services:
4-
dhiagent:
5-
image: dhiway/issuer-agent:latest
6-
container_name: dhiagent
7-
environment:
8-
- PORT=${AGENT_PORT}
9-
- TYPEORM_HOST=${STUDIO_TYPEORM_HOST}
10-
- TYPEORM_PORT=${TYPEORM_PORT}
11-
- TYPEORM_USERNAME=${STUDIO_TYPEORM_USERNAME}
12-
- TYPEORM_PASSWORD=${STUDIO_TYPEORM_PASSWORD}
13-
- TYPEORM_DATABASE=${STUDIO_TYPEORM_DATABASE}
14-
- TYPEORM_AUTO_SCHEMA_SYNC=${STUDIO_TYPEORM_AUTO_SCHEMA_SYNC}
15-
- TYPEORM_ENTITIES=${STUDIO_TYPEORM_ENTITIES}
16-
- TYPEORM_SUBSCRIBERS=${STUDIO_TYPEORM_SUBSCRIBERS}
17-
- TYPEORM_MIGRATIONS=${STUDIO_TYPEORM_MIGRATIONS}
18-
- TYPEORM_ENTITIES_DIR=${STUDIO_TYPEORM_ENTITIES_DIR}
19-
- TYPEORM_MIGRATIONS_DIR=${STUDIO_TYPEORM_MIGRATIONS_DIR}
20-
- TYPEORM_SUBSCRIBERS_DIR=${STUDIO_TYPEORM_SUBSCRIBERS_DIR}
21-
- TYPEORM_LOGGING=${STUDIO_TYPEORM_LOGGING}
22-
- CORD_WSS_URL=${CORD_WSS_URL}
23-
- AUTHOR_URI=${AUTHOR_URI}
24-
- MNEMONIC=${MNEMONIC}
25-
- WALLET_URL=${WALLET_URL}
26-
- AGENT_DID_NAME=${AGENT_DID_NAME}
27-
- CHAIN_SPACE_ID=${CHAIN_SPACE_ID}
28-
- CHAIN_SPACE_AUTH=${CHAIN_SPACE_AUTH}
29-
- WEB_URL=${WEB_URL}
30-
- REQUEST_URL_TOKEN=${REQUEST_URL_TOKEN}
31-
ports:
32-
- ${AGENT_PORT}:${AGENT_PORT}
33-
depends_on:
34-
- postgres42
35-
networks:
36-
- local
37-
command: node dist/index.js
2+
dhiagent:
3+
image: dhiway/issuer-agent:latest
4+
container_name: dhiagent
5+
environment:
6+
- PORT=${AGENT_PORT}
7+
- REDIS_URL=${REDIS_URL}
8+
- REDIS_TIMEOUT=${REDIS_TIMEOUT}
9+
- TYPEORM_HOST=${STUDIO_TYPEORM_HOST}
10+
- TYPEORM_PORT=${TYPEORM_PORT}
11+
- TYPEORM_USERNAME=${STUDIO_TYPEORM_USERNAME}
12+
- TYPEORM_PASSWORD=${STUDIO_TYPEORM_PASSWORD}
13+
- TYPEORM_DATABASE=${STUDIO_TYPEORM_DATABASE}
14+
- TYPEORM_AUTO_SCHEMA_SYNC=${STUDIO_TYPEORM_AUTO_SCHEMA_SYNC}
15+
- TYPEORM_ENTITIES=${STUDIO_TYPEORM_ENTITIES}
16+
- TYPEORM_SUBSCRIBERS=${STUDIO_TYPEORM_SUBSCRIBERS}
17+
- TYPEORM_MIGRATIONS=${STUDIO_TYPEORM_MIGRATIONS}
18+
- TYPEORM_ENTITIES_DIR=${STUDIO_TYPEORM_ENTITIES_DIR}
19+
- TYPEORM_MIGRATIONS_DIR=${STUDIO_TYPEORM_MIGRATIONS_DIR}
20+
- TYPEORM_SUBSCRIBERS_DIR=${STUDIO_TYPEORM_SUBSCRIBERS_DIR}
21+
- TYPEORM_LOGGING=${STUDIO_TYPEORM_LOGGING}
22+
- CORD_WSS_URL=${CORD_WSS_URL}
23+
- AUTHOR_URI=${AUTHOR_URI}
24+
- MNEMONIC=${MNEMONIC}
25+
- WALLET_URL=${WALLET_URL}
26+
- AGENT_DID_NAME=${AGENT_DID_NAME}
27+
- CHAIN_SPACE_ID=${CHAIN_SPACE_ID}
28+
- CHAIN_SPACE_AUTH=${CHAIN_SPACE_AUTH}
29+
- WEB_URL=${WEB_URL}
30+
- REQUEST_URL_TOKEN=${REQUEST_URL_TOKEN}
31+
- NETWORK_ADDRESS=${NETWORK_ADDRESS}
32+
- STASH_ACC_MNEMONIC=${STASH_ACC_MNEMONIC}
33+
ports:
34+
- ${AGENT_PORT}:${AGENT_PORT}
35+
depends_on:
36+
- postgres42
37+
- redis
38+
networks:
39+
- local
40+
command: node dist/index.js
3841

39-
vc-verify:
40-
image: dhiway/vc-verify-ui:latest
41-
container_name: vc-verify
42-
environment:
43-
- PORT=${VERIFY_PORT}
44-
- TYPEORM_HOST=${STUDIO_TYPEORM_HOST}
45-
- TYPEORM_PORT=${TYPEORM_PORT}
46-
- TYPEORM_USERNAME=${STUDIO_TYPEORM_USERNAME}
47-
- TYPEORM_PASSWORD=${STUDIO_TYPEORM_PASSWORD}
48-
- TYPEORM_DATABASE=${STUDIO_TYPEORM_DATABASE}
49-
ports:
50-
- ${VERIFY_PORT}:${VERIFY_PORT}
51-
depends_on:
52-
- postgres42
53-
- dhiagent
54-
networks:
55-
- local
56-
command: node dist/index.js
42+
postgres42:
43+
image: postgres:16-alpine
44+
container_name: postgres42
45+
environment:
46+
POSTGRES_USER: ${STUDIO_TYPEORM_USERNAME}
47+
POSTGRES_PASSWORD: ${STUDIO_TYPEORM_PASSWORD}
48+
POSTGRES_DB: ${STUDIO_TYPEORM_DATABASE}
49+
PGDATA: /var/lib/postgresql/data/pgdata
50+
ports:
51+
- ${STUDIO_TYPEORM_PORT}:${TYPEORM_PORT}
52+
restart: always
53+
volumes:
54+
- postgres-data42:/var/lib/postgresql/data
55+
networks:
56+
- local
5757

58-
postgres42:
59-
image: postgres:14.5-alpine
60-
container_name: postgres42
61-
environment:
62-
POSTGRES_USER: ${STUDIO_TYPEORM_USERNAME}
63-
POSTGRES_PASSWORD: ${STUDIO_TYPEORM_PASSWORD}
64-
POSTGRES_DB: ${STUDIO_TYPEORM_DATABASE}
65-
PGDATA: /var/lib/postgresql/data/pgdata
66-
ports:
67-
- ${STUDIO_TYPEORM_PORT}:${TYPEORM_PORT}
68-
restart: always
69-
volumes:
70-
- postgres-data42:/var/lib/postgresql/data
71-
networks:
72-
- local
58+
redis:
59+
image: redis:latest
60+
container_name: redis_container
61+
ports:
62+
- '6379:6379'
63+
restart: always
64+
networks:
65+
- local
7366

7467
volumes:
75-
postgres-data42:
76-
name: postgres-data42
68+
postgres-data42:
69+
name: postgres-data42
7770

7871
networks:
79-
local:
80-
name: local
72+
local:
73+
name: local

package.json

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
{
2-
"name": "issuer-cord",
3-
"version": "1.0.0",
4-
"description": "",
5-
"scripts": {
6-
"test": "echo \"Error: no test specified\" && exit 1",
7-
"start": "nodemon src/index.ts",
8-
"dev": "tsc-watch --skipLibCheck --onSuccess \"node ./dist/index.js\"",
9-
"prod": "node ./dist/index.js",
10-
"build": "tsc"
11-
},
12-
"author": "",
13-
"license": "ISC",
14-
"dependencies": {
15-
"@cord.network/vc-export": "0.9.5-rc3",
16-
"body-parser": "^1.20.2",
17-
"cors": "^2.8.5",
18-
"dotenv": "^16.0.3",
19-
"dayjs": "^1.11.13",
20-
"express": "^4.18.2",
21-
"moment": "^2.30.1",
22-
"nodemon": "^3.1.7",
23-
"pg": "^8.10.0",
24-
"reflect-metadata": "^0.2.2",
25-
"swagger-ui-express": "^5.0.1",
26-
"ts-node": "^10.9.1",
27-
"typeorm": "^0.3.20",
28-
"uuid": "^10.0.0",
29-
"yamljs": "^0.3.0"
30-
},
31-
"devDependencies": {
32-
"@types/cors": "^2.8.14",
33-
"@types/express": "^4.17.17",
34-
"@types/node": "^22.7.3",
35-
"@types/swagger-ui-express": "^4.1.3",
36-
"@types/uuid": "^10.0.0",
37-
"@types/yamljs": "^0.2.34",
38-
"typescript": "^5.6.2"
39-
},
40-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
2+
"name": "issuer-agent",
3+
"version": "1.0.0",
4+
"description": "",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1",
7+
"start": "nodemon src/index.ts",
8+
"dev": "tsc-watch --skipLibCheck --onSuccess \"node ./dist/index.js\"",
9+
"prod": "node ./dist/index.js",
10+
"build": "tsc"
11+
},
12+
"author": "",
13+
"license": "ISC",
14+
"dependencies": {
15+
"@cord.network/vc-export": "0.9.6-alpha9",
16+
"body-parser": "^1.20.2",
17+
"cors": "^2.8.5",
18+
"dayjs": "^1.11.13",
19+
"express": "^5.1.0",
20+
"moment": "^2.30.1",
21+
"pg": "^8.16.0",
22+
"redis": "^5.5.6",
23+
"reflect-metadata": "^0.2.2",
24+
"typeorm": "^0.3.24",
25+
"uuid": "^11.1.0",
26+
"yamljs": "^0.3.0"
27+
},
28+
"devDependencies": {
29+
"@types/cors": "^2.8.14",
30+
"@types/express": "^4.17.17",
31+
"@types/node": "^22.7.3",
32+
"@types/uuid": "^10.0.0",
33+
"@types/yamljs": "^0.2.34",
34+
"ts-node": "^10.9.1",
35+
"typescript": "^5.6.2"
36+
}
4137
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { createAccount } from '@cord.network/vc-export';
2+
import { cryptoWaitReady } from '@polkadot/util-crypto';
3+
4+
const { STASH_ACC_MNEMONIC } = process.env;
5+
6+
async function main() {
7+
// Create new account with mnemonic
8+
console.log(' Creating new account...');
9+
await cryptoWaitReady();
10+
const mnemonic = STASH_ACC_MNEMONIC;
11+
const { account } = createAccount(mnemonic);
12+
13+
console.log(`✅ New account created:`);
14+
console.log(` Address: ${account.address}`);
15+
console.log(
16+
` Public Key: 0x${Buffer.from(account.publicKey).toString('hex')}`
17+
);
18+
console.log(` Mnemonic: ${mnemonic}`);
19+
console.log(
20+
':warning: Save the mnemonic securely! It is required to recover the account.'
21+
);
22+
}
23+
main().catch((error) => {
24+
console.error(
25+
'❌ Unexpected error:',
26+
error instanceof Error ? error.message : error
27+
);
28+
process.exit(1);
29+
});

0 commit comments

Comments
 (0)