Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
807d2f1
fix: Remove vc verify and auth middleware
Vikastc Jun 18, 2025
3c81fde
feat: Create Profile
Vikastc Jun 19, 2025
d058aaa
fix: added a few comments
Vikastc Jun 19, 2025
2655362
fix: added a few comments
Vikastc Jun 19, 2025
ddebedf
fix: Working profile creation
Vikastc Jun 19, 2025
95dfb7a
feat: add redis and db for saving data
Vikastc Jun 20, 2025
78118f2
feat: Registry Creation
Vikastc Jun 23, 2025
ada6490
feat: Creation of entry and issuance of VC
Vikastc Jun 26, 2025
ff27a9b
fix: comment out did_controller for now
Vikastc Jun 26, 2025
46ef14f
feat: Issue and Update VC
Vikastc Jun 30, 2025
d24a55e
fix: keyuri change
Vikastc Jul 1, 2025
daee7df
Merge pull request #75 from Vikastc/sdk-4
Vikastc Jul 1, 2025
b56e621
feat: Revoke entry api
Vikastc Jul 2, 2025
1e6c704
Merge pull request #76 from Vikastc/revoke
Vikastc Jul 2, 2025
82178fb
fix: vc-export version update
Vikastc Jul 2, 2025
0be8f08
Merge pull request #77 from Vikastc/ver
Vikastc Jul 2, 2025
2420a03
fix: remove redundent imports
Vikastc Jul 2, 2025
a598b36
fix: updated readme
Vikastc Jul 2, 2025
05fecfd
fix: updated pr suggestions
Vikastc Jul 2, 2025
058762b
Update Dockerfile
Vikastc Jul 2, 2025
7643743
Merge pull request #78 from Vikastc/startup-flow
Vikastc Jul 2, 2025
fb65690
fix: Update readme and package
Vikastc Aug 11, 2025
19b97c4
Merge pull request #80 from Vikastc/update-readme
Vikastc Aug 11, 2025
04673e7
Merge branch 'main' into cordproof-2025
Vikastc Aug 12, 2025
e7d53ca
feat: Implemented mnemonic encryption and cluster
Vikastc Aug 12, 2025
7828d0e
fix: added back dockerfile for ci
Vikastc Aug 12, 2025
14b89a3
feat: Added docken precompute
Vikastc Aug 14, 2025
feae888
fix: send mnemonic in response
Vikastc Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .env
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
AGENT_PORT=5106
VERIFY_PORT=5004
AGENT_DID_NAME="issuer.agent.0235@cord"

CORD_WSS_URL=wss://sparknet.cord.network
AUTHOR_URI=//sparknet/agent

CHAIN_SPACE_ID=space:cord:c35h1XGuUXDHwtJTre7dwsb7KqZM5DWYA4kpPRuSx6BZJnXTg
CHAIN_SPACE_AUTH=auth:cord:a3fHEajeParsSaCNLffgi9UVL3dieXNrufHujvdorccQ94qqv
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

TYPEORM_PORT=5432

AGENT_MNEMONIC=bind sentence iron have wine frown forest twice coffee family balance together

STUDIO_TYPEORM_HOST=postgres42
STUDIO_TYPEORM_PORT=5574
STUDIO_TYPEORM_USERNAME=postgres
Expand All @@ -28,5 +22,14 @@ STUDIO_TYPEORM_LOGGING=false
# WALLET_URL = http://wallet:5001/api/v1
WEB_URL=issuer-agent.demo.dhiway.com
REQUEST_URL_TOKEN=d53b731c-be91-458d-bd97-71d37d444e60

# Cord
NETWORK_ADDRESS=wss://weave1.testnet.cord.network
STASH_ACC_MNEMONIC=demo

# Redis
REDIS_URL=redis://redis_container:6379
REDIS_TIMEOUT=3600

SENDGRID_API_KEY=SG.xxxxxxxx.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy # Replace with your actual SendGrid API key
DB_HOST=localhost
DB_HOST=localhost
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
.vscode
dist
8 changes: 4 additions & 4 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"jsxBracketSameLine": false
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"jsxBracketSameLine": false
}
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
FROM node:18-slim as prod

#ENV NODE_ENV=production
FROM node:22-slim AS build

WORKDIR /app

COPY package.json yarn.lock /app/
RUN yarn
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

COPY . .
RUN yarn build

RUN mkdir -p /tmp/templates
FROM node:22-slim

EXPOSE 5001
WORKDIR /app

CMD ["node", "dist/index.js"]
COPY --from=build /app/dist ./dist
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/node_modules ./node_modules

EXPOSE 5001

#CMD ["tail", "-f", "/dev/null"]
CMD ["yarn", "run", "prod"]
16 changes: 0 additions & 16 deletions Dockerfile.mac

This file was deleted.

174 changes: 142 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,164 @@
# Issuer-Agent: Verifiable Credentials on CORD Blockchain

This project demonstrates the APIs for creation and issuance of verifiable credentials in compliance with the W3C standards, using the CORD blockchain. The issuer-agent provides functionality for schema creation, credential issuance, and the anchoring of hashes on-chain, ensuring tamper-evident and verifiable data.
The Issuer-Agent is a backend service that enables the creation, issuance, and on-chain anchoring of Verifiable Credentials (VCs) using the CORD blockchain. It follows the W3C Verifiable Credentials standards to ensure security, interoperability, and decentralization. This service is built using Node.js and exposes a set of APIs to interact with credentials and registries.

The primary objective of the project is to issue digital credentials that are cryptographically verifiable and anchored on the CORD blockchain. This offers trust and transparency, enabling entities to issue and manage verifiable credentials while adhering to decentralized identity standards.
## ✨ Key Features

