Welcome to the ValyuDID repository. This project implements the Valyu DID method specification (detailed in DDOC.md) and provides RESTful APIs for creating and resolving Valyu DIDs, utilizing a straightforward SQL database architecture.
ValyuDID offers a set of endpoints designed for managing decentralized identifiers (DIDs). It enables the creation of new DIDs for users and data, as well as the resolution of existing DIDs, using a custom-built resolver, and provider, leveraging the Veramo framework.
This project heavily relies on the Veramo framework, which is crucial for managing the lifecycle of decentralized identifiers and their associated cryptographic operations. For more details on Veramo, please visit their official documentation
- Node.js (v18 or higher)
- npm (v8 or higher)
- Access to
.env
configurations (see example below)
Clone the Repository:
git clone https://github.com/valyu-network/valyu-did.git
cd valyu-did
Install Dependencies:
npm install
Environment Variables:
Create a .env
file in the root directory and populate it with the necessary secrets:
KMS_SECRET_KEY=<Your_Secret_Key>
The KMS_SECRET_KEY can be any string, like a password. It's used for key management operations within Veramo.
Start the server locally with:
npm start
This will run the project at http://localhost:3000
.
The server exposes three primary endpoints:
POST /createUserDID
- Create a new user DID.POST /createDataDID
- Create a new data DID.POST /resolveDID
- Resolve an existing DID.
For comprehensive API testing and documentation, access our Postman collection:
This collection includes detailed requests and responses for each endpoint, helping you to effectively integrate and test the Valyu-DID APIs.
-
Create Data DID (POST /createDataDID): Create a new data DID.
- Request Body:
alias
,dataTokenAddress
,chainId
,accessEndpoint
. - Success Response: Returns a DID document for the registered data asset.
- Request Body:
-
Create User DID (POST /createUserDID): Create a new user DID.
- Request Body:
alias
(required). - Success Response: Returns a DID document for the newly created user identity.
- Request Body:
-
Resolve DID (POST /resolveDID): Resolve a DID and retrieve the associated DID document.
- Request Body:
did
(required). - Success Response: Returns the resolved DID document.
- Request Body:
Here's a restructured version of the Docker Deployment section that emphasizes pulling the image from DockerHub first, followed by instructions on how to build and run the application locally while specifying the KMS_SECRET_KEY
as an environment variable:
This section outlines how to deploy the ValyuDID application using Docker, either by pulling a pre-built image from DockerHub or by building and running a Docker container locally.
To get started quickly without building the image yourself, you can pull the pre-built Docker image from DockerHub:
docker pull yorkeccak/valyudid:0.1-beta
After pulling the image from DockerHub, you can run the application as follows:
docker run -p 3000:3000 -e KMS_SECRET_KEY=Your_Secret_Key yorkeccak/valyudid:0.1-beta
This command starts a container from the yorkeccak/valyudid:0.1-beta
image, maps port 3000 inside the container to port 3000 on your host, and sets the KMS_SECRET_KEY
environment variable required for the application to function properly. Access the application via http://localhost:3000
.
If you prefer to build the Docker image yourself, especially for development or modifications, follow these steps:
Build the Docker Image:
docker build -t valyudid .
This command builds a Docker image named valyudid
based on the instructions in your Dockerfile.
Run the Docker Container:
docker run -p 3000:3000 -e KMS_SECRET_KEY=Your_Secret_Key valyudid
This command runs your locally built image with the necessary KMS_SECRET_KEY
set as an environment variable. This setup is crucial for managing cryptographic operations within Veramo used in the application.
For ease of access and deployment, you can find the Docker image on DockerHub:
This configuration ensures that both quick deployments using DockerHub and customized local builds are possible, providing flexibility for different deployment scenarios.
We welcome contributions from the community! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature.
- Commit your changes.
- Push to the branch.
- Submit a pull request.
- Use camelCase for variable names and function names.
- Keep functions small and focused.
- Document your code where necessary.
This project is currently licensed under MIT
, see LICENSE.md