Skip to content

anmol-73/did-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DID CLI

A simple command-line tool for managing Decentralized Identifiers (DIDs), issuing Verifiable Credentials (VCs), and creating/verifying Verifiable Presentations (VPs) on Hedera using Ethereum-compatible JSON-RPC.

Prerequisites

  • Node.js (v18+ recommended)
  • A Hedera-compatible JSON-RPC endpoint
  • A .env file with the following variables:
PRIVATE_KEY=your-private-key
HEDERA_RPC=https://your-hedera-jsonrpc-endpoint

Installation

git clone https://github.com/anmol-73/did-cli.git
cd did-cli
npm install

Ensure your .env file is correctly set up before using the CLI.

Usage

Run the CLI using:

node index.js <command> [options]

Or add executable permissions and run:

chmod +x index.js
./index.js <command> [options]

Commands

Deploy DID Registry

Deploys a new DID Registry smart contract.

./index.js deploy

Create a DID

Registers a new DID on the deployed registry. You can optionally specify a DID; otherwise, a random one is generated.

./index.js did:create  -r <registry-address> [did]

Get Controller of a DID

Fetches the controller address associated with a DID.

./index.js did:get-controller -r <registry-address> <did> 

Update Controller of a DID

Updates the controller of a DID to a new address. If a new controller is not specified, a random one is generated.

./index.js did:update-controller -r <registry-address> <did> [newController] 

Issue a Verifiable Credential

Issues a new Verifiable Credential (VC).

./index.js vc:issue -s <subject-did> -r <registry-address> --claims-file '<path-to-json-containing-credential>'

List all verifiables Credential

Lists all the verifiable credentials stored in the local wallet

./index.js vc:list

Create a Verifiable Presentation

Creates a Verifiable Presentation (VP) bundling one or more VCs.

./index.js vp:create --reveal-file 'path-to-json-with-information-about-fields-to-reveal'

Verify a Verifiable Presentation

Verifies a Verifiable Presentation (VP).

./index.js vp:verify -p <path-to-json-with-vp> -r <registry-address>

Environment Variables

Make sure your .env file contains:

PRIVATE_KEY=your-private-key
HEDERA_RPC=https://your-hedera-jsonrpc-endpoint

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published