## Key Features
- **Credential Issuance**: Issue cryptographically signed Verifiable Credentials compliant with W3C standards.
- **Blockchain Anchoring**: Anchor credential hashes on the CORD blockchain for tamper-evidence.
- **Decentralized Identity Support**: Built-in DID management and integration with the CORD identity layer.
- **Swagger Docs**: Explore and test API endpoints via an interactive Swagger UI.

- **Schema Creation**: Design and define credential schemas, forming the structure for verifiable credentials.
- **Verifiable Credential Issuance**: Issue credentials that are cryptographically signed and aligned with the W3C Verifiable Credentials standard.
- **CORD Blockchain Integration**: Anchor the issued credentials hash on the CORD blockchain to ensure tamper-evidence and verifiability.
- **Compliance**: Built to adhere to globally recognized standards for decentralized identity and credentialing, promoting interoperability and trust.
---

## Getting Started
## 📅 Prerequisites

To get the project up and running locally, follow the instructions below.
Make sure the following are installed on your system:

### Prerequisites
- [Node.js](https://nodejs.org/) (v18+ recommended)
- [Yarn](https://classic.yarnpkg.com/en/docs/install)
- [Docker](https://www.docker.com/products/docker-desktop)
- [Docker Compose](https://docs.docker.com/compose/install/)

Ensure that you have Docker installed on your system to run the issuer-agent locally. Docker Compose is also required for managing multiple containers efficiently.
---

### Running Locally Using Docker
## 📚 Getting Started

1. **Build the Docker image**
Build the Docker image for the issuer-agent using the following command:
### 1. Clone the Repository

```bash
docker build . -t dhiway/issuer-agent:latest -f Dockerfile.mac
```
```bash
git clone https://github.com/dhiway/issuer-agent.git
cd issuer-agent
```

2. **Run the Docker container**
After building the image, use Docker Compose to bring up the necessary services in detached mode:
### 2. Install Dependencies

```bash
docker compose up -d
```
```bash
yarn install
```

The service will now be running locally, and you can access the API documentation through the Swagger interface. Alternatively, you can also test the APIs by importing the Postman collection.
### 3. Create a Stash Account

## API Documentation
```bash
yarn create:stash-account
```

- [Swagger_Documentation](https://issuer-agent.demo.dhiway.com/docs)
This will generate a stash account with a mnemonic phrase. Save the phrase securely and add it to your environment variables.

You can explore the API and interact with the service using Swagger. The Swagger documentation provides detailed information about available endpoints, request/response formats, and the overall workflow.
Swagger Documentation
### 4. Configure Environment Variables

- [Postman_Collection]
Alternatively, the `postman_collection.json` file mentioned in the repository can be imported into Postman to test out the APIs directly. This collection contains pre-configured API requests, making it easier to interact with the issuer-agent.
Create a `.env` file in the root directory:

# Further Implementation: CORD.js SDK (https://github.com/dhiway/cord.js)
```env
STASH_ACC_MNEMONIC="your twelve word mnemonic phrase"
```

For more advanced interactions with the CORD blockchain, you can use the cord.js SDK, which provides developers with tools to build on the CORD blockchain. This SDK is essential for managing identity, verifiable credentials, and interacting with CORD-based decentralized networks.
Ensure your stash account is funded. You can contact Dhiway for testnet funds if needed.

The cord.js repository offers comprehensive utilities for handling blockchain transactions, creating and managing decentralized identifiers (DIDs), and managing credentials programmatically.
---

## 🚀 Running the Project

### Option 1: Using Docker (Recommended)

1. **Build the Docker image**

```bash
docker build . -t dhiway/issuer-agent:latest -f Dockerfile
```

2. **Start the service**

```bash
docker compose up -d
```

### Option 2: Running Locally with Node.js

```bash
yarn dev
```

---

## 🔍 API Documentation

### Swagger UI:

Access interactive documentation at:

```
https://dhiway.github.io/dhiway-api-docs/issuer-agent
```

### Postman:

Import the `postman_collection.json` file provided in the repo to quickly test APIs with pre-configured requests.

#### Available APIs:

- `POST /profile` → Create and link a profile
- `POST /registry` → Anchor the credential hash and schema to the blockchain
- `POST /credential/issue` → Issue a Verifiable Credential

> Note: There is no standalone schema creation API. Schemas are passed as part of the registry creation or credential issuance payload.

---

## 💡 Development Workflow

1. **Create Profile**: Register an entity (person/org) to issue credentials.
2. **Create Registry**: Define and anchor the credential structure and metadata to the blockchain.
3. **Issue Credential**: Generate a VC using the created profile and registry.
4. **Verify**: Use public chain data and cryptographic signatures to validate.

---

## 🎓 CORD.js SDK

For advanced use cases or integrating directly with the blockchain:

- GitHub: [https://github.com/dhiway/cord.js]
- Features:

- DID management
- Credential creation & verification
- On-chain registry access
- Signing utilities

---

## 🛠️ Architecture Overview

```
┌──────────────┐ ┌───────────────┐ ┌────────────────────┐
│ Client App ├────>│ Issuer-Agent ├────>│ CORD Blockchain │
└──────────────┘ └───────────────┘ └────────────────────┘
┌───────────────┐
│ VC Storage │
└───────────────┘
```

---

## 🌟 Contributing

We welcome contributions to the Issuer-Agent! Follow these steps:

1. Fork the repo
2. Create a new feature branch
3. Commit and push your changes
4. Submit a pull request with a clear description

---

## 🌐 Support & Contact

For technical support or help funding your stash account:

- Website: [https://dhiway.com](https://dhiway.com)
- GitHub: [https://github.com/dhiway](https://github.com/dhiway)

---
Loading